[ { "hash": "a3a464bb8e7235d1afade5c9c3d5332144265ddc", "msg": "Some f2py fixes", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T07:47:15+00:00", "author_timezone": 0, "committer_date": "2005-10-07T07:47:15+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "061e5e4477a21844b84321776938e002dfbe8748" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 4, "insertions": 58, "lines": 62, "files": 2, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": "scipy/base/include/scipy/ufuncobject.h", "new_path": "scipy/base/include/scipy/ufuncobject.h", "filename": "ufuncobject.h", "extension": "h", "change_type": "MODIFY", "diff": "@@ -157,8 +157,8 @@ typedef struct {\n \n \n #if defined(ALLOW_THREADS)\n-#define LOOP_BEGIN_THREADS if (!(loop->obj)) _save = PyEval_SaveThread();\n-#define LOOP_END_THREADS if (!(loop->obj)) PyEval_RestoreThread(_save);\n+#define LOOP_BEGIN_THREADS if (!(loop->obj)) {_save = PyEval_SaveThread();}\n+#define LOOP_END_THREADS if (!(loop->obj)) {PyEval_RestoreThread(_save);}\n #else\n #define LOOP_BEGIN_THREADS \n #define LOOP_END_THREADS \n", "added_lines": 2, "deleted_lines": 2, "source_code": "#ifndef Py_UFUNCOBJECT_H\n#define Py_UFUNCOBJECT_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define MAX_ARGS 40\n\ntypedef void (*PyUFuncGenericFunction) (char **, intp *, intp *, void *);\n\ntypedef struct {\n\tPyObject_HEAD\n\tint nin, nout, nargs;\n\tint identity;\n\tPyUFuncGenericFunction *functions;\n\tvoid **data;\n\tint ntypes;\n\tint check_return;\n\tchar *name, *types;\n\tchar *doc;\n void *ptr;\n PyObject *obj;\n\tPyObject *userloops;\n} PyUFuncObject;\n\n#include \"arrayobject.h\"\n\n#define UFUNC_ERR_IGNORE 0\n#define UFUNC_ERR_WARN 1\n#define UFUNC_ERR_RAISE 2\n#define UFUNC_ERR_CALL 3\n\n\t/* Python side integer mask */\n\n#define UFUNC_MASK_DIVIDEBYZERO 0x03\n#define UFUNC_MASK_OVERFLOW 0x0c\n#define UFUNC_MASK_UNDERFLOW 0x30\n#define UFUNC_MASK_INVALID 0xc0\n\n#define UFUNC_SHIFT_DIVIDEBYZERO 0\n#define UFUNC_SHIFT_OVERFLOW 2\n#define UFUNC_SHIFT_UNDERFLOW 4\n#define UFUNC_SHIFT_INVALID 6 \n\n\n/* platform-dependent code translates floating point\n status to an integer sum of these values\n*/\n#define UFUNC_FPE_DIVIDEBYZERO 1\n#define UFUNC_FPE_OVERFLOW 2\n#define UFUNC_FPE_UNDERFLOW 4\n#define UFUNC_FPE_INVALID 8\n\t\n#define UFUNC_ERR_DEFAULT 0 /* Default error mode */\n\n\t/* Only internal -- not exported, yet*/\ntypedef struct {\n\t/* Multi-iterator portion --- needs to be present in this order \n\t to work with PyArray_Broadcast */\n\tPyObject_HEAD\n\tint numiter;\n\tintp size; \n\tintp index; \n\tint nd;\n\tintp dimensions[MAX_DIMS];\t\n\tPyArrayIterObject *iters[MAX_ARGS];\n /* End of Multi-iterator portion */\n\n\t/* The ufunc */\n\tPyUFuncObject *ufunc;\n\t\n\t/* The error handling */\n\tint errormask; /* Integer showing desired error handling */\n\tPyObject *errobj; /* currently a tuple with \n\t\t\t\t (string, func or None)\n\t\t\t */\n\n\t/* Specific function and data to use */\n\tPyUFuncGenericFunction function;\n\tvoid *funcdata;\n\n\t/* Loop method */\n\tint meth;\n\t\n\t/* Whether or not to swap */\n\tint swap[MAX_ARGS];\n\n\t/* Buffers for the loop */\n\tvoid *buffer[MAX_ARGS];\n\tint bufsize;\n\tint bufcnt;\n\tvoid *dptr[MAX_ARGS];\n\n\t/* For casting */\n\tvoid *castbuf[MAX_ARGS];\n\tPyArray_VectorUnaryFunc *cast[MAX_ARGS];\n\n\t/* usually points to buffer but when a cast is to be\n\t done it switches for that argument to castbuf.\n\t*/\n\tvoid *bufptr[MAX_ARGS]; \n\n\t/* Steps filled in from iters or sizeof(item)\n\t depending on loop method. \n\t*/\n\tintp steps[MAX_ARGS];\n\n int obj; /* This loop calls object functions */\n\t\n} PyUFuncLoopObject;\n\n/* Could make this more clever someday */\n#define UFUNC_MAXIDENTITY 32\n\ntypedef struct {\n PyObject_HEAD\n PyArrayIterObject *it;\n PyArrayObject *ret;\n\tPyArrayIterObject *rit; /* Needed for Accumulate */\n int outsize;\n\tintp index;\n\tintp size;\n char idptr[UFUNC_MAXIDENTITY];\n\n\t/* The ufunc */\n\tPyUFuncObject *ufunc;\n\n\t/* The error handling */\n\tint errormask;\n\tPyObject *errobj;\n \n PyUFuncGenericFunction function;\n void *funcdata; \n int meth;\n int swap;\n \n void *buffer;\n int bufsize;\n\n void *castbuf;\n PyArray_VectorUnaryFunc *cast;\n\n void *bufptr[3];\n intp steps[3];\n\n intp N;\n int instrides;\n int insize;\n char *inptr;\n\n\t/* For copying small arrays */\n\tPyObject *decref;\n \n int obj;\n \n} PyUFuncReduceObject;\n\n\n#if defined(ALLOW_THREADS)\n#define LOOP_BEGIN_THREADS if (!(loop->obj)) {_save = PyEval_SaveThread();}\n#define LOOP_END_THREADS if (!(loop->obj)) {PyEval_RestoreThread(_save);}\n#else\n#define LOOP_BEGIN_THREADS \n#define LOOP_END_THREADS \n#endif\n\n#define PyUFunc_Unbounded 120\n#define PyUFunc_One 1\n#define PyUFunc_Zero 0\n#define PyUFunc_None -1\n\n\ntypedef struct {\n int nin;\n int nout;\n PyObject *callable; \n} PyUFunc_PyFuncData;\n\n\n#include \"__ufunc_api.h\"\n\n#define UFUNC_ERRMASK_NAME \"_UFUNC_ERRMASK\"\n#define UFUNC_ERRFUNC_NAME \"_UFUNC_ERRFUNC\"\n#define UFUNC_BUFSIZE_NAME \"_UFUNC_BUFSIZE\"\n\n#define UFUNC_CHECK_ERROR() \\\n\tif ((loop->obj && PyErr_Occurred()) || \\\n (loop->errormask && \\\n PyUFunc_checkfperr(loop->errormask, \\\n loop->errobj)))\t\t\t\t\\\n\t\tgoto fail\n\n/* This code checks the IEEE status flags in a platform-dependent way */\n/* Adapted from Numarray */\n\n/* OSF/Alpha (Tru64) ---------------------------------------------*/\n#if defined(__osf__) && defined(__alpha)\n\n#include \n\n#define UFUNC_CHECK_STATUS(ret) {\t\t\\\n\tunsigned long fpstatus;\t\t \\\n\t\t\t\t\t\t\\\n\tfpstatus = ieee_get_fp_control();\t\t\t\t\\\n\t/* clear status bits as well as disable exception mode if on */ \\\n\tieee_set_fp_control( 0 );\t\t\t\t\t\\\n\tret = ((IEEE_STATUS_DZE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \\\n\t\t| ((IEEE_STATUS_OVF & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \\\n\t\t| ((IEEE_STATUS_UNF & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \\\n\t\t| ((IEEE_STATUS_INV & fpstatus) ? UFUNC_FPE_INVALID : 0); \\\n\t}\n\t\n/* MS Windows -----------------------------------------------------*/\n#elif defined(_MSC_VER) \n\n#include \n\n#define UFUNC_CHECK_STATUS(ret) {\t\t \\\n\tint fpstatus = (int) _clear87();\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tret = ((SW_ZERODIVIDE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0)\t\\\n\t\t| ((SW_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0)\t\\\n\t\t| ((SW_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0)\t\\\n\t\t| ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0);\t\\\n\t}\n\t\n\n/* Solaris --------------------------------------------------------*/\n/* --------ignoring SunOS ieee_flags approach, someone else can\n** deal with that! */\n#elif defined(sun)\n#include \n\n#define UFUNC_CHECK_STATUS(ret) {\t\t\t\t\\\n\tint fpstatus;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\\\n\tfpstatus = (int) fpgetsticky();\t\t\t\t\t\\\n\tret = ((FP_X_DZ & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0)\t\\\n\t\t| ((FP_X_OFL & fpstatus) ? UFUNC_FPE_OVERFLOW : 0)\t\\\n\t\t| ((FP_X_UFL & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0)\t\\\n\t\t| ((FP_X_INV & fpstatus) ? UFUNC_FPE_INVALID : 0);\t\\\n\t(void) fpsetsticky(0);\t\t\t\t\t\t\\\n\t}\n\t\n#elif defined(linux) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) \n\n#if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__)\n#include \n#elif defined(__CYGWIN__)\n#include \n#endif\n\n#define UFUNC_CHECK_STATUS(ret) { \\\n\tint fpstatus = (int) fetestexcept(FE_DIVBYZERO | FE_OVERFLOW |\t\\\n\t\t\t\t\t FE_UNDERFLOW | FE_INVALID);\t\\\n\tret = ((FE_DIVBYZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \\\n\t\t| ((FE_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0)\t\\\n\t\t| ((FE_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \\\n\t\t| ((FE_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0);\t\\\n\t(void) feclearexcept(FE_DIVBYZERO | FE_OVERFLOW |\t\t\\\n\t\t\t FE_UNDERFLOW | FE_INVALID);\t\t\\\n}\n\n#define generate_divbyzero_error() feraiseexcept(FE_DIVBYZERO)\n#define generate_overflow_error() feraiseexcept(FE_OVERFLOW)\n\t\n#elif defined(AIX)\n\n#include \n#include \n\n#define UFUNC_CHECK_STATUS(ret) { \\\n\tfpflag_t fpstatus; \\\n \\\n\tfpstatus = fp_read_flag();\n\tret = ((FP_DIV_BY_ZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \\\n\t\t| ((FP_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0)\t\\\n\t\t| ((FP_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \\\n\t\t| ((FP_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0);\n\tfp_clr_flag( FP_DIV_BY_ZERO | FP_OVERFLOW | FP_UNDERFLOW | FP_INVALID); \\\n}\n\n#else\n\n#define UFUNC_CHECK_STATUS(ret) { \\\n printf(\"floating point flags not supported on this platform\\n\"); \\\n ret = 0;\t\t\t\t\t\t\t \\\n }\n\n#endif\n\n\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Py_UFUNCOBJECT_H */\n", "source_code_before": "#ifndef Py_UFUNCOBJECT_H\n#define Py_UFUNCOBJECT_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define MAX_ARGS 40\n\ntypedef void (*PyUFuncGenericFunction) (char **, intp *, intp *, void *);\n\ntypedef struct {\n\tPyObject_HEAD\n\tint nin, nout, nargs;\n\tint identity;\n\tPyUFuncGenericFunction *functions;\n\tvoid **data;\n\tint ntypes;\n\tint check_return;\n\tchar *name, *types;\n\tchar *doc;\n void *ptr;\n PyObject *obj;\n\tPyObject *userloops;\n} PyUFuncObject;\n\n#include \"arrayobject.h\"\n\n#define UFUNC_ERR_IGNORE 0\n#define UFUNC_ERR_WARN 1\n#define UFUNC_ERR_RAISE 2\n#define UFUNC_ERR_CALL 3\n\n\t/* Python side integer mask */\n\n#define UFUNC_MASK_DIVIDEBYZERO 0x03\n#define UFUNC_MASK_OVERFLOW 0x0c\n#define UFUNC_MASK_UNDERFLOW 0x30\n#define UFUNC_MASK_INVALID 0xc0\n\n#define UFUNC_SHIFT_DIVIDEBYZERO 0\n#define UFUNC_SHIFT_OVERFLOW 2\n#define UFUNC_SHIFT_UNDERFLOW 4\n#define UFUNC_SHIFT_INVALID 6 \n\n\n/* platform-dependent code translates floating point\n status to an integer sum of these values\n*/\n#define UFUNC_FPE_DIVIDEBYZERO 1\n#define UFUNC_FPE_OVERFLOW 2\n#define UFUNC_FPE_UNDERFLOW 4\n#define UFUNC_FPE_INVALID 8\n\t\n#define UFUNC_ERR_DEFAULT 0 /* Default error mode */\n\n\t/* Only internal -- not exported, yet*/\ntypedef struct {\n\t/* Multi-iterator portion --- needs to be present in this order \n\t to work with PyArray_Broadcast */\n\tPyObject_HEAD\n\tint numiter;\n\tintp size; \n\tintp index; \n\tint nd;\n\tintp dimensions[MAX_DIMS];\t\n\tPyArrayIterObject *iters[MAX_ARGS];\n /* End of Multi-iterator portion */\n\n\t/* The ufunc */\n\tPyUFuncObject *ufunc;\n\t\n\t/* The error handling */\n\tint errormask; /* Integer showing desired error handling */\n\tPyObject *errobj; /* currently a tuple with \n\t\t\t\t (string, func or None)\n\t\t\t */\n\n\t/* Specific function and data to use */\n\tPyUFuncGenericFunction function;\n\tvoid *funcdata;\n\n\t/* Loop method */\n\tint meth;\n\t\n\t/* Whether or not to swap */\n\tint swap[MAX_ARGS];\n\n\t/* Buffers for the loop */\n\tvoid *buffer[MAX_ARGS];\n\tint bufsize;\n\tint bufcnt;\n\tvoid *dptr[MAX_ARGS];\n\n\t/* For casting */\n\tvoid *castbuf[MAX_ARGS];\n\tPyArray_VectorUnaryFunc *cast[MAX_ARGS];\n\n\t/* usually points to buffer but when a cast is to be\n\t done it switches for that argument to castbuf.\n\t*/\n\tvoid *bufptr[MAX_ARGS]; \n\n\t/* Steps filled in from iters or sizeof(item)\n\t depending on loop method. \n\t*/\n\tintp steps[MAX_ARGS];\n\n int obj; /* This loop calls object functions */\n\t\n} PyUFuncLoopObject;\n\n/* Could make this more clever someday */\n#define UFUNC_MAXIDENTITY 32\n\ntypedef struct {\n PyObject_HEAD\n PyArrayIterObject *it;\n PyArrayObject *ret;\n\tPyArrayIterObject *rit; /* Needed for Accumulate */\n int outsize;\n\tintp index;\n\tintp size;\n char idptr[UFUNC_MAXIDENTITY];\n\n\t/* The ufunc */\n\tPyUFuncObject *ufunc;\n\n\t/* The error handling */\n\tint errormask;\n\tPyObject *errobj;\n \n PyUFuncGenericFunction function;\n void *funcdata; \n int meth;\n int swap;\n \n void *buffer;\n int bufsize;\n\n void *castbuf;\n PyArray_VectorUnaryFunc *cast;\n\n void *bufptr[3];\n intp steps[3];\n\n intp N;\n int instrides;\n int insize;\n char *inptr;\n\n\t/* For copying small arrays */\n\tPyObject *decref;\n \n int obj;\n \n} PyUFuncReduceObject;\n\n\n#if defined(ALLOW_THREADS)\n#define LOOP_BEGIN_THREADS if (!(loop->obj)) _save = PyEval_SaveThread();\n#define LOOP_END_THREADS if (!(loop->obj)) PyEval_RestoreThread(_save);\n#else\n#define LOOP_BEGIN_THREADS \n#define LOOP_END_THREADS \n#endif\n\n#define PyUFunc_Unbounded 120\n#define PyUFunc_One 1\n#define PyUFunc_Zero 0\n#define PyUFunc_None -1\n\n\ntypedef struct {\n int nin;\n int nout;\n PyObject *callable; \n} PyUFunc_PyFuncData;\n\n\n#include \"__ufunc_api.h\"\n\n#define UFUNC_ERRMASK_NAME \"_UFUNC_ERRMASK\"\n#define UFUNC_ERRFUNC_NAME \"_UFUNC_ERRFUNC\"\n#define UFUNC_BUFSIZE_NAME \"_UFUNC_BUFSIZE\"\n\n#define UFUNC_CHECK_ERROR() \\\n\tif ((loop->obj && PyErr_Occurred()) || \\\n (loop->errormask && \\\n PyUFunc_checkfperr(loop->errormask, \\\n loop->errobj)))\t\t\t\t\\\n\t\tgoto fail\n\n/* This code checks the IEEE status flags in a platform-dependent way */\n/* Adapted from Numarray */\n\n/* OSF/Alpha (Tru64) ---------------------------------------------*/\n#if defined(__osf__) && defined(__alpha)\n\n#include \n\n#define UFUNC_CHECK_STATUS(ret) {\t\t\\\n\tunsigned long fpstatus;\t\t \\\n\t\t\t\t\t\t\\\n\tfpstatus = ieee_get_fp_control();\t\t\t\t\\\n\t/* clear status bits as well as disable exception mode if on */ \\\n\tieee_set_fp_control( 0 );\t\t\t\t\t\\\n\tret = ((IEEE_STATUS_DZE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \\\n\t\t| ((IEEE_STATUS_OVF & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \\\n\t\t| ((IEEE_STATUS_UNF & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \\\n\t\t| ((IEEE_STATUS_INV & fpstatus) ? UFUNC_FPE_INVALID : 0); \\\n\t}\n\t\n/* MS Windows -----------------------------------------------------*/\n#elif defined(_MSC_VER) \n\n#include \n\n#define UFUNC_CHECK_STATUS(ret) {\t\t \\\n\tint fpstatus = (int) _clear87();\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tret = ((SW_ZERODIVIDE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0)\t\\\n\t\t| ((SW_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0)\t\\\n\t\t| ((SW_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0)\t\\\n\t\t| ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0);\t\\\n\t}\n\t\n\n/* Solaris --------------------------------------------------------*/\n/* --------ignoring SunOS ieee_flags approach, someone else can\n** deal with that! */\n#elif defined(sun)\n#include \n\n#define UFUNC_CHECK_STATUS(ret) {\t\t\t\t\\\n\tint fpstatus;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\\\n\tfpstatus = (int) fpgetsticky();\t\t\t\t\t\\\n\tret = ((FP_X_DZ & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0)\t\\\n\t\t| ((FP_X_OFL & fpstatus) ? UFUNC_FPE_OVERFLOW : 0)\t\\\n\t\t| ((FP_X_UFL & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0)\t\\\n\t\t| ((FP_X_INV & fpstatus) ? UFUNC_FPE_INVALID : 0);\t\\\n\t(void) fpsetsticky(0);\t\t\t\t\t\t\\\n\t}\n\t\n#elif defined(linux) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) \n\n#if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__)\n#include \n#elif defined(__CYGWIN__)\n#include \n#endif\n\n#define UFUNC_CHECK_STATUS(ret) { \\\n\tint fpstatus = (int) fetestexcept(FE_DIVBYZERO | FE_OVERFLOW |\t\\\n\t\t\t\t\t FE_UNDERFLOW | FE_INVALID);\t\\\n\tret = ((FE_DIVBYZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \\\n\t\t| ((FE_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0)\t\\\n\t\t| ((FE_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \\\n\t\t| ((FE_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0);\t\\\n\t(void) feclearexcept(FE_DIVBYZERO | FE_OVERFLOW |\t\t\\\n\t\t\t FE_UNDERFLOW | FE_INVALID);\t\t\\\n}\n\n#define generate_divbyzero_error() feraiseexcept(FE_DIVBYZERO)\n#define generate_overflow_error() feraiseexcept(FE_OVERFLOW)\n\t\n#elif defined(AIX)\n\n#include \n#include \n\n#define UFUNC_CHECK_STATUS(ret) { \\\n\tfpflag_t fpstatus; \\\n \\\n\tfpstatus = fp_read_flag();\n\tret = ((FP_DIV_BY_ZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \\\n\t\t| ((FP_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0)\t\\\n\t\t| ((FP_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \\\n\t\t| ((FP_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0);\n\tfp_clr_flag( FP_DIV_BY_ZERO | FP_OVERFLOW | FP_UNDERFLOW | FP_INVALID); \\\n}\n\n#else\n\n#define UFUNC_CHECK_STATUS(ret) { \\\n printf(\"floating point flags not supported on this platform\\n\"); \\\n ret = 0;\t\t\t\t\t\t\t \\\n }\n\n#endif\n\n\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !Py_UFUNCOBJECT_H */\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": 91, "complexity": 0, "token_count": 393, "diff_parsed": { "added": [ "#define LOOP_BEGIN_THREADS if (!(loop->obj)) {_save = PyEval_SaveThread();}", "#define LOOP_END_THREADS if (!(loop->obj)) {PyEval_RestoreThread(_save);}" ], "deleted": [ "#define LOOP_BEGIN_THREADS if (!(loop->obj)) _save = PyEval_SaveThread();", "#define LOOP_END_THREADS if (!(loop->obj)) PyEval_RestoreThread(_save);" ] } }, { "old_path": "scipy/f2py2e/cfuncs.py", "new_path": "scipy/f2py2e/cfuncs.py", "filename": "cfuncs.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -284,7 +284,6 @@\n #else\n #define TRYPYARRAYTEMPLATECHAR\n #endif\n-\n #if LP64\n #define TRYPYARRAYTEMPLATELONG case PyArray_LONG: *(long *)(arr->data)=*v; break;\n #else\n@@ -294,6 +293,11 @@\n /* XXX: need the corresponding numarray code here */\n #define TRYPYARRAYTEMPLATEOBJECT\n \n+#elif defined(NDARRAY_VERSION)\n+/* New SciPy */\n+#define TRYPYARRAYTEMPLATECHAR case PyArray_STRING: *(char *)(arr->data)=*v; break;\n+#define TRYPYARRAYTEMPLATELONG case PyArray_LONG: *(long *)(arr->data)=*v; break;\n+#define TRYPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data); break;\n #else\n /* Numeric */\n \n@@ -325,6 +329,28 @@\n \tdefault: return -2;\\\\\n \t};\\\\\n \treturn 1;\n+#elif defined(NDARRAY_VERSION)\n+#define TRYPYARRAYTEMPLATE(ctype,typecode) \\\\\n+\tPyArrayObject *arr = NULL;\\\\\n+\tif (!obj) return -2;\\\\\n+\tif (!PyArray_Check(obj)) return -1;\\\\\n+\tif (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n+\tif (arr->descr->type==typecode) {*(ctype *)(arr->data)=*v; return 1;}\\\\\n+\tswitch (arr->descr->type_num) {\\\\\n+ TRYPYARRAYTEMPLATELONG\\\\\n+\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=*v; break;\\\\\n+\t\tcase PyArray_INT: *(int *)(arr->data)=*v; break;\\\\\n+\t\tcase PyArray_FLOAT: *(float *)(arr->data)=*v; break;\\\\\n+\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=*v; break;\\\\\n+\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=*v; break;\\\\\n+ TRYPYARRAYTEMPLATECHAR\\\\\n+\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=*v; break;\\\\\n+\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=*v; break;\\\\\n+\t\tcase PyArray_SHORT: *(short *)(arr->data)=*v; break;\\\\\n+ case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data, arr); break;\\\\\n+\tdefault: return -2;\\\\\n+\t};\\\\\n+\treturn 1;\n #else\n #define TRYPYARRAYTEMPLATE(ctype,typecode) \\\\\n \tPyArrayObject *arr = NULL;\\\\\n@@ -365,6 +391,8 @@\n #ifdef NUMARRAY\n /* XXX: need the corresponding numarray code here */\n #define TRYCOMPLEXPYARRAYTEMPLATEOBJECT\n+#elif defined(NDARRAY_VERSION)\n+#define TRYCOMPLEXPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data, arr); break;\n #else\n #define TRYCOMPLEXPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data); break;\n #endif\n@@ -395,7 +423,33 @@\n \t\tdefault: return -2;\\\\\n \t};\\\\\n \treturn -1;\n-#else\n+#elif defined(NDARRAY_VERSION)\n+#define TRYCOMPLEXPYARRAYTEMPLATE(ctype,typecode)\\\\\n+\tPyArrayObject *arr = NULL;\\\\\n+\tif (!obj) return -2;\\\\\n+\tif (!PyArray_Check(obj)) return -1;\\\\\n+ if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYCOMPLEXPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n+\tif (arr->descr->type==typecode) {\\\\\n+ *(ctype *)(arr->data)=(*v).r;\\\\\n+ *(ctype *)(arr->data+sizeof(ctype))=(*v).i;\\\\\n+ return 1;\\\\\n+ }\\\\\n+\tswitch (arr->descr->type_num) {\\\\\n+\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=(*v).r;*(double *)(arr->data+sizeof(double))=(*v).i;break;\\\\\n+\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=(*v).r;*(float *)(arr->data+sizeof(float))=(*v).i;break;\\\\\n+\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=(*v).r; break;\\\\\n+ TRYCOMPLEXPYARRAYTEMPLATELONG\\\\\n+\t\tcase PyArray_FLOAT: *(float *)(arr->data)=(*v).r; break;\\\\\n+\t\tcase PyArray_INT: *(int *)(arr->data)=(*v).r; break;\\\\\n+\t\tcase PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\\\\n+ TRYCOMPLEXPYARRAYTEMPLATECHAR\\\\\n+\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\\\\n+\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=(*v).r; break;\\\\\n+ case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data, arr); break;\\\\\n+\t\tdefault: return -2;\\\\\n+\t};\\\\\n+\treturn -1; \n+#else \n #define TRYCOMPLEXPYARRAYTEMPLATE(ctype,typecode)\\\\\n \tPyArrayObject *arr = NULL;\\\\\n \tif (!obj) return -2;\\\\\n", "added_lines": 56, "deleted_lines": 2, "source_code": "#!/usr/bin/env python\n\"\"\"\n\nC declarations, CPP macros, and C functions for f2py2e.\nOnly required declarations/macros/functions will be used.\n\nCopyright 1999,2000 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the\nterms of the LGPL. See http://www.fsf.org\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n$Date: 2005/05/06 11:42:34 $\nPearu Peterson\n\"\"\"\n\n__version__ = \"$Revision: 1.75 $\"[10:-1]\n\nimport __version__\nf2py_version = __version__.version\n\nimport types,sys,copy,os\nerrmess=sys.stderr.write\n\n##################### Definitions ##################\n\noutneeds={'includes0':[],'includes':[],'typedefs':[],'typedefs_generated':[],\n 'userincludes':[],\n 'cppmacros':[],'cfuncs':[],'callbacks':[],'f90modhooks':[],\n 'commonhooks':[]}\nneeds={}\nincludes0={'includes0':'/*need_includes0*/'}\nincludes={'includes':'/*need_includes*/'}\nuserincludes={'userincludes':'/*need_userincludes*/'}\ntypedefs={'typedefs':'/*need_typedefs*/'}\ntypedefs_generated={'typedefs_generated':'/*need_typedefs_generated*/'}\ncppmacros={'cppmacros':'/*need_cppmacros*/'}\ncfuncs={'cfuncs':'/*need_cfuncs*/'}\ncallbacks={'callbacks':'/*need_callbacks*/'}\nf90modhooks={'f90modhooks':'/*need_f90modhooks*/',\n 'initf90modhooksstatic':'/*initf90modhooksstatic*/',\n 'initf90modhooksdynamic':'/*initf90modhooksdynamic*/',\n }\ncommonhooks={'commonhooks':'/*need_commonhooks*/',\n 'initcommonhooks':'/*need_initcommonhooks*/',\n }\n\n############ Includes ###################\n\nincludes0['math.h']='#include '\nincludes0['string.h']='#include '\nincludes0['setjmp.h']='#include '\n\nincludes['Python.h']='#include \"Python.h\"'\nneeds['arrayobject.h']=['Python.h']\nincludes['arrayobject.h']='''#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API\n#include \"arrayobject.h\"'''\n\nincludes['arrayobject.h']='#include \"fortranobject.h\"'\n\n############# Type definitions ###############\n\ntypedefs['unsigned_char']='typedef unsigned char unsigned_char;'\ntypedefs['unsigned_short']='typedef unsigned short unsigned_short;'\ntypedefs['unsigned_long']='typedef unsigned long unsigned_long;'\ntypedefs['signed_char']='typedef signed char signed_char;'\ntypedefs['long_long']=\"\"\"\\\n#ifdef _WIN32\ntypedef __int64 long_long;\n#else\ntypedef long long long_long;\ntypedef unsigned long long unsigned_long_long;\n#endif\n\"\"\"\ntypedefs['insinged_long_long']=\"\"\"\\\n#ifdef _WIN32\ntypedef __uint64 long_long;\n#else\ntypedef unsigned long long unsigned_long_long;\n#endif\n\"\"\"\ntypedefs['long_double']=\"\"\"\\\n#ifndef _LONG_DOUBLE\ntypedef long double long_double;\n#endif\n\"\"\"\ntypedefs['complex_long_double']='typedef struct {long double r,i;} complex_long_double;'\ntypedefs['complex_float']='typedef struct {float r,i;} complex_float;'\ntypedefs['complex_double']='typedef struct {double r,i;} complex_double;'\ntypedefs['string']=\"\"\"typedef char * string;\"\"\"\n\n\n############### CPP macros ####################\ncppmacros['CFUNCSMESS']=\"\"\"\\\n#ifdef DEBUGCFUNCS\n#define CFUNCSMESS(mess) fprintf(stderr,\\\"debug-capi:\\\"mess);\n#define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \\\\\n\\tPyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\\\\\n\\tfprintf(stderr,\\\"\\\\n\\\");\n#else\n#define CFUNCSMESS(mess)\n#define CFUNCSMESSPY(mess,obj)\n#endif\n\"\"\"\ncppmacros['F_FUNC']=\"\"\"\\\n#if defined(PREPEND_FORTRAN)\n#if defined(NO_APPEND_FORTRAN)\n#if defined(UPPERCASE_FORTRAN)\n#define F_FUNC(f,F) _##F\n#else\n#define F_FUNC(f,F) _##f\n#endif\n#else\n#if defined(UPPERCASE_FORTRAN)\n#define F_FUNC(f,F) _##F##_\n#else\n#define F_FUNC(f,F) _##f##_\n#endif\n#endif\n#else\n#if defined(NO_APPEND_FORTRAN)\n#if defined(UPPERCASE_FORTRAN)\n#define F_FUNC(f,F) F\n#else\n#define F_FUNC(f,F) f\n#endif\n#else\n#if defined(UPPERCASE_FORTRAN)\n#define F_FUNC(f,F) F##_\n#else\n#define F_FUNC(f,F) f##_\n#endif\n#endif\n#endif\n#if defined(UNDERSCORE_G77)\n#define F_FUNC_US(f,F) F_FUNC(f##_,F##_)\n#else\n#define F_FUNC_US(f,F) F_FUNC(f,F)\n#endif\n\"\"\"\ncppmacros['F_WRAPPEDFUNC']=\"\"\"\\\n#if defined(PREPEND_FORTRAN)\n#if defined(NO_APPEND_FORTRAN)\n#if defined(UPPERCASE_FORTRAN)\n#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F\n#else\n#define F_WRAPPEDFUNC(f,F) _f2pywrap##f\n#endif\n#else\n#if defined(UPPERCASE_FORTRAN)\n#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F##_\n#else\n#define F_WRAPPEDFUNC(f,F) _f2pywrap##f##_\n#endif\n#endif\n#else\n#if defined(NO_APPEND_FORTRAN)\n#if defined(UPPERCASE_FORTRAN)\n#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F\n#else\n#define F_WRAPPEDFUNC(f,F) f2pywrap##f\n#endif\n#else\n#if defined(UPPERCASE_FORTRAN)\n#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F##_\n#else\n#define F_WRAPPEDFUNC(f,F) f2pywrap##f##_\n#endif\n#endif\n#endif\n#if defined(UNDERSCORE_G77)\n#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f##_,F##_)\n#else\n#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f,F)\n#endif\n\"\"\"\ncppmacros['F_MODFUNC']=\"\"\"\\\n#if defined(F90MOD2CCONV1) /*E.g. Compaq Fortran */\n#if defined(NO_APPEND_FORTRAN)\n#define F_MODFUNCNAME(m,f) $ ## m ## $ ## f\n#else\n#define F_MODFUNCNAME(m,f) $ ## m ## $ ## f ## _\n#endif\n#endif\n\n#if defined(F90MOD2CCONV2) /*E.g. IBM XL Fortran, not tested though */\n#if defined(NO_APPEND_FORTRAN)\n#define F_MODFUNCNAME(m,f) __ ## m ## _MOD_ ## f\n#else\n#define F_MODFUNCNAME(m,f) __ ## m ## _MOD_ ## f ## _\n#endif\n#endif\n\n#if defined(F90MOD2CCONV3) /*E.g. MIPSPro Compilers */\n#if defined(NO_APPEND_FORTRAN)\n#define F_MODFUNCNAME(m,f) f ## .in. ## m\n#else\n#define F_MODFUNCNAME(m,f) f ## .in. ## m ## _\n#endif\n#endif\n/*\n#if defined(UPPERCASE_FORTRAN)\n#define F_MODFUNC(m,M,f,F) F_MODFUNCNAME(M,F)\n#else\n#define F_MODFUNC(m,M,f,F) F_MODFUNCNAME(m,f)\n#endif\n*/\n\n#define F_MODFUNC(m,f) (*(f2pymodstruct##m##.##f))\n\"\"\"\ncppmacros['SWAPUNSAFE']=\"\"\"\\\n#define SWAP(a,b) (size_t)(a) = ((size_t)(a) ^ (size_t)(b));\\\\\n (size_t)(b) = ((size_t)(a) ^ (size_t)(b));\\\\\n (size_t)(a) = ((size_t)(a) ^ (size_t)(b))\n\"\"\"\ncppmacros['SWAP']=\"\"\"\\\n#define SWAP(a,b,t) {\\\\\n\\tt *c;\\\\\n\\tc = a;\\\\\n\\ta = b;\\\\\n\\tb = c;}\n\"\"\"\n#cppmacros['ISCONTIGUOUS']='#define ISCONTIGUOUS(m) ((m)->flags & CONTIGUOUS)'\ncppmacros['PRINTPYOBJERR']=\"\"\"\\\n#define PRINTPYOBJERR(obj)\\\\\n\\tfprintf(stderr,\\\"#modulename#.error is related to \\\");\\\\\n\\tPyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\\\\\n\\tfprintf(stderr,\\\"\\\\n\\\");\n\"\"\"\ncppmacros['MINMAX']=\"\"\"\\\n#ifndef MAX\n#define MAX(a,b) ((a > b) ? (a) : (b))\n#endif\n#ifndef MIN\n#define MIN(a,b) ((a < b) ? (a) : (b))\n#endif\n\"\"\"\ncppmacros['len..']=\"\"\"\\\n#define rank(var) var ## _Rank\n#define shape(var,dim) var ## _Dims[dim]\n#define old_rank(var) (((PyArrayObject *)(capi_ ## var ## _tmp))->nd)\n#define old_shape(var,dim) (((PyArrayObject *)(capi_ ## var ## _tmp))->dimensions[dim])\n#define fshape(var,dim) shape(var,rank(var)-dim-1)\n#define len(var) shape(var,0)\n#define flen(var) fshape(var,0)\n#define size(var) PyArray_SIZE((PyArrayObject *)(capi_ ## var ## _tmp))\n/* #define index(i) capi_i ## i */\n#define slen(var) capi_ ## var ## _len\n\"\"\"\n\ncppmacros['pyobj_from_char1']='#define pyobj_from_char1(v) (PyInt_FromLong(v))'\ncppmacros['pyobj_from_short1']='#define pyobj_from_short1(v) (PyInt_FromLong(v))'\nneeds['pyobj_from_int1']=['signed_char']\ncppmacros['pyobj_from_int1']='#define pyobj_from_int1(v) (PyInt_FromLong(v))'\ncppmacros['pyobj_from_long1']='#define pyobj_from_long1(v) (PyLong_FromLong(v))'\nneeds['pyobj_from_long_long1']=['long_long']\ncppmacros['pyobj_from_long_long1']=\"\"\"\\\n#ifdef HAVE_LONG_LONG\n#define pyobj_from_long_long1(v) (PyLong_FromLongLong(v))\n#else\n#warning HAVE_LONG_LONG is not available. Redefining pyobj_from_long_long.\n#define pyobj_from_long_long1(v) (PyLong_FromLong(v))\n#endif\n\"\"\"\nneeds['pyobj_from_long_double1']=['long_double']\ncppmacros['pyobj_from_long_double1']='#define pyobj_from_long_double1(v) (PyFloat_FromDouble(v))'\ncppmacros['pyobj_from_double1']='#define pyobj_from_double1(v) (PyFloat_FromDouble(v))'\ncppmacros['pyobj_from_float1']='#define pyobj_from_float1(v) (PyFloat_FromDouble(v))'\nneeds['pyobj_from_complex_long_double1']=['complex_long_double']\ncppmacros['pyobj_from_complex_long_double1']='#define pyobj_from_complex_long_double1(v) (PyComplex_FromDoubles(v.r,v.i))'\nneeds['pyobj_from_complex_double1']=['complex_double']\ncppmacros['pyobj_from_complex_double1']='#define pyobj_from_complex_double1(v) (PyComplex_FromDoubles(v.r,v.i))'\nneeds['pyobj_from_complex_float1']=['complex_float']\ncppmacros['pyobj_from_complex_float1']='#define pyobj_from_complex_float1(v) (PyComplex_FromDoubles(v.r,v.i))'\nneeds['pyobj_from_string1']=['string']\ncppmacros['pyobj_from_string1']='#define pyobj_from_string1(v) (PyString_FromString((char *)v))'\nneeds['TRYPYARRAYTEMPLATE']=['PRINTPYOBJERR']\ncppmacros['TRYPYARRAYTEMPLATE']=\"\"\"\\\n#ifdef NUMARRAY\n/* Numarray */\n\n#if defined(USE_SIGNED_CHAR)\n#define TRYPYARRAYTEMPLATECHAR case PyArray_CHAR: *(char *)(arr->data)=*v; break;\n#else\n#define TRYPYARRAYTEMPLATECHAR\n#endif\n#if LP64\n#define TRYPYARRAYTEMPLATELONG case PyArray_LONG: *(long *)(arr->data)=*v; break;\n#else\n#define TRYPYARRAYTEMPLATELONG\n#endif\n\n/* XXX: need the corresponding numarray code here */\n#define TRYPYARRAYTEMPLATEOBJECT\n\n#elif defined(NDARRAY_VERSION)\n/* New SciPy */\n#define TRYPYARRAYTEMPLATECHAR case PyArray_STRING: *(char *)(arr->data)=*v; break;\n#define TRYPYARRAYTEMPLATELONG case PyArray_LONG: *(long *)(arr->data)=*v; break;\n#define TRYPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data); break;\n#else\n/* Numeric */\n\n#define TRYPYARRAYTEMPLATECHAR case PyArray_CHAR: *(char *)(arr->data)=*v; break;\n#define TRYPYARRAYTEMPLATELONG case PyArray_LONG: *(long *)(arr->data)=*v; break;\n#define TRYPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data); break;\n\n#endif\n\n#ifdef NUMARRAY\n#define TRYPYARRAYTEMPLATE(ctype,typecode) \\\\\n\tPyArrayObject *arr = NULL;\\\\\n\tif (!obj) return -2;\\\\\n\tif (!PyArray_Check(obj)) return -1;\\\\\n\tif (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n\tif (arr->descr->type==typecode) {*(ctype *)(arr->data)=*v; return 1;}\\\\\n\tswitch (arr->descr->type_num) {\\\\\n TRYPYARRAYTEMPLATELONG\\\\\n\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_INT: *(int *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_FLOAT: *(float *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=*v; break;\\\\\n TRYPYARRAYTEMPLATECHAR\\\\\n\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_SHORT: *(short *)(arr->data)=*v; break;\\\\\n TRYPYARRAYTEMPLATEOBJECT\\\\\n\tdefault: return -2;\\\\\n\t};\\\\\n\treturn 1;\n#elif defined(NDARRAY_VERSION)\n#define TRYPYARRAYTEMPLATE(ctype,typecode) \\\\\n\tPyArrayObject *arr = NULL;\\\\\n\tif (!obj) return -2;\\\\\n\tif (!PyArray_Check(obj)) return -1;\\\\\n\tif (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n\tif (arr->descr->type==typecode) {*(ctype *)(arr->data)=*v; return 1;}\\\\\n\tswitch (arr->descr->type_num) {\\\\\n TRYPYARRAYTEMPLATELONG\\\\\n\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_INT: *(int *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_FLOAT: *(float *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=*v; break;\\\\\n TRYPYARRAYTEMPLATECHAR\\\\\n\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_SHORT: *(short *)(arr->data)=*v; break;\\\\\n case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data, arr); break;\\\\\n\tdefault: return -2;\\\\\n\t};\\\\\n\treturn 1;\n#else\n#define TRYPYARRAYTEMPLATE(ctype,typecode) \\\\\n\tPyArrayObject *arr = NULL;\\\\\n\tif (!obj) return -2;\\\\\n\tif (!PyArray_Check(obj)) return -1;\\\\\n\tif (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n\tif (arr->descr->type==typecode) {*(ctype *)(arr->data)=*v; return 1;}\\\\\n\tswitch (arr->descr->type_num) {\\\\\n TRYPYARRAYTEMPLATELONG\\\\\n\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_INT: *(int *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_FLOAT: *(float *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=*v; break;\\\\\n TRYPYARRAYTEMPLATECHAR\\\\\n\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_SHORT: *(short *)(arr->data)=*v; break;\\\\\n case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data); break;\\\\\n\tdefault: return -2;\\\\\n\t};\\\\\n\treturn 1;\n#endif\n\"\"\"\n\nneeds['TRYCOMPLEXPYARRAYTEMPLATE']=['PRINTPYOBJERR']\ncppmacros['TRYCOMPLEXPYARRAYTEMPLATE']=\"\"\"\\\n#if PyArray_LONG != PyArray_INT\n#define TRYCOMPLEXPYARRAYTEMPLATELONG case PyArray_LONG: *(long *)(arr->data)=(*v).r; break;\n#else\n#define TRYCOMPLEXPYARRAYTEMPLATELONG\n#endif\n#if (PyArray_UBYTE != PyArray_CHAR)\n#define TRYCOMPLEXPYARRAYTEMPLATECHAR case PyArray_CHAR: *(char *)(arr->data)=(*v).r; break;\n#else\n#define TRYCOMPLEXPYARRAYTEMPLATECHAR\n#endif\n#ifdef NUMARRAY\n/* XXX: need the corresponding numarray code here */\n#define TRYCOMPLEXPYARRAYTEMPLATEOBJECT\n#elif defined(NDARRAY_VERSION)\n#define TRYCOMPLEXPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data, arr); break;\n#else\n#define TRYCOMPLEXPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data); break;\n#endif\n\n#ifdef NUMARRAY\n#define TRYCOMPLEXPYARRAYTEMPLATE(ctype,typecode)\\\\\n\tPyArrayObject *arr = NULL;\\\\\n\tif (!obj) return -2;\\\\\n\tif (!PyArray_Check(obj)) return -1;\\\\\n if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYCOMPLEXPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n\tif (arr->descr->type==typecode) {\\\\\n *(ctype *)(arr->data)=(*v).r;\\\\\n *(ctype *)(arr->data+sizeof(ctype))=(*v).i;\\\\\n return 1;\\\\\n }\\\\\n\tswitch (arr->descr->type_num) {\\\\\n\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=(*v).r;*(double *)(arr->data+sizeof(double))=(*v).i;break;\\\\\n\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=(*v).r;*(float *)(arr->data+sizeof(float))=(*v).i;break;\\\\\n\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATELONG\\\\\n\t\tcase PyArray_FLOAT: *(float *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_INT: *(int *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATECHAR\\\\\n\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATEOBJECT\\\\\n\t\tdefault: return -2;\\\\\n\t};\\\\\n\treturn -1;\n#elif defined(NDARRAY_VERSION)\n#define TRYCOMPLEXPYARRAYTEMPLATE(ctype,typecode)\\\\\n\tPyArrayObject *arr = NULL;\\\\\n\tif (!obj) return -2;\\\\\n\tif (!PyArray_Check(obj)) return -1;\\\\\n if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYCOMPLEXPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n\tif (arr->descr->type==typecode) {\\\\\n *(ctype *)(arr->data)=(*v).r;\\\\\n *(ctype *)(arr->data+sizeof(ctype))=(*v).i;\\\\\n return 1;\\\\\n }\\\\\n\tswitch (arr->descr->type_num) {\\\\\n\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=(*v).r;*(double *)(arr->data+sizeof(double))=(*v).i;break;\\\\\n\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=(*v).r;*(float *)(arr->data+sizeof(float))=(*v).i;break;\\\\\n\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATELONG\\\\\n\t\tcase PyArray_FLOAT: *(float *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_INT: *(int *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATECHAR\\\\\n\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=(*v).r; break;\\\\\n case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data, arr); break;\\\\\n\t\tdefault: return -2;\\\\\n\t};\\\\\n\treturn -1; \n#else \n#define TRYCOMPLEXPYARRAYTEMPLATE(ctype,typecode)\\\\\n\tPyArrayObject *arr = NULL;\\\\\n\tif (!obj) return -2;\\\\\n\tif (!PyArray_Check(obj)) return -1;\\\\\n if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYCOMPLEXPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n\tif (arr->descr->type==typecode) {\\\\\n *(ctype *)(arr->data)=(*v).r;\\\\\n *(ctype *)(arr->data+sizeof(ctype))=(*v).i;\\\\\n return 1;\\\\\n }\\\\\n\tswitch (arr->descr->type_num) {\\\\\n\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=(*v).r;*(double *)(arr->data+sizeof(double))=(*v).i;break;\\\\\n\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=(*v).r;*(float *)(arr->data+sizeof(float))=(*v).i;break;\\\\\n\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATELONG\\\\\n\t\tcase PyArray_FLOAT: *(float *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_INT: *(int *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATECHAR\\\\\n\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=(*v).r; break;\\\\\n case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data); break;\\\\\n\t\tdefault: return -2;\\\\\n\t};\\\\\n\treturn -1;\n#endif\n\"\"\"\n## cppmacros['NUMFROMARROBJ']=\"\"\"\\\n## #define NUMFROMARROBJ(typenum,ctype) \\\\\n## \\tif (PyArray_Check(obj)) arr = (PyArrayObject *)obj;\\\\\n## \\telse arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,typenum,0,0);\\\\\n## \\tif (arr) {\\\\\n## \\t\\tif (arr->descr->type_num==PyArray_OBJECT) {\\\\\n## \\t\\t\\tif (!ctype ## _from_pyobj(v,(arr->descr->getitem)(arr->data),\\\"\\\"))\\\\\n## \\t\\t\\tgoto capi_fail;\\\\\n## \\t\\t} else {\\\\\n## \\t\\t\\t(arr->descr->cast[typenum])(arr->data,1,(char*)v,1,1);\\\\\n## \\t\\t}\\\\\n## \\t\\tif ((PyObject *)arr != obj) { Py_DECREF(arr); }\\\\\n## \\t\\treturn 1;\\\\\n## \\t}\n## \"\"\"\n## #XXX: Note that CNUMFROMARROBJ is identical with NUMFROMARROBJ\n## cppmacros['CNUMFROMARROBJ']=\"\"\"\\\n## #define CNUMFROMARROBJ(typenum,ctype) \\\\\n## \\tif (PyArray_Check(obj)) arr = (PyArrayObject *)obj;\\\\\n## \\telse arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,typenum,0,0);\\\\\n## \\tif (arr) {\\\\\n## \\t\\tif (arr->descr->type_num==PyArray_OBJECT) {\\\\\n## \\t\\t\\tif (!ctype ## _from_pyobj(v,(arr->descr->getitem)(arr->data),\\\"\\\"))\\\\\n## \\t\\t\\tgoto capi_fail;\\\\\n## \\t\\t} else {\\\\\n## \\t\\t\\t(arr->descr->cast[typenum])((void *)(arr->data),1,(void *)(v),1,1);\\\\\n## \\t\\t}\\\\\n## \\t\\tif ((PyObject *)arr != obj) { Py_DECREF(arr); }\\\\\n## \\t\\treturn 1;\\\\\n## \\t}\n## \"\"\"\n\n\nneeds['GETSTRFROMPYTUPLE']=['STRINGCOPYN','PRINTPYOBJERR']\ncppmacros['GETSTRFROMPYTUPLE']=\"\"\"\\\n#define GETSTRFROMPYTUPLE(tuple,index,str,len) {\\\\\n\\t\\tPyObject *rv_cb_str = PyTuple_GetItem((tuple),(index));\\\\\n\\t\\tif (rv_cb_str == NULL)\\\\\n\\t\\t\\tgoto capi_fail;\\\\\n\\t\\tif (PyString_Check(rv_cb_str)) {\\\\\n\\t\\t\\tstr[len-1]='\\\\0';\\\\\n\\t\\t\\tSTRINGCOPYN((str),PyString_AS_STRING((PyStringObject*)rv_cb_str),(len));\\\\\n\\t\\t} else {\\\\\n\\t\\t\\tPRINTPYOBJERR(rv_cb_str);\\\\\n\\t\\t\\tPyErr_SetString(#modulename#_error,\\\"string object expected\\\");\\\\\n\\t\\t\\tgoto capi_fail;\\\\\n\\t\\t}\\\\\n\\t}\n\"\"\"\ncppmacros['GETSCALARFROMPYTUPLE']=\"\"\"\\\n#define GETSCALARFROMPYTUPLE(tuple,index,var,ctype,mess) {\\\\\n\\t\\tif ((capi_tmp = PyTuple_GetItem((tuple),(index)))==NULL) goto capi_fail;\\\\\n\\t\\tif (!(ctype ## _from_pyobj((var),capi_tmp,mess)))\\\\\n\\t\\t\\tgoto capi_fail;\\\\\n\\t}\n\"\"\"\n\nneeds['MEMCOPY']=['string.h']\ncppmacros['MEMCOPY']=\"\"\"\\\n#define MEMCOPY(to,from,n)\\\\\n\\tif ((memcpy(to,from,n)) == NULL) {\\\\\n\\t\\tPyErr_SetString(PyExc_MemoryError, \\\"memcpy failed\\\");\\\\\n\\t\\tgoto capi_fail;\\\\\n\\t}\n\"\"\"\ncppmacros['STRINGMALLOC']=\"\"\"\\\n#define STRINGMALLOC(str,len)\\\\\n\\tif ((str = (string)malloc(sizeof(char)*(len+1))) == NULL) {\\\\\n\\t\\tPyErr_SetString(PyExc_MemoryError, \\\"out of memory\\\");\\\\\n\\t\\tgoto capi_fail;\\\\\n\\t} else {\\\\\n\\t\\t(str)[len] = '\\\\0';\\\\\n\\t}\n\"\"\"\ncppmacros['STRINGFREE']=\"\"\"\\\n#define STRINGFREE(str)\\\\\n\\tif (!(str == NULL)) free(str);\n\"\"\"\nneeds['STRINGCOPYN']=['string.h']\ncppmacros['STRINGCOPYN']=\"\"\"\\\n#define STRINGCOPYN(to,from,n)\\\\\n\\tif ((strncpy(to,from,sizeof(char)*(n))) == NULL) {\\\\\n\\t\\tPyErr_SetString(PyExc_MemoryError, \\\"strncpy failed\\\");\\\\\n\\t\\tgoto capi_fail;\\\\\n\\t} else if (strlen(to)<(n)) {\\\\\n\\t\\tmemset((to)+strlen(to), ' ', (n)-strlen(to));\\\\\n\\t} /* Padding with spaces instead of nulls. */\n\"\"\"\nneeds['STRINGCOPY']=['string.h']\ncppmacros['STRINGCOPY']=\"\"\"\\\n#define STRINGCOPY(to,from)\\\\\n\\tif ((strcpy(to,from)) == NULL) {\\\\\n\\t\\tPyErr_SetString(PyExc_MemoryError, \\\"strcpy failed\\\");\\\\\n\\t\\tgoto capi_fail;\\\\\n\\t}\n\"\"\"\ncppmacros['CHECKGENERIC']=\"\"\"\\\n#define CHECKGENERIC(check,tcheck,name) \\\\\n\\tif (!(check)) {\\\\\n\\t\\tPyErr_SetString(#modulename#_error,\\\"(\\\"tcheck\\\") failed for \\\"name);\\\\\n\\t\\t/*goto capi_fail;*/\\\\\n\\t} else \"\"\"\ncppmacros['CHECKARRAY']=\"\"\"\\\n#define CHECKARRAY(check,tcheck,name) \\\\\n\\tif (!(check)) {\\\\\n\\t\\tPyErr_SetString(#modulename#_error,\\\"(\\\"tcheck\\\") failed for \\\"name);\\\\\n\\t\\t/*goto capi_fail;*/\\\\\n\\t} else \"\"\"\ncppmacros['CHECKSTRING']=\"\"\"\\\n#define CHECKSTRING(check,tcheck,name,show,var)\\\\\n\\tif (!(check)) {\\\\\n\\t\\tPyErr_SetString(#modulename#_error,\\\"(\\\"tcheck\\\") failed for \\\"name);\\\\\n\\t\\tfprintf(stderr,show\\\"\\\\n\\\",slen(var),var);\\\\\n\\t\\t/*goto capi_fail;*/\\\\\n\\t} else \"\"\"\ncppmacros['CHECKSCALAR']=\"\"\"\\\n#define CHECKSCALAR(check,tcheck,name,show,var)\\\\\n\\tif (!(check)) {\\\\\n\\t\\tPyErr_SetString(#modulename#_error,\\\"(\\\"tcheck\\\") failed for \\\"name);\\\\\n\\t\\tfprintf(stderr,show\\\"\\\\n\\\",var);\\\\\n\\t\\t/*goto capi_fail;*/\\\\\n\\t} else \"\"\"\n## cppmacros['CHECKDIMS']=\"\"\"\\\n## #define CHECKDIMS(dims,rank) \\\\\n## \\tfor (int i=0;i<(rank);i++)\\\\\n## \\t\\tif (dims[i]<0) {\\\\\n## \\t\\t\\tfprintf(stderr,\\\"Unspecified array argument requires a complete dimension specification.\\\\n\\\");\\\\\n## \\t\\t\\tgoto capi_fail;\\\\\n## \\t\\t}\n## \"\"\"\ncppmacros['ARRSIZE']='#define ARRSIZE(dims,rank) (_PyArray_multiply_list(dims,rank))'\ncppmacros['OLDPYNUM']=\"\"\"\\\n#ifdef OLDPYNUM\n#error You need to intall Numeric Python version 13 or higher. Get it from http:/sourceforge.net/project/?group_id=1369\n#endif\n\"\"\"\n################# C functions ###############\n\nneeds['arr_from_pyobj']=['PRINTPYOBJERR','SWAP',\n 'CFUNCSMESS','OLDPYNUM']\ncfuncs['arr_from_pyobj']=\"\"\"\\\nstatic PyArrayObject *arr_from_pyobj(int type,int *dims,int rank,PyObject *obj) {\n\\tPyArrayObject *self = NULL;\n\\tPyArrayObject *self_cp = NULL;\n\\tint i;\n\\tif (obj == Py_None) {\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj: obj = None. Doing FromDims\\\\n\\\");\n\\t\\tself = (PyArrayObject *)PyArray_FromDims(rank,dims,type);\n\\t} else {\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj: Trying ContiguousFromObject\\\\n\\\");\n\\t\\tself = (PyArrayObject *)PyArray_ContiguousFromObject(obj,type,0,0);\n\\t\\tif (self == NULL)\n\\t\\t\\tCFUNCSMESS(\\\"arr_from_pyobj: ContiguousFromObject unsuccesful\\\\n\\\");\n\\t}\n/*\\tPy_XINCREF(self);*/\n\\tif ((self == NULL) && PyArray_Check(obj)) { /* if could not cast safely in above */\n\\t\\tint loc_rank = ((PyArrayObject *)obj)->nd;\n\\t\\tint *loc_dims = ((PyArrayObject *)obj)->dimensions;\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj: isarray(obj). Doing FromDims\\\\n\\\");\n\\t\\tself = (PyArrayObject *)PyArray_FromDims(loc_rank,loc_dims,type);\n\\t}\n\\tif (self == NULL) {\n\\t\\tint i;\n\\t\\tfprintf(stderr,\\\"arr_from_pyobj: PyArray_FromDims failed (rank=%d,type=%d,dims=(%d\\\",rank,type,dims[0]);\n\\t\\tfor(i=1;ind)) {\n\\t\\tint u_dim = -1, dims_s = 1, self_s = (self->nd)?PyArray_Size((PyObject *)self):1;\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj: Mismatch of ranks. Trying to match.\\\\n\\\");\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj:\\\");\n#ifdef DEBUGCFUNCS\n\\t\\tfprintf(stderr,\\\"rank=%d,self->nd=%d,dims=(\\\",rank,self->nd);\n\\t\\tfor(i=0;i= 0) {\n\\t\\t\\tdims[u_dim] = self_s/dims_s;\n\\t\\t\\tdims_s *= dims[u_dim];\n\\t\\t}\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj:\\\");\n#ifdef DEBUGCFUNCS\n\\t\\tfprintf(stderr,\\\"rank=%d,self->nd=%d,self_s=%d,dims_s=%d,dims=(\\\",rank,self->nd,self_s,dims_s);\n\\t\\tfor(i=0;ind);\n\\t\\tgoto capi_fail;\n\\t\\t}\n\\t\\tself = (PyArrayObject *)PyArray_FromDimsAndDataAndDescr(rank, dims,self_cp->descr,self_cp->data);\n\\t\\tif (self == NULL)\n\\t\\t\\tgoto capi_fail;\n\\t\\tPy_INCREF(self_cp);\n\\t\\tself->base = (PyObject *)self_cp;\n\\t}\n\\tfor (i=0;iself->dimensions[i]) {\n\\t\\t\\tfprintf(stderr,\\\"#modulename#:arr_from_pyobj: %d-th dimension must be at least %d but got %d.\\\\n\\\",i+1,dims[i],self->dimensions[i]);\n\\t\\t\\tgoto capi_fail;\n\\t\\t}\n\\tif (((PyObject *)self_cp != obj) && PyArray_Check(obj)) {\n\\t\\tif (copy_ND_array((PyArrayObject *)obj,self_cp)) {\n\\t\\t\\tfprintf(stderr,\\\"#modulename#:arr_from_pyobj: failed to copy object to rank-%d array with shape (\\\",self_cp->nd);\n\\t\\t\\tfor(i=0;ind;i++) fprintf(stderr,\\\"%d,\\\",self_cp->dimensions[i]);\n\\t\\t\\tfprintf(stderr,\\\")\\\\n\\\");\n\\t\\t\\tPRINTPYOBJERR((PyObject *)self_cp);\n\\t\\t\\tgoto capi_fail;\n\\t\\t}\n\\t}\n\\tif (self != NULL)\n\\t\\treturn self;\n\\tCFUNCSMESS(\\\"arr_from_pyobj: self==NULL. Confused?!.\\\\n\\\");\ncapi_fail:\n\\tPRINTPYOBJERR(obj);\n\\tPy_XDECREF(self);\n\\treturn NULL;\n}\"\"\"\ncfuncs['calcarrindex']=\"\"\"\\\nstatic int calcarrindex(int *i,PyArrayObject *arr) {\n\\tint k,ii = i[0];\n\\tfor (k=1; k < arr->nd; k++)\n\\t\\tii += (ii*(arr->dimensions[k] - 1)+i[k]); /* assuming contiguous arr */\n\\treturn ii;\n}\"\"\"\ncfuncs['calcarrindextr']=\"\"\"\\\nstatic int calcarrindextr(int *i,PyArrayObject *arr) {\n\\tint k,ii = i[arr->nd-1];\n\\tfor (k=1; k < arr->nd; k++)\n\\t\\tii += (ii*(arr->dimensions[arr->nd-k-1] - 1)+i[arr->nd-k-1]); /* assuming contiguous arr */\n\\treturn ii;\n}\"\"\"\ncfuncs['forcomb']=\"\"\"\\\nstatic struct { int nd,*d,*i,*i_tr,tr; } forcombcache;\nstatic int initforcomb(int *dims,int nd,int tr) {\n int k;\n if (dims==NULL) return 0;\n if (nd<0) return 0;\n forcombcache.nd = nd;\n forcombcache.d = dims;\n forcombcache.tr = tr;\n if ((forcombcache.i = (int *)malloc(sizeof(int)*nd))==NULL) return 0;\n if ((forcombcache.i_tr = (int *)malloc(sizeof(int)*nd))==NULL) return 0;\n for (k=1;k= (max_ind)[k]) { \\\\\n## while (k >= 0 && ((ret_ind)[k] >= (max_ind)[k]-1)) \\\\\n## (ret_ind)[k--] = 0; \\\\\n## if (k >= 0) (ret_ind)[k]++; \\\\\n## else (ret_ind)[0] = (max_ind)[0]; \\\\\n## } \\\\\n## }\n## #define CALCINDEX(indx, nd_index, strides, ndim) \\\\\n## { \\\\\n## int i; \\\\\n## indx = 0; \\\\\n## for (i=0; i < (ndim); i++) \\\\\n## indx += nd_index[i]*strides[i]; \\\\\n## } \n## static int copy_ND_array(PyArrayObject *in, PyArrayObject *out)\n## {\n\n## /* This routine copies an N-D array in to an N-D array out where both\n## can be discontiguous. An appropriate (raw) cast is made on the data.\n## */\n\n## /* It works by using an N-1 length vector to hold the N-1 first indices \n## into the array. This counter is looped through copying (and casting) \n## the entire last dimension at a time.\n## */\n\n## int *nd_index, indx1;\n## int indx2, last_dim;\n## int instep, outstep;\n\n## if (0 == in->nd) {\n## in->descr->cast[out->descr->type_num]((void *)in->data,1,(void *)out->data,1,1);\n## return 0;\n## }\n## if (1 == in->nd) {\n## (in->descr->cast[out->descr->type_num])((void *)(in->data),1,(void *)(out->data),1,in->dimensions[0]);\n## return 0;\n## }\n## nd_index = (int *)calloc(in->nd-1,sizeof(int));\n## last_dim = in->nd - 1;\n## instep = in->strides[last_dim] / in->descr->elsize;\n## outstep = out->strides[last_dim] / out->descr->elsize;\n## if (NULL == nd_index) {\n## fprintf(stderr,\\\"Could not allocate memory for index array.\\\\n\\\");\n## return -1;\n## }\n## CFUNCSMESS(\\\"copy_ND_array: doing a complete copy\\\\n\\\");\n## while(nd_index[0] != in->dimensions[0]) {\n## CALCINDEX(indx1,nd_index,in->strides,in->nd-1);\n## CALCINDEX(indx2,nd_index,out->strides,out->nd-1);\n## /* Copy (with an appropriate cast) the last dimension of the array */\n## (in->descr->cast[out->descr->type_num])((void *)(in->data+indx1),instep,(void *)(out->data+indx2),outstep,in->dimensions[last_dim]); \n## INCREMENT(nd_index,in->nd-1,in->dimensions);\n## }\n## free(nd_index);\n## return 0;\n## } \n## /* EOF T.O.'s contib */\n## \"\"\"\n\nneeds['try_pyarr_from_string']=['STRINGCOPYN','PRINTPYOBJERR','string']\ncfuncs['try_pyarr_from_string']=\"\"\"\\\nstatic int try_pyarr_from_string(PyObject *obj,const string str) {\n\\tPyArrayObject *arr = NULL;\n\\tif (PyArray_Check(obj) && (!((arr = (PyArrayObject *)obj) == NULL)))\n\\t\\t{ STRINGCOPYN(arr->data,str,PyArray_SIZE(arr)); }\n\\treturn 1;\ncapi_fail:\n\\tPRINTPYOBJERR(obj);\n\\tPyErr_SetString(#modulename#_error,\\\"try_pyarr_from_string failed\\\");\n\\treturn 0;\n}\n\"\"\"\nneeds['string_from_pyobj']=['string','STRINGMALLOC','STRINGCOPYN']\ncfuncs['string_from_pyobj']=\"\"\"\\\nstatic int string_from_pyobj(string *str,int *len,const string inistr,PyObject *obj,const char *errmess) {\n\\tPyArrayObject *arr = NULL;\n\\tPyObject *tmp = NULL;\n#ifdef DEBUGCFUNCS\nfprintf(stderr,\\\"string_from_pyobj(str='%s',len=%d,inistr='%s',obj=%p)\\\\n\\\",(char*)str,*len,(char *)inistr,obj);\n#endif\n\\tif (obj == Py_None) {\n\\t\\tif (*len == -1)\n\\t\\t\\t*len = strlen(inistr); /* Will this cause problems? */\n\\t\\tSTRINGMALLOC(*str,*len);\n\\t\\tSTRINGCOPYN(*str,inistr,*len);\n\\t\\treturn 1;\n\\t}\n\\tif (PyArray_Check(obj)) {\n\\t\\tif ((arr = (PyArrayObject *)obj) == NULL)\n\\t\\t\\tgoto capi_fail;\n\\t\\tif (!ISCONTIGUOUS(arr)) {\n\\t\\t\\tPyErr_SetString(PyExc_ValueError,\\\"array object is non-contiguous.\\\");\n\\t\\t\\tgoto capi_fail;\n\\t\\t}\n\\t\\tif (arr->descr->elsize==sizeof(char)) {\n\\t\\t\\tif (*len == -1)\n\\t\\t\\t\\t*len = (arr->descr->elsize)*PyArray_SIZE(arr);\n\\t\\t\\tSTRINGMALLOC(*str,*len);\n\\t\\t\\tSTRINGCOPYN(*str,arr->data,*len);\n\\t\\t\\treturn 1;\n\\t\\t}\n\\t\\tPyErr_SetString(PyExc_ValueError,\\\"array object element size is not 1.\\\");\n\\t\\tgoto capi_fail;\n\\t}\n\\tif (PyString_Check(obj)) {\n\\t\\ttmp = obj;\n\\t\\tPy_INCREF(tmp);\n\\t}\n\\telse\n\\t\\ttmp = PyObject_Str(obj);\n\\tif (tmp == NULL) goto capi_fail;\n\\tif (*len == -1)\n\\t\\t*len = PyString_GET_SIZE(tmp);\n\\tSTRINGMALLOC(*str,*len);\n\\tSTRINGCOPYN(*str,PyString_AS_STRING(tmp),*len);\n\\tPy_DECREF(tmp);\n\\treturn 1;\ncapi_fail:\n\\tPy_XDECREF(tmp);\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL) err = #modulename#_error;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['char_from_pyobj']=['int_from_pyobj']\ncfuncs['char_from_pyobj']=\"\"\"\\\nstatic int char_from_pyobj(char* v,PyObject *obj,const char *errmess) {\n\\tint i=0;\n\\tif (int_from_pyobj(&i,obj,errmess)) {\n\\t\\t*v = (char)i;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['signed_char_from_pyobj']=['int_from_pyobj','signed_char']\ncfuncs['signed_char_from_pyobj']=\"\"\"\\\nstatic int signed_char_from_pyobj(signed_char* v,PyObject *obj,const char *errmess) {\n\\tint i=0;\n\\tif (int_from_pyobj(&i,obj,errmess)) {\n\\t\\t*v = (signed_char)i;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['short_from_pyobj']=['int_from_pyobj']\ncfuncs['short_from_pyobj']=\"\"\"\\\nstatic int short_from_pyobj(short* v,PyObject *obj,const char *errmess) {\n\\tint i=0;\n\\tif (int_from_pyobj(&i,obj,errmess)) {\n\\t\\t*v = (short)i;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\ncfuncs['int_from_pyobj']=\"\"\"\\\nstatic int int_from_pyobj(int* v,PyObject *obj,const char *errmess) {\n\\tPyObject* tmp = NULL;\n\\tif (PyInt_Check(obj)) {\n\\t\\t*v = (int)PyInt_AS_LONG(obj);\n\\t\\treturn 1;\n\\t}\n\\ttmp = PyNumber_Int(obj);\n\\tif (tmp) {\n\\t\\t*v = PyInt_AS_LONG(tmp);\n\\t\\tPy_DECREF(tmp);\n\\t\\treturn 1;\n\\t}\n\\tif (PyComplex_Check(obj))\n\\t\\ttmp = PyObject_GetAttrString(obj,\\\"real\\\");\n\\telse if (PyString_Check(obj))\n\\t\\t/*pass*/;\n\\telse if (PySequence_Check(obj))\n\\t\\ttmp = PySequence_GetItem(obj,0);\n\\tif (tmp) {\n\\t\\tPyErr_Clear();\n\\t\\tif (int_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}\n\\t\\tPy_DECREF(tmp);\n\\t}\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL) err = #modulename#_error;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\ncfuncs['long_from_pyobj']=\"\"\"\\\nstatic int long_from_pyobj(long* v,PyObject *obj,const char *errmess) {\n\\tPyObject* tmp = NULL;\n\\tif (PyInt_Check(obj)) {\n\\t\\t*v = PyInt_AS_LONG(obj);\n\\t\\treturn 1;\n\\t}\n\\ttmp = PyNumber_Int(obj);\n\\tif (tmp) {\n\\t\\t*v = PyInt_AS_LONG(tmp);\n\\t\\tPy_DECREF(tmp);\n\\t\\treturn 1;\n\\t}\n\\tif (PyComplex_Check(obj))\n\\t\\ttmp = PyObject_GetAttrString(obj,\\\"real\\\");\n\\telse if (PyString_Check(obj))\n\\t\\t/*pass*/;\n\\telse if (PySequence_Check(obj))\n\\t\\ttmp = PySequence_GetItem(obj,0);\n\\tif (tmp) {\n\\t\\tPyErr_Clear();\n\\t\\tif (long_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}\n\\t\\tPy_DECREF(tmp);\n\\t}\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL) err = #modulename#_error;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['long_long_from_pyobj']=['long_long']\ncfuncs['long_long_from_pyobj']=\"\"\"\\\nstatic int long_long_from_pyobj(long_long* v,PyObject *obj,const char *errmess) {\n\\tPyObject* tmp = NULL;\n\\tif (PyLong_Check(obj)) {\n\\t\\t*v = PyLong_AsLongLong(obj);\n\\t\\treturn (!PyErr_Occurred());\n\\t}\n\\tif (PyInt_Check(obj)) {\n\\t\\t*v = (long_long)PyInt_AS_LONG(obj);\n\\t\\treturn 1;\n\\t}\n\\ttmp = PyNumber_Long(obj);\n\\tif (tmp) {\n\\t\\t*v = PyLong_AsLongLong(tmp);\n\\t\\tPy_DECREF(tmp);\n\\t\\treturn (!PyErr_Occurred());\n\\t}\n\\tif (PyComplex_Check(obj))\n\\t\\ttmp = PyObject_GetAttrString(obj,\\\"real\\\");\n\\telse if (PyString_Check(obj))\n\\t\\t/*pass*/;\n\\telse if (PySequence_Check(obj))\n\\t\\ttmp = PySequence_GetItem(obj,0);\n\\tif (tmp) {\n\\t\\tPyErr_Clear();\n\\t\\tif (long_long_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}\n\\t\\tPy_DECREF(tmp);\n\\t}\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL) err = #modulename#_error;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['long_double_from_pyobj']=['double_from_pyobj','long_double']\ncfuncs['long_double_from_pyobj']=\"\"\"\\\nstatic int long_double_from_pyobj(long_double* v,PyObject *obj,const char *errmess) {\n\\tdouble d=0;\n\\tif (double_from_pyobj(&d,obj,errmess)) {\n\\t\\t*v = (long_double)d;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\ncfuncs['double_from_pyobj']=\"\"\"\\\nstatic int double_from_pyobj(double* v,PyObject *obj,const char *errmess) {\n\\tPyObject* tmp = NULL;\n\\tif (PyFloat_Check(obj)) {\n#ifdef __sgi\n\\t\\t*v = PyFloat_AsDouble(obj);\n#else\n\\t\\t*v = PyFloat_AS_DOUBLE(obj);\n#endif\n\\t\\treturn 1;\n\\t}\n\\ttmp = PyNumber_Float(obj);\n\\tif (tmp) {\n#ifdef __sgi\n\\t\\t*v = PyFloat_AsDouble(tmp);\n#else\n\\t\\t*v = PyFloat_AS_DOUBLE(tmp);\n#endif\n\\t\\tPy_DECREF(tmp);\n\\t\\treturn 1;\n\\t}\n\\tif (PyComplex_Check(obj))\n\\t\\ttmp = PyObject_GetAttrString(obj,\\\"real\\\");\n\\telse if (PyString_Check(obj))\n\\t\\t/*pass*/;\n\\telse if (PySequence_Check(obj))\n\\t\\ttmp = PySequence_GetItem(obj,0);\n\\tif (tmp) {\n\\t\\tPyErr_Clear();\n\\t\\tif (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}\n\\t\\tPy_DECREF(tmp);\n\\t}\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL) err = #modulename#_error;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['float_from_pyobj']=['double_from_pyobj']\ncfuncs['float_from_pyobj']=\"\"\"\\\nstatic int float_from_pyobj(float* v,PyObject *obj,const char *errmess) {\n\\tdouble d=0.0;\n\\tif (double_from_pyobj(&d,obj,errmess)) {\n\\t\\t*v = (float)d;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['complex_long_double_from_pyobj']=['complex_long_double','long_double',\n 'complex_double_from_pyobj']\ncfuncs['complex_long_double_from_pyobj']=\"\"\"\\\nstatic int complex_long_double_from_pyobj(complex_long_double* v,PyObject *obj,const char *errmess) {\n\\tcomplex_double cd={0.0,0.0};\n\\tif (complex_double_from_pyobj(&cd,obj,errmess)) {\n\\t\\t(*v).r = (long_double)cd.r;\n\\t\\t(*v).i = (long_double)cd.i;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['complex_double_from_pyobj']=['complex_double']\ncfuncs['complex_double_from_pyobj']=\"\"\"\\\nstatic int complex_double_from_pyobj(complex_double* v,PyObject *obj,const char *errmess) {\n\\tPy_complex c;\n\\tif (PyComplex_Check(obj)) {\n\\t\\tc=PyComplex_AsCComplex(obj);\n\\t\\t(*v).r=c.real, (*v).i=c.imag;\n\\t\\treturn 1;\n\\t}\n\\t/* Python does not provide PyNumber_Complex function :-( */\n\\t(*v).i=0.0;\n\\tif (PyFloat_Check(obj)) {\n#ifdef __sgi\n\\t\\t(*v).r = PyFloat_AsDouble(obj);\n#else\n\\t\\t(*v).r = PyFloat_AS_DOUBLE(obj);\n#endif\n\\t\\treturn 1;\n\\t}\n\\tif (PyInt_Check(obj)) {\n\\t\\t(*v).r = (double)PyInt_AS_LONG(obj);\n\\t\\treturn 1;\n\\t}\n\\tif (PyLong_Check(obj)) {\n\\t\\t(*v).r = PyLong_AsDouble(obj);\n\\t\\treturn (!PyErr_Occurred());\n\\t}\n\\tif (PySequence_Check(obj) && (!PyString_Check(obj))) {\n\\t\\tPyObject *tmp = PySequence_GetItem(obj,0);\n\\t\\tif (tmp) {\n\\t\\t\\tif (complex_double_from_pyobj(v,tmp,errmess)) {\n\\t\\t\\t\\tPy_DECREF(tmp);\n\\t\\t\\t\\treturn 1;\n\\t\\t\\t}\n\\t\\t\\tPy_DECREF(tmp);\n\\t\\t}\n\\t}\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL)\n\\t\\t\\terr = PyExc_TypeError;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['complex_float_from_pyobj']=['complex_float','complex_double_from_pyobj']\ncfuncs['complex_float_from_pyobj']=\"\"\"\\\nstatic int complex_float_from_pyobj(complex_float* v,PyObject *obj,const char *errmess) {\n\\tcomplex_double cd={0.0,0.0};\n\\tif (complex_double_from_pyobj(&cd,obj,errmess)) {\n\\t\\t(*v).r = (float)cd.r;\n\\t\\t(*v).i = (float)cd.i;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['try_pyarr_from_char']=['pyobj_from_char1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_char']='static int try_pyarr_from_char(PyObject* obj,char* v) {\\n\\tTRYPYARRAYTEMPLATE(char,\\'c\\');\\n}\\n'\nneeds['try_pyarr_from_signed_char']=['TRYPYARRAYTEMPLATE','unsigned_char']\ncfuncs['try_pyarr_from_unsigned_char']='static int try_pyarr_from_unsigned_char(PyObject* obj,unsigned_char* v) {\\n\\tTRYPYARRAYTEMPLATE(unsigned_char,\\'b\\');\\n}\\n'\nneeds['try_pyarr_from_signed_char']=['TRYPYARRAYTEMPLATE','signed_char']\ncfuncs['try_pyarr_from_signed_char']='static int try_pyarr_from_signed_char(PyObject* obj,signed_char* v) {\\n\\tTRYPYARRAYTEMPLATE(signed_char,\\'1\\');\\n}\\n'\nneeds['try_pyarr_from_short']=['pyobj_from_short1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_short']='static int try_pyarr_from_short(PyObject* obj,short* v) {\\n\\tTRYPYARRAYTEMPLATE(short,\\'s\\');\\n}\\n'\nneeds['try_pyarr_from_int']=['pyobj_from_int1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_int']='static int try_pyarr_from_int(PyObject* obj,int* v) {\\n\\tTRYPYARRAYTEMPLATE(int,\\'i\\');\\n}\\n'\nneeds['try_pyarr_from_long']=['pyobj_from_long1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_long']='static int try_pyarr_from_long(PyObject* obj,long* v) {\\n\\tTRYPYARRAYTEMPLATE(long,\\'l\\');\\n}\\n'\nneeds['try_pyarr_from_long_long']=['pyobj_from_long_long1','TRYPYARRAYTEMPLATE','long_long']\ncfuncs['try_pyarr_from_long_long']='static int try_pyarr_from_long_long(PyObject* obj,long_long* v) {\\n\\tTRYPYARRAYTEMPLATE(long_long,\\'L\\');\\n}\\n'\nneeds['try_pyarr_from_float']=['pyobj_from_float1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_float']='static int try_pyarr_from_float(PyObject* obj,float* v) {\\n\\tTRYPYARRAYTEMPLATE(float,\\'f\\');\\n}\\n'\nneeds['try_pyarr_from_double']=['pyobj_from_double1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_double']='static int try_pyarr_from_double(PyObject* obj,double* v) {\\n\\tTRYPYARRAYTEMPLATE(double,\\'d\\');\\n}\\n'\nneeds['try_pyarr_from_complex_float']=['pyobj_from_complex_float1','TRYCOMPLEXPYARRAYTEMPLATE','complex_float']\ncfuncs['try_pyarr_from_complex_float']='static int try_pyarr_from_complex_float(PyObject* obj,complex_float* v) {\\n\\tTRYCOMPLEXPYARRAYTEMPLATE(float,\\'F\\');\\n}\\n'\nneeds['try_pyarr_from_complex_double']=['pyobj_from_complex_double1','TRYCOMPLEXPYARRAYTEMPLATE','complex_double']\ncfuncs['try_pyarr_from_complex_double']='static int try_pyarr_from_complex_double(PyObject* obj,complex_double* v) {\\n\\tTRYCOMPLEXPYARRAYTEMPLATE(double,\\'D\\');\\n}\\n'\n\nneeds['create_cb_arglist']=['CFUNCSMESS','PRINTPYOBJERR','MINMAX']\ncfuncs['create_cb_arglist']=\"\"\"\\\nstatic int create_cb_arglist(PyObject* fun,PyTupleObject* xa,const int maxnofargs,const int nofoptargs,int *nofargs,PyTupleObject **args,const char *errmess) {\n\\tPyObject *tmp = NULL;\n\\tPyObject *tmp_fun = NULL;\n\\tint tot,opt,ext,siz,i,di=0;\n\\tCFUNCSMESS(\\\"create_cb_arglist\\\\n\\\");\n\\ttot=opt=ext=siz=0;\n\\t/* Get the total number of arguments */\n\\tif (PyFunction_Check(fun))\n\\t\\ttmp_fun = fun;\n\\telse {\n\\t\\tdi = 1;\n\\t\\tif (PyObject_HasAttrString(fun,\\\"im_func\\\")) {\n\\t\\t\\ttmp_fun = PyObject_GetAttrString(fun,\\\"im_func\\\");\n\\t\\t}\n\\t\\telse if (PyObject_HasAttrString(fun,\\\"__call__\\\")) {\n\\t\\t\\ttmp = PyObject_GetAttrString(fun,\\\"__call__\\\");\n\\t\\t\\tif (PyObject_HasAttrString(tmp,\\\"im_func\\\"))\n\\t\\t\\t\\ttmp_fun = PyObject_GetAttrString(tmp,\\\"im_func\\\");\n\\t\\t\\telse {\n\\t\\t\\t\\ttmp_fun = fun; /* built-in function */\n\\t\\t\\t\\ttot = maxnofargs;\n\\t\\t\\t\\tif (xa != NULL)\n\\t\\t\\t\\t\\ttot += PyTuple_Size((PyObject *)xa);\n\\t\\t\\t}\n\\t\\t\\tPy_XDECREF(tmp);\n\\t\\t}\n\\t\\telse if (PyFortran_Check(fun) || PyFortran_Check1(fun)) {\n\\t\\t\\ttot = maxnofargs;\n\\t\\t\\tif (xa != NULL)\n\\t\\t\\t\\ttot += PyTuple_Size((PyObject *)xa);\n\\t\\t\\ttmp_fun = fun;\n\\t\\t}\n\\t\\telse if (PyCObject_Check(fun)) {\n\\t\\t\\ttot = maxnofargs;\n\\t\\t\\tif (xa != NULL)\n\\t\\t\\t\\text = PyTuple_Size((PyObject *)xa);\n\\t\\t\\tif(ext>0) {\n\\t\\t\\t\\tfprintf(stderr,\\\"extra arguments tuple cannot be used with CObject call-back\\\\n\\\");\n\\t\\t\\t\\tgoto capi_fail;\n\\t\\t\\t}\n\\t\\t\\ttmp_fun = fun;\n\\t\\t}\n\\t}\nif (tmp_fun==NULL) {\nfprintf(stderr,\\\"Call-back argument must be function|instance|instance.__call__|f2py-function but got %s.\\\\n\\\",(fun==NULL?\\\"NULL\\\":fun->ob_type->tp_name));\ngoto capi_fail;\n}\n\\tif (PyObject_HasAttrString(tmp_fun,\\\"func_code\\\")) {\n\\t\\tif (PyObject_HasAttrString(tmp = PyObject_GetAttrString(tmp_fun,\\\"func_code\\\"),\\\"co_argcount\\\"))\n\\t\\t\\ttot = PyInt_AsLong(PyObject_GetAttrString(tmp,\\\"co_argcount\\\")) - di;\n\\t\\tPy_XDECREF(tmp);\n\\t}\n\\t/* Get the number of optional arguments */\n\\tif (PyObject_HasAttrString(tmp_fun,\\\"func_defaults\\\"))\n\\t\\tif (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,\\\"func_defaults\\\")))\n\\t\\t\\topt = PyTuple_Size(tmp);\n\\t\\tPy_XDECREF(tmp);\n\\t/* Get the number of extra arguments */\n\\tif (xa != NULL)\n\\t\\text = PyTuple_Size((PyObject *)xa);\n\\t/* Calculate the size of call-backs argument list */\n\\tsiz = MIN(maxnofargs+ext,tot);\n\\t*nofargs = MAX(0,siz-ext);\n#ifdef DEBUGCFUNCS\n\\tfprintf(stderr,\\\"debug-capi:create_cb_arglist:maxnofargs(-nofoptargs),tot,opt,ext,siz,nofargs=%d(-%d),%d,%d,%d,%d,%d\\\\n\\\",maxnofargs,nofoptargs,tot,opt,ext,siz,*nofargs);\n#endif\n\\tif (siz0:\n if not needs.has_key(outneeds[n][0]):\n out.append(outneeds[n][0])\n del outneeds[n][0]\n else:\n flag=0\n for k in outneeds[n][1:]:\n if k in needs[outneeds[n][0]]:\n flag=1\n break\n if flag:\n outneeds[n]=outneeds[n][1:]+[outneeds[n][0]]\n else:\n out.append(outneeds[n][0])\n del outneeds[n][0]\n if saveout and (0 not in map(lambda x,y:x==y,saveout,outneeds[n])):\n print n,saveout\n errmess('get_needs: no progress in sorting needs, probably circular dependence, skipping.\\n')\n out=out+saveout\n break\n saveout=copy.copy(outneeds[n])\n if out==[]: out=[n]\n res[n]=out\n return res\n", "source_code_before": "#!/usr/bin/env python\n\"\"\"\n\nC declarations, CPP macros, and C functions for f2py2e.\nOnly required declarations/macros/functions will be used.\n\nCopyright 1999,2000 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the\nterms of the LGPL. See http://www.fsf.org\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n$Date: 2005/05/06 11:42:34 $\nPearu Peterson\n\"\"\"\n\n__version__ = \"$Revision: 1.75 $\"[10:-1]\n\nimport __version__\nf2py_version = __version__.version\n\nimport types,sys,copy,os\nerrmess=sys.stderr.write\n\n##################### Definitions ##################\n\noutneeds={'includes0':[],'includes':[],'typedefs':[],'typedefs_generated':[],\n 'userincludes':[],\n 'cppmacros':[],'cfuncs':[],'callbacks':[],'f90modhooks':[],\n 'commonhooks':[]}\nneeds={}\nincludes0={'includes0':'/*need_includes0*/'}\nincludes={'includes':'/*need_includes*/'}\nuserincludes={'userincludes':'/*need_userincludes*/'}\ntypedefs={'typedefs':'/*need_typedefs*/'}\ntypedefs_generated={'typedefs_generated':'/*need_typedefs_generated*/'}\ncppmacros={'cppmacros':'/*need_cppmacros*/'}\ncfuncs={'cfuncs':'/*need_cfuncs*/'}\ncallbacks={'callbacks':'/*need_callbacks*/'}\nf90modhooks={'f90modhooks':'/*need_f90modhooks*/',\n 'initf90modhooksstatic':'/*initf90modhooksstatic*/',\n 'initf90modhooksdynamic':'/*initf90modhooksdynamic*/',\n }\ncommonhooks={'commonhooks':'/*need_commonhooks*/',\n 'initcommonhooks':'/*need_initcommonhooks*/',\n }\n\n############ Includes ###################\n\nincludes0['math.h']='#include '\nincludes0['string.h']='#include '\nincludes0['setjmp.h']='#include '\n\nincludes['Python.h']='#include \"Python.h\"'\nneeds['arrayobject.h']=['Python.h']\nincludes['arrayobject.h']='''#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API\n#include \"arrayobject.h\"'''\n\nincludes['arrayobject.h']='#include \"fortranobject.h\"'\n\n############# Type definitions ###############\n\ntypedefs['unsigned_char']='typedef unsigned char unsigned_char;'\ntypedefs['unsigned_short']='typedef unsigned short unsigned_short;'\ntypedefs['unsigned_long']='typedef unsigned long unsigned_long;'\ntypedefs['signed_char']='typedef signed char signed_char;'\ntypedefs['long_long']=\"\"\"\\\n#ifdef _WIN32\ntypedef __int64 long_long;\n#else\ntypedef long long long_long;\ntypedef unsigned long long unsigned_long_long;\n#endif\n\"\"\"\ntypedefs['insinged_long_long']=\"\"\"\\\n#ifdef _WIN32\ntypedef __uint64 long_long;\n#else\ntypedef unsigned long long unsigned_long_long;\n#endif\n\"\"\"\ntypedefs['long_double']=\"\"\"\\\n#ifndef _LONG_DOUBLE\ntypedef long double long_double;\n#endif\n\"\"\"\ntypedefs['complex_long_double']='typedef struct {long double r,i;} complex_long_double;'\ntypedefs['complex_float']='typedef struct {float r,i;} complex_float;'\ntypedefs['complex_double']='typedef struct {double r,i;} complex_double;'\ntypedefs['string']=\"\"\"typedef char * string;\"\"\"\n\n\n############### CPP macros ####################\ncppmacros['CFUNCSMESS']=\"\"\"\\\n#ifdef DEBUGCFUNCS\n#define CFUNCSMESS(mess) fprintf(stderr,\\\"debug-capi:\\\"mess);\n#define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \\\\\n\\tPyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\\\\\n\\tfprintf(stderr,\\\"\\\\n\\\");\n#else\n#define CFUNCSMESS(mess)\n#define CFUNCSMESSPY(mess,obj)\n#endif\n\"\"\"\ncppmacros['F_FUNC']=\"\"\"\\\n#if defined(PREPEND_FORTRAN)\n#if defined(NO_APPEND_FORTRAN)\n#if defined(UPPERCASE_FORTRAN)\n#define F_FUNC(f,F) _##F\n#else\n#define F_FUNC(f,F) _##f\n#endif\n#else\n#if defined(UPPERCASE_FORTRAN)\n#define F_FUNC(f,F) _##F##_\n#else\n#define F_FUNC(f,F) _##f##_\n#endif\n#endif\n#else\n#if defined(NO_APPEND_FORTRAN)\n#if defined(UPPERCASE_FORTRAN)\n#define F_FUNC(f,F) F\n#else\n#define F_FUNC(f,F) f\n#endif\n#else\n#if defined(UPPERCASE_FORTRAN)\n#define F_FUNC(f,F) F##_\n#else\n#define F_FUNC(f,F) f##_\n#endif\n#endif\n#endif\n#if defined(UNDERSCORE_G77)\n#define F_FUNC_US(f,F) F_FUNC(f##_,F##_)\n#else\n#define F_FUNC_US(f,F) F_FUNC(f,F)\n#endif\n\"\"\"\ncppmacros['F_WRAPPEDFUNC']=\"\"\"\\\n#if defined(PREPEND_FORTRAN)\n#if defined(NO_APPEND_FORTRAN)\n#if defined(UPPERCASE_FORTRAN)\n#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F\n#else\n#define F_WRAPPEDFUNC(f,F) _f2pywrap##f\n#endif\n#else\n#if defined(UPPERCASE_FORTRAN)\n#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F##_\n#else\n#define F_WRAPPEDFUNC(f,F) _f2pywrap##f##_\n#endif\n#endif\n#else\n#if defined(NO_APPEND_FORTRAN)\n#if defined(UPPERCASE_FORTRAN)\n#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F\n#else\n#define F_WRAPPEDFUNC(f,F) f2pywrap##f\n#endif\n#else\n#if defined(UPPERCASE_FORTRAN)\n#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F##_\n#else\n#define F_WRAPPEDFUNC(f,F) f2pywrap##f##_\n#endif\n#endif\n#endif\n#if defined(UNDERSCORE_G77)\n#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f##_,F##_)\n#else\n#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f,F)\n#endif\n\"\"\"\ncppmacros['F_MODFUNC']=\"\"\"\\\n#if defined(F90MOD2CCONV1) /*E.g. Compaq Fortran */\n#if defined(NO_APPEND_FORTRAN)\n#define F_MODFUNCNAME(m,f) $ ## m ## $ ## f\n#else\n#define F_MODFUNCNAME(m,f) $ ## m ## $ ## f ## _\n#endif\n#endif\n\n#if defined(F90MOD2CCONV2) /*E.g. IBM XL Fortran, not tested though */\n#if defined(NO_APPEND_FORTRAN)\n#define F_MODFUNCNAME(m,f) __ ## m ## _MOD_ ## f\n#else\n#define F_MODFUNCNAME(m,f) __ ## m ## _MOD_ ## f ## _\n#endif\n#endif\n\n#if defined(F90MOD2CCONV3) /*E.g. MIPSPro Compilers */\n#if defined(NO_APPEND_FORTRAN)\n#define F_MODFUNCNAME(m,f) f ## .in. ## m\n#else\n#define F_MODFUNCNAME(m,f) f ## .in. ## m ## _\n#endif\n#endif\n/*\n#if defined(UPPERCASE_FORTRAN)\n#define F_MODFUNC(m,M,f,F) F_MODFUNCNAME(M,F)\n#else\n#define F_MODFUNC(m,M,f,F) F_MODFUNCNAME(m,f)\n#endif\n*/\n\n#define F_MODFUNC(m,f) (*(f2pymodstruct##m##.##f))\n\"\"\"\ncppmacros['SWAPUNSAFE']=\"\"\"\\\n#define SWAP(a,b) (size_t)(a) = ((size_t)(a) ^ (size_t)(b));\\\\\n (size_t)(b) = ((size_t)(a) ^ (size_t)(b));\\\\\n (size_t)(a) = ((size_t)(a) ^ (size_t)(b))\n\"\"\"\ncppmacros['SWAP']=\"\"\"\\\n#define SWAP(a,b,t) {\\\\\n\\tt *c;\\\\\n\\tc = a;\\\\\n\\ta = b;\\\\\n\\tb = c;}\n\"\"\"\n#cppmacros['ISCONTIGUOUS']='#define ISCONTIGUOUS(m) ((m)->flags & CONTIGUOUS)'\ncppmacros['PRINTPYOBJERR']=\"\"\"\\\n#define PRINTPYOBJERR(obj)\\\\\n\\tfprintf(stderr,\\\"#modulename#.error is related to \\\");\\\\\n\\tPyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\\\\\n\\tfprintf(stderr,\\\"\\\\n\\\");\n\"\"\"\ncppmacros['MINMAX']=\"\"\"\\\n#ifndef MAX\n#define MAX(a,b) ((a > b) ? (a) : (b))\n#endif\n#ifndef MIN\n#define MIN(a,b) ((a < b) ? (a) : (b))\n#endif\n\"\"\"\ncppmacros['len..']=\"\"\"\\\n#define rank(var) var ## _Rank\n#define shape(var,dim) var ## _Dims[dim]\n#define old_rank(var) (((PyArrayObject *)(capi_ ## var ## _tmp))->nd)\n#define old_shape(var,dim) (((PyArrayObject *)(capi_ ## var ## _tmp))->dimensions[dim])\n#define fshape(var,dim) shape(var,rank(var)-dim-1)\n#define len(var) shape(var,0)\n#define flen(var) fshape(var,0)\n#define size(var) PyArray_SIZE((PyArrayObject *)(capi_ ## var ## _tmp))\n/* #define index(i) capi_i ## i */\n#define slen(var) capi_ ## var ## _len\n\"\"\"\n\ncppmacros['pyobj_from_char1']='#define pyobj_from_char1(v) (PyInt_FromLong(v))'\ncppmacros['pyobj_from_short1']='#define pyobj_from_short1(v) (PyInt_FromLong(v))'\nneeds['pyobj_from_int1']=['signed_char']\ncppmacros['pyobj_from_int1']='#define pyobj_from_int1(v) (PyInt_FromLong(v))'\ncppmacros['pyobj_from_long1']='#define pyobj_from_long1(v) (PyLong_FromLong(v))'\nneeds['pyobj_from_long_long1']=['long_long']\ncppmacros['pyobj_from_long_long1']=\"\"\"\\\n#ifdef HAVE_LONG_LONG\n#define pyobj_from_long_long1(v) (PyLong_FromLongLong(v))\n#else\n#warning HAVE_LONG_LONG is not available. Redefining pyobj_from_long_long.\n#define pyobj_from_long_long1(v) (PyLong_FromLong(v))\n#endif\n\"\"\"\nneeds['pyobj_from_long_double1']=['long_double']\ncppmacros['pyobj_from_long_double1']='#define pyobj_from_long_double1(v) (PyFloat_FromDouble(v))'\ncppmacros['pyobj_from_double1']='#define pyobj_from_double1(v) (PyFloat_FromDouble(v))'\ncppmacros['pyobj_from_float1']='#define pyobj_from_float1(v) (PyFloat_FromDouble(v))'\nneeds['pyobj_from_complex_long_double1']=['complex_long_double']\ncppmacros['pyobj_from_complex_long_double1']='#define pyobj_from_complex_long_double1(v) (PyComplex_FromDoubles(v.r,v.i))'\nneeds['pyobj_from_complex_double1']=['complex_double']\ncppmacros['pyobj_from_complex_double1']='#define pyobj_from_complex_double1(v) (PyComplex_FromDoubles(v.r,v.i))'\nneeds['pyobj_from_complex_float1']=['complex_float']\ncppmacros['pyobj_from_complex_float1']='#define pyobj_from_complex_float1(v) (PyComplex_FromDoubles(v.r,v.i))'\nneeds['pyobj_from_string1']=['string']\ncppmacros['pyobj_from_string1']='#define pyobj_from_string1(v) (PyString_FromString((char *)v))'\nneeds['TRYPYARRAYTEMPLATE']=['PRINTPYOBJERR']\ncppmacros['TRYPYARRAYTEMPLATE']=\"\"\"\\\n#ifdef NUMARRAY\n/* Numarray */\n\n#if defined(USE_SIGNED_CHAR)\n#define TRYPYARRAYTEMPLATECHAR case PyArray_CHAR: *(char *)(arr->data)=*v; break;\n#else\n#define TRYPYARRAYTEMPLATECHAR\n#endif\n\n#if LP64\n#define TRYPYARRAYTEMPLATELONG case PyArray_LONG: *(long *)(arr->data)=*v; break;\n#else\n#define TRYPYARRAYTEMPLATELONG\n#endif\n\n/* XXX: need the corresponding numarray code here */\n#define TRYPYARRAYTEMPLATEOBJECT\n\n#else\n/* Numeric */\n\n#define TRYPYARRAYTEMPLATECHAR case PyArray_CHAR: *(char *)(arr->data)=*v; break;\n#define TRYPYARRAYTEMPLATELONG case PyArray_LONG: *(long *)(arr->data)=*v; break;\n#define TRYPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data); break;\n\n#endif\n\n#ifdef NUMARRAY\n#define TRYPYARRAYTEMPLATE(ctype,typecode) \\\\\n\tPyArrayObject *arr = NULL;\\\\\n\tif (!obj) return -2;\\\\\n\tif (!PyArray_Check(obj)) return -1;\\\\\n\tif (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n\tif (arr->descr->type==typecode) {*(ctype *)(arr->data)=*v; return 1;}\\\\\n\tswitch (arr->descr->type_num) {\\\\\n TRYPYARRAYTEMPLATELONG\\\\\n\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_INT: *(int *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_FLOAT: *(float *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=*v; break;\\\\\n TRYPYARRAYTEMPLATECHAR\\\\\n\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_SHORT: *(short *)(arr->data)=*v; break;\\\\\n TRYPYARRAYTEMPLATEOBJECT\\\\\n\tdefault: return -2;\\\\\n\t};\\\\\n\treturn 1;\n#else\n#define TRYPYARRAYTEMPLATE(ctype,typecode) \\\\\n\tPyArrayObject *arr = NULL;\\\\\n\tif (!obj) return -2;\\\\\n\tif (!PyArray_Check(obj)) return -1;\\\\\n\tif (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n\tif (arr->descr->type==typecode) {*(ctype *)(arr->data)=*v; return 1;}\\\\\n\tswitch (arr->descr->type_num) {\\\\\n TRYPYARRAYTEMPLATELONG\\\\\n\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_INT: *(int *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_FLOAT: *(float *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=*v; break;\\\\\n TRYPYARRAYTEMPLATECHAR\\\\\n\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=*v; break;\\\\\n\t\tcase PyArray_SHORT: *(short *)(arr->data)=*v; break;\\\\\n case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data); break;\\\\\n\tdefault: return -2;\\\\\n\t};\\\\\n\treturn 1;\n#endif\n\"\"\"\n\nneeds['TRYCOMPLEXPYARRAYTEMPLATE']=['PRINTPYOBJERR']\ncppmacros['TRYCOMPLEXPYARRAYTEMPLATE']=\"\"\"\\\n#if PyArray_LONG != PyArray_INT\n#define TRYCOMPLEXPYARRAYTEMPLATELONG case PyArray_LONG: *(long *)(arr->data)=(*v).r; break;\n#else\n#define TRYCOMPLEXPYARRAYTEMPLATELONG\n#endif\n#if (PyArray_UBYTE != PyArray_CHAR)\n#define TRYCOMPLEXPYARRAYTEMPLATECHAR case PyArray_CHAR: *(char *)(arr->data)=(*v).r; break;\n#else\n#define TRYCOMPLEXPYARRAYTEMPLATECHAR\n#endif\n#ifdef NUMARRAY\n/* XXX: need the corresponding numarray code here */\n#define TRYCOMPLEXPYARRAYTEMPLATEOBJECT\n#else\n#define TRYCOMPLEXPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data); break;\n#endif\n\n#ifdef NUMARRAY\n#define TRYCOMPLEXPYARRAYTEMPLATE(ctype,typecode)\\\\\n\tPyArrayObject *arr = NULL;\\\\\n\tif (!obj) return -2;\\\\\n\tif (!PyArray_Check(obj)) return -1;\\\\\n if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYCOMPLEXPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n\tif (arr->descr->type==typecode) {\\\\\n *(ctype *)(arr->data)=(*v).r;\\\\\n *(ctype *)(arr->data+sizeof(ctype))=(*v).i;\\\\\n return 1;\\\\\n }\\\\\n\tswitch (arr->descr->type_num) {\\\\\n\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=(*v).r;*(double *)(arr->data+sizeof(double))=(*v).i;break;\\\\\n\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=(*v).r;*(float *)(arr->data+sizeof(float))=(*v).i;break;\\\\\n\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATELONG\\\\\n\t\tcase PyArray_FLOAT: *(float *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_INT: *(int *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATECHAR\\\\\n\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATEOBJECT\\\\\n\t\tdefault: return -2;\\\\\n\t};\\\\\n\treturn -1;\n#else\n#define TRYCOMPLEXPYARRAYTEMPLATE(ctype,typecode)\\\\\n\tPyArrayObject *arr = NULL;\\\\\n\tif (!obj) return -2;\\\\\n\tif (!PyArray_Check(obj)) return -1;\\\\\n if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYCOMPLEXPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\\n\tif (arr->descr->type==typecode) {\\\\\n *(ctype *)(arr->data)=(*v).r;\\\\\n *(ctype *)(arr->data+sizeof(ctype))=(*v).i;\\\\\n return 1;\\\\\n }\\\\\n\tswitch (arr->descr->type_num) {\\\\\n\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=(*v).r;*(double *)(arr->data+sizeof(double))=(*v).i;break;\\\\\n\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=(*v).r;*(float *)(arr->data+sizeof(float))=(*v).i;break;\\\\\n\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATELONG\\\\\n\t\tcase PyArray_FLOAT: *(float *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_INT: *(int *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\\\\n TRYCOMPLEXPYARRAYTEMPLATECHAR\\\\\n\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\\\\n\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=(*v).r; break;\\\\\n case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data); break;\\\\\n\t\tdefault: return -2;\\\\\n\t};\\\\\n\treturn -1;\n#endif\n\"\"\"\n## cppmacros['NUMFROMARROBJ']=\"\"\"\\\n## #define NUMFROMARROBJ(typenum,ctype) \\\\\n## \\tif (PyArray_Check(obj)) arr = (PyArrayObject *)obj;\\\\\n## \\telse arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,typenum,0,0);\\\\\n## \\tif (arr) {\\\\\n## \\t\\tif (arr->descr->type_num==PyArray_OBJECT) {\\\\\n## \\t\\t\\tif (!ctype ## _from_pyobj(v,(arr->descr->getitem)(arr->data),\\\"\\\"))\\\\\n## \\t\\t\\tgoto capi_fail;\\\\\n## \\t\\t} else {\\\\\n## \\t\\t\\t(arr->descr->cast[typenum])(arr->data,1,(char*)v,1,1);\\\\\n## \\t\\t}\\\\\n## \\t\\tif ((PyObject *)arr != obj) { Py_DECREF(arr); }\\\\\n## \\t\\treturn 1;\\\\\n## \\t}\n## \"\"\"\n## #XXX: Note that CNUMFROMARROBJ is identical with NUMFROMARROBJ\n## cppmacros['CNUMFROMARROBJ']=\"\"\"\\\n## #define CNUMFROMARROBJ(typenum,ctype) \\\\\n## \\tif (PyArray_Check(obj)) arr = (PyArrayObject *)obj;\\\\\n## \\telse arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,typenum,0,0);\\\\\n## \\tif (arr) {\\\\\n## \\t\\tif (arr->descr->type_num==PyArray_OBJECT) {\\\\\n## \\t\\t\\tif (!ctype ## _from_pyobj(v,(arr->descr->getitem)(arr->data),\\\"\\\"))\\\\\n## \\t\\t\\tgoto capi_fail;\\\\\n## \\t\\t} else {\\\\\n## \\t\\t\\t(arr->descr->cast[typenum])((void *)(arr->data),1,(void *)(v),1,1);\\\\\n## \\t\\t}\\\\\n## \\t\\tif ((PyObject *)arr != obj) { Py_DECREF(arr); }\\\\\n## \\t\\treturn 1;\\\\\n## \\t}\n## \"\"\"\n\n\nneeds['GETSTRFROMPYTUPLE']=['STRINGCOPYN','PRINTPYOBJERR']\ncppmacros['GETSTRFROMPYTUPLE']=\"\"\"\\\n#define GETSTRFROMPYTUPLE(tuple,index,str,len) {\\\\\n\\t\\tPyObject *rv_cb_str = PyTuple_GetItem((tuple),(index));\\\\\n\\t\\tif (rv_cb_str == NULL)\\\\\n\\t\\t\\tgoto capi_fail;\\\\\n\\t\\tif (PyString_Check(rv_cb_str)) {\\\\\n\\t\\t\\tstr[len-1]='\\\\0';\\\\\n\\t\\t\\tSTRINGCOPYN((str),PyString_AS_STRING((PyStringObject*)rv_cb_str),(len));\\\\\n\\t\\t} else {\\\\\n\\t\\t\\tPRINTPYOBJERR(rv_cb_str);\\\\\n\\t\\t\\tPyErr_SetString(#modulename#_error,\\\"string object expected\\\");\\\\\n\\t\\t\\tgoto capi_fail;\\\\\n\\t\\t}\\\\\n\\t}\n\"\"\"\ncppmacros['GETSCALARFROMPYTUPLE']=\"\"\"\\\n#define GETSCALARFROMPYTUPLE(tuple,index,var,ctype,mess) {\\\\\n\\t\\tif ((capi_tmp = PyTuple_GetItem((tuple),(index)))==NULL) goto capi_fail;\\\\\n\\t\\tif (!(ctype ## _from_pyobj((var),capi_tmp,mess)))\\\\\n\\t\\t\\tgoto capi_fail;\\\\\n\\t}\n\"\"\"\n\nneeds['MEMCOPY']=['string.h']\ncppmacros['MEMCOPY']=\"\"\"\\\n#define MEMCOPY(to,from,n)\\\\\n\\tif ((memcpy(to,from,n)) == NULL) {\\\\\n\\t\\tPyErr_SetString(PyExc_MemoryError, \\\"memcpy failed\\\");\\\\\n\\t\\tgoto capi_fail;\\\\\n\\t}\n\"\"\"\ncppmacros['STRINGMALLOC']=\"\"\"\\\n#define STRINGMALLOC(str,len)\\\\\n\\tif ((str = (string)malloc(sizeof(char)*(len+1))) == NULL) {\\\\\n\\t\\tPyErr_SetString(PyExc_MemoryError, \\\"out of memory\\\");\\\\\n\\t\\tgoto capi_fail;\\\\\n\\t} else {\\\\\n\\t\\t(str)[len] = '\\\\0';\\\\\n\\t}\n\"\"\"\ncppmacros['STRINGFREE']=\"\"\"\\\n#define STRINGFREE(str)\\\\\n\\tif (!(str == NULL)) free(str);\n\"\"\"\nneeds['STRINGCOPYN']=['string.h']\ncppmacros['STRINGCOPYN']=\"\"\"\\\n#define STRINGCOPYN(to,from,n)\\\\\n\\tif ((strncpy(to,from,sizeof(char)*(n))) == NULL) {\\\\\n\\t\\tPyErr_SetString(PyExc_MemoryError, \\\"strncpy failed\\\");\\\\\n\\t\\tgoto capi_fail;\\\\\n\\t} else if (strlen(to)<(n)) {\\\\\n\\t\\tmemset((to)+strlen(to), ' ', (n)-strlen(to));\\\\\n\\t} /* Padding with spaces instead of nulls. */\n\"\"\"\nneeds['STRINGCOPY']=['string.h']\ncppmacros['STRINGCOPY']=\"\"\"\\\n#define STRINGCOPY(to,from)\\\\\n\\tif ((strcpy(to,from)) == NULL) {\\\\\n\\t\\tPyErr_SetString(PyExc_MemoryError, \\\"strcpy failed\\\");\\\\\n\\t\\tgoto capi_fail;\\\\\n\\t}\n\"\"\"\ncppmacros['CHECKGENERIC']=\"\"\"\\\n#define CHECKGENERIC(check,tcheck,name) \\\\\n\\tif (!(check)) {\\\\\n\\t\\tPyErr_SetString(#modulename#_error,\\\"(\\\"tcheck\\\") failed for \\\"name);\\\\\n\\t\\t/*goto capi_fail;*/\\\\\n\\t} else \"\"\"\ncppmacros['CHECKARRAY']=\"\"\"\\\n#define CHECKARRAY(check,tcheck,name) \\\\\n\\tif (!(check)) {\\\\\n\\t\\tPyErr_SetString(#modulename#_error,\\\"(\\\"tcheck\\\") failed for \\\"name);\\\\\n\\t\\t/*goto capi_fail;*/\\\\\n\\t} else \"\"\"\ncppmacros['CHECKSTRING']=\"\"\"\\\n#define CHECKSTRING(check,tcheck,name,show,var)\\\\\n\\tif (!(check)) {\\\\\n\\t\\tPyErr_SetString(#modulename#_error,\\\"(\\\"tcheck\\\") failed for \\\"name);\\\\\n\\t\\tfprintf(stderr,show\\\"\\\\n\\\",slen(var),var);\\\\\n\\t\\t/*goto capi_fail;*/\\\\\n\\t} else \"\"\"\ncppmacros['CHECKSCALAR']=\"\"\"\\\n#define CHECKSCALAR(check,tcheck,name,show,var)\\\\\n\\tif (!(check)) {\\\\\n\\t\\tPyErr_SetString(#modulename#_error,\\\"(\\\"tcheck\\\") failed for \\\"name);\\\\\n\\t\\tfprintf(stderr,show\\\"\\\\n\\\",var);\\\\\n\\t\\t/*goto capi_fail;*/\\\\\n\\t} else \"\"\"\n## cppmacros['CHECKDIMS']=\"\"\"\\\n## #define CHECKDIMS(dims,rank) \\\\\n## \\tfor (int i=0;i<(rank);i++)\\\\\n## \\t\\tif (dims[i]<0) {\\\\\n## \\t\\t\\tfprintf(stderr,\\\"Unspecified array argument requires a complete dimension specification.\\\\n\\\");\\\\\n## \\t\\t\\tgoto capi_fail;\\\\\n## \\t\\t}\n## \"\"\"\ncppmacros['ARRSIZE']='#define ARRSIZE(dims,rank) (_PyArray_multiply_list(dims,rank))'\ncppmacros['OLDPYNUM']=\"\"\"\\\n#ifdef OLDPYNUM\n#error You need to intall Numeric Python version 13 or higher. Get it from http:/sourceforge.net/project/?group_id=1369\n#endif\n\"\"\"\n################# C functions ###############\n\nneeds['arr_from_pyobj']=['PRINTPYOBJERR','SWAP',\n 'CFUNCSMESS','OLDPYNUM']\ncfuncs['arr_from_pyobj']=\"\"\"\\\nstatic PyArrayObject *arr_from_pyobj(int type,int *dims,int rank,PyObject *obj) {\n\\tPyArrayObject *self = NULL;\n\\tPyArrayObject *self_cp = NULL;\n\\tint i;\n\\tif (obj == Py_None) {\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj: obj = None. Doing FromDims\\\\n\\\");\n\\t\\tself = (PyArrayObject *)PyArray_FromDims(rank,dims,type);\n\\t} else {\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj: Trying ContiguousFromObject\\\\n\\\");\n\\t\\tself = (PyArrayObject *)PyArray_ContiguousFromObject(obj,type,0,0);\n\\t\\tif (self == NULL)\n\\t\\t\\tCFUNCSMESS(\\\"arr_from_pyobj: ContiguousFromObject unsuccesful\\\\n\\\");\n\\t}\n/*\\tPy_XINCREF(self);*/\n\\tif ((self == NULL) && PyArray_Check(obj)) { /* if could not cast safely in above */\n\\t\\tint loc_rank = ((PyArrayObject *)obj)->nd;\n\\t\\tint *loc_dims = ((PyArrayObject *)obj)->dimensions;\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj: isarray(obj). Doing FromDims\\\\n\\\");\n\\t\\tself = (PyArrayObject *)PyArray_FromDims(loc_rank,loc_dims,type);\n\\t}\n\\tif (self == NULL) {\n\\t\\tint i;\n\\t\\tfprintf(stderr,\\\"arr_from_pyobj: PyArray_FromDims failed (rank=%d,type=%d,dims=(%d\\\",rank,type,dims[0]);\n\\t\\tfor(i=1;ind)) {\n\\t\\tint u_dim = -1, dims_s = 1, self_s = (self->nd)?PyArray_Size((PyObject *)self):1;\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj: Mismatch of ranks. Trying to match.\\\\n\\\");\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj:\\\");\n#ifdef DEBUGCFUNCS\n\\t\\tfprintf(stderr,\\\"rank=%d,self->nd=%d,dims=(\\\",rank,self->nd);\n\\t\\tfor(i=0;i= 0) {\n\\t\\t\\tdims[u_dim] = self_s/dims_s;\n\\t\\t\\tdims_s *= dims[u_dim];\n\\t\\t}\n\\t\\tCFUNCSMESS(\\\"arr_from_pyobj:\\\");\n#ifdef DEBUGCFUNCS\n\\t\\tfprintf(stderr,\\\"rank=%d,self->nd=%d,self_s=%d,dims_s=%d,dims=(\\\",rank,self->nd,self_s,dims_s);\n\\t\\tfor(i=0;ind);\n\\t\\tgoto capi_fail;\n\\t\\t}\n\\t\\tself = (PyArrayObject *)PyArray_FromDimsAndDataAndDescr(rank, dims,self_cp->descr,self_cp->data);\n\\t\\tif (self == NULL)\n\\t\\t\\tgoto capi_fail;\n\\t\\tPy_INCREF(self_cp);\n\\t\\tself->base = (PyObject *)self_cp;\n\\t}\n\\tfor (i=0;iself->dimensions[i]) {\n\\t\\t\\tfprintf(stderr,\\\"#modulename#:arr_from_pyobj: %d-th dimension must be at least %d but got %d.\\\\n\\\",i+1,dims[i],self->dimensions[i]);\n\\t\\t\\tgoto capi_fail;\n\\t\\t}\n\\tif (((PyObject *)self_cp != obj) && PyArray_Check(obj)) {\n\\t\\tif (copy_ND_array((PyArrayObject *)obj,self_cp)) {\n\\t\\t\\tfprintf(stderr,\\\"#modulename#:arr_from_pyobj: failed to copy object to rank-%d array with shape (\\\",self_cp->nd);\n\\t\\t\\tfor(i=0;ind;i++) fprintf(stderr,\\\"%d,\\\",self_cp->dimensions[i]);\n\\t\\t\\tfprintf(stderr,\\\")\\\\n\\\");\n\\t\\t\\tPRINTPYOBJERR((PyObject *)self_cp);\n\\t\\t\\tgoto capi_fail;\n\\t\\t}\n\\t}\n\\tif (self != NULL)\n\\t\\treturn self;\n\\tCFUNCSMESS(\\\"arr_from_pyobj: self==NULL. Confused?!.\\\\n\\\");\ncapi_fail:\n\\tPRINTPYOBJERR(obj);\n\\tPy_XDECREF(self);\n\\treturn NULL;\n}\"\"\"\ncfuncs['calcarrindex']=\"\"\"\\\nstatic int calcarrindex(int *i,PyArrayObject *arr) {\n\\tint k,ii = i[0];\n\\tfor (k=1; k < arr->nd; k++)\n\\t\\tii += (ii*(arr->dimensions[k] - 1)+i[k]); /* assuming contiguous arr */\n\\treturn ii;\n}\"\"\"\ncfuncs['calcarrindextr']=\"\"\"\\\nstatic int calcarrindextr(int *i,PyArrayObject *arr) {\n\\tint k,ii = i[arr->nd-1];\n\\tfor (k=1; k < arr->nd; k++)\n\\t\\tii += (ii*(arr->dimensions[arr->nd-k-1] - 1)+i[arr->nd-k-1]); /* assuming contiguous arr */\n\\treturn ii;\n}\"\"\"\ncfuncs['forcomb']=\"\"\"\\\nstatic struct { int nd,*d,*i,*i_tr,tr; } forcombcache;\nstatic int initforcomb(int *dims,int nd,int tr) {\n int k;\n if (dims==NULL) return 0;\n if (nd<0) return 0;\n forcombcache.nd = nd;\n forcombcache.d = dims;\n forcombcache.tr = tr;\n if ((forcombcache.i = (int *)malloc(sizeof(int)*nd))==NULL) return 0;\n if ((forcombcache.i_tr = (int *)malloc(sizeof(int)*nd))==NULL) return 0;\n for (k=1;k= (max_ind)[k]) { \\\\\n## while (k >= 0 && ((ret_ind)[k] >= (max_ind)[k]-1)) \\\\\n## (ret_ind)[k--] = 0; \\\\\n## if (k >= 0) (ret_ind)[k]++; \\\\\n## else (ret_ind)[0] = (max_ind)[0]; \\\\\n## } \\\\\n## }\n## #define CALCINDEX(indx, nd_index, strides, ndim) \\\\\n## { \\\\\n## int i; \\\\\n## indx = 0; \\\\\n## for (i=0; i < (ndim); i++) \\\\\n## indx += nd_index[i]*strides[i]; \\\\\n## } \n## static int copy_ND_array(PyArrayObject *in, PyArrayObject *out)\n## {\n\n## /* This routine copies an N-D array in to an N-D array out where both\n## can be discontiguous. An appropriate (raw) cast is made on the data.\n## */\n\n## /* It works by using an N-1 length vector to hold the N-1 first indices \n## into the array. This counter is looped through copying (and casting) \n## the entire last dimension at a time.\n## */\n\n## int *nd_index, indx1;\n## int indx2, last_dim;\n## int instep, outstep;\n\n## if (0 == in->nd) {\n## in->descr->cast[out->descr->type_num]((void *)in->data,1,(void *)out->data,1,1);\n## return 0;\n## }\n## if (1 == in->nd) {\n## (in->descr->cast[out->descr->type_num])((void *)(in->data),1,(void *)(out->data),1,in->dimensions[0]);\n## return 0;\n## }\n## nd_index = (int *)calloc(in->nd-1,sizeof(int));\n## last_dim = in->nd - 1;\n## instep = in->strides[last_dim] / in->descr->elsize;\n## outstep = out->strides[last_dim] / out->descr->elsize;\n## if (NULL == nd_index) {\n## fprintf(stderr,\\\"Could not allocate memory for index array.\\\\n\\\");\n## return -1;\n## }\n## CFUNCSMESS(\\\"copy_ND_array: doing a complete copy\\\\n\\\");\n## while(nd_index[0] != in->dimensions[0]) {\n## CALCINDEX(indx1,nd_index,in->strides,in->nd-1);\n## CALCINDEX(indx2,nd_index,out->strides,out->nd-1);\n## /* Copy (with an appropriate cast) the last dimension of the array */\n## (in->descr->cast[out->descr->type_num])((void *)(in->data+indx1),instep,(void *)(out->data+indx2),outstep,in->dimensions[last_dim]); \n## INCREMENT(nd_index,in->nd-1,in->dimensions);\n## }\n## free(nd_index);\n## return 0;\n## } \n## /* EOF T.O.'s contib */\n## \"\"\"\n\nneeds['try_pyarr_from_string']=['STRINGCOPYN','PRINTPYOBJERR','string']\ncfuncs['try_pyarr_from_string']=\"\"\"\\\nstatic int try_pyarr_from_string(PyObject *obj,const string str) {\n\\tPyArrayObject *arr = NULL;\n\\tif (PyArray_Check(obj) && (!((arr = (PyArrayObject *)obj) == NULL)))\n\\t\\t{ STRINGCOPYN(arr->data,str,PyArray_SIZE(arr)); }\n\\treturn 1;\ncapi_fail:\n\\tPRINTPYOBJERR(obj);\n\\tPyErr_SetString(#modulename#_error,\\\"try_pyarr_from_string failed\\\");\n\\treturn 0;\n}\n\"\"\"\nneeds['string_from_pyobj']=['string','STRINGMALLOC','STRINGCOPYN']\ncfuncs['string_from_pyobj']=\"\"\"\\\nstatic int string_from_pyobj(string *str,int *len,const string inistr,PyObject *obj,const char *errmess) {\n\\tPyArrayObject *arr = NULL;\n\\tPyObject *tmp = NULL;\n#ifdef DEBUGCFUNCS\nfprintf(stderr,\\\"string_from_pyobj(str='%s',len=%d,inistr='%s',obj=%p)\\\\n\\\",(char*)str,*len,(char *)inistr,obj);\n#endif\n\\tif (obj == Py_None) {\n\\t\\tif (*len == -1)\n\\t\\t\\t*len = strlen(inistr); /* Will this cause problems? */\n\\t\\tSTRINGMALLOC(*str,*len);\n\\t\\tSTRINGCOPYN(*str,inistr,*len);\n\\t\\treturn 1;\n\\t}\n\\tif (PyArray_Check(obj)) {\n\\t\\tif ((arr = (PyArrayObject *)obj) == NULL)\n\\t\\t\\tgoto capi_fail;\n\\t\\tif (!ISCONTIGUOUS(arr)) {\n\\t\\t\\tPyErr_SetString(PyExc_ValueError,\\\"array object is non-contiguous.\\\");\n\\t\\t\\tgoto capi_fail;\n\\t\\t}\n\\t\\tif (arr->descr->elsize==sizeof(char)) {\n\\t\\t\\tif (*len == -1)\n\\t\\t\\t\\t*len = (arr->descr->elsize)*PyArray_SIZE(arr);\n\\t\\t\\tSTRINGMALLOC(*str,*len);\n\\t\\t\\tSTRINGCOPYN(*str,arr->data,*len);\n\\t\\t\\treturn 1;\n\\t\\t}\n\\t\\tPyErr_SetString(PyExc_ValueError,\\\"array object element size is not 1.\\\");\n\\t\\tgoto capi_fail;\n\\t}\n\\tif (PyString_Check(obj)) {\n\\t\\ttmp = obj;\n\\t\\tPy_INCREF(tmp);\n\\t}\n\\telse\n\\t\\ttmp = PyObject_Str(obj);\n\\tif (tmp == NULL) goto capi_fail;\n\\tif (*len == -1)\n\\t\\t*len = PyString_GET_SIZE(tmp);\n\\tSTRINGMALLOC(*str,*len);\n\\tSTRINGCOPYN(*str,PyString_AS_STRING(tmp),*len);\n\\tPy_DECREF(tmp);\n\\treturn 1;\ncapi_fail:\n\\tPy_XDECREF(tmp);\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL) err = #modulename#_error;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['char_from_pyobj']=['int_from_pyobj']\ncfuncs['char_from_pyobj']=\"\"\"\\\nstatic int char_from_pyobj(char* v,PyObject *obj,const char *errmess) {\n\\tint i=0;\n\\tif (int_from_pyobj(&i,obj,errmess)) {\n\\t\\t*v = (char)i;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['signed_char_from_pyobj']=['int_from_pyobj','signed_char']\ncfuncs['signed_char_from_pyobj']=\"\"\"\\\nstatic int signed_char_from_pyobj(signed_char* v,PyObject *obj,const char *errmess) {\n\\tint i=0;\n\\tif (int_from_pyobj(&i,obj,errmess)) {\n\\t\\t*v = (signed_char)i;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['short_from_pyobj']=['int_from_pyobj']\ncfuncs['short_from_pyobj']=\"\"\"\\\nstatic int short_from_pyobj(short* v,PyObject *obj,const char *errmess) {\n\\tint i=0;\n\\tif (int_from_pyobj(&i,obj,errmess)) {\n\\t\\t*v = (short)i;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\ncfuncs['int_from_pyobj']=\"\"\"\\\nstatic int int_from_pyobj(int* v,PyObject *obj,const char *errmess) {\n\\tPyObject* tmp = NULL;\n\\tif (PyInt_Check(obj)) {\n\\t\\t*v = (int)PyInt_AS_LONG(obj);\n\\t\\treturn 1;\n\\t}\n\\ttmp = PyNumber_Int(obj);\n\\tif (tmp) {\n\\t\\t*v = PyInt_AS_LONG(tmp);\n\\t\\tPy_DECREF(tmp);\n\\t\\treturn 1;\n\\t}\n\\tif (PyComplex_Check(obj))\n\\t\\ttmp = PyObject_GetAttrString(obj,\\\"real\\\");\n\\telse if (PyString_Check(obj))\n\\t\\t/*pass*/;\n\\telse if (PySequence_Check(obj))\n\\t\\ttmp = PySequence_GetItem(obj,0);\n\\tif (tmp) {\n\\t\\tPyErr_Clear();\n\\t\\tif (int_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}\n\\t\\tPy_DECREF(tmp);\n\\t}\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL) err = #modulename#_error;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\ncfuncs['long_from_pyobj']=\"\"\"\\\nstatic int long_from_pyobj(long* v,PyObject *obj,const char *errmess) {\n\\tPyObject* tmp = NULL;\n\\tif (PyInt_Check(obj)) {\n\\t\\t*v = PyInt_AS_LONG(obj);\n\\t\\treturn 1;\n\\t}\n\\ttmp = PyNumber_Int(obj);\n\\tif (tmp) {\n\\t\\t*v = PyInt_AS_LONG(tmp);\n\\t\\tPy_DECREF(tmp);\n\\t\\treturn 1;\n\\t}\n\\tif (PyComplex_Check(obj))\n\\t\\ttmp = PyObject_GetAttrString(obj,\\\"real\\\");\n\\telse if (PyString_Check(obj))\n\\t\\t/*pass*/;\n\\telse if (PySequence_Check(obj))\n\\t\\ttmp = PySequence_GetItem(obj,0);\n\\tif (tmp) {\n\\t\\tPyErr_Clear();\n\\t\\tif (long_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}\n\\t\\tPy_DECREF(tmp);\n\\t}\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL) err = #modulename#_error;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['long_long_from_pyobj']=['long_long']\ncfuncs['long_long_from_pyobj']=\"\"\"\\\nstatic int long_long_from_pyobj(long_long* v,PyObject *obj,const char *errmess) {\n\\tPyObject* tmp = NULL;\n\\tif (PyLong_Check(obj)) {\n\\t\\t*v = PyLong_AsLongLong(obj);\n\\t\\treturn (!PyErr_Occurred());\n\\t}\n\\tif (PyInt_Check(obj)) {\n\\t\\t*v = (long_long)PyInt_AS_LONG(obj);\n\\t\\treturn 1;\n\\t}\n\\ttmp = PyNumber_Long(obj);\n\\tif (tmp) {\n\\t\\t*v = PyLong_AsLongLong(tmp);\n\\t\\tPy_DECREF(tmp);\n\\t\\treturn (!PyErr_Occurred());\n\\t}\n\\tif (PyComplex_Check(obj))\n\\t\\ttmp = PyObject_GetAttrString(obj,\\\"real\\\");\n\\telse if (PyString_Check(obj))\n\\t\\t/*pass*/;\n\\telse if (PySequence_Check(obj))\n\\t\\ttmp = PySequence_GetItem(obj,0);\n\\tif (tmp) {\n\\t\\tPyErr_Clear();\n\\t\\tif (long_long_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}\n\\t\\tPy_DECREF(tmp);\n\\t}\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL) err = #modulename#_error;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['long_double_from_pyobj']=['double_from_pyobj','long_double']\ncfuncs['long_double_from_pyobj']=\"\"\"\\\nstatic int long_double_from_pyobj(long_double* v,PyObject *obj,const char *errmess) {\n\\tdouble d=0;\n\\tif (double_from_pyobj(&d,obj,errmess)) {\n\\t\\t*v = (long_double)d;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\ncfuncs['double_from_pyobj']=\"\"\"\\\nstatic int double_from_pyobj(double* v,PyObject *obj,const char *errmess) {\n\\tPyObject* tmp = NULL;\n\\tif (PyFloat_Check(obj)) {\n#ifdef __sgi\n\\t\\t*v = PyFloat_AsDouble(obj);\n#else\n\\t\\t*v = PyFloat_AS_DOUBLE(obj);\n#endif\n\\t\\treturn 1;\n\\t}\n\\ttmp = PyNumber_Float(obj);\n\\tif (tmp) {\n#ifdef __sgi\n\\t\\t*v = PyFloat_AsDouble(tmp);\n#else\n\\t\\t*v = PyFloat_AS_DOUBLE(tmp);\n#endif\n\\t\\tPy_DECREF(tmp);\n\\t\\treturn 1;\n\\t}\n\\tif (PyComplex_Check(obj))\n\\t\\ttmp = PyObject_GetAttrString(obj,\\\"real\\\");\n\\telse if (PyString_Check(obj))\n\\t\\t/*pass*/;\n\\telse if (PySequence_Check(obj))\n\\t\\ttmp = PySequence_GetItem(obj,0);\n\\tif (tmp) {\n\\t\\tPyErr_Clear();\n\\t\\tif (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}\n\\t\\tPy_DECREF(tmp);\n\\t}\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL) err = #modulename#_error;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['float_from_pyobj']=['double_from_pyobj']\ncfuncs['float_from_pyobj']=\"\"\"\\\nstatic int float_from_pyobj(float* v,PyObject *obj,const char *errmess) {\n\\tdouble d=0.0;\n\\tif (double_from_pyobj(&d,obj,errmess)) {\n\\t\\t*v = (float)d;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['complex_long_double_from_pyobj']=['complex_long_double','long_double',\n 'complex_double_from_pyobj']\ncfuncs['complex_long_double_from_pyobj']=\"\"\"\\\nstatic int complex_long_double_from_pyobj(complex_long_double* v,PyObject *obj,const char *errmess) {\n\\tcomplex_double cd={0.0,0.0};\n\\tif (complex_double_from_pyobj(&cd,obj,errmess)) {\n\\t\\t(*v).r = (long_double)cd.r;\n\\t\\t(*v).i = (long_double)cd.i;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['complex_double_from_pyobj']=['complex_double']\ncfuncs['complex_double_from_pyobj']=\"\"\"\\\nstatic int complex_double_from_pyobj(complex_double* v,PyObject *obj,const char *errmess) {\n\\tPy_complex c;\n\\tif (PyComplex_Check(obj)) {\n\\t\\tc=PyComplex_AsCComplex(obj);\n\\t\\t(*v).r=c.real, (*v).i=c.imag;\n\\t\\treturn 1;\n\\t}\n\\t/* Python does not provide PyNumber_Complex function :-( */\n\\t(*v).i=0.0;\n\\tif (PyFloat_Check(obj)) {\n#ifdef __sgi\n\\t\\t(*v).r = PyFloat_AsDouble(obj);\n#else\n\\t\\t(*v).r = PyFloat_AS_DOUBLE(obj);\n#endif\n\\t\\treturn 1;\n\\t}\n\\tif (PyInt_Check(obj)) {\n\\t\\t(*v).r = (double)PyInt_AS_LONG(obj);\n\\t\\treturn 1;\n\\t}\n\\tif (PyLong_Check(obj)) {\n\\t\\t(*v).r = PyLong_AsDouble(obj);\n\\t\\treturn (!PyErr_Occurred());\n\\t}\n\\tif (PySequence_Check(obj) && (!PyString_Check(obj))) {\n\\t\\tPyObject *tmp = PySequence_GetItem(obj,0);\n\\t\\tif (tmp) {\n\\t\\t\\tif (complex_double_from_pyobj(v,tmp,errmess)) {\n\\t\\t\\t\\tPy_DECREF(tmp);\n\\t\\t\\t\\treturn 1;\n\\t\\t\\t}\n\\t\\t\\tPy_DECREF(tmp);\n\\t\\t}\n\\t}\n\\t{\n\\t\\tPyObject* err = PyErr_Occurred();\n\\t\\tif (err==NULL)\n\\t\\t\\terr = PyExc_TypeError;\n\\t\\tPyErr_SetString(err,errmess);\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['complex_float_from_pyobj']=['complex_float','complex_double_from_pyobj']\ncfuncs['complex_float_from_pyobj']=\"\"\"\\\nstatic int complex_float_from_pyobj(complex_float* v,PyObject *obj,const char *errmess) {\n\\tcomplex_double cd={0.0,0.0};\n\\tif (complex_double_from_pyobj(&cd,obj,errmess)) {\n\\t\\t(*v).r = (float)cd.r;\n\\t\\t(*v).i = (float)cd.i;\n\\t\\treturn 1;\n\\t}\n\\treturn 0;\n}\n\"\"\"\nneeds['try_pyarr_from_char']=['pyobj_from_char1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_char']='static int try_pyarr_from_char(PyObject* obj,char* v) {\\n\\tTRYPYARRAYTEMPLATE(char,\\'c\\');\\n}\\n'\nneeds['try_pyarr_from_signed_char']=['TRYPYARRAYTEMPLATE','unsigned_char']\ncfuncs['try_pyarr_from_unsigned_char']='static int try_pyarr_from_unsigned_char(PyObject* obj,unsigned_char* v) {\\n\\tTRYPYARRAYTEMPLATE(unsigned_char,\\'b\\');\\n}\\n'\nneeds['try_pyarr_from_signed_char']=['TRYPYARRAYTEMPLATE','signed_char']\ncfuncs['try_pyarr_from_signed_char']='static int try_pyarr_from_signed_char(PyObject* obj,signed_char* v) {\\n\\tTRYPYARRAYTEMPLATE(signed_char,\\'1\\');\\n}\\n'\nneeds['try_pyarr_from_short']=['pyobj_from_short1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_short']='static int try_pyarr_from_short(PyObject* obj,short* v) {\\n\\tTRYPYARRAYTEMPLATE(short,\\'s\\');\\n}\\n'\nneeds['try_pyarr_from_int']=['pyobj_from_int1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_int']='static int try_pyarr_from_int(PyObject* obj,int* v) {\\n\\tTRYPYARRAYTEMPLATE(int,\\'i\\');\\n}\\n'\nneeds['try_pyarr_from_long']=['pyobj_from_long1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_long']='static int try_pyarr_from_long(PyObject* obj,long* v) {\\n\\tTRYPYARRAYTEMPLATE(long,\\'l\\');\\n}\\n'\nneeds['try_pyarr_from_long_long']=['pyobj_from_long_long1','TRYPYARRAYTEMPLATE','long_long']\ncfuncs['try_pyarr_from_long_long']='static int try_pyarr_from_long_long(PyObject* obj,long_long* v) {\\n\\tTRYPYARRAYTEMPLATE(long_long,\\'L\\');\\n}\\n'\nneeds['try_pyarr_from_float']=['pyobj_from_float1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_float']='static int try_pyarr_from_float(PyObject* obj,float* v) {\\n\\tTRYPYARRAYTEMPLATE(float,\\'f\\');\\n}\\n'\nneeds['try_pyarr_from_double']=['pyobj_from_double1','TRYPYARRAYTEMPLATE']\ncfuncs['try_pyarr_from_double']='static int try_pyarr_from_double(PyObject* obj,double* v) {\\n\\tTRYPYARRAYTEMPLATE(double,\\'d\\');\\n}\\n'\nneeds['try_pyarr_from_complex_float']=['pyobj_from_complex_float1','TRYCOMPLEXPYARRAYTEMPLATE','complex_float']\ncfuncs['try_pyarr_from_complex_float']='static int try_pyarr_from_complex_float(PyObject* obj,complex_float* v) {\\n\\tTRYCOMPLEXPYARRAYTEMPLATE(float,\\'F\\');\\n}\\n'\nneeds['try_pyarr_from_complex_double']=['pyobj_from_complex_double1','TRYCOMPLEXPYARRAYTEMPLATE','complex_double']\ncfuncs['try_pyarr_from_complex_double']='static int try_pyarr_from_complex_double(PyObject* obj,complex_double* v) {\\n\\tTRYCOMPLEXPYARRAYTEMPLATE(double,\\'D\\');\\n}\\n'\n\nneeds['create_cb_arglist']=['CFUNCSMESS','PRINTPYOBJERR','MINMAX']\ncfuncs['create_cb_arglist']=\"\"\"\\\nstatic int create_cb_arglist(PyObject* fun,PyTupleObject* xa,const int maxnofargs,const int nofoptargs,int *nofargs,PyTupleObject **args,const char *errmess) {\n\\tPyObject *tmp = NULL;\n\\tPyObject *tmp_fun = NULL;\n\\tint tot,opt,ext,siz,i,di=0;\n\\tCFUNCSMESS(\\\"create_cb_arglist\\\\n\\\");\n\\ttot=opt=ext=siz=0;\n\\t/* Get the total number of arguments */\n\\tif (PyFunction_Check(fun))\n\\t\\ttmp_fun = fun;\n\\telse {\n\\t\\tdi = 1;\n\\t\\tif (PyObject_HasAttrString(fun,\\\"im_func\\\")) {\n\\t\\t\\ttmp_fun = PyObject_GetAttrString(fun,\\\"im_func\\\");\n\\t\\t}\n\\t\\telse if (PyObject_HasAttrString(fun,\\\"__call__\\\")) {\n\\t\\t\\ttmp = PyObject_GetAttrString(fun,\\\"__call__\\\");\n\\t\\t\\tif (PyObject_HasAttrString(tmp,\\\"im_func\\\"))\n\\t\\t\\t\\ttmp_fun = PyObject_GetAttrString(tmp,\\\"im_func\\\");\n\\t\\t\\telse {\n\\t\\t\\t\\ttmp_fun = fun; /* built-in function */\n\\t\\t\\t\\ttot = maxnofargs;\n\\t\\t\\t\\tif (xa != NULL)\n\\t\\t\\t\\t\\ttot += PyTuple_Size((PyObject *)xa);\n\\t\\t\\t}\n\\t\\t\\tPy_XDECREF(tmp);\n\\t\\t}\n\\t\\telse if (PyFortran_Check(fun) || PyFortran_Check1(fun)) {\n\\t\\t\\ttot = maxnofargs;\n\\t\\t\\tif (xa != NULL)\n\\t\\t\\t\\ttot += PyTuple_Size((PyObject *)xa);\n\\t\\t\\ttmp_fun = fun;\n\\t\\t}\n\\t\\telse if (PyCObject_Check(fun)) {\n\\t\\t\\ttot = maxnofargs;\n\\t\\t\\tif (xa != NULL)\n\\t\\t\\t\\text = PyTuple_Size((PyObject *)xa);\n\\t\\t\\tif(ext>0) {\n\\t\\t\\t\\tfprintf(stderr,\\\"extra arguments tuple cannot be used with CObject call-back\\\\n\\\");\n\\t\\t\\t\\tgoto capi_fail;\n\\t\\t\\t}\n\\t\\t\\ttmp_fun = fun;\n\\t\\t}\n\\t}\nif (tmp_fun==NULL) {\nfprintf(stderr,\\\"Call-back argument must be function|instance|instance.__call__|f2py-function but got %s.\\\\n\\\",(fun==NULL?\\\"NULL\\\":fun->ob_type->tp_name));\ngoto capi_fail;\n}\n\\tif (PyObject_HasAttrString(tmp_fun,\\\"func_code\\\")) {\n\\t\\tif (PyObject_HasAttrString(tmp = PyObject_GetAttrString(tmp_fun,\\\"func_code\\\"),\\\"co_argcount\\\"))\n\\t\\t\\ttot = PyInt_AsLong(PyObject_GetAttrString(tmp,\\\"co_argcount\\\")) - di;\n\\t\\tPy_XDECREF(tmp);\n\\t}\n\\t/* Get the number of optional arguments */\n\\tif (PyObject_HasAttrString(tmp_fun,\\\"func_defaults\\\"))\n\\t\\tif (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,\\\"func_defaults\\\")))\n\\t\\t\\topt = PyTuple_Size(tmp);\n\\t\\tPy_XDECREF(tmp);\n\\t/* Get the number of extra arguments */\n\\tif (xa != NULL)\n\\t\\text = PyTuple_Size((PyObject *)xa);\n\\t/* Calculate the size of call-backs argument list */\n\\tsiz = MIN(maxnofargs+ext,tot);\n\\t*nofargs = MAX(0,siz-ext);\n#ifdef DEBUGCFUNCS\n\\tfprintf(stderr,\\\"debug-capi:create_cb_arglist:maxnofargs(-nofoptargs),tot,opt,ext,siz,nofargs=%d(-%d),%d,%d,%d,%d,%d\\\\n\\\",maxnofargs,nofoptargs,tot,opt,ext,siz,*nofargs);\n#endif\n\\tif (siz0:\n if not needs.has_key(outneeds[n][0]):\n out.append(outneeds[n][0])\n del outneeds[n][0]\n else:\n flag=0\n for k in outneeds[n][1:]:\n if k in needs[outneeds[n][0]]:\n flag=1\n break\n if flag:\n outneeds[n]=outneeds[n][1:]+[outneeds[n][0]]\n else:\n out.append(outneeds[n][0])\n del outneeds[n][0]\n if saveout and (0 not in map(lambda x,y:x==y,saveout,outneeds[n])):\n print n,saveout\n errmess('get_needs: no progress in sorting needs, probably circular dependence, skipping.\\n')\n out=out+saveout\n break\n saveout=copy.copy(outneeds[n])\n if out==[]: out=[n]\n res[n]=out\n return res\n", "methods": [ { "name": "buildcfuncs", "long_name": "buildcfuncs( )", "filename": "cfuncs.py", "nloc": 8, "complexity": 2, "token_count": 55, "parameters": [], "start_line": 1277, "end_line": 1284, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "append_needs", "long_name": "append_needs( need , flag = 1 )", "filename": "cfuncs.py", "nloc": 48, "complexity": 30, "token_count": 422, "parameters": [ "need", "flag" ], "start_line": 1289, "end_line": 1336, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "get_needs", "long_name": "get_needs( )", "filename": "cfuncs.py", "nloc": 30, "complexity": 10, "token_count": 236, "parameters": [], "start_line": 1338, "end_line": 1367, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 } ], "methods_before": [ { "name": "buildcfuncs", "long_name": "buildcfuncs( )", "filename": "cfuncs.py", "nloc": 8, "complexity": 2, "token_count": 55, "parameters": [], "start_line": 1223, "end_line": 1230, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "append_needs", "long_name": "append_needs( need , flag = 1 )", "filename": "cfuncs.py", "nloc": 48, "complexity": 30, "token_count": 422, "parameters": [ "need", "flag" ], "start_line": 1235, "end_line": 1282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "get_needs", "long_name": "get_needs( )", "filename": "cfuncs.py", "nloc": 30, "complexity": 10, "token_count": 236, "parameters": [], "start_line": 1284, "end_line": 1313, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 } ], "changed_methods": [], "nloc": 1228, "complexity": 42, "token_count": 1749, "diff_parsed": { "added": [ "#elif defined(NDARRAY_VERSION)", "/* New SciPy */", "#define TRYPYARRAYTEMPLATECHAR case PyArray_STRING: *(char *)(arr->data)=*v; break;", "#define TRYPYARRAYTEMPLATELONG case PyArray_LONG: *(long *)(arr->data)=*v; break;", "#define TRYPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data); break;", "#elif defined(NDARRAY_VERSION)", "#define TRYPYARRAYTEMPLATE(ctype,typecode) \\\\", "\tPyArrayObject *arr = NULL;\\\\", "\tif (!obj) return -2;\\\\", "\tif (!PyArray_Check(obj)) return -1;\\\\", "\tif (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\", "\tif (arr->descr->type==typecode) {*(ctype *)(arr->data)=*v; return 1;}\\\\", "\tswitch (arr->descr->type_num) {\\\\", " TRYPYARRAYTEMPLATELONG\\\\", "\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=*v; break;\\\\", "\t\tcase PyArray_INT: *(int *)(arr->data)=*v; break;\\\\", "\t\tcase PyArray_FLOAT: *(float *)(arr->data)=*v; break;\\\\", "\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=*v; break;\\\\", "\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=*v; break;\\\\", " TRYPYARRAYTEMPLATECHAR\\\\", "\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=*v; break;\\\\", "\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=*v; break;\\\\", "\t\tcase PyArray_SHORT: *(short *)(arr->data)=*v; break;\\\\", " case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data, arr); break;\\\\", "\tdefault: return -2;\\\\", "\t};\\\\", "\treturn 1;", "#elif defined(NDARRAY_VERSION)", "#define TRYCOMPLEXPYARRAYTEMPLATEOBJECT case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data, arr); break;", "#elif defined(NDARRAY_VERSION)", "#define TRYCOMPLEXPYARRAYTEMPLATE(ctype,typecode)\\\\", "\tPyArrayObject *arr = NULL;\\\\", "\tif (!obj) return -2;\\\\", "\tif (!PyArray_Check(obj)) return -1;\\\\", " if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\\\"TRYCOMPLEXPYARRAYTEMPLATE:\\\");PRINTPYOBJERR(obj);return 0;}\\\\", "\tif (arr->descr->type==typecode) {\\\\", " *(ctype *)(arr->data)=(*v).r;\\\\", " *(ctype *)(arr->data+sizeof(ctype))=(*v).i;\\\\", " return 1;\\\\", " }\\\\", "\tswitch (arr->descr->type_num) {\\\\", "\t\tcase PyArray_CDOUBLE: *(double *)(arr->data)=(*v).r;*(double *)(arr->data+sizeof(double))=(*v).i;break;\\\\", "\t\tcase PyArray_CFLOAT: *(float *)(arr->data)=(*v).r;*(float *)(arr->data+sizeof(float))=(*v).i;break;\\\\", "\t\tcase PyArray_DOUBLE: *(double *)(arr->data)=(*v).r; break;\\\\", " TRYCOMPLEXPYARRAYTEMPLATELONG\\\\", "\t\tcase PyArray_FLOAT: *(float *)(arr->data)=(*v).r; break;\\\\", "\t\tcase PyArray_INT: *(int *)(arr->data)=(*v).r; break;\\\\", "\t\tcase PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\\\", " TRYCOMPLEXPYARRAYTEMPLATECHAR\\\\", "\t\tcase PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\\\", "\t\tcase PyArray_SBYTE: *(signed char *)(arr->data)=(*v).r; break;\\\\", " case PyArray_OBJECT: (arr->descr->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data, arr); break;\\\\", "\t\tdefault: return -2;\\\\", "\t};\\\\", "\treturn -1;", "#else" ], "deleted": [ "", "#else" ] } } ] }, { "hash": "1348aa1cabad5bbf8574c0cf89100b1be6d8172c", "msg": "Trial run of random...", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T07:59:45+00:00", "author_timezone": 0, "committer_date": "2005-10-07T07:59:45+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "a3a464bb8e7235d1afade5c9c3d5332144265ddc" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 4, "insertions": 4, "lines": 8, "files": 3, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": "scipy/__init__.py", "new_path": "scipy/__init__.py", "filename": "__init__.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -13,8 +13,8 @@\n import scipy.linalg as linalg\n import scipy.fftpack as fftpack\n from scipy.fftpack import fft, ifft\n- import scipy.stats as stats\n- from scipy.stats import rand, randn\n+ import scipy.random as random\n+ from scipy.random import rand, randn\n from core_version import version as __version__\n from scipy.test.testing import ScipyTest\n test = ScipyTest('scipy').test\n", "added_lines": 2, "deleted_lines": 2, "source_code": "\"\"\"SciPy \n\nYou can support the development of scipy by purchasing documentation at\n\nhttp://www.trelgol.com\n\nIronically, you can help make the documentation free by purchasing a copy today.\n\"\"\"\n\n\ntry: # For installation purposes only \n from scipy.base import *\n import scipy.linalg as linalg\n import scipy.fftpack as fftpack\n from scipy.fftpack import fft, ifft\n import scipy.random as random\n from scipy.random import rand, randn\n from core_version import version as __version__\n from scipy.test.testing import ScipyTest\n test = ScipyTest('scipy').test\n\nexcept AttributeError, inst:\n if inst.args[0] == \"'module' object has no attribute 'typeinfo'\":\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\nexcept ImportError, inst:\n if inst.args[0] == 'No module named multiarray':\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\n\n", "source_code_before": "\"\"\"SciPy \n\nYou can support the development of scipy by purchasing documentation at\n\nhttp://www.trelgol.com\n\nIronically, you can help make the documentation free by purchasing a copy today.\n\"\"\"\n\n\ntry: # For installation purposes only \n from scipy.base import *\n import scipy.linalg as linalg\n import scipy.fftpack as fftpack\n from scipy.fftpack import fft, ifft\n import scipy.stats as stats\n from scipy.stats import rand, randn\n from core_version import version as __version__\n from scipy.test.testing import ScipyTest\n test = ScipyTest('scipy').test\n\nexcept AttributeError, inst:\n if inst.args[0] == \"'module' object has no attribute 'typeinfo'\":\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\nexcept ImportError, inst:\n if inst.args[0] == 'No module named multiarray':\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\n\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": 28, "complexity": 0, "token_count": 105, "diff_parsed": { "added": [ " import scipy.random as random", " from scipy.random import rand, randn" ], "deleted": [ " import scipy.stats as stats", " from scipy.stats import rand, randn" ] } }, { "old_path": "scipy/base/convertcode.py", "new_path": "scipy/base/convertcode.py", "filename": "convertcode.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -122,8 +122,8 @@ def fromstr(filestr):\n filestr, fromall3 = changeimports(filestr, 'scipy_base', 'scipy.base')\n filestr, fromall3 = changeimports(filestr, 'MLab', 'scipy.linalg')\n filestr, fromall3 = changeimports(filestr, 'LinearAlgebra', 'scipy.linalg')\n- filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.stats')\n- filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.stats')\n+ filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.random')\n+ filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.random')\n filestr, fromall3 = changeimports(filestr, 'FFT', 'scipy.fftpack')\n filestr, fromall3 = changeimports(filestr, 'MA', 'scipy.base.ma')\n fromall = fromall1 or fromall2 or fromall3\n", "added_lines": 2, "deleted_lines": 2, "source_code": "\n# This module converts code written for Numeric to run with scipy.base\n\n# Makes the following changes:\n# * Converts typecharacters\n# * Changes import statements (warns of use of from Numeric import *)\n# * Changes import statements (using numerix) ...\n# * Makes search and replace changes to:\n# - .typecode()\n# - .iscontiguous()\n# - .byteswapped()\n# - .itemsize()\n# * Converts .flat to .ravel() except for .flat = xxx or .flat[xxx]\n# * Change typecode= to dtype=\n# * Eliminates savespace=xxx\n# * Replace xxx.spacesaver() with True\n# * Convert xx.savespace(?) to pass + ## xx.savespace(?)\n# * Convert a.shape = ? to a.reshape(?) \n# * Prints warning for use of bool, int, float, copmlex, object, and unicode\n#\n\n__all__ = ['fromfile', 'fromstr']\n\nimport sys\nimport os\nimport re\nimport warnings\n\nflatindex_re = re.compile('([.]flat(\\s*?[[=]))')\nint_re = re.compile('int\\s*[(][^)]*[)]')\nbool_re = re.compile('bool\\s*[(][^)]*[)]')\nfloat_re = re.compile('float\\s*[(][^)]*[)]')\ncomplex_re = re.compile('complex\\s*[(][^)]*[)]')\nunicode_re = re.compile('unicode\\s*[(][^)]*[)]')\n\ndef replacetypechars(astr):\n astr = astr.replace(\"'s'\",\"'h'\")\n astr = astr.replace(\"'c'\",\"'S1'\")\n astr = astr.replace(\"'b'\",\"'B'\")\n astr = astr.replace(\"'1'\",\"'b'\")\n astr = astr.replace(\"'w'\",\"'H'\")\n astr = astr.replace(\"'u'\",\"'I'\")\n return astr\n\ndef changeimports(fstr, name, newname):\n importstr = 'import %s' % name\n importasstr = 'import %s as ' % name\n fromstr = 'from %s import ' % name\n fromallstr = 'from %s import *' % name\n fromall=0\n\n fstr = fstr.replace(importasstr, 'import %s as ' % newname)\n fstr = fstr.replace(importstr, 'import %s as %s' % (newname,name))\n if (fstr.find(fromallstr) >= 0):\n warnings.warn('Usage of %s found.' % fromallstr)\n fstr = fstr.replace(fromallstr, 'from %s import *' % newname)\n fromall=1\n\n ind = 0\n Nlen = len(fromstr)\n Nlen2 = len(\"from %s import \" % newname)\n while 1:\n found = fstr.find(fromstr,ind)\n if (found < 0):\n break\n ind = found + Nlen\n if fstr[ind] == '*':\n continue\n fstr = \"%sfrom %s import %s\" % (fstr[:found], newname, fstr[ind:])\n ind += Nlen2 - Nlen\n return fstr, fromall\n\ndef replaceattr(astr):\n astr = astr.replace(\".typecode()\",\".dtypechar\")\n astr = astr.replace(\".iscontiguous()\",\".flags['CONTIGUOUS']\")\n astr = astr.replace(\".byteswapped()\",\".byteswap()\")\n astr = astr.replace(\".itemsize()\",\".itemsize\")\n\n # preserve uses of flat that should be o.k.\n tmpstr = flatindex_re.sub(\"@@@@\\\\2\",astr)\n # replace other uses of flat\n tmpstr = tmpstr.replace(\".flat\",\".ravel()\")\n # put back .flat where it was valid\n astr = tmpstr.replace(\"@@@@\", \".flat\")\n return astr\n\nsvspc = re.compile(r'(\\S+\\s*[(].+),\\s*savespace\\s*=.+\\s*[)]')\nsvspc2 = re.compile(r'([^,(\\s]+[.]spacesaver[(][)])')\nsvspc3 = re.compile(r'(\\S+[.]savespace[(].*[)])')\nshpe = re.compile(r'(\\S+\\s*)[.]shape\\s*=[^=]\\s*(.+)')\ndef replaceother(astr):\n astr = astr.replace(\"typecode=\",\"dtype=\")\n astr = astr.replace(\"UserArray\",\"ndarray\")\n astr = svspc.sub('\\\\1)',astr)\n astr = svspc2.sub('True',astr)\n astr = svspc3.sub('pass ## \\\\1', astr)\n astr = shpe.sub('\\\\1=\\\\1.reshape(\\\\2)', astr)\n return astr\n\ndef warnofnewtypes(filestr):\n if int_re.search(filestr) or \\\n float_re.search(filestr) or \\\n complex_re.search(filestr) or \\\n unicode_re.search(filestr) or \\\n bool_re.search(filestr):\n warnings.warn(\"Use of builtin bool, int, float, complex, or unicode\\n\" \\\n \"found when import * used -- these will be handled by\\n\" \\\n \"new array scalars under scipy\")\n \n return\n \nimport datetime\ndef fromstr(filestr):\n filestr = replacetypechars(filestr)\n filestr, fromall1 = changeimports(filestr, 'Numeric', 'scipy')\n filestr, fromall1 = changeimports(filestr, 'multiarray',\n 'scipy.base.multiarray')\n filestr, fromall1 = changeimports(filestr, 'umath',\n 'scipy.base.umath')\n filestr, fromall1 = changeimports(filestr, 'Precision', 'scipy.base')\n filestr, fromall2 = changeimports(filestr, 'numerix', 'scipy.base')\n filestr, fromall3 = changeimports(filestr, 'scipy_base', 'scipy.base')\n filestr, fromall3 = changeimports(filestr, 'MLab', 'scipy.linalg')\n filestr, fromall3 = changeimports(filestr, 'LinearAlgebra', 'scipy.linalg')\n filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.random')\n filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.random')\n filestr, fromall3 = changeimports(filestr, 'FFT', 'scipy.fftpack')\n filestr, fromall3 = changeimports(filestr, 'MA', 'scipy.base.ma')\n fromall = fromall1 or fromall2 or fromall3\n filestr = replaceattr(filestr)\n filestr = replaceother(filestr)\n if fromall:\n warnofnewtypes(filestr)\n today = datetime.date.today().strftime('%b %d, %Y')\n name = os.path.split(sys.argv[0])[-1]\n filestr = '## Automatically adapted for '\\\n 'scipy %s by %s\\n\\n%s' % (today, name, filestr)\n return filestr\n\ndef makenewfile(name, filestr):\n fid = file(name, 'w')\n fid.write(filestr)\n fid.close()\n\ndef getandcopy(name):\n fid = file(name)\n filestr = fid.read()\n fid.close()\n base, ext = os.path.splitext(name)\n makenewfile(base+'.orig', filestr)\n return filestr\n \ndef fromfile(args):\n filename = args[1]\n filestr = getandcopy(filename)\n filestr = fromstr(filestr)\n makenewfile(filename, filestr)\n\nif __name__ == '__main__':\n fromfile(sys.argv)\n \n \n\n", "source_code_before": "\n# This module converts code written for Numeric to run with scipy.base\n\n# Makes the following changes:\n# * Converts typecharacters\n# * Changes import statements (warns of use of from Numeric import *)\n# * Changes import statements (using numerix) ...\n# * Makes search and replace changes to:\n# - .typecode()\n# - .iscontiguous()\n# - .byteswapped()\n# - .itemsize()\n# * Converts .flat to .ravel() except for .flat = xxx or .flat[xxx]\n# * Change typecode= to dtype=\n# * Eliminates savespace=xxx\n# * Replace xxx.spacesaver() with True\n# * Convert xx.savespace(?) to pass + ## xx.savespace(?)\n# * Convert a.shape = ? to a.reshape(?) \n# * Prints warning for use of bool, int, float, copmlex, object, and unicode\n#\n\n__all__ = ['fromfile', 'fromstr']\n\nimport sys\nimport os\nimport re\nimport warnings\n\nflatindex_re = re.compile('([.]flat(\\s*?[[=]))')\nint_re = re.compile('int\\s*[(][^)]*[)]')\nbool_re = re.compile('bool\\s*[(][^)]*[)]')\nfloat_re = re.compile('float\\s*[(][^)]*[)]')\ncomplex_re = re.compile('complex\\s*[(][^)]*[)]')\nunicode_re = re.compile('unicode\\s*[(][^)]*[)]')\n\ndef replacetypechars(astr):\n astr = astr.replace(\"'s'\",\"'h'\")\n astr = astr.replace(\"'c'\",\"'S1'\")\n astr = astr.replace(\"'b'\",\"'B'\")\n astr = astr.replace(\"'1'\",\"'b'\")\n astr = astr.replace(\"'w'\",\"'H'\")\n astr = astr.replace(\"'u'\",\"'I'\")\n return astr\n\ndef changeimports(fstr, name, newname):\n importstr = 'import %s' % name\n importasstr = 'import %s as ' % name\n fromstr = 'from %s import ' % name\n fromallstr = 'from %s import *' % name\n fromall=0\n\n fstr = fstr.replace(importasstr, 'import %s as ' % newname)\n fstr = fstr.replace(importstr, 'import %s as %s' % (newname,name))\n if (fstr.find(fromallstr) >= 0):\n warnings.warn('Usage of %s found.' % fromallstr)\n fstr = fstr.replace(fromallstr, 'from %s import *' % newname)\n fromall=1\n\n ind = 0\n Nlen = len(fromstr)\n Nlen2 = len(\"from %s import \" % newname)\n while 1:\n found = fstr.find(fromstr,ind)\n if (found < 0):\n break\n ind = found + Nlen\n if fstr[ind] == '*':\n continue\n fstr = \"%sfrom %s import %s\" % (fstr[:found], newname, fstr[ind:])\n ind += Nlen2 - Nlen\n return fstr, fromall\n\ndef replaceattr(astr):\n astr = astr.replace(\".typecode()\",\".dtypechar\")\n astr = astr.replace(\".iscontiguous()\",\".flags['CONTIGUOUS']\")\n astr = astr.replace(\".byteswapped()\",\".byteswap()\")\n astr = astr.replace(\".itemsize()\",\".itemsize\")\n\n # preserve uses of flat that should be o.k.\n tmpstr = flatindex_re.sub(\"@@@@\\\\2\",astr)\n # replace other uses of flat\n tmpstr = tmpstr.replace(\".flat\",\".ravel()\")\n # put back .flat where it was valid\n astr = tmpstr.replace(\"@@@@\", \".flat\")\n return astr\n\nsvspc = re.compile(r'(\\S+\\s*[(].+),\\s*savespace\\s*=.+\\s*[)]')\nsvspc2 = re.compile(r'([^,(\\s]+[.]spacesaver[(][)])')\nsvspc3 = re.compile(r'(\\S+[.]savespace[(].*[)])')\nshpe = re.compile(r'(\\S+\\s*)[.]shape\\s*=[^=]\\s*(.+)')\ndef replaceother(astr):\n astr = astr.replace(\"typecode=\",\"dtype=\")\n astr = astr.replace(\"UserArray\",\"ndarray\")\n astr = svspc.sub('\\\\1)',astr)\n astr = svspc2.sub('True',astr)\n astr = svspc3.sub('pass ## \\\\1', astr)\n astr = shpe.sub('\\\\1=\\\\1.reshape(\\\\2)', astr)\n return astr\n\ndef warnofnewtypes(filestr):\n if int_re.search(filestr) or \\\n float_re.search(filestr) or \\\n complex_re.search(filestr) or \\\n unicode_re.search(filestr) or \\\n bool_re.search(filestr):\n warnings.warn(\"Use of builtin bool, int, float, complex, or unicode\\n\" \\\n \"found when import * used -- these will be handled by\\n\" \\\n \"new array scalars under scipy\")\n \n return\n \nimport datetime\ndef fromstr(filestr):\n filestr = replacetypechars(filestr)\n filestr, fromall1 = changeimports(filestr, 'Numeric', 'scipy')\n filestr, fromall1 = changeimports(filestr, 'multiarray',\n 'scipy.base.multiarray')\n filestr, fromall1 = changeimports(filestr, 'umath',\n 'scipy.base.umath')\n filestr, fromall1 = changeimports(filestr, 'Precision', 'scipy.base')\n filestr, fromall2 = changeimports(filestr, 'numerix', 'scipy.base')\n filestr, fromall3 = changeimports(filestr, 'scipy_base', 'scipy.base')\n filestr, fromall3 = changeimports(filestr, 'MLab', 'scipy.linalg')\n filestr, fromall3 = changeimports(filestr, 'LinearAlgebra', 'scipy.linalg')\n filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.stats')\n filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.stats')\n filestr, fromall3 = changeimports(filestr, 'FFT', 'scipy.fftpack')\n filestr, fromall3 = changeimports(filestr, 'MA', 'scipy.base.ma')\n fromall = fromall1 or fromall2 or fromall3\n filestr = replaceattr(filestr)\n filestr = replaceother(filestr)\n if fromall:\n warnofnewtypes(filestr)\n today = datetime.date.today().strftime('%b %d, %Y')\n name = os.path.split(sys.argv[0])[-1]\n filestr = '## Automatically adapted for '\\\n 'scipy %s by %s\\n\\n%s' % (today, name, filestr)\n return filestr\n\ndef makenewfile(name, filestr):\n fid = file(name, 'w')\n fid.write(filestr)\n fid.close()\n\ndef getandcopy(name):\n fid = file(name)\n filestr = fid.read()\n fid.close()\n base, ext = os.path.splitext(name)\n makenewfile(base+'.orig', filestr)\n return filestr\n \ndef fromfile(args):\n filename = args[1]\n filestr = getandcopy(filename)\n filestr = fromstr(filestr)\n makenewfile(filename, filestr)\n\nif __name__ == '__main__':\n fromfile(sys.argv)\n \n \n\n", "methods": [ { "name": "replacetypechars", "long_name": "replacetypechars( astr )", "filename": "convertcode.py", "nloc": 8, "complexity": 1, "token_count": 67, "parameters": [ "astr" ], "start_line": 36, "end_line": 43, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "changeimports", "long_name": "changeimports( fstr , name , newname )", "filename": "convertcode.py", "nloc": 25, "complexity": 5, "token_count": 175, "parameters": [ "fstr", "name", "newname" ], "start_line": 45, "end_line": 71, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "replaceattr", "long_name": "replaceattr( astr )", "filename": "convertcode.py", "nloc": 9, "complexity": 1, "token_count": 77, "parameters": [ "astr" ], "start_line": 73, "end_line": 85, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "replaceother", "long_name": "replaceother( astr )", "filename": "convertcode.py", "nloc": 8, "complexity": 1, "token_count": 67, "parameters": [ "astr" ], "start_line": 91, "end_line": 98, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "warnofnewtypes", "long_name": "warnofnewtypes( filestr )", "filename": "convertcode.py", "nloc": 10, "complexity": 6, "token_count": 56, "parameters": [ "filestr" ], "start_line": 100, "end_line": 110, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "fromstr", "long_name": "fromstr( filestr )", "filename": "convertcode.py", "nloc": 26, "complexity": 4, "token_count": 229, "parameters": [ "filestr" ], "start_line": 113, "end_line": 138, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "makenewfile", "long_name": "makenewfile( name , filestr )", "filename": "convertcode.py", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "name", "filestr" ], "start_line": 140, "end_line": 143, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "getandcopy", "long_name": "getandcopy( name )", "filename": "convertcode.py", "nloc": 7, "complexity": 1, "token_count": 45, "parameters": [ "name" ], "start_line": 145, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "fromfile", "long_name": "fromfile( args )", "filename": "convertcode.py", "nloc": 5, "complexity": 1, "token_count": 29, "parameters": [ "args" ], "start_line": 153, "end_line": 157, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 } ], "methods_before": [ { "name": "replacetypechars", "long_name": "replacetypechars( astr )", "filename": "convertcode.py", "nloc": 8, "complexity": 1, "token_count": 67, "parameters": [ "astr" ], "start_line": 36, "end_line": 43, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "changeimports", "long_name": "changeimports( fstr , name , newname )", "filename": "convertcode.py", "nloc": 25, "complexity": 5, "token_count": 175, "parameters": [ "fstr", "name", "newname" ], "start_line": 45, "end_line": 71, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "replaceattr", "long_name": "replaceattr( astr )", "filename": "convertcode.py", "nloc": 9, "complexity": 1, "token_count": 77, "parameters": [ "astr" ], "start_line": 73, "end_line": 85, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "replaceother", "long_name": "replaceother( astr )", "filename": "convertcode.py", "nloc": 8, "complexity": 1, "token_count": 67, "parameters": [ "astr" ], "start_line": 91, "end_line": 98, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "warnofnewtypes", "long_name": "warnofnewtypes( filestr )", "filename": "convertcode.py", "nloc": 10, "complexity": 6, "token_count": 56, "parameters": [ "filestr" ], "start_line": 100, "end_line": 110, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "fromstr", "long_name": "fromstr( filestr )", "filename": "convertcode.py", "nloc": 26, "complexity": 4, "token_count": 229, "parameters": [ "filestr" ], "start_line": 113, "end_line": 138, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "makenewfile", "long_name": "makenewfile( name , filestr )", "filename": "convertcode.py", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "name", "filestr" ], "start_line": 140, "end_line": 143, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "getandcopy", "long_name": "getandcopy( name )", "filename": "convertcode.py", "nloc": 7, "complexity": 1, "token_count": 45, "parameters": [ "name" ], "start_line": 145, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "fromfile", "long_name": "fromfile( args )", "filename": "convertcode.py", "nloc": 5, "complexity": 1, "token_count": 29, "parameters": [ "args" ], "start_line": 153, "end_line": 157, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "fromstr", "long_name": "fromstr( filestr )", "filename": "convertcode.py", "nloc": 26, "complexity": 4, "token_count": 229, "parameters": [ "filestr" ], "start_line": 113, "end_line": 138, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 } ], "nloc": 120, "complexity": 21, "token_count": 892, "diff_parsed": { "added": [ " filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.random')", " filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.random')" ], "deleted": [ " filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.stats')", " filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.stats')" ] } }, { "old_path": "scipy/stats/__init__.py", "new_path": "scipy/random/__init__.py", "filename": "__init__.py", "extension": "py", "change_type": "RENAME", "diff": "", "added_lines": 0, "deleted_lines": 0, "source_code": null, "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [], "deleted": [] } } ] }, { "hash": "de02f8159ac4ef845dae9fb78c938ab85570d3e2", "msg": "Get rid of rfftfreq and add random.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T08:17:39+00:00", "author_timezone": 0, "committer_date": "2005-10-07T08:17:39+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "1348aa1cabad5bbf8574c0cf89100b1be6d8172c" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 17, "insertions": 2, "lines": 19, "files": 2, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.0, "dmm_unit_interfacing": 0.0, "modified_files": [ { "old_path": "scipy/fftpack/helper.py", "new_path": "scipy/fftpack/helper.py", "filename": "helper.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -61,22 +61,7 @@ def fftfreq(n,d=1.0):\n f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even\n f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd\n \"\"\"\n- assert isinstance(n,types.IntType)\n+ assert isinstance(n,types.IntType) or isinstance(n, integer)\n k = range(0,(n-1)/2+1)+range(-(n/2),0)\n return array(k,'d')/(n*d)\n \n-def rfftfreq(n,d=1.0):\n- \"\"\" rfftfreq(n, d=1.0) -> f\n-\n- DFT sample frequencies (for usage with rfft,irfft).\n-\n- The returned float array contains the frequency bins in\n- cycles/unit (with zero at the start) given a window length n and a\n- sample spacing d:\n-\n- f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2]/(d*n) if n is even\n- f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2,n/2]/(d*n) if n is odd\n- \"\"\"\n- assert isinstance(n,types.IntType) or isinstance(n,integer)\n- return array(range(1,n+1),'i')/2/float(n*d)\n-\n", "added_lines": 1, "deleted_lines": 16, "source_code": "\"\"\"\nDiscrete Fourier Transforms - helper.py\n\"\"\"\n# Created by Pearu Peterson, September 2002\n\n__all__ = ['fftshift','ifftshift','fftfreq','rfftfreq']\n\nfrom scipy.base import asarray, concatenate, arange, take, \\\n\t\tarray, integer\nimport types\n\ndef fftshift(x,axes=None):\n \"\"\" fftshift(x, axes=None) -> y\n\n Shift zero-frequency component to center of spectrum.\n\n This function swaps half-spaces for all axes listed (defaults to all).\n\n Notes:\n If len(x) is even then the Nyquist component is y[0].\n \"\"\"\n tmp = asarray(x)\n ndim = len(tmp.shape)\n if axes is None:\n axes = range(ndim)\n y = tmp\n for k in axes:\n n = tmp.shape[k]\n p2 = (n+1)/2\n mylist = concatenate((arange(p2,n),arange(p2)))\n y = take(y,mylist,k)\n return y\n\n\ndef ifftshift(x,axes=None):\n \"\"\" ifftshift(x,axes=None) - > y\n\n Inverse of fftshift.\n \"\"\"\n tmp = asarray(x)\n ndim = len(tmp.shape)\n if axes is None:\n axes = range(ndim)\n y = tmp\n for k in axes:\n n = tmp.shape[k]\n p2 = n-(n+1)/2\n mylist = concatenate((arange(p2,n),arange(p2)))\n y = take(y,mylist,k)\n return y\n\ndef fftfreq(n,d=1.0):\n \"\"\" fftfreq(n, d=1.0) -> f\n\n DFT sample frequencies\n\n The returned float array contains the frequency bins in\n cycles/unit (with zero at the start) given a window length n and a\n sample spacing d:\n\n f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even\n f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd\n \"\"\"\n assert isinstance(n,types.IntType) or isinstance(n, integer)\n k = range(0,(n-1)/2+1)+range(-(n/2),0)\n return array(k,'d')/(n*d)\n\n", "source_code_before": "\"\"\"\nDiscrete Fourier Transforms - helper.py\n\"\"\"\n# Created by Pearu Peterson, September 2002\n\n__all__ = ['fftshift','ifftshift','fftfreq','rfftfreq']\n\nfrom scipy.base import asarray, concatenate, arange, take, \\\n\t\tarray, integer\nimport types\n\ndef fftshift(x,axes=None):\n \"\"\" fftshift(x, axes=None) -> y\n\n Shift zero-frequency component to center of spectrum.\n\n This function swaps half-spaces for all axes listed (defaults to all).\n\n Notes:\n If len(x) is even then the Nyquist component is y[0].\n \"\"\"\n tmp = asarray(x)\n ndim = len(tmp.shape)\n if axes is None:\n axes = range(ndim)\n y = tmp\n for k in axes:\n n = tmp.shape[k]\n p2 = (n+1)/2\n mylist = concatenate((arange(p2,n),arange(p2)))\n y = take(y,mylist,k)\n return y\n\n\ndef ifftshift(x,axes=None):\n \"\"\" ifftshift(x,axes=None) - > y\n\n Inverse of fftshift.\n \"\"\"\n tmp = asarray(x)\n ndim = len(tmp.shape)\n if axes is None:\n axes = range(ndim)\n y = tmp\n for k in axes:\n n = tmp.shape[k]\n p2 = n-(n+1)/2\n mylist = concatenate((arange(p2,n),arange(p2)))\n y = take(y,mylist,k)\n return y\n\ndef fftfreq(n,d=1.0):\n \"\"\" fftfreq(n, d=1.0) -> f\n\n DFT sample frequencies\n\n The returned float array contains the frequency bins in\n cycles/unit (with zero at the start) given a window length n and a\n sample spacing d:\n\n f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even\n f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd\n \"\"\"\n assert isinstance(n,types.IntType)\n k = range(0,(n-1)/2+1)+range(-(n/2),0)\n return array(k,'d')/(n*d)\n\ndef rfftfreq(n,d=1.0):\n \"\"\" rfftfreq(n, d=1.0) -> f\n\n DFT sample frequencies (for usage with rfft,irfft).\n\n The returned float array contains the frequency bins in\n cycles/unit (with zero at the start) given a window length n and a\n sample spacing d:\n\n f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2]/(d*n) if n is even\n f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2,n/2]/(d*n) if n is odd\n \"\"\"\n assert isinstance(n,types.IntType) or isinstance(n,integer)\n return array(range(1,n+1),'i')/2/float(n*d)\n\n", "methods": [ { "name": "fftshift", "long_name": "fftshift( x , axes = None )", "filename": "helper.py", "nloc": 12, "complexity": 3, "token_count": 90, "parameters": [ "x", "axes" ], "start_line": 12, "end_line": 32, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "ifftshift", "long_name": "ifftshift( x , axes = None )", "filename": "helper.py", "nloc": 12, "complexity": 3, "token_count": 92, "parameters": [ "x", "axes" ], "start_line": 35, "end_line": 50, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "fftfreq", "long_name": "fftfreq( n , d = 1 . 0 )", "filename": "helper.py", "nloc": 4, "complexity": 2, "token_count": 69, "parameters": [ "n", "d" ], "start_line": 52, "end_line": 66, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 } ], "methods_before": [ { "name": "fftshift", "long_name": "fftshift( x , axes = None )", "filename": "helper.py", "nloc": 12, "complexity": 3, "token_count": 90, "parameters": [ "x", "axes" ], "start_line": 12, "end_line": 32, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "ifftshift", "long_name": "ifftshift( x , axes = None )", "filename": "helper.py", "nloc": 12, "complexity": 3, "token_count": 92, "parameters": [ "x", "axes" ], "start_line": 35, "end_line": 50, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "fftfreq", "long_name": "fftfreq( n , d = 1 . 0 )", "filename": "helper.py", "nloc": 4, "complexity": 1, "token_count": 62, "parameters": [ "n", "d" ], "start_line": 52, "end_line": 66, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "rfftfreq", "long_name": "rfftfreq( n , d = 1 . 0 )", "filename": "helper.py", "nloc": 3, "complexity": 2, "token_count": 51, "parameters": [ "n", "d" ], "start_line": 68, "end_line": 81, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "rfftfreq", "long_name": "rfftfreq( n , d = 1 . 0 )", "filename": "helper.py", "nloc": 3, "complexity": 2, "token_count": 51, "parameters": [ "n", "d" ], "start_line": 68, "end_line": 81, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "fftfreq", "long_name": "fftfreq( n , d = 1 . 0 )", "filename": "helper.py", "nloc": 4, "complexity": 2, "token_count": 69, "parameters": [ "n", "d" ], "start_line": 52, "end_line": 66, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 } ], "nloc": 35, "complexity": 8, "token_count": 285, "diff_parsed": { "added": [ " assert isinstance(n,types.IntType) or isinstance(n, integer)" ], "deleted": [ " assert isinstance(n,types.IntType)", "def rfftfreq(n,d=1.0):", " \"\"\" rfftfreq(n, d=1.0) -> f", "", " DFT sample frequencies (for usage with rfft,irfft).", "", " The returned float array contains the frequency bins in", " cycles/unit (with zero at the start) given a window length n and a", " sample spacing d:", "", " f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2]/(d*n) if n is even", " f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2,n/2]/(d*n) if n is odd", " \"\"\"", " assert isinstance(n,types.IntType) or isinstance(n,integer)", " return array(range(1,n+1),'i')/2/float(n*d)", "" ] } }, { "old_path": "scipy/setup.py", "new_path": "scipy/setup.py", "filename": "setup.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -12,7 +12,7 @@ def configuration(parent_package='',top_path=None):\n config.add_subpackage('corelib') # installed as scipy.lib\n config.add_subpackage('fftpack')\n config.add_subpackage('linalg')\n- config.add_subpackage('stats')\n+ config.add_subpackage('random')\n config.make_svn_version_py() # installs __svn_version__.py\n return config.todict()\n \n", "added_lines": 1, "deleted_lines": 1, "source_code": "#!/usr/bin/env python\nimport os\n\ndef configuration(parent_package='',top_path=None):\n from scipy.distutils.misc_util import Configuration\n config = Configuration('scipy',parent_package,top_path)\n config.add_subpackage('distutils')\n config.add_subpackage('weave')\n config.add_subpackage('test')\n config.add_subpackage('f2py2e') # installed as scipy.f2py\n config.add_subpackage('base')\n config.add_subpackage('corelib') # installed as scipy.lib\n config.add_subpackage('fftpack')\n config.add_subpackage('linalg')\n config.add_subpackage('random')\n config.make_svn_version_py() # installs __svn_version__.py\n return config.todict()\n\nif __name__ == '__main__':\n # Remove current working directory from sys.path\n # to avoid importing scipy.distutils as Python std. distutils:\n import os, sys\n sys.path.remove(os.getcwd())\n\n from scipy.distutils.core import setup\n setup(**configuration(top_path=''))\n", "source_code_before": "#!/usr/bin/env python\nimport os\n\ndef configuration(parent_package='',top_path=None):\n from scipy.distutils.misc_util import Configuration\n config = Configuration('scipy',parent_package,top_path)\n config.add_subpackage('distutils')\n config.add_subpackage('weave')\n config.add_subpackage('test')\n config.add_subpackage('f2py2e') # installed as scipy.f2py\n config.add_subpackage('base')\n config.add_subpackage('corelib') # installed as scipy.lib\n config.add_subpackage('fftpack')\n config.add_subpackage('linalg')\n config.add_subpackage('stats')\n config.make_svn_version_py() # installs __svn_version__.py\n return config.todict()\n\nif __name__ == '__main__':\n # Remove current working directory from sys.path\n # to avoid importing scipy.distutils as Python std. distutils:\n import os, sys\n sys.path.remove(os.getcwd())\n\n from scipy.distutils.core import setup\n setup(**configuration(top_path=''))\n", "methods": [ { "name": "configuration", "long_name": "configuration( parent_package = '' , top_path = None )", "filename": "setup.py", "nloc": 14, "complexity": 1, "token_count": 94, "parameters": [ "parent_package", "top_path" ], "start_line": 4, "end_line": 17, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "methods_before": [ { "name": "configuration", "long_name": "configuration( parent_package = '' , top_path = None )", "filename": "setup.py", "nloc": 14, "complexity": 1, "token_count": 94, "parameters": [ "parent_package", "top_path" ], "start_line": 4, "end_line": 17, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "configuration", "long_name": "configuration( parent_package = '' , top_path = None )", "filename": "setup.py", "nloc": 14, "complexity": 1, "token_count": 94, "parameters": [ "parent_package", "top_path" ], "start_line": 4, "end_line": 17, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "nloc": 20, "complexity": 1, "token_count": 136, "diff_parsed": { "added": [ " config.add_subpackage('random')" ], "deleted": [ " config.add_subpackage('stats')" ] } } ] }, { "hash": "911cb6b831c7842f9fe3720f67d0f4eff7b24b9e", "msg": "Fixed missing intp's", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T08:47:52+00:00", "author_timezone": 0, "committer_date": "2005-10-07T08:47:52+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "de02f8159ac4ef845dae9fb78c938ab85570d3e2" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 5, "insertions": 5, "lines": 10, "files": 1, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": "scipy/base/src/ufuncobject.c", "new_path": "scipy/base/src/ufuncobject.c", "filename": "ufuncobject.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -91,7 +91,7 @@ PyUFunc_gg_g(char **args, intp *dimensions, intp *steps, void *func)\n \n \n static void \n-PyUFunc_FF_F_As_DD_D(char **args, int *dimensions, intp *steps, void *func) \n+PyUFunc_FF_F_As_DD_D(char **args, intp *dimensions, intp *steps, void *func) \n {\n \tregister int i;\n \tintp is1=steps[0],is2=steps[1],os=steps[2];\n@@ -109,7 +109,7 @@ PyUFunc_FF_F_As_DD_D(char **args, int *dimensions, intp *steps, void *func)\n }\n \n static void \n-PyUFunc_DD_D(char **args, int *dimensions, intp *steps, void *func)\n+PyUFunc_DD_D(char **args, intp *dimensions, intp *steps, void *func)\n {\n \tregister intp i, is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0];\n \tchar *ip1=args[0], *ip2=args[1], *op=args[2];\n@@ -125,7 +125,7 @@ PyUFunc_DD_D(char **args, int *dimensions, intp *steps, void *func)\n }\n \n static void \n-PyUFunc_FF_F(char **args, int *dimensions, intp *steps, void *func) \n+PyUFunc_FF_F(char **args, intp *dimensions, intp *steps, void *func) \n {\n \tregister intp i, is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0];\n \tchar *ip1=args[0], *ip2=args[1], *op=args[2];\n@@ -141,7 +141,7 @@ PyUFunc_FF_F(char **args, int *dimensions, intp *steps, void *func)\n }\n \n static void \n-PyUFunc_GG_G(char **args, int *dimensions, intp *steps, void *func) \n+PyUFunc_GG_G(char **args, intp *dimensions, intp *steps, void *func) \n {\n \tregister intp i, is1=steps[0],is2=steps[1],os=steps[2],n=dimensions[0];\n \tchar *ip1=args[0], *ip2=args[1], *op=args[2];\n@@ -159,7 +159,7 @@ PyUFunc_GG_G(char **args, int *dimensions, intp *steps, void *func)\n }\n \n static void \n-PyUFunc_OO_O(char **args, int *dimensions, intp *steps, void *func) \n+PyUFunc_OO_O(char **args, intp *dimensions, intp *steps, void *func) \n {\n \tint i, is1=steps[0],is2=steps[1],os=steps[2];\n \tchar *ip1=args[0], *ip2=args[1], *op=args[2];\n", "added_lines": 5, "deleted_lines": 5, "source_code": "\n/*\n Python Universal Functions Object -- Math for all types, plus fast \n arrays math\n \n Full description\n \n This supports mathematical (and Boolean) functions on arrays and other python\n objects. Math on large arrays of basic C types is rather efficient.\n\n Travis E. Oliphant (2005)\n Assistant Professor\n Brigham Young University\n\n based on the \n\n Original Implementation: \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n with inspiration and code from\n Numarray\n Space Science Telescope Institute\n J. Todd Miller\n Perry Greenfield\n \n*/\n\n\ntypedef double (DoubleBinaryFunc)(double x, double y);\ntypedef float (FloatBinaryFunc)(float x, float y);\ntypedef longdouble (LongdoubleBinaryFunc)(longdouble x, longdouble y);\n\ntypedef void (CdoubleBinaryFunc)(cdouble *x, cdouble *y, cdouble *res);\ntypedef void (CfloatBinaryFunc)(cfloat *x, cfloat *y, cfloat *res);\ntypedef void (ClongdoubleBinaryFunc)(clongdouble *x, clongdouble *y, \\\n\t\t\t\t clongdouble *res);\n\nstatic void\nPyUFunc_ff_f_As_dd_d(char **args, intp *dimensions, intp *steps, void *func)\n{\n\tregister intp i, n=dimensions[0];\n\tintp is1=steps[0],is2=steps[1],os=steps[2];\n\tchar *ip1=args[0], *ip2=args[1], *op=args[2];\n\t\n\tfor(i=0; inin, nout=data->nout;\n int ntot;\n PyObject *tocall = data->callable; \n char *ptrs[MAX_ARGS];\n PyObject *arglist, *result;\n PyObject *in, **op;\n\n ntot = nin+nout;\n\n for (j=0; j < ntot; j++) ptrs[j] = args[j];\n\tfor(i=0; i> UFUNC_SHIFT_##NAME, \\\n\t\t\t\t\t errobj, str, retstatus) < 0) \\\n\t\t\t\treturn -1;\t\t \\\n\t\t\t}}\n\n\tif (errmask && retstatus) {\n\t\tHANDLEIT(DIVIDEBYZERO, \"divide by zero\");\n\t\tHANDLEIT(OVERFLOW, \"overflow\");\n\t\tHANDLEIT(UNDERFLOW, \"underflow\");\n\t\tHANDLEIT(INVALID, \"invalid\");\n\t}\n\n#undef HANDLEIT\n\n\treturn 0;\n}\n\n\n/* Checking the status flag clears it */\nstatic void\nPyUFunc_clearfperr()\n{\n\tint retstatus;\n\n\tUFUNC_CHECK_STATUS(retstatus)\n}\n\n\n#define UFUNC_NOSCALAR 0\n#define UFUNC_BOOL_SCALAR 1\n#define UFUNC_INTPOS_SCALAR 2\n#define UFUNC_INTNEG_SCALAR 3\n#define UFUNC_FLOAT_SCALAR 4\n#define UFUNC_COMPLEX_SCALAR 5\n#define UFUNC_OBJECT_SCALAR 6\n\n#define NO_UFUNCLOOP 0\n#define ZERODIM_REDUCELOOP 0\n#define ONE_UFUNCLOOP 1\n#define ONEDIM_REDUCELOOP 1\n#define NOBUFFER_UFUNCLOOP 2\n#define NOBUFFER_REDUCELOOP 2\n#define BUFFER_UFUNCLOOP 3\n#define BUFFER_REDUCELOOP 3\n\n\n#define UFUNC_REDUCE 0\n#define UFUNC_ACCUMULATE 1\n#define UFUNC_REDUCEAT 2\n#define UFUNC_OUTER 3\n\n\n\n\nstatic char\n_lowest_type(char intype)\n{\n switch(intype) {\n\t/* case PyArray_BYTE */\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\treturn PyArray_BYTE;\n\t/* case PyArray_UBYTE */\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\treturn PyArray_UBYTE;\n\t/* case PyArray_FLOAT:*/\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\treturn PyArray_FLOAT;\n\t/* case PyArray_CFLOAT:*/\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn PyArray_CFLOAT;\n default:\n return intype;\n }\n}\n\nstatic int \n_cancoerce(char thistype, char neededtype, char scalar) \n{\n\n\tswitch(scalar) {\n\tcase UFUNC_NOSCALAR:\n\tcase UFUNC_BOOL_SCALAR:\n\tcase UFUNC_OBJECT_SCALAR:\n\t\treturn PyArray_CanCastSafely(thistype, neededtype);\n\tcase UFUNC_INTPOS_SCALAR:\n\t\treturn (neededtype >= PyArray_UBYTE);\n\tcase UFUNC_INTNEG_SCALAR:\n\t\treturn (neededtype >= PyArray_BYTE) &&\t\t\\\n\t\t\t!(PyTypeNum_ISUNSIGNED(neededtype));\n\tcase UFUNC_FLOAT_SCALAR:\n\t\treturn (neededtype >= PyArray_FLOAT);\n\tcase UFUNC_COMPLEX_SCALAR:\n\t\treturn (neededtype >= PyArray_CFLOAT);\n\t}\n\tfprintf(stderr, \"\\n**Error** coerce fall through: %d %d %d\\n\\n\", \n\t\tthistype, neededtype, scalar);\n\treturn 1; /* should never get here... */ \n}\n\n\nstatic int \nselect_types(PyUFuncObject *self, int *arg_types, \n PyUFuncGenericFunction *function, void **data,\n\t char *scalars)\n{\n\n\tint i=0, j;\n\tchar start_type;\n\t\n\tif (PyTypeNum_ISUSERDEF((arg_types[0]))) {\n\t\tPyObject *key, *obj;\n\t\tfor (i=0; inin; i++) {\n\t\t\tif (arg_types[i] != arg_types[0]) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\t\t\"ufuncs on user defined\" \\\n\t\t\t\t\t\t\" types don't support \"\\\n\t\t\t\t\t\t\"coercion.\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfor (i=self->nin; inargs; i++) {\n\t\t\targ_types[i] = arg_types[0];\n\t\t}\n\t\t\n\t\tkey = PyInt_FromLong((long) arg_types[0]);\n\t\tif (key == NULL) return -1;\n\t\tobj = PyDict_GetItem(self->userloops, key);\n\t\tif (obj == NULL) {\n\t\t\tPy_DECREF(key);\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"no registered loop for this \"\t\\\n\t\t\t\t\t\"user-defined type.\");\n\t\t\treturn -1;\t\t\t\n\t\t}\n\t\tif PyTuple_Check(obj) {\n\t\t\t*function = (PyUFuncGenericFunction) \\\n\t\t\t\tPyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 0));\n\t\t\t*data = PyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 1));\n\t\t}\n\t\telse {\n\t\t\t*function = (PyUFuncGenericFunction)\t\\\n\t\t\t\tPyCObject_AsVoidPtr(obj);\n\t\t\t*data = NULL;\n\t\t}\n\t\tPy_DECREF(key);\n\t\treturn 0;\n\t}\n\t\n\n\tstart_type = arg_types[0];\n\t/* If the first argument is a scalar we need to place \n\t the start type as the lowest type in the class\n\t*/\n\tif (scalars[0] != UFUNC_NOSCALAR) {\n\t\tstart_type = _lowest_type(start_type);\n\t}\n\n\twhile (intypes && start_type > self->types[i*self->nargs]) \n\t\ti++;\n\n\tfor(;intypes; i++) {\n\t\tfor(j=0; jnin; j++) {\n\t\t\tif (!_cancoerce(arg_types[j], \n\t\t\t\t\tself->types[i*self->nargs+j],\n\t\t\t\t\tscalars[j]))\n\t\t\t\tbreak;\n\t\t}\n\t\tif (j == self->nin) break;\n\t}\n\tif(i>=self->ntypes) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"function not supported for these types, \"\\\n\t\t\t\t\"and can't coerce safely to supported types\");\n\t\treturn -1;\n\t}\n\tfor(j=0; jnargs; j++) \n\t\targ_types[j] = self->types[i*self->nargs+j];\n\n\t*data = self->data[i];\n\t*function = self->functions[i];\n\n\treturn 0;\n}\n\n\n\nstatic int\n_getintfromvar(char *str, int deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tint retval=deflt;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n thedict = PyEval_GetGlobals();\n ref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = (int) PyInt_AsLong(ref);\n if (ref == NULL || retval == -1) retval = deflt;\n PyErr_Clear();\n\treturn retval;\n}\n\nstatic PyObject *\n_getfuncfromvar(char *str, PyObject *deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tPyObject *retval;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n\t\tthedict = PyEval_GetGlobals();\n\t\tref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = ref;\n\telse retval = deflt;\n\tif (retval != Py_None && !PyCallable_Check(retval)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"%s if provided must be callable\", str);\n\t\treturn NULL;\n\t}\n\tPy_INCREF(retval);\n\treturn retval;\n}\n\n\nstatic char\n_scalar_kind(int typenum, PyArrayObject **arr) \n{\n\tif (PyTypeNum_ISSIGNED(typenum)) return UFUNC_INTNEG_SCALAR;\n\tif (PyTypeNum_ISFLOAT(typenum)) return UFUNC_FLOAT_SCALAR;\n\tif (PyTypeNum_ISCOMPLEX(typenum)) return UFUNC_COMPLEX_SCALAR;\n\tif (PyTypeNum_ISUNSIGNED(typenum)) return UFUNC_INTPOS_SCALAR;\n\tif (PyTypeNum_ISBOOL(typenum)) return UFUNC_BOOL_SCALAR;\n\treturn UFUNC_OBJECT_SCALAR;\n}\n\n\n/* Create copies for any arrays that are less than loop->bufsize\n in total size and are mis-behaved or in need\n of casting.\n*/\n\nstatic int\n_create_copies(PyUFuncLoopObject *loop, int *arg_types, PyArrayObject **mps)\n{\n\tint nin = loop->ufunc->nin;\n\tint i;\n\tintp size;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\n\tfor (i=0; ielsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\t\tif (size < loop->bufsize) {\n\t\t\tif (!(PyArray_ISBEHAVED_RO(mps[i])) ||\t\t\\\n\t\t\t PyArray_TYPE(mps[i]) != arg_types[i]) {\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST |\t\\\n\t\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\nstatic int\nconstruct_matrices(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps)\n{\n int nargs, i, cnt, cntcast, maxsize;\n int arg_types[MAX_ARGS];\n\tchar scalars[MAX_ARGS];\n\tPyUFuncObject *self=loop->ufunc;\n\tBool allscalars=TRUE;\n\tPyTypeObject *subtype=&PyArray_Type;\n\n /* Check number of arguments */\n nargs = PyTuple_Size(args);\n if ((nargs != self->nin) && (nargs != self->nargs)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of arguments\");\n return -1;\n }\n\n\n /* Get each input argument */\n for (i=0; inin; i++) {\n mps[i] = (PyArrayObject *)\\\n\t\t\tPyArray_FromAny(PyTuple_GET_ITEM(args,i), \n\t\t\t\t\tNULL, 0, 0, 0);\n if (mps[i] == NULL) return -1;\n arg_types[i] = PyArray_TYPE(mps[i]);\n if (PyTypeNum_ISFLEXIBLE(arg_types[i])) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"ufuncs do not support\"\t\\\n \" flexible arrays\");\n return -1;\n }\n\t\t/*\n\t\tfprintf(stderr, \"array %d has reference %d\\n\", i, \n\t\t (mps[i])->ob_refcnt);\n\t\t*/\n\n\t\t/* Scalars are 0-dimensional arrays\n\t\t at this point\n\t\t*/\n\t\tif (mps[i]->nd > 0) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t\tallscalars=FALSE;\n\t\t}\n\t\telse scalars[i] = _scalar_kind(arg_types[i], &(mps[i]));\n\n\t\t/* If any input is a big-array */\n\t\tif (!PyType_IsSubtype(mps[i]->ob_type, &PyArray_Type)) {\n\t\t\tsubtype = &PyBigArray_Type;\n\t\t}\n }\n\n\t/* If everything is a scalar, then use normal coercion rules */\n\tif (allscalars) {\n\t\tfor (i=0; inin; i++) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t}\n\t}\n \n /* Select an appropriate function for these argument types. */\n if (select_types(loop->ufunc, arg_types, &(loop->function), \n &(loop->funcdata), scalars) == -1)\n\t\treturn -1;\n\n\t/* This is the buffer size in number of elements.*/\n loop->bufsize = _getintfromvar(UFUNC_BUFSIZE_NAME, PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \"The buffer size (%d) is not \" \\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\treturn -1;\n\t}\n\t\n\t/* Create copies for some of the arrays if appropriate */\n\tif (_create_copies(loop, arg_types, mps) < 0) return -1;\n\t\n\t/* Create Iterators for the Inputs */\n\tfor (i=0; inin; i++) {\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n\t}\n \n /* Broadcast the result */\n loop->numiter = self->nin;\n if (PyArray_Broadcast((PyArrayMultiIterObject *)loop) < 0)\n\t\treturn -1;\n\t\n /* Get any return arguments */\n for (i=self->nin; idimensions, \n\t\t\t\t\t loop->dimensions, loop->nd)) {\n PyErr_SetString(PyExc_ValueError, \n \"invalid return array shape\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n if (!PyArray_ISWRITEABLE(mps[i])) {\n PyErr_SetString(PyExc_ValueError, \n \"return array is not writeable\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n }\n\n /* construct any missing return arrays and make output iterators */\n \n for (i=self->nin; inargs; i++) {\n\t\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\n if (mps[i] == NULL) {\n mps[i] = (PyArrayObject *)PyArray_New(subtype,\n loop->nd, \n loop->dimensions,\n arg_types[i], \n NULL, NULL,\n 0, 0, NULL);\n if (mps[i] == NULL) return -1;\n }\n\n\n\t\t/* reset types for outputs that are equivalent \n\t\t -- no sense casting uselessly\n\t\t*/\n\t\tif (mps[i]->descr->type_num != arg_types[i]) {\n\t\t\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\t\t\tntype.type_num = PyArray_TYPE(mps[i]);\n\t\t\tntype.itemsize = PyArray_ITEMSIZE(mps[i]);\n\t\t\tatype.type_num = arg_types[i];\n\t\t\tatype.itemsize = \\\n\t\t\t\tPyArray_DescrFromType(arg_types[i])->elsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\n\t\t/* still not the same -- or will we have to use buffers?*/\n\t\tif (mps[i]->descr->type_num != arg_types[i] ||\n\t\t !PyArray_ISBEHAVED_RO(mps[i])) {\n\t\t\tif (loop->size < loop->bufsize) {\n\t\t\t\tPyObject *new;\n\t\t\t\t/* Copy the array to a temporary copy \n\t\t\t\t and set the UPDATEIFCOPY flag\n\t\t\t\t*/\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST | \n\t\t\t\t\t\t BEHAVED_FLAGS_RO |\n\t\t\t\t\t\t UPDATEIFCOPY);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t\t\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n }\n\n\n /* If any of different type, or misaligned or swapped\n then must use buffers */\n\n loop->bufcnt = 0;\n\n loop->obj = 0;\n\n /* Determine looping method needed */\n loop->meth = NO_UFUNCLOOP;\n\n\tcnt = cntcast = 0; /* keeps track of bytes to allocate */\n\tmaxsize = 0;\n for (i=0; inargs; i++) {\n\t\tcnt += mps[i]->itemsize;\n if (arg_types[i] != mps[i]->descr->type_num) {\n\t\t\tPyArray_Descr *descr;\n\n loop->meth = BUFFER_UFUNCLOOP;\n\t\t\tdescr = PyArray_DescrFromType(arg_types[i]);\n\t\t\tcntcast += descr->elsize;\n if (i < self->nin) {\n loop->cast[i] = \\\n\t\t\t\t\tmps[i]->descr->cast[arg_types[i]];\n\t\t\t}\n else {\n loop->cast[i] = descr->\\\n\t\t\t\t\tcast[mps[i]->descr->type_num];\n\t\t\t}\n\n }\n loop->swap[i] = !(PyArray_ISNOTSWAPPED(mps[i]));\n if (!PyArray_ISBEHAVED_RO(mps[i])) {\n loop->meth = BUFFER_UFUNCLOOP;\n }\n if (!loop->obj && mps[i]->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n }\n \n if (loop->meth == NO_UFUNCLOOP) {\n \n loop->meth = ONE_UFUNCLOOP;\n\n /* All correct type and BEHAVED */\n /* Check for non-uniform stridedness */\n\n for (i=0; inargs; i++) {\n if (!(loop->iters[i]->contiguous)) {\n\t\t\t\t/* may still have uniform stride\n\t\t\t\t if (broadcated result) <= 1-d */\n\t\t\t\tif (mps[i]->nd != 0 &&\t\t\t\\\n\t\t\t\t (loop->iters[i]->nd_m1 > 0)) {\n\t\t\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n }\n\t\tif (loop->meth == ONE_UFUNCLOOP) {\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tloop->bufptr[i] = mps[i]->data;\n\t\t\t}\n\t\t}\n }\n\n loop->numiter = self->nargs;\n\n /* Fill in steps */\n if (loop->meth == NOBUFFER_UFUNCLOOP) {\n\t\tint ldim = 0;\n\t\tintp maxdim=-1;\n\t\tPyArrayIterObject *it;\n\n /* Fix iterators */\n\n /* Find the **largest** dimension */\n \n\t\tmaxdim = -1;\n\t\tfor (i=loop->nd - 1; i>=0; i--) {\n\t\t\tif (loop->dimensions[i] > maxdim) {\n\t\t\t\tldim = i;\n\t\t\t\tmaxdim = loop->dimensions[i];\n\t\t\t}\n\t\t}\n\n\t\tloop->size /= maxdim;\n loop->bufcnt = maxdim;\n\n /* Fix the iterators so the inner loop occurs over the \n\t\t largest dimensions -- This can be done by \n\t\t setting the size to 1 in that dimension \n\t\t (just in the iterators)\n */\n\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = loop->iters[i];\n it->contiguous = 0;\n\t\t\tit->size /= (it->dims_m1[ldim]+1);\n\t\t\tit->dims_m1[ldim] = 0;\n\t\t\tit->backstrides[ldim] = 0;\n\n\t\t\t/* (won't fix factors because we\n\t\t\t don't use PyArray_ITER_GOTO1D \n\t\t\t so don't change them) */\n\n\n\t\t\t/* Set the steps to the strides in that dimension */\n loop->steps[i] = it->strides[ldim];\n\t\t}\n\n }\n else if (loop->meth == BUFFER_UFUNCLOOP) {\n for (i=0; inargs; i++) {\n\t\t\tloop->steps[i] = mps[i]->itemsize; \n\t\t}\n }\n\telse { /* uniformly-strided case ONE_UFUNCLOOP */\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (mps[i]->nd == 0)\n\t\t\t\tloop->steps[i] = 0;\n\t\t\telse \n\t\t\t\tloop->steps[i] = mps[i]->strides[mps[i]->nd-1];\n\t\t}\n\t}\n \n\n\t/* Finally, create memory for buffers if we need them */\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\t\tchar *castptr;\n\t\tint oldsize=0;\n\t\tloop->buffer[0] = (char *)malloc(loop->bufsize*(cnt+cntcast));\n\t\t/* fprintf(stderr, \"Allocated buffer at %p of size %d, cnt=%d, cntcast=%d\\n\", loop->buffer[0], loop->bufsize * (cnt + cntcast), cnt, cntcast); */\n\t\tif (loop->buffer[0] == NULL) return -1;\n\t\tcastptr = loop->buffer[0] + loop->bufsize*cnt;\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (i > 0)\n\t\t\t\tloop->buffer[i] = loop->buffer[i-1] + \\\n\t\t\t\t\tloop->bufsize * mps[i-1]->itemsize;\n\t\t\t/* fprintf(stderr, \"buffer[%d] = %p\\n\", i, loop->buffer[i]); */\n\t\t\tif (loop->cast[i]) {\n\t\t\t\tloop->castbuf[i] = castptr + \n\t\t\t\t\tloop->bufsize*oldsize;\n\t\t\t\t/* fprintf(stderr, \"castbuf[%d] = %p\\n\", i, loop->castbuf[i]); */\n#define _PyD PyArray_DescrFromType\n\t\t\t\toldsize = _PyD(arg_types[i])->elsize;\n#undef _PyD\n\t\t\t\tloop->bufptr[i] = loop->castbuf[i];\n\t\t\t\tcastptr = loop->castbuf[i];\n\t\t\t\tloop->steps[i] = oldsize;\n\t\t\t}\n\t\t\telse\n\t\t\t\tloop->bufptr[i] = loop->buffer[i];\n\t\t\tloop->dptr[i] = loop->buffer[i];\n\t\t}\n\t}\n\n return nargs;\n}\n\nstatic PyTypeObject PyUFuncLoop_Type;\n\nstatic void ufuncloop_dealloc(PyUFuncLoopObject *);\n\nstatic PyUFuncLoopObject *\nconstruct_loop(PyUFuncObject *self, PyObject *args, PyArrayObject **mps)\n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\t\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\n\n\tif ((loop=PyObject_NEW(PyUFuncLoopObject, &PyUFuncLoop_Type)) == NULL)\n\t\treturn NULL;\n\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n\tloop->buffer[0] = NULL;\n for (i=0; inargs; i++) {\n loop->iters[i] = NULL;\n loop->cast[i] = NULL;\n }\n\tloop->errobj = NULL;\n\n\t/* Setup the matrices */\n\tif (construct_matrices(loop, args, mps) < 0) goto fail;\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString((self->name ? \\\n self->name : \"\")), \n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n\tPyUFunc_clearfperr();\n\n\treturn loop;\n\n fail:\n\tufuncloop_dealloc(loop);\n\treturn NULL;\n}\n\n\n/* \nstatic void\n_printbytebuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing byte buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %d\\n\", *(((byte *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbufptr(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->bufptr[bufnum]))+i));\n\t} \n}\n\n\n \nstatic void\n_printcastbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->castbuf[bufnum]))+i));\n\t} \n}\n\n*/\n\n\n\n\n/* currently generic ufuncs cannot be built for use on flexible arrays.\n\n The cast functions in the generic loop would need to be fixed to pass \n something besides NULL, NULL \n\n*/\n\n/* This generic function is called with the ufunc object, the arguments to it,\n and an array of (pointers to) PyArrayObjects which are NULL. The \n arguments are parsed and placed in mps in construct_loop (construct_matrices)\n*/\n\nstatic int \nPyUFunc_GenericFunction(PyUFuncObject *self, PyObject *args, \n\t\t\tPyArrayObject **mps) \n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\tint temp;\n BEGIN_THREADS_DEF\n\n\tif (!(loop = construct_loop(self, args, mps))) return -1;\n\n\tLOOP_BEGIN_THREADS\n\n\tswitch(loop->meth) {\n\tcase ONE_UFUNCLOOP:\n\t\t/* Everything is contiguous, notswapped, aligned,\n\t\t and of the right type. -- Fastest.\n\t\t Or if not contiguous, then a single-stride\n\t\t increment moves through the entire array. \n\t\t*/\n /* fprintf(stderr, \"ONE...%d\\n\", loop->size);*/\n\t\tloop->function((char **)loop->bufptr, &(loop->size), \n\t\t\t loop->steps, loop->funcdata);\n\t\tUFUNC_CHECK_ERROR();\n\t\tbreak;\n\tcase NOBUFFER_UFUNCLOOP:\n\t\t/* Everything is notswapped, aligned and of the \n\t\t right type but not contiguous. -- Almost as fast.\n\t\t*/\n /* fprintf(stderr, \"NOBUFFER...%d\\n\", loop->size);*/\n\t\twhile (loop->index < loop->size) {\n\t\t\tfor (i=0; inargs; i++) \n\t\t\t\tloop->bufptr[i] = loop->iters[i]->dataptr;\n\n\t\t\tloop->function((char **)loop->bufptr, &(loop->bufcnt),\n\t\t\t\t loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tPyArray_ITER_NEXT(loop->iters[i]);\n\t\t\t}\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\tcase BUFFER_UFUNCLOOP: {\n\t\t/* Make local copies of all loop variables */\n\t\t/* Optimizations needed:\n\t\t 1) move data better into the buffer better\n\t\t --- not one at a time -- this requires some \n pre-analysis and is only possible over \n the largest dimension.\n\t\t*/\n\n\t\tPyArray_CopySwapNFunc *copyswapn[MAX_ARGS];\n\t\tPyArrayIterObject **iters=loop->iters;\n\t\tint *swap=loop->swap;\n\t\tvoid **dptr=loop->dptr;\n\t\tint mpselsize[MAX_ARGS];\n\t\tintp index=loop->index, size=loop->size;\n\t\tint bufcnt=loop->bufcnt, bufsize=loop->bufsize;\n\t\tvoid **bufptr = loop->bufptr;\n\t\tvoid **buffer = loop->buffer;\n\t\tvoid **castbuf = loop->castbuf;\n\t\tintp *steps = loop->steps;\n\t\tBool pyobject[MAX_ARGS];\n\t\t\n\t\tfor (i=0; inargs; i++) {\n\t\t\tcopyswapn[i] = mps[i]->descr->copyswapn;\n\t\t\tmpselsize[i] = mps[i]->itemsize;\n\t\t\tpyobject[i] = (loop->obj && \\\n (mps[i]->descr->type_num == PyArray_OBJECT));\n\t\t}\n\t\t/* Do generic buffered looping here (works for any kind of\n\t\t arrays): Everything uses a buffer. \n\n\t\t 1. fill the input buffers.\n\t\t 2. If buffer is filled then \n\t\t a. cast any input buffers needing it. \n\t\t b. call inner function (which loops over the buffer).\n\t\t\t c. cast any output buffers needing it.\n\t\t\t d. copy output buffer back to output arrays.\n 3. goto next position\n\t\t*/ \n\t\tfprintf(stderr, \"BUFFER...%d\\n\", loop->size);\n\t\t/*\n\t\tfor (i=0; inargs; i++) {\n\t\t\tfprintf(stderr, \"iters[%d]->dataptr = %p, %p of size %d\\n\", i, \n\t\t\t\titers[i], iters[i]->ao->data, PyArray_NBYTES(iters[i]->ao));\n\t\t}\n\t\t*/\n\t\twhile (index < size) {\n\t\t\t/*copy input data */\n\t\t\tfor (i=0; inin; i++) {\n\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\tPy_INCREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t}\n\t\t\t\t/*\t\t\t\tfprintf(stderr, \"index = %d, i=%d, writing to %p\\n\", index, i, dptr[i]); */\n\t\t\t\tmemcpy(dptr[i], iters[i]->dataptr,\n\t\t\t\t mpselsize[i]);\n\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t}\n\t\t\tbufcnt++;\n\t\t\tindex++; \n\t\t\tif ((bufcnt == bufsize) || \\\n\t\t\t (index == size)) {\n\t\t\t\t\n\t\t\t\tfor (i=0; inin; i++) {\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping...\\n\");*/\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](buffer[i],\n\t\t\t\t\t\t\t castbuf[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t\tloop->function((char **)bufptr, \n\t\t\t\t\t &bufcnt, \n\t\t\t\t\t steps, loop->funcdata);\n \n\t\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\t\tfor (i=self->nin; inargs; i++) {\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](castbuf[i],\n\t\t\t\t\t\t\t buffer[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping back...\\n\"); */\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tfor (temp = 0; temp < bufcnt; temp++) {\n\t\t\t\t\t\t/* fprintf(stderr, \"temp=%d, i=%d; reading from %p\\n\", temp, i, dptr[i]);*/\n\t\t\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\t\t\tPy_XDECREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t\t\t\tPy_INCREF(*((PyObject **)dptr[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmemcpy(iters[i]->dataptr,\n\t\t\t\t\t\t dptr[i], mpselsize[i]);\n\t\t\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbufcnt = 0;\n\t\t\t\tfor (i=0; inargs; i++) \n\t\t\t\t\tdptr[i] = buffer[i];\n\t\t\t\t\n\t\t\t} \n\t\t}\n\t}\n\t}\t\n\t\n LOOP_END_THREADS\n\t\n Py_DECREF(loop);\n\treturn 0;\n\n fail:\n LOOP_END_THREADS\n \n\tPy_XDECREF(loop);\n\treturn -1;\n }\n\nstatic PyArrayObject *\n_getidentity(PyUFuncObject *self, int otype, char *str)\n{\n PyObject *obj, *arr;\n PyArray_Typecode typecode = {otype, 0, 0};\n\n if (self->identity == PyUFunc_None) {\n PyErr_Format(PyExc_ValueError, \n \"zero-size array to ufunc.%s \" \\\n \"without identity\", str);\n return NULL;\n }\n if (self->identity == PyUFunc_One) {\n obj = PyInt_FromLong((long) 1);\n } else {\n obj = PyInt_FromLong((long) 0);\n }\n\t\n arr = PyArray_FromAny(obj, &typecode, 0, 0, CARRAY_FLAGS);\n Py_DECREF(obj);\n return (PyArrayObject *)arr;\n}\n\nstatic int\n_create_reduce_copy(PyUFuncReduceObject *loop, PyArrayObject **arr, int rtype)\n{\n\tintp maxsize;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {rtype, 0, 0};\n\t\n\tmaxsize = PyArray_SIZE(*arr);\n\t\n\tif (maxsize < loop->bufsize) {\n\t\tif (!(PyArray_ISBEHAVED_RO(*arr)) ||\t\\\n\t\t PyArray_TYPE(*arr) != rtype) {\n\t\t\tnew = PyArray_FromAny((PyObject *)(*arr), \n\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t FORCECAST |\t\t\\\n\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\tif (new == NULL) return -1;\n\t\t\t*arr = (PyArrayObject *)new;\n\t\t\tloop->decref = new;\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\n\n\nstatic PyTypeObject PyUFuncReduce_Type;\n\nstatic void ufuncreduce_dealloc(PyUFuncReduceObject *);\n\nstatic PyUFuncReduceObject *\nconstruct_reduce(PyUFuncObject *self, PyArrayObject **arr, int axis, \n\t\t int otype, int operation, intp ind_size, char *str)\n{\n PyUFuncReduceObject *loop;\n PyArrayObject *idarr;\n\tPyArrayObject *aar;\n intp loop_i[MAX_DIMS];\n int arg_types[3] = {otype, otype, otype};\n\tchar scalars[3] = {UFUNC_NOSCALAR, UFUNC_NOSCALAR, UFUNC_NOSCALAR};\n\tint i, j;\n\tint nd = (*arr)->nd;\n\t/* Reduce type is the type requested of the input \n\t during reduction */\n\n\tif ((loop=PyObject_NEW(PyUFuncReduceObject, \n\t\t\t &PyUFuncReduce_Type)) == NULL)\n\t\treturn NULL;\n\n\n loop->swap = 0;\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n loop->cast = NULL;\n loop->buffer = NULL;\n loop->ret = NULL;\n\tloop->it = NULL;\n\tloop->rit = NULL;\n\tloop->errobj = NULL;\n\tloop->decref=NULL; \n loop->N = (*arr)->dimensions[axis];\n\tloop->instrides = (*arr)->strides[axis];\n\n\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t &(loop->funcdata), scalars) == -1) goto fail; \n\t\n\t/* output type may change -- if it does \n\t reduction is forced into that type \n\t and we need to select the reduction function again\n\t*/\n\tif (otype != arg_types[2]) {\n\t\totype = arg_types[2];\n\t\targ_types[0] = otype;\n\t\targ_types[1] = otype;\n\t\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t\t &(loop->funcdata), scalars) == -1) \n\t\t\tgoto fail; \t\t\n\t}\n\n\t/* Make bufsize depend on a local then module-level variable */\n\tloop->bufsize = _getintfromvar(\"UFUNC_BUFSIZE\", \n\t\t\t\t PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"The buffer size (%d) is not \"\t\\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\tgoto fail;\n\t}\n\t\n\t/* Make copy if misbehaved or not otype for small arrays */\n\tif (_create_reduce_copy(loop, arr, otype) < 0) goto fail; \n\taar = *arr;\n\t\n if (loop->N == 0) {\n loop->meth = ZERODIM_REDUCELOOP;\n }\n else if (PyArray_ISBEHAVED_RO(aar) &&\t\t\\\n otype == (aar)->descr->type_num) {\n\t\tif (loop->N == 1) {\n\t\t\tloop->meth = ONEDIM_REDUCELOOP;\n\t\t}\n\t\telse {\n\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\tloop->steps[0] = (aar)->strides[axis];\n\t\t\tloop->N -= 1;\n\t\t}\n }\n else {\n loop->meth = BUFFER_UFUNCLOOP;\n loop->swap = !(PyArray_ISNOTSWAPPED(aar));\n }\n\n if (loop->meth == ZERODIM_REDUCELOOP) {\n idarr = _getidentity(self, otype, str);\n if (idarr == NULL) goto fail;\n if (idarr->itemsize > UFUNC_MAXIDENTITY) {\n PyErr_Format(PyExc_RuntimeError, \n\t\t\t\t \"UFUNC_MAXIDENTITY (%d)\"\t\t\\\n \" is too small (needs to be at least %d)\",\n UFUNC_MAXIDENTITY, idarr->itemsize);\n Py_DECREF(idarr);\n goto fail;\n }\n memcpy(loop->idptr, idarr->data, idarr->itemsize);\n Py_DECREF(idarr);\n }\n\t\n /* Construct return array */\n\tswitch(operation) {\n\tcase UFUNC_REDUCE:\n\t\tfor (j=0, i=0; idimensions[i];\n\t\t\t\n\t\t}\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd-1, loop_i, otype, \n\t\t\t\t NULL, NULL, 0, 0, aar);\n\t\tbreak;\n\tcase UFUNC_ACCUMULATE:\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, aar->dimensions, \n\t\t\t\t otype, NULL, NULL, 0, 0, aar);\n\t\tbreak;\n\tcase UFUNC_REDUCEAT:\n\t\tmemcpy(loop_i, aar->dimensions, nd*sizeof(intp));\n\t\t/* Index is 1-d array */\n\t\tloop_i[axis] = ind_size; \n\t\tloop->ret = (PyArrayObject *)\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, loop_i, otype,\n\t\t\t\t NULL, NULL, 0, 0, aar);\n\t\tif (loop->ret == NULL) goto fail;\n\t\tif (ind_size == 0) {\n\t\t\tloop->meth = ZERODIM_REDUCELOOP;\n\t\t\treturn loop;\n\t\t}\n\t\tif (loop->meth == ONEDIM_REDUCELOOP)\n\t\t\tloop->meth = NOBUFFER_REDUCELOOP;\n\t\tbreak;\n\t}\n if (loop->ret == NULL) goto fail;\n loop->insize = aar->itemsize;\n loop->outsize = loop->ret->itemsize;\n loop->bufptr[1] = loop->ret->data;\n\n\tif (loop->meth == ZERODIM_REDUCELOOP) {\n\t\tloop->size = PyArray_SIZE(loop->ret);\n\t\treturn loop;\n\t}\n\n\tloop->it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)aar);\n if (loop->it == NULL) return NULL;\n\n\tif (loop->meth == ONEDIM_REDUCELOOP) {\n\t\tloop->size = loop->it->size;\t\t\n\t\treturn loop;\n\t}\n\n /* Fix iterator to loop over correct dimension */\n\t/* Set size in axis dimension to 1 */\n \n loop->it->contiguous = 0;\n loop->it->size /= (loop->it->dims_m1[axis]+1);\n loop->it->dims_m1[axis] = 0;\n loop->it->backstrides[axis] = 0;\n\n\n loop->size = loop->it->size;\n\n\tif (operation == UFUNC_REDUCE) {\n\t\tloop->steps[1] = 0;\n\t}\n\telse {\n\t\tloop->rit = (PyArrayIterObject *)\t\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)(loop->ret));\n\t\tif (loop->rit == NULL) return NULL;\t\t\n\n\t\t/* Fix iterator to loop over correct dimension */\n\t\t/* Set size in axis dimension to 1 */\n\t\t\n\t\tloop->rit->contiguous = 0;\n\t\tloop->rit->size /= (loop->rit->dims_m1[axis]+1);\n\t\tloop->rit->dims_m1[axis] = 0;\n\t\tloop->rit->backstrides[axis] = 0;\n\n\t\tif (operation == UFUNC_ACCUMULATE)\n\t\t\tloop->steps[1] = loop->ret->strides[axis];\n\t\telse \n\t\t\tloop->steps[1] = 0;\n\t}\n\tloop->steps[2] = loop->steps[1];\n\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[2];\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\n\t\tloop->steps[0] = loop->outsize;\n if (otype != aar->descr->type_num) {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n (loop->outsize + \\\n aar->itemsize));\n if (loop->buffer == NULL) goto fail;\n loop->castbuf = loop->buffer + \\\n loop->bufsize*aar->itemsize;\n loop->bufptr[0] = loop->castbuf; \n loop->cast = aar->descr->cast[otype];\n }\n else {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n loop->outsize);\n if (loop->buffer == NULL) goto fail;\n loop->bufptr[0] = loop->buffer;\n }\n\t}\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \\\n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t\t\t \n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString(str),\n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n /* Determine if object arrays are involved */\n if (otype == PyArray_OBJECT || aar->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n else\n loop->obj = 0;\n\n\tPyUFunc_clearfperr();\n\treturn loop;\n\n fail:\n ufuncreduce_dealloc(loop);\n\treturn NULL;\t\n}\n\n\n/* We have two basic kinds of loops */\n/* One is used when arr is not-swapped and aligned and output type\n is the same as input type.\n and another using buffers when one of these is not satisfied.\n\n Zero-length and one-length axes-to-be-reduced are handled separately.\n*/\n\nstatic PyObject *\nPyUFunc_Reduce(PyUFuncObject *self, PyArrayObject *arr, int axis, int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n BEGIN_THREADS_DEF\n \t\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCE, 0,\n\t\t\t\t\"reduce\");\n\tif (!loop) return NULL;\n\n LOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP:\n\t\t/*fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP:\n\t\t/*fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it)\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1];\n loop->index++; \n\t\t\tif (PyErr_Occurred()) goto fail;\n }\n break;\n case BUFFER_UFUNCLOOP:\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy first item over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %d\\n\", loop->size, \n\t\t loop->swap); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1]; \n loop->index++;\n }\n }\n\n LOOP_END_THREADS\n\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n LOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n\nstatic PyObject *\nPyUFunc_Accumulate(PyUFuncObject *self, PyArrayObject *arr, int axis, \n\t\t int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n \n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_ACCUMULATE, 0,\n\t\t\t\t\"accumulate\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n break;\n case BUFFER_UFUNCLOOP: /* Accumulate */\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy identity over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %p\\n\", loop->size, \n\t\t loop->cast); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n }\n\n\tLOOP_END_THREADS\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n\tLOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n/* Reduceat performs a reduce over an axis using the indices as a guide\n\nop.reduceat(array,indices) computes\nop.reduce(array[indices[i]:indices[i+1]] \n for i=0..end with an implicit indices[i+1]=len(array)\n assumed when i=end-1\n\nif indices[i+1] <= indices[i]+1 \n then the result is array[indices[i]] for that value\n\nop.accumulate(array) is the same as\nop.reduceat(array,indices)[::2]\nwhere indices is range(len(array)-1) with a zero placed in every other sample\n indices = zeros(len(array)*2-1)\n indices[1::2] = range(1,len(array))\n\noutput shape is based on the size of indices\n */\n\nstatic PyObject *\nPyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, \n int axis, int otype)\n{\t\n\tPyArrayObject *ret;\n PyUFuncReduceObject *loop;\n\tintp *ptr=(intp *)ind->data;\n\tintp nn=ind->dimensions[0];\t\t\n\tintp mm=arr->dimensions[axis]-1;\n\tintp n, i;\n\tint j;\n\tchar *dptr;\n\n\t/* Check for out-of-bounds values in indices array */\t\t\n\tfor (i=0; i mm)) {\n\t\t\tPyErr_Format(PyExc_IndexError, \n\t\t\t\t \"index out-of-bounds (0, %d)\", mm);\n\t\t\treturn NULL;\n\t\t}\n\t\tptr++;\n\t}\n\t\n\tptr = (intp *)ind->data;\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCEAT, nn,\n\t\t\t\t\"reduceat\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n\tswitch(loop->meth) {\n\t/* zero-length index -- return array immediately */\n\tcase ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..\\n\"); */\n\t\tbreak;\n\n\t/* NOBUFFER -- behaved array and same type */\n\tcase NOBUFFER_UFUNCLOOP: \t /* Reduceat */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[0] = loop->it->dataptr +\t\\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\tmemcpy(loop->bufptr[1], loop->bufptr[0],\n\t\t\t\t loop->outsize);\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis]-*ptr : \\\n\t\t\t\t *(ptr+1) - *ptr) - 1;\n\t\t\t\tif (mm > 0) {\n\t\t\t\t\tloop->bufptr[0] += loop->instrides;\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &mm, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t}\t\n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\n\t/* BUFFER -- misbehaved array or different types */ \n\tcase BUFFER_UFUNCLOOP: /* Reduceat */\n\t\t/* fprintf(stderr, \"BUFFERED..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[1], loop->idptr, \n\t\t\t\t loop->outsize);\n\t\t\t\tn = 0;\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis] - *ptr :\\\n\t\t\t\t *(ptr+1) - *ptr);\n\t\t\t\tif (mm < 1) mm = 1;\n\t\t\t\tloop->inptr = loop->it->dataptr + \\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\twhile (n < mm) {\n\t\t\t\t\t/* Copy up to loop->bufsize elements\n\t\t\t\t\t to buffer */\n\t\t\t\t\tdptr = loop->buffer;\n\t\t\t\t\tfor (j=0; jbufsize; j++, n++) {\n\t\t\t\t\t\tif (n == mm) break;\n\t\t\t\t\t\tarr->descr->copyswap\\\n\t\t\t\t\t\t\t(dptr,\n\t\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t\t loop->insize);\n\t\t\t\t\t\tloop->inptr += loop->instrides;\n\t\t\t\t\t\tdptr += loop->insize;\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast)\n\t\t\t\t\t\tloop->cast(loop->buffer,\n\t\t\t\t\t\t\t loop->castbuf,\n\t\t\t\t\t\t\t j, NULL, NULL);\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &j, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t} \n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\t}\n\n\tLOOP_END_THREADS\n\t\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\t\n fail:\n\tLOOP_END_THREADS\n\n\tPy_XDECREF(loop);\n\treturn NULL;\n}\n\n\n/* This code handles reduce, reduceat, and accumulate \n (accumulate and reduce are special cases of the more general reduceat \n but they are handled separately for speed) \n*/\n\nstatic PyObject * \nPyUFunc_GenericReduction(PyUFuncObject *self, PyObject *args, \n PyObject *kwds, int operation) \n{\n\tint axis=0;\n\tPyArrayObject *mp, *ret = NULL;\n\tPyObject *op, *res=NULL;\n\tPyObject *obj_ind; \n\tPyArrayObject *indices = NULL;\n\tPyArray_Typecode otype= {PyArray_NOTYPE, 0, 0};\n PyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tstatic char *kwlist1[] = {\"array\", \"axis\", \"rtype\", NULL};\n\tstatic char *kwlist2[] = {\"array\", \"indices\", \"axis\", \"rtype\", NULL}; \n static char *_reduce_type[] = {\"reduce\", \"accumulate\", \\\n\t\t\t\t \"reduceat\", NULL};\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\t\n\n\tif (self->nin != 2) {\n\t\tPyErr_Format(PyExc_ValueError, \n \"%s only supported for binary functions\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\tif (self->nout != 1) {\n\t\tPyErr_Format(PyExc_ValueError,\n \"%s only supported for functions \" \\\n \"returning a single value\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\n\tif (operation == UFUNC_REDUCEAT) {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|iO&\", kwlist2, \n\t\t\t\t\t\t&op, &obj_ind, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n indices = (PyArrayObject *)PyArray_FromAny(obj_ind, &indtype, \n\t\t\t\t\t\t\t 1, 1, CARRAY_FLAGS);\n if (indices == NULL) return NULL;\n\n\t}\n\telse {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|iO&\", kwlist1,\n\t\t\t\t\t\t&op, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n\t}\n\t\n\t/* Ensure input is an array */\t\n\tmp = (PyArrayObject *)PyArray_FromAny(op, NULL, 0, 0, 0);\n\tif (mp == NULL) return NULL;\n\n /* Check to see if input is zero-dimensional */\n if (mp->nd == 0) {\n PyErr_Format(PyExc_ValueError, \"cannot %s on a scalar\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL; \n }\n\n /* Check to see that type (and otype) is not FLEXIBLE */\n\tif (PyArray_ISFLEXIBLE(mp) || PyTypeNum_ISFLEXIBLE(otype.type_num)) {\n PyErr_Format(PyExc_ValueError, \n\t\t\t \"cannot perform %s with flexible type\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL;\n }\n\n\tif (axis < 0) axis += mp->nd;\n\tif (axis < 0 || axis >= mp->nd) {\n\t\tPyErr_SetString(PyExc_ValueError, \"axis not in array\");\n Py_DECREF(mp);\n\t\treturn NULL;\n\t}\n\n\n if (otype.type_num == PyArray_NOTYPE)\n otype.type_num = mp->descr->type_num;\n\n switch(operation) {\n case UFUNC_REDUCE:\n ret = (PyArrayObject *)PyUFunc_Reduce(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_ACCUMULATE:\n ret = (PyArrayObject *)PyUFunc_Accumulate(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_REDUCEAT:\n ret = (PyArrayObject *)PyUFunc_Reduceat(self, mp, indices, \n axis, otype.type_num);\n Py_DECREF(indices);\n\t\tbreak;\n }\n Py_DECREF(mp);\n\tif (ret==NULL) return NULL;\n\tif (op->ob_type != ret->ob_type) {\n\t\tres = PyObject_CallMethod(op, \"__array_wrap__\", \"O\", ret);\n\t}\n\tif (res == NULL) PyErr_Clear();\n\telse if (res == Py_None) Py_DECREF(res);\n\telse {\n\t\tPy_DECREF(ret);\n\t\treturn res;\n\t}\t\n\treturn PyArray_Return(ret);\n\t\n}\n\n\n\n/* ---------- */\n\nstatic PyObject *\n_find_array_wrap(PyObject *args)\n{\n\tint nargs, i;\n\tint np = 0;\n\tint argmax = 0;\n\tint val;\n\tdouble priority[MAX_ARGS];\n\tdouble maxpriority = PyArray_SUBTYPE_PRIORITY;\n\tPyObject *with_wrap[MAX_ARGS];\n\tPyObject *attr;\n\tPyObject *obj;\n\n\tnargs = PyTuple_Size(args);\n\tfor (i=0; i maxpriority) {\n\t\t\tmaxpriority = priority[i];\n\t\t\targmax = i;\n\t\t}\n\t}\n\n\treturn with_wrap[argmax];\n}\n\nstatic PyObject *\nufunc_generic_call(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyTupleObject *ret;\n\tPyArrayObject *mps[MAX_ARGS];\n\tPyObject *retobj[MAX_ARGS];\n\tPyObject *res;\n\tPyObject *obj;\n\t\n\t/* Initialize all array objects to NULL to make cleanup easier \n\t if something goes wrong. */\n\tfor(i=0; inargs; i++) mps[i] = NULL;\n\t\n\tif (PyUFunc_GenericFunction(self, args, mps) == -1) {\n\t\tfor(i=0; inargs; i++) Py_XDECREF(mps[i]);\n\t\treturn NULL;\n\t}\n\t\n\tfor(i=0; inin; i++) Py_DECREF(mps[i]);\n\n\t/* Use __array_wrap__ on all outputs \n\t if present on one of the input arguments.\n\t If present for multiple inputs:\n\t use __array_wrap__ of input object with largest \n\t\t__array_priority__ (default = 0.0)\n\t */\n\tobj = _find_array_wrap(args);\n\t\n\t/* wrap outputs */\n\tfor (i=0; inout; i++) {\n\t\tint j=self->nin+i;\n\t\t/* check to see if any UPDATEIFCOPY flags are set \n\t\t which meant that a temporary output was generated \n\t\t*/\n\t\tif (mps[j]->flags & UPDATEIFCOPY) {\n\t\t\tPyObject *old = mps[j]->base;\n\t\t\tPy_INCREF(old); /* we want to hang on to this */\n\t\t\tPy_DECREF(mps[j]); /* should trigger the copy \n\t\t\t\t\t back into old */\n\t\t\tmps[j] = (PyArrayObject *)old;\n\t\t}\n\t\tif (obj != NULL) {\n\t\t\tres = PyObject_CallMethod(obj, \"__array_wrap__\",\n\t\t\t\t\t\t \"O\", mps[j]);\n\t\t\tif (res == NULL) PyErr_Clear();\n\t\t\telse if (res == Py_None) Py_DECREF(res);\n\t\t\telse {\n\t\t\t\tPy_DECREF(mps[j]);\n\t\t\t\tretobj[i] = res;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tretobj[i] = PyArray_Return(mps[j]);\n\t}\n\t\n\tif (self->nout == 1) { \n\t\treturn retobj[0];\n\t} else { \n\t\tret = (PyTupleObject *)PyTuple_New(self->nout);\n\t\tfor(i=0; inout; i++) {\n\t\t\tPyTuple_SET_ITEM(ret, i, retobj[i]);\n\t\t}\n\t\treturn (PyObject *)ret;\n\t}\t\n\n}\n\nstatic PyUFuncGenericFunction pyfunc_functions[] = {PyUFunc_On_Om};\n\nstatic char \ndoc_frompyfunc[] = \"frompyfunc(func, nin, nout) take an arbitrary python function that takes nin objects as input and returns nout objects and return a universal function (ufunc). This ufunc always returns PyObject arrays\";\n\nstatic PyObject *\nufunc_frompyfunc(PyObject *dummy, PyObject *args, PyObject *kwds) {\n /* Keywords are ignored for now */\n \n PyObject *function, *pyname=NULL;\n int nin, nout, i;\n PyUFunc_PyFuncData *fdata;\n PyUFuncObject *self;\n char *fname, *str;\n int fname_len=-1;\n\n if (!PyArg_ParseTuple(args, \"Oii\", &function, &nin, &nout)) return NULL;\n\n if (!PyCallable_Check(function)) {\n PyErr_SetString(PyExc_TypeError, \"Function must be callable.\");\n return NULL;\n }\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\n\tself->userloops = NULL;\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = PyUFunc_None;\t\n\tself->functions = pyfunc_functions;\n\n\tself->ntypes = 1;\n\tself->check_return = 0;\n\n pyname = PyObject_GetAttrString(function, \"__name__\");\n if (pyname)\n (void) PyString_AsStringAndSize(pyname, &fname, &fname_len);\n \n if (PyErr_Occurred()) {\n fname = \"?\";\n fname_len = 1;\n PyErr_Clear();\n } \n Py_XDECREF(pyname);\n\n\n self->ptr = malloc((self->nargs)+sizeof(PyUFunc_PyFuncData)+sizeof(void *)+(fname_len+14));\n \n\tif (self->ptr == NULL) return PyErr_NoMemory();\n Py_INCREF(function);\n self->obj = function;\n\tfdata = (PyUFunc_PyFuncData *)(self->ptr + (nin+nout) + sizeof(void *));\n fdata->nin = nin;\n fdata->nout = nout;\n fdata->callable = function;\n \n self->data = (void **)(self->ptr + (nin+nout));\n self->data[0] = (void *)fdata;\n\n\n\tself->types = (char *)self->ptr;\n for (i=0; inargs; i++) self->types[i] = PyArray_OBJECT;\n\n str = (char *)(fdata + 1);\n memcpy(str, fname, fname_len);\n memcpy(str+fname_len, \" (vectorized)\", 14);\n \n self->name = str;\n\n /* Do a better job someday */\n self->doc = \"dynamic ufunc based on a python function\";\n \n\t\n\treturn (PyObject *)self;\n}\n\n\nstatic PyObject *\nPyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void **data, \n\t\t\tchar *types, int ntypes,\n\t\t\tint nin, int nout, int identity, \n\t\t\tchar *name, char *doc, int check_return) \n{\n\tPyUFuncObject *self;\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = identity;\n\t\n\tself->functions = func;\n\tself->data = data;\n\tself->types = types;\n\tself->ntypes = ntypes;\n\tself->check_return = check_return;\n self->ptr = NULL;\n self->obj = NULL;\n\tself->userloops=NULL;\n\t\n\tif (name == NULL) self->name = \"?\";\n\telse self->name = name;\n\t\n if (doc == NULL) self->doc = \"NULL\";\n\telse self->doc = doc;\n\t\n\treturn (PyObject *)self;\n}\n\nstatic int\nPyUFunc_RegisterLoopForType(PyUFuncObject *ufunc, \n\t\t\t int usertype,\n\t\t\t PyUFuncGenericFunction function,\n\t\t\t void *data)\n{\n\tPyArray_Descr *descr=PyArray_DescrFromType(usertype);\n \tPyObject *key, *cobj;\n\tint ret;\t\n\t\n\tif ((usertype < PyArray_USERDEF) || (descr==NULL)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Cannot register typenumber\");\n\t\treturn -1;\n\t}\n\tif (ufunc->userloops == NULL) {\n\t\tufunc->userloops = PyDict_New();\n\t}\n\tkey = PyInt_FromLong(usertype);\n\tif (key == NULL) return -1;\n\tcobj = PyCObject_FromVoidPtr((void *)function, NULL);\n\tif (cobj == NULL) {Py_DECREF(key); return -1;}\n\tif (data == NULL) {\n\t\tret = PyDict_SetItem(ufunc->userloops, key, cobj);\n\t\tPy_DECREF(cobj);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n\telse {\n\t\tPyObject *cobj2, *tmp;\n\t\tcobj2 = PyCObject_FromVoidPtr(data, NULL);\n\t\tif (cobj2 == NULL) {\n\t\t\tPy_DECREF(cobj); \n\t\t\tPy_DECREF(key);\n\t\t\treturn -1;\n\t\t}\n\t\ttmp=Py_BuildValue(\"NN\", cobj, cobj2);\n\t\tret = PyDict_SetItem(ufunc->userloops, key, tmp);\n\t\tPy_DECREF(tmp);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n}\n\nstatic void\nufuncreduce_dealloc(PyUFuncReduceObject *self)\n{\n if (self->ufunc) {\n Py_XDECREF(self->it);\n\t\tPy_XDECREF(self->rit);\n Py_XDECREF(self->ret);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_XDECREF(self->decref);\n if (self->buffer) free(self->buffer);\n Py_DECREF(self->ufunc);\n }\n PyObject_DEL(self);\n}\n\nstatic void\nufuncloop_dealloc(PyUFuncLoopObject *self)\n{\n\tint i;\n\t\n\tif (self->ufunc != NULL) {\n\t\tfor (i=0; iufunc->nargs; i++)\n\t\t\tPy_XDECREF(self->iters[i]);\n\t\tif (self->buffer[0]) free(self->buffer[0]);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_DECREF(self->ufunc);\n\t}\n\tPyObject_DEL(self);\n}\n\n\nstatic void\nufunc_dealloc(PyUFuncObject *self)\n{\n if (self->ptr) free(self->ptr);\n\tPy_XDECREF(self->userloops);\n Py_XDECREF(self->obj);\n\tPyObject_DEL(self);\n}\n\nstatic PyObject *\nufunc_repr(PyUFuncObject *self)\n{\n\tchar buf[100];\n\t\n\tsprintf(buf, \"\", self->name);\n\t\n\treturn PyString_FromString(buf);\n}\n\n\n/* -------------------------------------------------------- */\n\n/* op.outer(a,b) is equivalent to op(a[:,NewAxis,NewAxis,etc.],b)\n where a has b.ndim NewAxis terms appended.\n\n The result has dimensions a.ndim + b.ndim\n */\n\nstatic PyObject *\nufunc_outer(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyObject *ret;\n\tPyArrayObject *ap1=NULL, *ap2=NULL, *ap_new=NULL;\n\tPyObject *new_args, *tmp;\n\tPyObject *shape1, *shape2, *newshape;\n\n\tif(self->nin != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"outer product only supported \"\\\n\t\t\t\t\"for binary functions\");\n\t\treturn NULL;\n\t}\n\t\n\tif (PySequence_Length(args) != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"exactly two arguments expected\");\n\t\treturn NULL;\n\t}\n\t\n\ttmp = PySequence_GetItem(args, 0);\n\tif (tmp == NULL) return NULL;\n\tap1 = (PyArrayObject *)\t\t\t\t\t\\\n\t\tPyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap1 == NULL) return NULL;\n\t\n\ttmp = PySequence_GetItem(args, 1);\n\tif (tmp == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap2 == NULL) {Py_DECREF(ap1); return NULL;}\n\n\t/* Construct new shape tuple */\n\tshape1 = PyTuple_New(ap1->nd);\n\tif (shape1 == NULL) goto fail;\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape1, i, \n\t\t\t\t PyLong_FromLongLong((longlong)ap1->\t\\\n\t\t\t\t\t\t dimensions[i]));\n\t\n\tshape2 = PyTuple_New(ap2->nd);\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape2, i, PyInt_FromLong((long) 1));\n\tif (shape2 == NULL) {Py_DECREF(shape1); goto fail;}\n\tnewshape = PyNumber_Add(shape1, shape2);\n\tPy_DECREF(shape1);\n\tPy_DECREF(shape2);\n\tif (newshape == NULL) goto fail;\n\t\n\tap_new = (PyArrayObject *)PyArray_Reshape(ap1, newshape);\n\tPy_DECREF(newshape);\n\tif (ap_new == NULL) goto fail;\n\t\n\tnew_args = Py_BuildValue(\"(OO)\", ap_new, ap2);\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\tPy_DECREF(ap_new);\t\n\tret = ufunc_generic_call(self, new_args);\n\tPy_DECREF(new_args);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ap_new);\n\treturn NULL;\n\n}\n\n\nstatic PyObject *\nufunc_reduce(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCE);\n}\n\nstatic PyObject *\nufunc_accumulate(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_ACCUMULATE);\n}\n\nstatic PyObject *\nufunc_reduceat(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCEAT);\n}\n\n\nstatic struct PyMethodDef ufunc_methods[] = {\n\t{\"reduce\", (PyCFunction)ufunc_reduce, METH_VARARGS | METH_KEYWORDS},\n\t{\"accumulate\", (PyCFunction)ufunc_accumulate, \n\t METH_VARARGS | METH_KEYWORDS},\n\t{\"reduceat\", (PyCFunction)ufunc_reduceat, \n\t METH_VARARGS | METH_KEYWORDS},\t\n\t{\"outer\", (PyCFunction)ufunc_outer, METH_VARARGS},\n\t{NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\n\n/* construct the string\n y1,y2,...,yn\n*/\n\nstatic void\n_makeargs(int num, char ltr, char *str) \n{\n\tint ind=0;\n\tint k;\n\tstatic char *digits=\"123456789ABCDE\";\n\n\tif (num == 1) {\n\t\tstr[0] = ltr;\n\t\tind = 1;\n\t}\n\telse {\n\t\tfor (k=0; ktype)\n\nstatic PyObject *\nufunc_getattr(PyUFuncObject *self, char *name)\n{\n\tPyObject *obj;\n\t/* Put docstring first or FindMethod finds it...*/\n\t/* could so some introspection on name and nin + nout */\n\t/* to automate the first part of it */\n\t/* the doc string shouldn't need the calling convention */\n\tif (strcmp(name, \"__doc__\") == 0) {\n\t\tstatic char doc[256];\n\t\tstatic char tmp1[3*MAX_ARGS+2];\n\t\tstatic char tmp2[3*MAX_ARGS+2];\n\t\t/* construct \n\t\t y1,y2,,... = name(x1,x2,...) __doc__\n\t\t*/\t\t\n\t\t_makeargs(self->nout, 'y', tmp1);\n\t\t_makeargs(self->nin, 'x', tmp2);\n\t\tsnprintf(doc, 256, \"%s = %s(%s) %s\", tmp1, self->name, \n\t\t\t tmp2, self->doc);\n\t\treturn PyString_FromString(doc);\n\t}\n\tobj = Py_FindMethod(ufunc_methods, (PyObject *)self, name);\n\tif (obj != NULL) return obj;\n\tPyErr_Clear();\n\tif (strcmp(name, \"nin\") == 0) {\n\t\treturn PyInt_FromLong(self->nin);\n\t}\n\telse if (strcmp(name, \"nout\") == 0) {\n\t\treturn PyInt_FromLong(self->nout);\n\t}\n\telse if (strcmp(name, \"nargs\") == 0) {\n\t\treturn PyInt_FromLong(self->nargs);\n\t}\n\telse if (strcmp(name, \"ntypes\") == 0) {\n\t\treturn PyInt_FromLong(self->ntypes);\n\t}\n\telse if (strcmp(name, \"types\") == 0) {\n\t\t/* return a list with types grouped\n\t\t input->output */\n\t\tPyObject *list;\n\t\tPyObject *str;\n\t\tint k, j, n, nt=self->ntypes;\n\t\tint ni = self->nin;\n\t\tint no = self->nout;\n\t\tchar *t;\n\t\tlist = PyList_New(nt);\n\t\tif (list == NULL) return NULL;\n\t\tt = malloc(no+ni+2);\n\t\tn = 0;\n\t\tfor (k=0; ktypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tt[ni] = '-';\n\t\t\tt[ni+1] = '>';\n\t\t\tfor (j=0; jtypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tstr = PyString_FromStringAndSize(t, no+ni+2);\n\t\t\tPyList_SET_ITEM(list, k, str);\n\t\t}\n\t\tfree(t);\n\t\treturn list;\n\t\t\n\t}\n\telse if (strcmp(name, \"__name__\") == 0) {\n\t\treturn PyString_FromString(self->name);\n\t}\n\telse if (strcmp(name, \"identity\") == 0) {\n\t\tswitch(self->identity) {\n\t\tcase PyUFunc_One:\n\t\t\treturn PyInt_FromLong(1);\n\t\tcase PyUFunc_Zero:\n\t\t\treturn PyInt_FromLong(0);\n\t\tdefault:\n\t\t\tPy_INCREF(Py_None);\n\t\t\treturn Py_None;\n\t\t}\n\t}\n\tPyErr_SetString(PyExc_AttributeError, name);\n\treturn NULL;\n}\n\n#undef _typecharfromnum\n\nstatic int\nufunc_setattr(PyUFuncObject *self, char *name, PyObject *v) \n{\n\treturn -1;\n}\n\nstatic char Ufunctype__doc__[] = \n\t\"Optimized functions make it possible to implement arithmetic \"\\\n\t\"with arrays efficiently\";\n\nstatic PyTypeObject PyUFunc_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufunc\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncObject),\t\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufunc_dealloc,\t/*tp_dealloc*/\n\t(printfunc)0,\t\t /*tp_print*/\n\t(getattrfunc)ufunc_getattr,\t/*tp_getattr*/\n\t(setattrfunc)ufunc_setattr,\t/*tp_setattr*/\n\t(cmpfunc)0,\t \t/*tp_compare*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_repr*/\n\t0,\t\t\t /*tp_as_number*/\n\t0,\t\t /*tp_as_sequence*/\n\t0,\t\t /*tp_as_mapping*/\n\t(hashfunc)0,\t\t/*tp_hash*/\n\t(ternaryfunc)ufunc_generic_call,\t\t/*tp_call*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_str*/\n\t\t\n\t/* Space for future expansion */\n\t0L,0L,0L,0L,\n\tUfunctype__doc__ /* Documentation string */\n};\n\nstatic PyTypeObject PyUFuncLoop_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncloop\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncLoopObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncloop_dealloc\t/*tp_dealloc*/\n};\n\nstatic PyTypeObject PyUFuncReduce_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncreduce\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncReduceObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncreduce_dealloc\t/*tp_dealloc*/\n};\n\n\n/* End of code for ufunc objects */\n/* -------------------------------------------------------- */\n", "source_code_before": "\n/*\n Python Universal Functions Object -- Math for all types, plus fast \n arrays math\n \n Full description\n \n This supports mathematical (and Boolean) functions on arrays and other python\n objects. Math on large arrays of basic C types is rather efficient.\n\n Travis E. Oliphant (2005)\n Assistant Professor\n Brigham Young University\n\n based on the \n\n Original Implementation: \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n with inspiration and code from\n Numarray\n Space Science Telescope Institute\n J. Todd Miller\n Perry Greenfield\n \n*/\n\n\ntypedef double (DoubleBinaryFunc)(double x, double y);\ntypedef float (FloatBinaryFunc)(float x, float y);\ntypedef longdouble (LongdoubleBinaryFunc)(longdouble x, longdouble y);\n\ntypedef void (CdoubleBinaryFunc)(cdouble *x, cdouble *y, cdouble *res);\ntypedef void (CfloatBinaryFunc)(cfloat *x, cfloat *y, cfloat *res);\ntypedef void (ClongdoubleBinaryFunc)(clongdouble *x, clongdouble *y, \\\n\t\t\t\t clongdouble *res);\n\nstatic void\nPyUFunc_ff_f_As_dd_d(char **args, intp *dimensions, intp *steps, void *func)\n{\n\tregister intp i, n=dimensions[0];\n\tintp is1=steps[0],is2=steps[1],os=steps[2];\n\tchar *ip1=args[0], *ip2=args[1], *op=args[2];\n\t\n\tfor(i=0; inin, nout=data->nout;\n int ntot;\n PyObject *tocall = data->callable; \n char *ptrs[MAX_ARGS];\n PyObject *arglist, *result;\n PyObject *in, **op;\n\n ntot = nin+nout;\n\n for (j=0; j < ntot; j++) ptrs[j] = args[j];\n\tfor(i=0; i> UFUNC_SHIFT_##NAME, \\\n\t\t\t\t\t errobj, str, retstatus) < 0) \\\n\t\t\t\treturn -1;\t\t \\\n\t\t\t}}\n\n\tif (errmask && retstatus) {\n\t\tHANDLEIT(DIVIDEBYZERO, \"divide by zero\");\n\t\tHANDLEIT(OVERFLOW, \"overflow\");\n\t\tHANDLEIT(UNDERFLOW, \"underflow\");\n\t\tHANDLEIT(INVALID, \"invalid\");\n\t}\n\n#undef HANDLEIT\n\n\treturn 0;\n}\n\n\n/* Checking the status flag clears it */\nstatic void\nPyUFunc_clearfperr()\n{\n\tint retstatus;\n\n\tUFUNC_CHECK_STATUS(retstatus)\n}\n\n\n#define UFUNC_NOSCALAR 0\n#define UFUNC_BOOL_SCALAR 1\n#define UFUNC_INTPOS_SCALAR 2\n#define UFUNC_INTNEG_SCALAR 3\n#define UFUNC_FLOAT_SCALAR 4\n#define UFUNC_COMPLEX_SCALAR 5\n#define UFUNC_OBJECT_SCALAR 6\n\n#define NO_UFUNCLOOP 0\n#define ZERODIM_REDUCELOOP 0\n#define ONE_UFUNCLOOP 1\n#define ONEDIM_REDUCELOOP 1\n#define NOBUFFER_UFUNCLOOP 2\n#define NOBUFFER_REDUCELOOP 2\n#define BUFFER_UFUNCLOOP 3\n#define BUFFER_REDUCELOOP 3\n\n\n#define UFUNC_REDUCE 0\n#define UFUNC_ACCUMULATE 1\n#define UFUNC_REDUCEAT 2\n#define UFUNC_OUTER 3\n\n\n\n\nstatic char\n_lowest_type(char intype)\n{\n switch(intype) {\n\t/* case PyArray_BYTE */\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\treturn PyArray_BYTE;\n\t/* case PyArray_UBYTE */\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\treturn PyArray_UBYTE;\n\t/* case PyArray_FLOAT:*/\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\treturn PyArray_FLOAT;\n\t/* case PyArray_CFLOAT:*/\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn PyArray_CFLOAT;\n default:\n return intype;\n }\n}\n\nstatic int \n_cancoerce(char thistype, char neededtype, char scalar) \n{\n\n\tswitch(scalar) {\n\tcase UFUNC_NOSCALAR:\n\tcase UFUNC_BOOL_SCALAR:\n\tcase UFUNC_OBJECT_SCALAR:\n\t\treturn PyArray_CanCastSafely(thistype, neededtype);\n\tcase UFUNC_INTPOS_SCALAR:\n\t\treturn (neededtype >= PyArray_UBYTE);\n\tcase UFUNC_INTNEG_SCALAR:\n\t\treturn (neededtype >= PyArray_BYTE) &&\t\t\\\n\t\t\t!(PyTypeNum_ISUNSIGNED(neededtype));\n\tcase UFUNC_FLOAT_SCALAR:\n\t\treturn (neededtype >= PyArray_FLOAT);\n\tcase UFUNC_COMPLEX_SCALAR:\n\t\treturn (neededtype >= PyArray_CFLOAT);\n\t}\n\tfprintf(stderr, \"\\n**Error** coerce fall through: %d %d %d\\n\\n\", \n\t\tthistype, neededtype, scalar);\n\treturn 1; /* should never get here... */ \n}\n\n\nstatic int \nselect_types(PyUFuncObject *self, int *arg_types, \n PyUFuncGenericFunction *function, void **data,\n\t char *scalars)\n{\n\n\tint i=0, j;\n\tchar start_type;\n\t\n\tif (PyTypeNum_ISUSERDEF((arg_types[0]))) {\n\t\tPyObject *key, *obj;\n\t\tfor (i=0; inin; i++) {\n\t\t\tif (arg_types[i] != arg_types[0]) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\t\t\"ufuncs on user defined\" \\\n\t\t\t\t\t\t\" types don't support \"\\\n\t\t\t\t\t\t\"coercion.\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfor (i=self->nin; inargs; i++) {\n\t\t\targ_types[i] = arg_types[0];\n\t\t}\n\t\t\n\t\tkey = PyInt_FromLong((long) arg_types[0]);\n\t\tif (key == NULL) return -1;\n\t\tobj = PyDict_GetItem(self->userloops, key);\n\t\tif (obj == NULL) {\n\t\t\tPy_DECREF(key);\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"no registered loop for this \"\t\\\n\t\t\t\t\t\"user-defined type.\");\n\t\t\treturn -1;\t\t\t\n\t\t}\n\t\tif PyTuple_Check(obj) {\n\t\t\t*function = (PyUFuncGenericFunction) \\\n\t\t\t\tPyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 0));\n\t\t\t*data = PyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 1));\n\t\t}\n\t\telse {\n\t\t\t*function = (PyUFuncGenericFunction)\t\\\n\t\t\t\tPyCObject_AsVoidPtr(obj);\n\t\t\t*data = NULL;\n\t\t}\n\t\tPy_DECREF(key);\n\t\treturn 0;\n\t}\n\t\n\n\tstart_type = arg_types[0];\n\t/* If the first argument is a scalar we need to place \n\t the start type as the lowest type in the class\n\t*/\n\tif (scalars[0] != UFUNC_NOSCALAR) {\n\t\tstart_type = _lowest_type(start_type);\n\t}\n\n\twhile (intypes && start_type > self->types[i*self->nargs]) \n\t\ti++;\n\n\tfor(;intypes; i++) {\n\t\tfor(j=0; jnin; j++) {\n\t\t\tif (!_cancoerce(arg_types[j], \n\t\t\t\t\tself->types[i*self->nargs+j],\n\t\t\t\t\tscalars[j]))\n\t\t\t\tbreak;\n\t\t}\n\t\tif (j == self->nin) break;\n\t}\n\tif(i>=self->ntypes) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"function not supported for these types, \"\\\n\t\t\t\t\"and can't coerce safely to supported types\");\n\t\treturn -1;\n\t}\n\tfor(j=0; jnargs; j++) \n\t\targ_types[j] = self->types[i*self->nargs+j];\n\n\t*data = self->data[i];\n\t*function = self->functions[i];\n\n\treturn 0;\n}\n\n\n\nstatic int\n_getintfromvar(char *str, int deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tint retval=deflt;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n thedict = PyEval_GetGlobals();\n ref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = (int) PyInt_AsLong(ref);\n if (ref == NULL || retval == -1) retval = deflt;\n PyErr_Clear();\n\treturn retval;\n}\n\nstatic PyObject *\n_getfuncfromvar(char *str, PyObject *deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tPyObject *retval;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n\t\tthedict = PyEval_GetGlobals();\n\t\tref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = ref;\n\telse retval = deflt;\n\tif (retval != Py_None && !PyCallable_Check(retval)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"%s if provided must be callable\", str);\n\t\treturn NULL;\n\t}\n\tPy_INCREF(retval);\n\treturn retval;\n}\n\n\nstatic char\n_scalar_kind(int typenum, PyArrayObject **arr) \n{\n\tif (PyTypeNum_ISSIGNED(typenum)) return UFUNC_INTNEG_SCALAR;\n\tif (PyTypeNum_ISFLOAT(typenum)) return UFUNC_FLOAT_SCALAR;\n\tif (PyTypeNum_ISCOMPLEX(typenum)) return UFUNC_COMPLEX_SCALAR;\n\tif (PyTypeNum_ISUNSIGNED(typenum)) return UFUNC_INTPOS_SCALAR;\n\tif (PyTypeNum_ISBOOL(typenum)) return UFUNC_BOOL_SCALAR;\n\treturn UFUNC_OBJECT_SCALAR;\n}\n\n\n/* Create copies for any arrays that are less than loop->bufsize\n in total size and are mis-behaved or in need\n of casting.\n*/\n\nstatic int\n_create_copies(PyUFuncLoopObject *loop, int *arg_types, PyArrayObject **mps)\n{\n\tint nin = loop->ufunc->nin;\n\tint i;\n\tintp size;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\n\tfor (i=0; ielsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\t\tif (size < loop->bufsize) {\n\t\t\tif (!(PyArray_ISBEHAVED_RO(mps[i])) ||\t\t\\\n\t\t\t PyArray_TYPE(mps[i]) != arg_types[i]) {\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST |\t\\\n\t\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\nstatic int\nconstruct_matrices(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps)\n{\n int nargs, i, cnt, cntcast, maxsize;\n int arg_types[MAX_ARGS];\n\tchar scalars[MAX_ARGS];\n\tPyUFuncObject *self=loop->ufunc;\n\tBool allscalars=TRUE;\n\tPyTypeObject *subtype=&PyArray_Type;\n\n /* Check number of arguments */\n nargs = PyTuple_Size(args);\n if ((nargs != self->nin) && (nargs != self->nargs)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of arguments\");\n return -1;\n }\n\n\n /* Get each input argument */\n for (i=0; inin; i++) {\n mps[i] = (PyArrayObject *)\\\n\t\t\tPyArray_FromAny(PyTuple_GET_ITEM(args,i), \n\t\t\t\t\tNULL, 0, 0, 0);\n if (mps[i] == NULL) return -1;\n arg_types[i] = PyArray_TYPE(mps[i]);\n if (PyTypeNum_ISFLEXIBLE(arg_types[i])) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"ufuncs do not support\"\t\\\n \" flexible arrays\");\n return -1;\n }\n\t\t/*\n\t\tfprintf(stderr, \"array %d has reference %d\\n\", i, \n\t\t (mps[i])->ob_refcnt);\n\t\t*/\n\n\t\t/* Scalars are 0-dimensional arrays\n\t\t at this point\n\t\t*/\n\t\tif (mps[i]->nd > 0) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t\tallscalars=FALSE;\n\t\t}\n\t\telse scalars[i] = _scalar_kind(arg_types[i], &(mps[i]));\n\n\t\t/* If any input is a big-array */\n\t\tif (!PyType_IsSubtype(mps[i]->ob_type, &PyArray_Type)) {\n\t\t\tsubtype = &PyBigArray_Type;\n\t\t}\n }\n\n\t/* If everything is a scalar, then use normal coercion rules */\n\tif (allscalars) {\n\t\tfor (i=0; inin; i++) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t}\n\t}\n \n /* Select an appropriate function for these argument types. */\n if (select_types(loop->ufunc, arg_types, &(loop->function), \n &(loop->funcdata), scalars) == -1)\n\t\treturn -1;\n\n\t/* This is the buffer size in number of elements.*/\n loop->bufsize = _getintfromvar(UFUNC_BUFSIZE_NAME, PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \"The buffer size (%d) is not \" \\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\treturn -1;\n\t}\n\t\n\t/* Create copies for some of the arrays if appropriate */\n\tif (_create_copies(loop, arg_types, mps) < 0) return -1;\n\t\n\t/* Create Iterators for the Inputs */\n\tfor (i=0; inin; i++) {\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n\t}\n \n /* Broadcast the result */\n loop->numiter = self->nin;\n if (PyArray_Broadcast((PyArrayMultiIterObject *)loop) < 0)\n\t\treturn -1;\n\t\n /* Get any return arguments */\n for (i=self->nin; idimensions, \n\t\t\t\t\t loop->dimensions, loop->nd)) {\n PyErr_SetString(PyExc_ValueError, \n \"invalid return array shape\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n if (!PyArray_ISWRITEABLE(mps[i])) {\n PyErr_SetString(PyExc_ValueError, \n \"return array is not writeable\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n }\n\n /* construct any missing return arrays and make output iterators */\n \n for (i=self->nin; inargs; i++) {\n\t\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\n if (mps[i] == NULL) {\n mps[i] = (PyArrayObject *)PyArray_New(subtype,\n loop->nd, \n loop->dimensions,\n arg_types[i], \n NULL, NULL,\n 0, 0, NULL);\n if (mps[i] == NULL) return -1;\n }\n\n\n\t\t/* reset types for outputs that are equivalent \n\t\t -- no sense casting uselessly\n\t\t*/\n\t\tif (mps[i]->descr->type_num != arg_types[i]) {\n\t\t\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\t\t\tntype.type_num = PyArray_TYPE(mps[i]);\n\t\t\tntype.itemsize = PyArray_ITEMSIZE(mps[i]);\n\t\t\tatype.type_num = arg_types[i];\n\t\t\tatype.itemsize = \\\n\t\t\t\tPyArray_DescrFromType(arg_types[i])->elsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\n\t\t/* still not the same -- or will we have to use buffers?*/\n\t\tif (mps[i]->descr->type_num != arg_types[i] ||\n\t\t !PyArray_ISBEHAVED_RO(mps[i])) {\n\t\t\tif (loop->size < loop->bufsize) {\n\t\t\t\tPyObject *new;\n\t\t\t\t/* Copy the array to a temporary copy \n\t\t\t\t and set the UPDATEIFCOPY flag\n\t\t\t\t*/\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST | \n\t\t\t\t\t\t BEHAVED_FLAGS_RO |\n\t\t\t\t\t\t UPDATEIFCOPY);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t\t\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n }\n\n\n /* If any of different type, or misaligned or swapped\n then must use buffers */\n\n loop->bufcnt = 0;\n\n loop->obj = 0;\n\n /* Determine looping method needed */\n loop->meth = NO_UFUNCLOOP;\n\n\tcnt = cntcast = 0; /* keeps track of bytes to allocate */\n\tmaxsize = 0;\n for (i=0; inargs; i++) {\n\t\tcnt += mps[i]->itemsize;\n if (arg_types[i] != mps[i]->descr->type_num) {\n\t\t\tPyArray_Descr *descr;\n\n loop->meth = BUFFER_UFUNCLOOP;\n\t\t\tdescr = PyArray_DescrFromType(arg_types[i]);\n\t\t\tcntcast += descr->elsize;\n if (i < self->nin) {\n loop->cast[i] = \\\n\t\t\t\t\tmps[i]->descr->cast[arg_types[i]];\n\t\t\t}\n else {\n loop->cast[i] = descr->\\\n\t\t\t\t\tcast[mps[i]->descr->type_num];\n\t\t\t}\n\n }\n loop->swap[i] = !(PyArray_ISNOTSWAPPED(mps[i]));\n if (!PyArray_ISBEHAVED_RO(mps[i])) {\n loop->meth = BUFFER_UFUNCLOOP;\n }\n if (!loop->obj && mps[i]->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n }\n \n if (loop->meth == NO_UFUNCLOOP) {\n \n loop->meth = ONE_UFUNCLOOP;\n\n /* All correct type and BEHAVED */\n /* Check for non-uniform stridedness */\n\n for (i=0; inargs; i++) {\n if (!(loop->iters[i]->contiguous)) {\n\t\t\t\t/* may still have uniform stride\n\t\t\t\t if (broadcated result) <= 1-d */\n\t\t\t\tif (mps[i]->nd != 0 &&\t\t\t\\\n\t\t\t\t (loop->iters[i]->nd_m1 > 0)) {\n\t\t\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n }\n\t\tif (loop->meth == ONE_UFUNCLOOP) {\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tloop->bufptr[i] = mps[i]->data;\n\t\t\t}\n\t\t}\n }\n\n loop->numiter = self->nargs;\n\n /* Fill in steps */\n if (loop->meth == NOBUFFER_UFUNCLOOP) {\n\t\tint ldim = 0;\n\t\tintp maxdim=-1;\n\t\tPyArrayIterObject *it;\n\n /* Fix iterators */\n\n /* Find the **largest** dimension */\n \n\t\tmaxdim = -1;\n\t\tfor (i=loop->nd - 1; i>=0; i--) {\n\t\t\tif (loop->dimensions[i] > maxdim) {\n\t\t\t\tldim = i;\n\t\t\t\tmaxdim = loop->dimensions[i];\n\t\t\t}\n\t\t}\n\n\t\tloop->size /= maxdim;\n loop->bufcnt = maxdim;\n\n /* Fix the iterators so the inner loop occurs over the \n\t\t largest dimensions -- This can be done by \n\t\t setting the size to 1 in that dimension \n\t\t (just in the iterators)\n */\n\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = loop->iters[i];\n it->contiguous = 0;\n\t\t\tit->size /= (it->dims_m1[ldim]+1);\n\t\t\tit->dims_m1[ldim] = 0;\n\t\t\tit->backstrides[ldim] = 0;\n\n\t\t\t/* (won't fix factors because we\n\t\t\t don't use PyArray_ITER_GOTO1D \n\t\t\t so don't change them) */\n\n\n\t\t\t/* Set the steps to the strides in that dimension */\n loop->steps[i] = it->strides[ldim];\n\t\t}\n\n }\n else if (loop->meth == BUFFER_UFUNCLOOP) {\n for (i=0; inargs; i++) {\n\t\t\tloop->steps[i] = mps[i]->itemsize; \n\t\t}\n }\n\telse { /* uniformly-strided case ONE_UFUNCLOOP */\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (mps[i]->nd == 0)\n\t\t\t\tloop->steps[i] = 0;\n\t\t\telse \n\t\t\t\tloop->steps[i] = mps[i]->strides[mps[i]->nd-1];\n\t\t}\n\t}\n \n\n\t/* Finally, create memory for buffers if we need them */\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\t\tchar *castptr;\n\t\tint oldsize=0;\n\t\tloop->buffer[0] = (char *)malloc(loop->bufsize*(cnt+cntcast));\n\t\t/* fprintf(stderr, \"Allocated buffer at %p of size %d, cnt=%d, cntcast=%d\\n\", loop->buffer[0], loop->bufsize * (cnt + cntcast), cnt, cntcast); */\n\t\tif (loop->buffer[0] == NULL) return -1;\n\t\tcastptr = loop->buffer[0] + loop->bufsize*cnt;\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (i > 0)\n\t\t\t\tloop->buffer[i] = loop->buffer[i-1] + \\\n\t\t\t\t\tloop->bufsize * mps[i-1]->itemsize;\n\t\t\t/* fprintf(stderr, \"buffer[%d] = %p\\n\", i, loop->buffer[i]); */\n\t\t\tif (loop->cast[i]) {\n\t\t\t\tloop->castbuf[i] = castptr + \n\t\t\t\t\tloop->bufsize*oldsize;\n\t\t\t\t/* fprintf(stderr, \"castbuf[%d] = %p\\n\", i, loop->castbuf[i]); */\n#define _PyD PyArray_DescrFromType\n\t\t\t\toldsize = _PyD(arg_types[i])->elsize;\n#undef _PyD\n\t\t\t\tloop->bufptr[i] = loop->castbuf[i];\n\t\t\t\tcastptr = loop->castbuf[i];\n\t\t\t\tloop->steps[i] = oldsize;\n\t\t\t}\n\t\t\telse\n\t\t\t\tloop->bufptr[i] = loop->buffer[i];\n\t\t\tloop->dptr[i] = loop->buffer[i];\n\t\t}\n\t}\n\n return nargs;\n}\n\nstatic PyTypeObject PyUFuncLoop_Type;\n\nstatic void ufuncloop_dealloc(PyUFuncLoopObject *);\n\nstatic PyUFuncLoopObject *\nconstruct_loop(PyUFuncObject *self, PyObject *args, PyArrayObject **mps)\n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\t\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\n\n\tif ((loop=PyObject_NEW(PyUFuncLoopObject, &PyUFuncLoop_Type)) == NULL)\n\t\treturn NULL;\n\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n\tloop->buffer[0] = NULL;\n for (i=0; inargs; i++) {\n loop->iters[i] = NULL;\n loop->cast[i] = NULL;\n }\n\tloop->errobj = NULL;\n\n\t/* Setup the matrices */\n\tif (construct_matrices(loop, args, mps) < 0) goto fail;\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString((self->name ? \\\n self->name : \"\")), \n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n\tPyUFunc_clearfperr();\n\n\treturn loop;\n\n fail:\n\tufuncloop_dealloc(loop);\n\treturn NULL;\n}\n\n\n/* \nstatic void\n_printbytebuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing byte buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %d\\n\", *(((byte *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbufptr(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->bufptr[bufnum]))+i));\n\t} \n}\n\n\n \nstatic void\n_printcastbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->castbuf[bufnum]))+i));\n\t} \n}\n\n*/\n\n\n\n\n/* currently generic ufuncs cannot be built for use on flexible arrays.\n\n The cast functions in the generic loop would need to be fixed to pass \n something besides NULL, NULL \n\n*/\n\n/* This generic function is called with the ufunc object, the arguments to it,\n and an array of (pointers to) PyArrayObjects which are NULL. The \n arguments are parsed and placed in mps in construct_loop (construct_matrices)\n*/\n\nstatic int \nPyUFunc_GenericFunction(PyUFuncObject *self, PyObject *args, \n\t\t\tPyArrayObject **mps) \n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\tint temp;\n BEGIN_THREADS_DEF\n\n\tif (!(loop = construct_loop(self, args, mps))) return -1;\n\n\tLOOP_BEGIN_THREADS\n\n\tswitch(loop->meth) {\n\tcase ONE_UFUNCLOOP:\n\t\t/* Everything is contiguous, notswapped, aligned,\n\t\t and of the right type. -- Fastest.\n\t\t Or if not contiguous, then a single-stride\n\t\t increment moves through the entire array. \n\t\t*/\n /* fprintf(stderr, \"ONE...%d\\n\", loop->size);*/\n\t\tloop->function((char **)loop->bufptr, &(loop->size), \n\t\t\t loop->steps, loop->funcdata);\n\t\tUFUNC_CHECK_ERROR();\n\t\tbreak;\n\tcase NOBUFFER_UFUNCLOOP:\n\t\t/* Everything is notswapped, aligned and of the \n\t\t right type but not contiguous. -- Almost as fast.\n\t\t*/\n /* fprintf(stderr, \"NOBUFFER...%d\\n\", loop->size);*/\n\t\twhile (loop->index < loop->size) {\n\t\t\tfor (i=0; inargs; i++) \n\t\t\t\tloop->bufptr[i] = loop->iters[i]->dataptr;\n\n\t\t\tloop->function((char **)loop->bufptr, &(loop->bufcnt),\n\t\t\t\t loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tPyArray_ITER_NEXT(loop->iters[i]);\n\t\t\t}\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\tcase BUFFER_UFUNCLOOP: {\n\t\t/* Make local copies of all loop variables */\n\t\t/* Optimizations needed:\n\t\t 1) move data better into the buffer better\n\t\t --- not one at a time -- this requires some \n pre-analysis and is only possible over \n the largest dimension.\n\t\t*/\n\n\t\tPyArray_CopySwapNFunc *copyswapn[MAX_ARGS];\n\t\tPyArrayIterObject **iters=loop->iters;\n\t\tint *swap=loop->swap;\n\t\tvoid **dptr=loop->dptr;\n\t\tint mpselsize[MAX_ARGS];\n\t\tintp index=loop->index, size=loop->size;\n\t\tint bufcnt=loop->bufcnt, bufsize=loop->bufsize;\n\t\tvoid **bufptr = loop->bufptr;\n\t\tvoid **buffer = loop->buffer;\n\t\tvoid **castbuf = loop->castbuf;\n\t\tintp *steps = loop->steps;\n\t\tBool pyobject[MAX_ARGS];\n\t\t\n\t\tfor (i=0; inargs; i++) {\n\t\t\tcopyswapn[i] = mps[i]->descr->copyswapn;\n\t\t\tmpselsize[i] = mps[i]->itemsize;\n\t\t\tpyobject[i] = (loop->obj && \\\n (mps[i]->descr->type_num == PyArray_OBJECT));\n\t\t}\n\t\t/* Do generic buffered looping here (works for any kind of\n\t\t arrays): Everything uses a buffer. \n\n\t\t 1. fill the input buffers.\n\t\t 2. If buffer is filled then \n\t\t a. cast any input buffers needing it. \n\t\t b. call inner function (which loops over the buffer).\n\t\t\t c. cast any output buffers needing it.\n\t\t\t d. copy output buffer back to output arrays.\n 3. goto next position\n\t\t*/ \n\t\tfprintf(stderr, \"BUFFER...%d\\n\", loop->size);\n\t\t/*\n\t\tfor (i=0; inargs; i++) {\n\t\t\tfprintf(stderr, \"iters[%d]->dataptr = %p, %p of size %d\\n\", i, \n\t\t\t\titers[i], iters[i]->ao->data, PyArray_NBYTES(iters[i]->ao));\n\t\t}\n\t\t*/\n\t\twhile (index < size) {\n\t\t\t/*copy input data */\n\t\t\tfor (i=0; inin; i++) {\n\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\tPy_INCREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t}\n\t\t\t\t/*\t\t\t\tfprintf(stderr, \"index = %d, i=%d, writing to %p\\n\", index, i, dptr[i]); */\n\t\t\t\tmemcpy(dptr[i], iters[i]->dataptr,\n\t\t\t\t mpselsize[i]);\n\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t}\n\t\t\tbufcnt++;\n\t\t\tindex++; \n\t\t\tif ((bufcnt == bufsize) || \\\n\t\t\t (index == size)) {\n\t\t\t\t\n\t\t\t\tfor (i=0; inin; i++) {\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping...\\n\");*/\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](buffer[i],\n\t\t\t\t\t\t\t castbuf[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t\tloop->function((char **)bufptr, \n\t\t\t\t\t &bufcnt, \n\t\t\t\t\t steps, loop->funcdata);\n \n\t\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\t\tfor (i=self->nin; inargs; i++) {\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](castbuf[i],\n\t\t\t\t\t\t\t buffer[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping back...\\n\"); */\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tfor (temp = 0; temp < bufcnt; temp++) {\n\t\t\t\t\t\t/* fprintf(stderr, \"temp=%d, i=%d; reading from %p\\n\", temp, i, dptr[i]);*/\n\t\t\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\t\t\tPy_XDECREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t\t\t\tPy_INCREF(*((PyObject **)dptr[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmemcpy(iters[i]->dataptr,\n\t\t\t\t\t\t dptr[i], mpselsize[i]);\n\t\t\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbufcnt = 0;\n\t\t\t\tfor (i=0; inargs; i++) \n\t\t\t\t\tdptr[i] = buffer[i];\n\t\t\t\t\n\t\t\t} \n\t\t}\n\t}\n\t}\t\n\t\n LOOP_END_THREADS\n\t\n Py_DECREF(loop);\n\treturn 0;\n\n fail:\n LOOP_END_THREADS\n \n\tPy_XDECREF(loop);\n\treturn -1;\n }\n\nstatic PyArrayObject *\n_getidentity(PyUFuncObject *self, int otype, char *str)\n{\n PyObject *obj, *arr;\n PyArray_Typecode typecode = {otype, 0, 0};\n\n if (self->identity == PyUFunc_None) {\n PyErr_Format(PyExc_ValueError, \n \"zero-size array to ufunc.%s \" \\\n \"without identity\", str);\n return NULL;\n }\n if (self->identity == PyUFunc_One) {\n obj = PyInt_FromLong((long) 1);\n } else {\n obj = PyInt_FromLong((long) 0);\n }\n\t\n arr = PyArray_FromAny(obj, &typecode, 0, 0, CARRAY_FLAGS);\n Py_DECREF(obj);\n return (PyArrayObject *)arr;\n}\n\nstatic int\n_create_reduce_copy(PyUFuncReduceObject *loop, PyArrayObject **arr, int rtype)\n{\n\tintp maxsize;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {rtype, 0, 0};\n\t\n\tmaxsize = PyArray_SIZE(*arr);\n\t\n\tif (maxsize < loop->bufsize) {\n\t\tif (!(PyArray_ISBEHAVED_RO(*arr)) ||\t\\\n\t\t PyArray_TYPE(*arr) != rtype) {\n\t\t\tnew = PyArray_FromAny((PyObject *)(*arr), \n\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t FORCECAST |\t\t\\\n\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\tif (new == NULL) return -1;\n\t\t\t*arr = (PyArrayObject *)new;\n\t\t\tloop->decref = new;\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\n\n\nstatic PyTypeObject PyUFuncReduce_Type;\n\nstatic void ufuncreduce_dealloc(PyUFuncReduceObject *);\n\nstatic PyUFuncReduceObject *\nconstruct_reduce(PyUFuncObject *self, PyArrayObject **arr, int axis, \n\t\t int otype, int operation, intp ind_size, char *str)\n{\n PyUFuncReduceObject *loop;\n PyArrayObject *idarr;\n\tPyArrayObject *aar;\n intp loop_i[MAX_DIMS];\n int arg_types[3] = {otype, otype, otype};\n\tchar scalars[3] = {UFUNC_NOSCALAR, UFUNC_NOSCALAR, UFUNC_NOSCALAR};\n\tint i, j;\n\tint nd = (*arr)->nd;\n\t/* Reduce type is the type requested of the input \n\t during reduction */\n\n\tif ((loop=PyObject_NEW(PyUFuncReduceObject, \n\t\t\t &PyUFuncReduce_Type)) == NULL)\n\t\treturn NULL;\n\n\n loop->swap = 0;\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n loop->cast = NULL;\n loop->buffer = NULL;\n loop->ret = NULL;\n\tloop->it = NULL;\n\tloop->rit = NULL;\n\tloop->errobj = NULL;\n\tloop->decref=NULL; \n loop->N = (*arr)->dimensions[axis];\n\tloop->instrides = (*arr)->strides[axis];\n\n\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t &(loop->funcdata), scalars) == -1) goto fail; \n\t\n\t/* output type may change -- if it does \n\t reduction is forced into that type \n\t and we need to select the reduction function again\n\t*/\n\tif (otype != arg_types[2]) {\n\t\totype = arg_types[2];\n\t\targ_types[0] = otype;\n\t\targ_types[1] = otype;\n\t\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t\t &(loop->funcdata), scalars) == -1) \n\t\t\tgoto fail; \t\t\n\t}\n\n\t/* Make bufsize depend on a local then module-level variable */\n\tloop->bufsize = _getintfromvar(\"UFUNC_BUFSIZE\", \n\t\t\t\t PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"The buffer size (%d) is not \"\t\\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\tgoto fail;\n\t}\n\t\n\t/* Make copy if misbehaved or not otype for small arrays */\n\tif (_create_reduce_copy(loop, arr, otype) < 0) goto fail; \n\taar = *arr;\n\t\n if (loop->N == 0) {\n loop->meth = ZERODIM_REDUCELOOP;\n }\n else if (PyArray_ISBEHAVED_RO(aar) &&\t\t\\\n otype == (aar)->descr->type_num) {\n\t\tif (loop->N == 1) {\n\t\t\tloop->meth = ONEDIM_REDUCELOOP;\n\t\t}\n\t\telse {\n\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\tloop->steps[0] = (aar)->strides[axis];\n\t\t\tloop->N -= 1;\n\t\t}\n }\n else {\n loop->meth = BUFFER_UFUNCLOOP;\n loop->swap = !(PyArray_ISNOTSWAPPED(aar));\n }\n\n if (loop->meth == ZERODIM_REDUCELOOP) {\n idarr = _getidentity(self, otype, str);\n if (idarr == NULL) goto fail;\n if (idarr->itemsize > UFUNC_MAXIDENTITY) {\n PyErr_Format(PyExc_RuntimeError, \n\t\t\t\t \"UFUNC_MAXIDENTITY (%d)\"\t\t\\\n \" is too small (needs to be at least %d)\",\n UFUNC_MAXIDENTITY, idarr->itemsize);\n Py_DECREF(idarr);\n goto fail;\n }\n memcpy(loop->idptr, idarr->data, idarr->itemsize);\n Py_DECREF(idarr);\n }\n\t\n /* Construct return array */\n\tswitch(operation) {\n\tcase UFUNC_REDUCE:\n\t\tfor (j=0, i=0; idimensions[i];\n\t\t\t\n\t\t}\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd-1, loop_i, otype, \n\t\t\t\t NULL, NULL, 0, 0, aar);\n\t\tbreak;\n\tcase UFUNC_ACCUMULATE:\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, aar->dimensions, \n\t\t\t\t otype, NULL, NULL, 0, 0, aar);\n\t\tbreak;\n\tcase UFUNC_REDUCEAT:\n\t\tmemcpy(loop_i, aar->dimensions, nd*sizeof(intp));\n\t\t/* Index is 1-d array */\n\t\tloop_i[axis] = ind_size; \n\t\tloop->ret = (PyArrayObject *)\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, loop_i, otype,\n\t\t\t\t NULL, NULL, 0, 0, aar);\n\t\tif (loop->ret == NULL) goto fail;\n\t\tif (ind_size == 0) {\n\t\t\tloop->meth = ZERODIM_REDUCELOOP;\n\t\t\treturn loop;\n\t\t}\n\t\tif (loop->meth == ONEDIM_REDUCELOOP)\n\t\t\tloop->meth = NOBUFFER_REDUCELOOP;\n\t\tbreak;\n\t}\n if (loop->ret == NULL) goto fail;\n loop->insize = aar->itemsize;\n loop->outsize = loop->ret->itemsize;\n loop->bufptr[1] = loop->ret->data;\n\n\tif (loop->meth == ZERODIM_REDUCELOOP) {\n\t\tloop->size = PyArray_SIZE(loop->ret);\n\t\treturn loop;\n\t}\n\n\tloop->it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)aar);\n if (loop->it == NULL) return NULL;\n\n\tif (loop->meth == ONEDIM_REDUCELOOP) {\n\t\tloop->size = loop->it->size;\t\t\n\t\treturn loop;\n\t}\n\n /* Fix iterator to loop over correct dimension */\n\t/* Set size in axis dimension to 1 */\n \n loop->it->contiguous = 0;\n loop->it->size /= (loop->it->dims_m1[axis]+1);\n loop->it->dims_m1[axis] = 0;\n loop->it->backstrides[axis] = 0;\n\n\n loop->size = loop->it->size;\n\n\tif (operation == UFUNC_REDUCE) {\n\t\tloop->steps[1] = 0;\n\t}\n\telse {\n\t\tloop->rit = (PyArrayIterObject *)\t\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)(loop->ret));\n\t\tif (loop->rit == NULL) return NULL;\t\t\n\n\t\t/* Fix iterator to loop over correct dimension */\n\t\t/* Set size in axis dimension to 1 */\n\t\t\n\t\tloop->rit->contiguous = 0;\n\t\tloop->rit->size /= (loop->rit->dims_m1[axis]+1);\n\t\tloop->rit->dims_m1[axis] = 0;\n\t\tloop->rit->backstrides[axis] = 0;\n\n\t\tif (operation == UFUNC_ACCUMULATE)\n\t\t\tloop->steps[1] = loop->ret->strides[axis];\n\t\telse \n\t\t\tloop->steps[1] = 0;\n\t}\n\tloop->steps[2] = loop->steps[1];\n\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[2];\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\n\t\tloop->steps[0] = loop->outsize;\n if (otype != aar->descr->type_num) {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n (loop->outsize + \\\n aar->itemsize));\n if (loop->buffer == NULL) goto fail;\n loop->castbuf = loop->buffer + \\\n loop->bufsize*aar->itemsize;\n loop->bufptr[0] = loop->castbuf; \n loop->cast = aar->descr->cast[otype];\n }\n else {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n loop->outsize);\n if (loop->buffer == NULL) goto fail;\n loop->bufptr[0] = loop->buffer;\n }\n\t}\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \\\n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t\t\t \n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString(str),\n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n /* Determine if object arrays are involved */\n if (otype == PyArray_OBJECT || aar->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n else\n loop->obj = 0;\n\n\tPyUFunc_clearfperr();\n\treturn loop;\n\n fail:\n ufuncreduce_dealloc(loop);\n\treturn NULL;\t\n}\n\n\n/* We have two basic kinds of loops */\n/* One is used when arr is not-swapped and aligned and output type\n is the same as input type.\n and another using buffers when one of these is not satisfied.\n\n Zero-length and one-length axes-to-be-reduced are handled separately.\n*/\n\nstatic PyObject *\nPyUFunc_Reduce(PyUFuncObject *self, PyArrayObject *arr, int axis, int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n BEGIN_THREADS_DEF\n \t\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCE, 0,\n\t\t\t\t\"reduce\");\n\tif (!loop) return NULL;\n\n LOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP:\n\t\t/*fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP:\n\t\t/*fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it)\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1];\n loop->index++; \n\t\t\tif (PyErr_Occurred()) goto fail;\n }\n break;\n case BUFFER_UFUNCLOOP:\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy first item over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %d\\n\", loop->size, \n\t\t loop->swap); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1]; \n loop->index++;\n }\n }\n\n LOOP_END_THREADS\n\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n LOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n\nstatic PyObject *\nPyUFunc_Accumulate(PyUFuncObject *self, PyArrayObject *arr, int axis, \n\t\t int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n \n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_ACCUMULATE, 0,\n\t\t\t\t\"accumulate\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n break;\n case BUFFER_UFUNCLOOP: /* Accumulate */\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy identity over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %p\\n\", loop->size, \n\t\t loop->cast); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n }\n\n\tLOOP_END_THREADS\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n\tLOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n/* Reduceat performs a reduce over an axis using the indices as a guide\n\nop.reduceat(array,indices) computes\nop.reduce(array[indices[i]:indices[i+1]] \n for i=0..end with an implicit indices[i+1]=len(array)\n assumed when i=end-1\n\nif indices[i+1] <= indices[i]+1 \n then the result is array[indices[i]] for that value\n\nop.accumulate(array) is the same as\nop.reduceat(array,indices)[::2]\nwhere indices is range(len(array)-1) with a zero placed in every other sample\n indices = zeros(len(array)*2-1)\n indices[1::2] = range(1,len(array))\n\noutput shape is based on the size of indices\n */\n\nstatic PyObject *\nPyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, \n int axis, int otype)\n{\t\n\tPyArrayObject *ret;\n PyUFuncReduceObject *loop;\n\tintp *ptr=(intp *)ind->data;\n\tintp nn=ind->dimensions[0];\t\t\n\tintp mm=arr->dimensions[axis]-1;\n\tintp n, i;\n\tint j;\n\tchar *dptr;\n\n\t/* Check for out-of-bounds values in indices array */\t\t\n\tfor (i=0; i mm)) {\n\t\t\tPyErr_Format(PyExc_IndexError, \n\t\t\t\t \"index out-of-bounds (0, %d)\", mm);\n\t\t\treturn NULL;\n\t\t}\n\t\tptr++;\n\t}\n\t\n\tptr = (intp *)ind->data;\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCEAT, nn,\n\t\t\t\t\"reduceat\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n\tswitch(loop->meth) {\n\t/* zero-length index -- return array immediately */\n\tcase ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..\\n\"); */\n\t\tbreak;\n\n\t/* NOBUFFER -- behaved array and same type */\n\tcase NOBUFFER_UFUNCLOOP: \t /* Reduceat */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[0] = loop->it->dataptr +\t\\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\tmemcpy(loop->bufptr[1], loop->bufptr[0],\n\t\t\t\t loop->outsize);\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis]-*ptr : \\\n\t\t\t\t *(ptr+1) - *ptr) - 1;\n\t\t\t\tif (mm > 0) {\n\t\t\t\t\tloop->bufptr[0] += loop->instrides;\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &mm, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t}\t\n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\n\t/* BUFFER -- misbehaved array or different types */ \n\tcase BUFFER_UFUNCLOOP: /* Reduceat */\n\t\t/* fprintf(stderr, \"BUFFERED..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[1], loop->idptr, \n\t\t\t\t loop->outsize);\n\t\t\t\tn = 0;\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis] - *ptr :\\\n\t\t\t\t *(ptr+1) - *ptr);\n\t\t\t\tif (mm < 1) mm = 1;\n\t\t\t\tloop->inptr = loop->it->dataptr + \\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\twhile (n < mm) {\n\t\t\t\t\t/* Copy up to loop->bufsize elements\n\t\t\t\t\t to buffer */\n\t\t\t\t\tdptr = loop->buffer;\n\t\t\t\t\tfor (j=0; jbufsize; j++, n++) {\n\t\t\t\t\t\tif (n == mm) break;\n\t\t\t\t\t\tarr->descr->copyswap\\\n\t\t\t\t\t\t\t(dptr,\n\t\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t\t loop->insize);\n\t\t\t\t\t\tloop->inptr += loop->instrides;\n\t\t\t\t\t\tdptr += loop->insize;\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast)\n\t\t\t\t\t\tloop->cast(loop->buffer,\n\t\t\t\t\t\t\t loop->castbuf,\n\t\t\t\t\t\t\t j, NULL, NULL);\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &j, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t} \n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\t}\n\n\tLOOP_END_THREADS\n\t\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\t\n fail:\n\tLOOP_END_THREADS\n\n\tPy_XDECREF(loop);\n\treturn NULL;\n}\n\n\n/* This code handles reduce, reduceat, and accumulate \n (accumulate and reduce are special cases of the more general reduceat \n but they are handled separately for speed) \n*/\n\nstatic PyObject * \nPyUFunc_GenericReduction(PyUFuncObject *self, PyObject *args, \n PyObject *kwds, int operation) \n{\n\tint axis=0;\n\tPyArrayObject *mp, *ret = NULL;\n\tPyObject *op, *res=NULL;\n\tPyObject *obj_ind; \n\tPyArrayObject *indices = NULL;\n\tPyArray_Typecode otype= {PyArray_NOTYPE, 0, 0};\n PyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tstatic char *kwlist1[] = {\"array\", \"axis\", \"rtype\", NULL};\n\tstatic char *kwlist2[] = {\"array\", \"indices\", \"axis\", \"rtype\", NULL}; \n static char *_reduce_type[] = {\"reduce\", \"accumulate\", \\\n\t\t\t\t \"reduceat\", NULL};\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\t\n\n\tif (self->nin != 2) {\n\t\tPyErr_Format(PyExc_ValueError, \n \"%s only supported for binary functions\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\tif (self->nout != 1) {\n\t\tPyErr_Format(PyExc_ValueError,\n \"%s only supported for functions \" \\\n \"returning a single value\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\n\tif (operation == UFUNC_REDUCEAT) {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|iO&\", kwlist2, \n\t\t\t\t\t\t&op, &obj_ind, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n indices = (PyArrayObject *)PyArray_FromAny(obj_ind, &indtype, \n\t\t\t\t\t\t\t 1, 1, CARRAY_FLAGS);\n if (indices == NULL) return NULL;\n\n\t}\n\telse {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|iO&\", kwlist1,\n\t\t\t\t\t\t&op, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n\t}\n\t\n\t/* Ensure input is an array */\t\n\tmp = (PyArrayObject *)PyArray_FromAny(op, NULL, 0, 0, 0);\n\tif (mp == NULL) return NULL;\n\n /* Check to see if input is zero-dimensional */\n if (mp->nd == 0) {\n PyErr_Format(PyExc_ValueError, \"cannot %s on a scalar\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL; \n }\n\n /* Check to see that type (and otype) is not FLEXIBLE */\n\tif (PyArray_ISFLEXIBLE(mp) || PyTypeNum_ISFLEXIBLE(otype.type_num)) {\n PyErr_Format(PyExc_ValueError, \n\t\t\t \"cannot perform %s with flexible type\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL;\n }\n\n\tif (axis < 0) axis += mp->nd;\n\tif (axis < 0 || axis >= mp->nd) {\n\t\tPyErr_SetString(PyExc_ValueError, \"axis not in array\");\n Py_DECREF(mp);\n\t\treturn NULL;\n\t}\n\n\n if (otype.type_num == PyArray_NOTYPE)\n otype.type_num = mp->descr->type_num;\n\n switch(operation) {\n case UFUNC_REDUCE:\n ret = (PyArrayObject *)PyUFunc_Reduce(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_ACCUMULATE:\n ret = (PyArrayObject *)PyUFunc_Accumulate(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_REDUCEAT:\n ret = (PyArrayObject *)PyUFunc_Reduceat(self, mp, indices, \n axis, otype.type_num);\n Py_DECREF(indices);\n\t\tbreak;\n }\n Py_DECREF(mp);\n\tif (ret==NULL) return NULL;\n\tif (op->ob_type != ret->ob_type) {\n\t\tres = PyObject_CallMethod(op, \"__array_wrap__\", \"O\", ret);\n\t}\n\tif (res == NULL) PyErr_Clear();\n\telse if (res == Py_None) Py_DECREF(res);\n\telse {\n\t\tPy_DECREF(ret);\n\t\treturn res;\n\t}\t\n\treturn PyArray_Return(ret);\n\t\n}\n\n\n\n/* ---------- */\n\nstatic PyObject *\n_find_array_wrap(PyObject *args)\n{\n\tint nargs, i;\n\tint np = 0;\n\tint argmax = 0;\n\tint val;\n\tdouble priority[MAX_ARGS];\n\tdouble maxpriority = PyArray_SUBTYPE_PRIORITY;\n\tPyObject *with_wrap[MAX_ARGS];\n\tPyObject *attr;\n\tPyObject *obj;\n\n\tnargs = PyTuple_Size(args);\n\tfor (i=0; i maxpriority) {\n\t\t\tmaxpriority = priority[i];\n\t\t\targmax = i;\n\t\t}\n\t}\n\n\treturn with_wrap[argmax];\n}\n\nstatic PyObject *\nufunc_generic_call(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyTupleObject *ret;\n\tPyArrayObject *mps[MAX_ARGS];\n\tPyObject *retobj[MAX_ARGS];\n\tPyObject *res;\n\tPyObject *obj;\n\t\n\t/* Initialize all array objects to NULL to make cleanup easier \n\t if something goes wrong. */\n\tfor(i=0; inargs; i++) mps[i] = NULL;\n\t\n\tif (PyUFunc_GenericFunction(self, args, mps) == -1) {\n\t\tfor(i=0; inargs; i++) Py_XDECREF(mps[i]);\n\t\treturn NULL;\n\t}\n\t\n\tfor(i=0; inin; i++) Py_DECREF(mps[i]);\n\n\t/* Use __array_wrap__ on all outputs \n\t if present on one of the input arguments.\n\t If present for multiple inputs:\n\t use __array_wrap__ of input object with largest \n\t\t__array_priority__ (default = 0.0)\n\t */\n\tobj = _find_array_wrap(args);\n\t\n\t/* wrap outputs */\n\tfor (i=0; inout; i++) {\n\t\tint j=self->nin+i;\n\t\t/* check to see if any UPDATEIFCOPY flags are set \n\t\t which meant that a temporary output was generated \n\t\t*/\n\t\tif (mps[j]->flags & UPDATEIFCOPY) {\n\t\t\tPyObject *old = mps[j]->base;\n\t\t\tPy_INCREF(old); /* we want to hang on to this */\n\t\t\tPy_DECREF(mps[j]); /* should trigger the copy \n\t\t\t\t\t back into old */\n\t\t\tmps[j] = (PyArrayObject *)old;\n\t\t}\n\t\tif (obj != NULL) {\n\t\t\tres = PyObject_CallMethod(obj, \"__array_wrap__\",\n\t\t\t\t\t\t \"O\", mps[j]);\n\t\t\tif (res == NULL) PyErr_Clear();\n\t\t\telse if (res == Py_None) Py_DECREF(res);\n\t\t\telse {\n\t\t\t\tPy_DECREF(mps[j]);\n\t\t\t\tretobj[i] = res;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tretobj[i] = PyArray_Return(mps[j]);\n\t}\n\t\n\tif (self->nout == 1) { \n\t\treturn retobj[0];\n\t} else { \n\t\tret = (PyTupleObject *)PyTuple_New(self->nout);\n\t\tfor(i=0; inout; i++) {\n\t\t\tPyTuple_SET_ITEM(ret, i, retobj[i]);\n\t\t}\n\t\treturn (PyObject *)ret;\n\t}\t\n\n}\n\nstatic PyUFuncGenericFunction pyfunc_functions[] = {PyUFunc_On_Om};\n\nstatic char \ndoc_frompyfunc[] = \"frompyfunc(func, nin, nout) take an arbitrary python function that takes nin objects as input and returns nout objects and return a universal function (ufunc). This ufunc always returns PyObject arrays\";\n\nstatic PyObject *\nufunc_frompyfunc(PyObject *dummy, PyObject *args, PyObject *kwds) {\n /* Keywords are ignored for now */\n \n PyObject *function, *pyname=NULL;\n int nin, nout, i;\n PyUFunc_PyFuncData *fdata;\n PyUFuncObject *self;\n char *fname, *str;\n int fname_len=-1;\n\n if (!PyArg_ParseTuple(args, \"Oii\", &function, &nin, &nout)) return NULL;\n\n if (!PyCallable_Check(function)) {\n PyErr_SetString(PyExc_TypeError, \"Function must be callable.\");\n return NULL;\n }\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\n\tself->userloops = NULL;\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = PyUFunc_None;\t\n\tself->functions = pyfunc_functions;\n\n\tself->ntypes = 1;\n\tself->check_return = 0;\n\n pyname = PyObject_GetAttrString(function, \"__name__\");\n if (pyname)\n (void) PyString_AsStringAndSize(pyname, &fname, &fname_len);\n \n if (PyErr_Occurred()) {\n fname = \"?\";\n fname_len = 1;\n PyErr_Clear();\n } \n Py_XDECREF(pyname);\n\n\n self->ptr = malloc((self->nargs)+sizeof(PyUFunc_PyFuncData)+sizeof(void *)+(fname_len+14));\n \n\tif (self->ptr == NULL) return PyErr_NoMemory();\n Py_INCREF(function);\n self->obj = function;\n\tfdata = (PyUFunc_PyFuncData *)(self->ptr + (nin+nout) + sizeof(void *));\n fdata->nin = nin;\n fdata->nout = nout;\n fdata->callable = function;\n \n self->data = (void **)(self->ptr + (nin+nout));\n self->data[0] = (void *)fdata;\n\n\n\tself->types = (char *)self->ptr;\n for (i=0; inargs; i++) self->types[i] = PyArray_OBJECT;\n\n str = (char *)(fdata + 1);\n memcpy(str, fname, fname_len);\n memcpy(str+fname_len, \" (vectorized)\", 14);\n \n self->name = str;\n\n /* Do a better job someday */\n self->doc = \"dynamic ufunc based on a python function\";\n \n\t\n\treturn (PyObject *)self;\n}\n\n\nstatic PyObject *\nPyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void **data, \n\t\t\tchar *types, int ntypes,\n\t\t\tint nin, int nout, int identity, \n\t\t\tchar *name, char *doc, int check_return) \n{\n\tPyUFuncObject *self;\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = identity;\n\t\n\tself->functions = func;\n\tself->data = data;\n\tself->types = types;\n\tself->ntypes = ntypes;\n\tself->check_return = check_return;\n self->ptr = NULL;\n self->obj = NULL;\n\tself->userloops=NULL;\n\t\n\tif (name == NULL) self->name = \"?\";\n\telse self->name = name;\n\t\n if (doc == NULL) self->doc = \"NULL\";\n\telse self->doc = doc;\n\t\n\treturn (PyObject *)self;\n}\n\nstatic int\nPyUFunc_RegisterLoopForType(PyUFuncObject *ufunc, \n\t\t\t int usertype,\n\t\t\t PyUFuncGenericFunction function,\n\t\t\t void *data)\n{\n\tPyArray_Descr *descr=PyArray_DescrFromType(usertype);\n \tPyObject *key, *cobj;\n\tint ret;\t\n\t\n\tif ((usertype < PyArray_USERDEF) || (descr==NULL)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Cannot register typenumber\");\n\t\treturn -1;\n\t}\n\tif (ufunc->userloops == NULL) {\n\t\tufunc->userloops = PyDict_New();\n\t}\n\tkey = PyInt_FromLong(usertype);\n\tif (key == NULL) return -1;\n\tcobj = PyCObject_FromVoidPtr((void *)function, NULL);\n\tif (cobj == NULL) {Py_DECREF(key); return -1;}\n\tif (data == NULL) {\n\t\tret = PyDict_SetItem(ufunc->userloops, key, cobj);\n\t\tPy_DECREF(cobj);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n\telse {\n\t\tPyObject *cobj2, *tmp;\n\t\tcobj2 = PyCObject_FromVoidPtr(data, NULL);\n\t\tif (cobj2 == NULL) {\n\t\t\tPy_DECREF(cobj); \n\t\t\tPy_DECREF(key);\n\t\t\treturn -1;\n\t\t}\n\t\ttmp=Py_BuildValue(\"NN\", cobj, cobj2);\n\t\tret = PyDict_SetItem(ufunc->userloops, key, tmp);\n\t\tPy_DECREF(tmp);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n}\n\nstatic void\nufuncreduce_dealloc(PyUFuncReduceObject *self)\n{\n if (self->ufunc) {\n Py_XDECREF(self->it);\n\t\tPy_XDECREF(self->rit);\n Py_XDECREF(self->ret);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_XDECREF(self->decref);\n if (self->buffer) free(self->buffer);\n Py_DECREF(self->ufunc);\n }\n PyObject_DEL(self);\n}\n\nstatic void\nufuncloop_dealloc(PyUFuncLoopObject *self)\n{\n\tint i;\n\t\n\tif (self->ufunc != NULL) {\n\t\tfor (i=0; iufunc->nargs; i++)\n\t\t\tPy_XDECREF(self->iters[i]);\n\t\tif (self->buffer[0]) free(self->buffer[0]);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_DECREF(self->ufunc);\n\t}\n\tPyObject_DEL(self);\n}\n\n\nstatic void\nufunc_dealloc(PyUFuncObject *self)\n{\n if (self->ptr) free(self->ptr);\n\tPy_XDECREF(self->userloops);\n Py_XDECREF(self->obj);\n\tPyObject_DEL(self);\n}\n\nstatic PyObject *\nufunc_repr(PyUFuncObject *self)\n{\n\tchar buf[100];\n\t\n\tsprintf(buf, \"\", self->name);\n\t\n\treturn PyString_FromString(buf);\n}\n\n\n/* -------------------------------------------------------- */\n\n/* op.outer(a,b) is equivalent to op(a[:,NewAxis,NewAxis,etc.],b)\n where a has b.ndim NewAxis terms appended.\n\n The result has dimensions a.ndim + b.ndim\n */\n\nstatic PyObject *\nufunc_outer(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyObject *ret;\n\tPyArrayObject *ap1=NULL, *ap2=NULL, *ap_new=NULL;\n\tPyObject *new_args, *tmp;\n\tPyObject *shape1, *shape2, *newshape;\n\n\tif(self->nin != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"outer product only supported \"\\\n\t\t\t\t\"for binary functions\");\n\t\treturn NULL;\n\t}\n\t\n\tif (PySequence_Length(args) != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"exactly two arguments expected\");\n\t\treturn NULL;\n\t}\n\t\n\ttmp = PySequence_GetItem(args, 0);\n\tif (tmp == NULL) return NULL;\n\tap1 = (PyArrayObject *)\t\t\t\t\t\\\n\t\tPyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap1 == NULL) return NULL;\n\t\n\ttmp = PySequence_GetItem(args, 1);\n\tif (tmp == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap2 == NULL) {Py_DECREF(ap1); return NULL;}\n\n\t/* Construct new shape tuple */\n\tshape1 = PyTuple_New(ap1->nd);\n\tif (shape1 == NULL) goto fail;\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape1, i, \n\t\t\t\t PyLong_FromLongLong((longlong)ap1->\t\\\n\t\t\t\t\t\t dimensions[i]));\n\t\n\tshape2 = PyTuple_New(ap2->nd);\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape2, i, PyInt_FromLong((long) 1));\n\tif (shape2 == NULL) {Py_DECREF(shape1); goto fail;}\n\tnewshape = PyNumber_Add(shape1, shape2);\n\tPy_DECREF(shape1);\n\tPy_DECREF(shape2);\n\tif (newshape == NULL) goto fail;\n\t\n\tap_new = (PyArrayObject *)PyArray_Reshape(ap1, newshape);\n\tPy_DECREF(newshape);\n\tif (ap_new == NULL) goto fail;\n\t\n\tnew_args = Py_BuildValue(\"(OO)\", ap_new, ap2);\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\tPy_DECREF(ap_new);\t\n\tret = ufunc_generic_call(self, new_args);\n\tPy_DECREF(new_args);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ap_new);\n\treturn NULL;\n\n}\n\n\nstatic PyObject *\nufunc_reduce(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCE);\n}\n\nstatic PyObject *\nufunc_accumulate(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_ACCUMULATE);\n}\n\nstatic PyObject *\nufunc_reduceat(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCEAT);\n}\n\n\nstatic struct PyMethodDef ufunc_methods[] = {\n\t{\"reduce\", (PyCFunction)ufunc_reduce, METH_VARARGS | METH_KEYWORDS},\n\t{\"accumulate\", (PyCFunction)ufunc_accumulate, \n\t METH_VARARGS | METH_KEYWORDS},\n\t{\"reduceat\", (PyCFunction)ufunc_reduceat, \n\t METH_VARARGS | METH_KEYWORDS},\t\n\t{\"outer\", (PyCFunction)ufunc_outer, METH_VARARGS},\n\t{NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\n\n/* construct the string\n y1,y2,...,yn\n*/\n\nstatic void\n_makeargs(int num, char ltr, char *str) \n{\n\tint ind=0;\n\tint k;\n\tstatic char *digits=\"123456789ABCDE\";\n\n\tif (num == 1) {\n\t\tstr[0] = ltr;\n\t\tind = 1;\n\t}\n\telse {\n\t\tfor (k=0; ktype)\n\nstatic PyObject *\nufunc_getattr(PyUFuncObject *self, char *name)\n{\n\tPyObject *obj;\n\t/* Put docstring first or FindMethod finds it...*/\n\t/* could so some introspection on name and nin + nout */\n\t/* to automate the first part of it */\n\t/* the doc string shouldn't need the calling convention */\n\tif (strcmp(name, \"__doc__\") == 0) {\n\t\tstatic char doc[256];\n\t\tstatic char tmp1[3*MAX_ARGS+2];\n\t\tstatic char tmp2[3*MAX_ARGS+2];\n\t\t/* construct \n\t\t y1,y2,,... = name(x1,x2,...) __doc__\n\t\t*/\t\t\n\t\t_makeargs(self->nout, 'y', tmp1);\n\t\t_makeargs(self->nin, 'x', tmp2);\n\t\tsnprintf(doc, 256, \"%s = %s(%s) %s\", tmp1, self->name, \n\t\t\t tmp2, self->doc);\n\t\treturn PyString_FromString(doc);\n\t}\n\tobj = Py_FindMethod(ufunc_methods, (PyObject *)self, name);\n\tif (obj != NULL) return obj;\n\tPyErr_Clear();\n\tif (strcmp(name, \"nin\") == 0) {\n\t\treturn PyInt_FromLong(self->nin);\n\t}\n\telse if (strcmp(name, \"nout\") == 0) {\n\t\treturn PyInt_FromLong(self->nout);\n\t}\n\telse if (strcmp(name, \"nargs\") == 0) {\n\t\treturn PyInt_FromLong(self->nargs);\n\t}\n\telse if (strcmp(name, \"ntypes\") == 0) {\n\t\treturn PyInt_FromLong(self->ntypes);\n\t}\n\telse if (strcmp(name, \"types\") == 0) {\n\t\t/* return a list with types grouped\n\t\t input->output */\n\t\tPyObject *list;\n\t\tPyObject *str;\n\t\tint k, j, n, nt=self->ntypes;\n\t\tint ni = self->nin;\n\t\tint no = self->nout;\n\t\tchar *t;\n\t\tlist = PyList_New(nt);\n\t\tif (list == NULL) return NULL;\n\t\tt = malloc(no+ni+2);\n\t\tn = 0;\n\t\tfor (k=0; ktypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tt[ni] = '-';\n\t\t\tt[ni+1] = '>';\n\t\t\tfor (j=0; jtypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tstr = PyString_FromStringAndSize(t, no+ni+2);\n\t\t\tPyList_SET_ITEM(list, k, str);\n\t\t}\n\t\tfree(t);\n\t\treturn list;\n\t\t\n\t}\n\telse if (strcmp(name, \"__name__\") == 0) {\n\t\treturn PyString_FromString(self->name);\n\t}\n\telse if (strcmp(name, \"identity\") == 0) {\n\t\tswitch(self->identity) {\n\t\tcase PyUFunc_One:\n\t\t\treturn PyInt_FromLong(1);\n\t\tcase PyUFunc_Zero:\n\t\t\treturn PyInt_FromLong(0);\n\t\tdefault:\n\t\t\tPy_INCREF(Py_None);\n\t\t\treturn Py_None;\n\t\t}\n\t}\n\tPyErr_SetString(PyExc_AttributeError, name);\n\treturn NULL;\n}\n\n#undef _typecharfromnum\n\nstatic int\nufunc_setattr(PyUFuncObject *self, char *name, PyObject *v) \n{\n\treturn -1;\n}\n\nstatic char Ufunctype__doc__[] = \n\t\"Optimized functions make it possible to implement arithmetic \"\\\n\t\"with arrays efficiently\";\n\nstatic PyTypeObject PyUFunc_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufunc\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncObject),\t\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufunc_dealloc,\t/*tp_dealloc*/\n\t(printfunc)0,\t\t /*tp_print*/\n\t(getattrfunc)ufunc_getattr,\t/*tp_getattr*/\n\t(setattrfunc)ufunc_setattr,\t/*tp_setattr*/\n\t(cmpfunc)0,\t \t/*tp_compare*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_repr*/\n\t0,\t\t\t /*tp_as_number*/\n\t0,\t\t /*tp_as_sequence*/\n\t0,\t\t /*tp_as_mapping*/\n\t(hashfunc)0,\t\t/*tp_hash*/\n\t(ternaryfunc)ufunc_generic_call,\t\t/*tp_call*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_str*/\n\t\t\n\t/* Space for future expansion */\n\t0L,0L,0L,0L,\n\tUfunctype__doc__ /* Documentation string */\n};\n\nstatic PyTypeObject PyUFuncLoop_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncloop\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncLoopObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncloop_dealloc\t/*tp_dealloc*/\n};\n\nstatic PyTypeObject PyUFuncReduce_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncreduce\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncReduceObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncreduce_dealloc\t/*tp_dealloc*/\n};\n\n\n/* End of code for ufunc objects */\n/* -------------------------------------------------------- */\n", "methods": [ { "name": "PyUFunc_ff_f_As_dd_d", "long_name": "PyUFunc_ff_f_As_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 145, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 39, "end_line": 49, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_ff_f", "long_name": "PyUFunc_ff_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 135, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 52, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_dd_d", "long_name": "PyUFunc_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 66, "end_line": 77, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_gg_g", "long_name": "PyUFunc_gg_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 135, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 80, "end_line": 90, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F_As_DD_D", "long_name": "PyUFunc_FF_F_As_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 227, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 94, "end_line": 109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_DD_D", "long_name": "PyUFunc_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 112, "end_line": 125, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F", "long_name": "PyUFunc_FF_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 128, "end_line": 141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_GG_G", "long_name": "PyUFunc_GG_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 144, "end_line": 159, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_OO_O", "long_name": "PyUFunc_OO_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 238, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 162, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f_As_d_d", "long_name": "PyUFunc_f_f_As_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 106, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 200, "end_line": 207, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_d_d", "long_name": "PyUFunc_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 210, "end_line": 217, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f", "long_name": "PyUFunc_f_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 220, "end_line": 227, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_g_g", "long_name": "PyUFunc_g_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 2, "token_count": 94, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 230, "end_line": 238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F_As_D_D", "long_name": "PyUFunc_F_F_As_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 164, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 242, "end_line": 253, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F", "long_name": "PyUFunc_F_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 256, "end_line": 267, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_D_D", "long_name": "PyUFunc_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 271, "end_line": 282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_G_G", "long_name": "PyUFunc_G_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 286, "end_line": 297, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O", "long_name": "PyUFunc_O_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 18, "complexity": 5, "token_count": 152, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 300, "end_line": 320, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O_method", "long_name": "PyUFunc_O_O_method( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 24, "complexity": 6, "token_count": 193, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 323, "end_line": 350, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_On_Om", "long_name": "PyUFunc_On_Om( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 47, "complexity": 11, "token_count": 357, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 359, "end_line": 407, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "_error_handler", "long_name": "_error_handler( int method , PyObject * errobj , char * errtype , int retstatus)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 211, "parameters": [ "method", "errobj", "errtype", "retstatus" ], "start_line": 431, "end_line": 477, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "PyUFunc_checkfperr", "long_name": "PyUFunc_checkfperr( int errmask , PyObject * errobj)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 60, "parameters": [ "errmask", "errobj" ], "start_line": 481, "end_line": 510, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyUFunc_clearfperr", "long_name": "PyUFunc_clearfperr()", "filename": "ufuncobject.c", "nloc": 5, "complexity": 1, "token_count": 12, "parameters": [], "start_line": 515, "end_line": 520, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "_lowest_type", "long_name": "_lowest_type( char intype)", "filename": "ufuncobject.c", "nloc": 23, "complexity": 13, "token_count": 66, "parameters": [ "intype" ], "start_line": 550, "end_line": 576, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_cancoerce", "long_name": "_cancoerce( char thistype , char neededtype , char scalar)", "filename": "ufuncobject.c", "nloc": 21, "complexity": 9, "token_count": 101, "parameters": [ "thistype", "neededtype", "scalar" ], "start_line": 579, "end_line": 600, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "select_types", "long_name": "select_types( PyUFuncObject * self , int * arg_types , PyUFuncGenericFunction * function , ** data , char * scalars)", "filename": "ufuncobject.c", "nloc": 70, "complexity": 17, "token_count": 455, "parameters": [ "self", "arg_types", "function", "data", "scalars" ], "start_line": 604, "end_line": 685, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 82, "top_nesting_level": 0 }, { "name": "_getintfromvar", "long_name": "_getintfromvar( char * str , int deflt)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 6, "token_count": 123, "parameters": [ "str", "deflt" ], "start_line": 690, "end_line": 710, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_getfuncfromvar", "long_name": "_getfuncfromvar( char * str , PyObject * deflt)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 134, "parameters": [ "str", "deflt" ], "start_line": 713, "end_line": 738, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "_scalar_kind", "long_name": "_scalar_kind( int typenum , PyArrayObject ** arr)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 6, "token_count": 64, "parameters": [ "typenum", "arr" ], "start_line": 742, "end_line": 750, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "_create_copies", "long_name": "_create_copies( PyUFuncLoopObject * loop , int * arg_types , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 37, "complexity": 8, "token_count": 285, "parameters": [ "loop", "arg_types", "mps" ], "start_line": 759, "end_line": 801, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "construct_matrices", "long_name": "construct_matrices( PyUFuncLoopObject * loop , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 246, "complexity": 59, "token_count": 1912, "parameters": [ "loop", "args", "mps" ], "start_line": 804, "end_line": 1146, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 343, "top_nesting_level": 0 }, { "name": "construct_loop", "long_name": "construct_loop( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 40, "complexity": 8, "token_count": 238, "parameters": [ "self", "args", "mps" ], "start_line": 1153, "end_line": 1202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericFunction", "long_name": "PyUFunc_GenericFunction( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 117, "complexity": 24, "token_count": 838, "parameters": [ "self", "args", "mps" ], "start_line": 1270, "end_line": 1441, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 172, "top_nesting_level": 0 }, { "name": "_getidentity", "long_name": "_getidentity( PyUFuncObject * self , int otype , char * str)", "filename": "ufuncobject.c", "nloc": 19, "complexity": 3, "token_count": 118, "parameters": [ "self", "otype", "str" ], "start_line": 1444, "end_line": 1464, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_create_reduce_copy", "long_name": "_create_reduce_copy( PyUFuncReduceObject * loop , PyArrayObject ** arr , int rtype)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 5, "token_count": 127, "parameters": [ "loop", "arr", "rtype" ], "start_line": 1467, "end_line": 1489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "construct_reduce", "long_name": "construct_reduce( PyUFuncObject * self , PyArrayObject ** arr , int axis , int otype , int operation , intp ind_size , char * str)", "filename": "ufuncobject.c", "nloc": 191, "complexity": 38, "token_count": 1408, "parameters": [ "self", "arr", "axis", "otype", "operation", "ind_size", "str" ], "start_line": 1498, "end_line": 1733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 236, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduce", "long_name": "PyUFunc_Reduce( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 100, "complexity": 16, "token_count": 660, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1745, "end_line": 1875, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Accumulate", "long_name": "PyUFunc_Accumulate( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 101, "complexity": 15, "token_count": 683, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1879, "end_line": 2009, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduceat", "long_name": "PyUFunc_Reduceat( PyUFuncObject * self , PyArrayObject * arr , PyArrayObject * ind , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 108, "complexity": 20, "token_count": 763, "parameters": [ "self", "arr", "ind", "axis", "otype" ], "start_line": 2031, "end_line": 2158, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 128, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericReduction", "long_name": "PyUFunc_GenericReduction( PyUFuncObject * self , PyObject * args , PyObject * kwds , int operation)", "filename": "ufuncobject.c", "nloc": 97, "complexity": 23, "token_count": 613, "parameters": [ "self", "args", "kwds", "operation" ], "start_line": 2167, "end_line": 2277, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 111, "top_nesting_level": 0 }, { "name": "_find_array_wrap", "long_name": "_find_array_wrap( PyObject * args)", "filename": "ufuncobject.c", "nloc": 49, "complexity": 12, "token_count": 260, "parameters": [ "args" ], "start_line": 2284, "end_line": 2336, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "ufunc_generic_call", "long_name": "ufunc_generic_call( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 46, "complexity": 12, "token_count": 356, "parameters": [ "self", "args" ], "start_line": 2339, "end_line": 2404, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 66, "top_nesting_level": 0 }, { "name": "ufunc_frompyfunc", "long_name": "ufunc_frompyfunc( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 50, "complexity": 8, "token_count": 432, "parameters": [ "dummy", "args", "kwds" ], "start_line": 2412, "end_line": 2483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyUFunc_FromFuncAndData", "long_name": "PyUFunc_FromFuncAndData( PyUFuncGenericFunction * func , ** data , char * types , int ntypes , int nin , int nout , int identity , char * name , char * doc , int check_return)", "filename": "ufuncobject.c", "nloc": 26, "complexity": 4, "token_count": 181, "parameters": [ "func", "data", "types", "ntypes", "nin", "nout", "identity", "name", "doc", "check_return" ], "start_line": 2487, "end_line": 2518, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyUFunc_RegisterLoopForType", "long_name": "PyUFunc_RegisterLoopForType( PyUFuncObject * ufunc , int usertype , PyUFuncGenericFunction function , * data)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 241, "parameters": [ "ufunc", "usertype", "function", "data" ], "start_line": 2521, "end_line": 2562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "ufuncreduce_dealloc", "long_name": "ufuncreduce_dealloc( PyUFuncReduceObject * self)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 76, "parameters": [ "self" ], "start_line": 2565, "end_line": 2577, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufuncloop_dealloc", "long_name": "ufuncloop_dealloc( PyUFuncLoopObject * self)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 4, "token_count": 86, "parameters": [ "self" ], "start_line": 2580, "end_line": 2592, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufunc_dealloc", "long_name": "ufunc_dealloc( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 7, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 2596, "end_line": 2602, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "ufunc_repr", "long_name": "ufunc_repr( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 6, "complexity": 1, "token_count": 31, "parameters": [ "self" ], "start_line": 2605, "end_line": 2612, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "ufunc_outer", "long_name": "ufunc_outer( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 59, "complexity": 13, "token_count": 428, "parameters": [ "self", "args" ], "start_line": 2624, "end_line": 2693, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "ufunc_reduce", "long_name": "ufunc_reduce( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2697, "end_line": 2701, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_accumulate", "long_name": "ufunc_accumulate( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2704, "end_line": 2708, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_reduceat", "long_name": "ufunc_reduceat( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2711, "end_line": 2714, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "_makeargs", "long_name": "_makeargs( int num , char ltr , char * str)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 3, "token_count": 117, "parameters": [ "num", "ltr", "str" ], "start_line": 2734, "end_line": 2756, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "ufunc_getattr", "long_name": "ufunc_getattr( PyUFuncObject * self , char * name)", "filename": "ufuncobject.c", "nloc": 74, "complexity": 16, "token_count": 520, "parameters": [ "self", "name" ], "start_line": 2761, "end_line": 2844, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 84, "top_nesting_level": 0 }, { "name": "ufunc_setattr", "long_name": "ufunc_setattr( PyUFuncObject * self , char * name , PyObject * v)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self", "name", "v" ], "start_line": 2849, "end_line": 2852, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyUFunc_ff_f_As_dd_d", "long_name": "PyUFunc_ff_f_As_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 145, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 39, "end_line": 49, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_ff_f", "long_name": "PyUFunc_ff_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 135, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 52, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_dd_d", "long_name": "PyUFunc_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 66, "end_line": 77, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_gg_g", "long_name": "PyUFunc_gg_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 135, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 80, "end_line": 90, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F_As_DD_D", "long_name": "PyUFunc_FF_F_As_DD_D( char ** args , int * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 227, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 94, "end_line": 109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_DD_D", "long_name": "PyUFunc_DD_D( char ** args , int * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 112, "end_line": 125, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F", "long_name": "PyUFunc_FF_F( char ** args , int * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 128, "end_line": 141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_GG_G", "long_name": "PyUFunc_GG_G( char ** args , int * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 144, "end_line": 159, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_OO_O", "long_name": "PyUFunc_OO_O( char ** args , int * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 238, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 162, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f_As_d_d", "long_name": "PyUFunc_f_f_As_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 106, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 200, "end_line": 207, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_d_d", "long_name": "PyUFunc_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 210, "end_line": 217, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f", "long_name": "PyUFunc_f_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 220, "end_line": 227, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_g_g", "long_name": "PyUFunc_g_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 2, "token_count": 94, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 230, "end_line": 238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F_As_D_D", "long_name": "PyUFunc_F_F_As_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 164, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 242, "end_line": 253, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F", "long_name": "PyUFunc_F_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 256, "end_line": 267, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_D_D", "long_name": "PyUFunc_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 271, "end_line": 282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_G_G", "long_name": "PyUFunc_G_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 286, "end_line": 297, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O", "long_name": "PyUFunc_O_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 18, "complexity": 5, "token_count": 152, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 300, "end_line": 320, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O_method", "long_name": "PyUFunc_O_O_method( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 24, "complexity": 6, "token_count": 193, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 323, "end_line": 350, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_On_Om", "long_name": "PyUFunc_On_Om( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 47, "complexity": 11, "token_count": 357, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 359, "end_line": 407, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "_error_handler", "long_name": "_error_handler( int method , PyObject * errobj , char * errtype , int retstatus)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 211, "parameters": [ "method", "errobj", "errtype", "retstatus" ], "start_line": 431, "end_line": 477, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "PyUFunc_checkfperr", "long_name": "PyUFunc_checkfperr( int errmask , PyObject * errobj)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 60, "parameters": [ "errmask", "errobj" ], "start_line": 481, "end_line": 510, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyUFunc_clearfperr", "long_name": "PyUFunc_clearfperr()", "filename": "ufuncobject.c", "nloc": 5, "complexity": 1, "token_count": 12, "parameters": [], "start_line": 515, "end_line": 520, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "_lowest_type", "long_name": "_lowest_type( char intype)", "filename": "ufuncobject.c", "nloc": 23, "complexity": 13, "token_count": 66, "parameters": [ "intype" ], "start_line": 550, "end_line": 576, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_cancoerce", "long_name": "_cancoerce( char thistype , char neededtype , char scalar)", "filename": "ufuncobject.c", "nloc": 21, "complexity": 9, "token_count": 101, "parameters": [ "thistype", "neededtype", "scalar" ], "start_line": 579, "end_line": 600, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "select_types", "long_name": "select_types( PyUFuncObject * self , int * arg_types , PyUFuncGenericFunction * function , ** data , char * scalars)", "filename": "ufuncobject.c", "nloc": 70, "complexity": 17, "token_count": 455, "parameters": [ "self", "arg_types", "function", "data", "scalars" ], "start_line": 604, "end_line": 685, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 82, "top_nesting_level": 0 }, { "name": "_getintfromvar", "long_name": "_getintfromvar( char * str , int deflt)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 6, "token_count": 123, "parameters": [ "str", "deflt" ], "start_line": 690, "end_line": 710, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_getfuncfromvar", "long_name": "_getfuncfromvar( char * str , PyObject * deflt)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 134, "parameters": [ "str", "deflt" ], "start_line": 713, "end_line": 738, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "_scalar_kind", "long_name": "_scalar_kind( int typenum , PyArrayObject ** arr)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 6, "token_count": 64, "parameters": [ "typenum", "arr" ], "start_line": 742, "end_line": 750, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "_create_copies", "long_name": "_create_copies( PyUFuncLoopObject * loop , int * arg_types , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 37, "complexity": 8, "token_count": 285, "parameters": [ "loop", "arg_types", "mps" ], "start_line": 759, "end_line": 801, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "construct_matrices", "long_name": "construct_matrices( PyUFuncLoopObject * loop , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 246, "complexity": 59, "token_count": 1912, "parameters": [ "loop", "args", "mps" ], "start_line": 804, "end_line": 1146, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 343, "top_nesting_level": 0 }, { "name": "construct_loop", "long_name": "construct_loop( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 40, "complexity": 8, "token_count": 238, "parameters": [ "self", "args", "mps" ], "start_line": 1153, "end_line": 1202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericFunction", "long_name": "PyUFunc_GenericFunction( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 117, "complexity": 24, "token_count": 838, "parameters": [ "self", "args", "mps" ], "start_line": 1270, "end_line": 1441, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 172, "top_nesting_level": 0 }, { "name": "_getidentity", "long_name": "_getidentity( PyUFuncObject * self , int otype , char * str)", "filename": "ufuncobject.c", "nloc": 19, "complexity": 3, "token_count": 118, "parameters": [ "self", "otype", "str" ], "start_line": 1444, "end_line": 1464, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_create_reduce_copy", "long_name": "_create_reduce_copy( PyUFuncReduceObject * loop , PyArrayObject ** arr , int rtype)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 5, "token_count": 127, "parameters": [ "loop", "arr", "rtype" ], "start_line": 1467, "end_line": 1489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "construct_reduce", "long_name": "construct_reduce( PyUFuncObject * self , PyArrayObject ** arr , int axis , int otype , int operation , intp ind_size , char * str)", "filename": "ufuncobject.c", "nloc": 191, "complexity": 38, "token_count": 1408, "parameters": [ "self", "arr", "axis", "otype", "operation", "ind_size", "str" ], "start_line": 1498, "end_line": 1733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 236, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduce", "long_name": "PyUFunc_Reduce( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 100, "complexity": 16, "token_count": 660, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1745, "end_line": 1875, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Accumulate", "long_name": "PyUFunc_Accumulate( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 101, "complexity": 15, "token_count": 683, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1879, "end_line": 2009, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduceat", "long_name": "PyUFunc_Reduceat( PyUFuncObject * self , PyArrayObject * arr , PyArrayObject * ind , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 108, "complexity": 20, "token_count": 763, "parameters": [ "self", "arr", "ind", "axis", "otype" ], "start_line": 2031, "end_line": 2158, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 128, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericReduction", "long_name": "PyUFunc_GenericReduction( PyUFuncObject * self , PyObject * args , PyObject * kwds , int operation)", "filename": "ufuncobject.c", "nloc": 97, "complexity": 23, "token_count": 613, "parameters": [ "self", "args", "kwds", "operation" ], "start_line": 2167, "end_line": 2277, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 111, "top_nesting_level": 0 }, { "name": "_find_array_wrap", "long_name": "_find_array_wrap( PyObject * args)", "filename": "ufuncobject.c", "nloc": 49, "complexity": 12, "token_count": 260, "parameters": [ "args" ], "start_line": 2284, "end_line": 2336, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "ufunc_generic_call", "long_name": "ufunc_generic_call( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 46, "complexity": 12, "token_count": 356, "parameters": [ "self", "args" ], "start_line": 2339, "end_line": 2404, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 66, "top_nesting_level": 0 }, { "name": "ufunc_frompyfunc", "long_name": "ufunc_frompyfunc( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 50, "complexity": 8, "token_count": 432, "parameters": [ "dummy", "args", "kwds" ], "start_line": 2412, "end_line": 2483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyUFunc_FromFuncAndData", "long_name": "PyUFunc_FromFuncAndData( PyUFuncGenericFunction * func , ** data , char * types , int ntypes , int nin , int nout , int identity , char * name , char * doc , int check_return)", "filename": "ufuncobject.c", "nloc": 26, "complexity": 4, "token_count": 181, "parameters": [ "func", "data", "types", "ntypes", "nin", "nout", "identity", "name", "doc", "check_return" ], "start_line": 2487, "end_line": 2518, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyUFunc_RegisterLoopForType", "long_name": "PyUFunc_RegisterLoopForType( PyUFuncObject * ufunc , int usertype , PyUFuncGenericFunction function , * data)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 241, "parameters": [ "ufunc", "usertype", "function", "data" ], "start_line": 2521, "end_line": 2562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "ufuncreduce_dealloc", "long_name": "ufuncreduce_dealloc( PyUFuncReduceObject * self)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 76, "parameters": [ "self" ], "start_line": 2565, "end_line": 2577, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufuncloop_dealloc", "long_name": "ufuncloop_dealloc( PyUFuncLoopObject * self)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 4, "token_count": 86, "parameters": [ "self" ], "start_line": 2580, "end_line": 2592, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufunc_dealloc", "long_name": "ufunc_dealloc( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 7, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 2596, "end_line": 2602, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "ufunc_repr", "long_name": "ufunc_repr( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 6, "complexity": 1, "token_count": 31, "parameters": [ "self" ], "start_line": 2605, "end_line": 2612, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "ufunc_outer", "long_name": "ufunc_outer( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 59, "complexity": 13, "token_count": 428, "parameters": [ "self", "args" ], "start_line": 2624, "end_line": 2693, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "ufunc_reduce", "long_name": "ufunc_reduce( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2697, "end_line": 2701, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_accumulate", "long_name": "ufunc_accumulate( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2704, "end_line": 2708, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_reduceat", "long_name": "ufunc_reduceat( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2711, "end_line": 2714, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "_makeargs", "long_name": "_makeargs( int num , char ltr , char * str)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 3, "token_count": 117, "parameters": [ "num", "ltr", "str" ], "start_line": 2734, "end_line": 2756, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "ufunc_getattr", "long_name": "ufunc_getattr( PyUFuncObject * self , char * name)", "filename": "ufuncobject.c", "nloc": 74, "complexity": 16, "token_count": 520, "parameters": [ "self", "name" ], "start_line": 2761, "end_line": 2844, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 84, "top_nesting_level": 0 }, { "name": "ufunc_setattr", "long_name": "ufunc_setattr( PyUFuncObject * self , char * name , PyObject * v)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self", "name", "v" ], "start_line": 2849, "end_line": 2852, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "PyUFunc_FF_F_As_DD_D", "long_name": "PyUFunc_FF_F_As_DD_D( char ** args , int * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 227, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 94, "end_line": 109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_DD_D", "long_name": "PyUFunc_DD_D( char ** args , int * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 112, "end_line": 125, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_GG_G", "long_name": "PyUFunc_GG_G( char ** args , int * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 144, "end_line": 159, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_DD_D", "long_name": "PyUFunc_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 112, "end_line": 125, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_OO_O", "long_name": "PyUFunc_OO_O( char ** args , int * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 238, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 162, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F", "long_name": "PyUFunc_FF_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 128, "end_line": 141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F", "long_name": "PyUFunc_FF_F( char ** args , int * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 128, "end_line": 141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F_As_DD_D", "long_name": "PyUFunc_FF_F_As_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 227, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 94, "end_line": 109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_OO_O", "long_name": "PyUFunc_OO_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 238, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 162, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_GG_G", "long_name": "PyUFunc_GG_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 144, "end_line": 159, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 } ], "nloc": 2138, "complexity": 438, "token_count": 15659, "diff_parsed": { "added": [ "PyUFunc_FF_F_As_DD_D(char **args, intp *dimensions, intp *steps, void *func)", "PyUFunc_DD_D(char **args, intp *dimensions, intp *steps, void *func)", "PyUFunc_FF_F(char **args, intp *dimensions, intp *steps, void *func)", "PyUFunc_GG_G(char **args, intp *dimensions, intp *steps, void *func)", "PyUFunc_OO_O(char **args, intp *dimensions, intp *steps, void *func)" ], "deleted": [ "PyUFunc_FF_F_As_DD_D(char **args, int *dimensions, intp *steps, void *func)", "PyUFunc_DD_D(char **args, int *dimensions, intp *steps, void *func)", "PyUFunc_FF_F(char **args, int *dimensions, intp *steps, void *func)", "PyUFunc_GG_G(char **args, int *dimensions, intp *steps, void *func)", "PyUFunc_OO_O(char **args, int *dimensions, intp *steps, void *func)" ] } } ] }, { "hash": "e67afea77cf3b076c4d56a9c902e68d31bf80e6d", "msg": "Some more fixes", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T08:55:08+00:00", "author_timezone": 0, "committer_date": "2005-10-07T08:55:08+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "911cb6b831c7842f9fe3720f67d0f4eff7b24b9e" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 9, "insertions": 7, "lines": 16, "files": 1, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.0, "dmm_unit_interfacing": 1.0, "modified_files": [ { "old_path": "scipy/base/src/ufuncobject.c", "new_path": "scipy/base/src/ufuncobject.c", "filename": "ufuncobject.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -39,7 +39,7 @@ static void\n PyUFunc_ff_f_As_dd_d(char **args, intp *dimensions, intp *steps, void *func)\n {\n \tregister intp i, n=dimensions[0];\n-\tintp is1=steps[0],is2=steps[1],os=steps[2];\n+\tregister intp is1=steps[0],is2=steps[1],os=steps[2];\n \tchar *ip1=args[0], *ip2=args[1], *op=args[2];\n \t\n \tfor(i=0; inin, nout=data->nout;\n int ntot;\n PyObject *tocall = data->callable; \n char *ptrs[MAX_ARGS];\n PyObject *arglist, *result;\n PyObject *in, **op;\n\n ntot = nin+nout;\n\n for (j=0; j < ntot; j++) ptrs[j] = args[j];\n\tfor(i=0; i> UFUNC_SHIFT_##NAME, \\\n\t\t\t\t\t errobj, str, retstatus) < 0) \\\n\t\t\t\treturn -1;\t\t \\\n\t\t\t}}\n\n\tif (errmask && retstatus) {\n\t\tHANDLEIT(DIVIDEBYZERO, \"divide by zero\");\n\t\tHANDLEIT(OVERFLOW, \"overflow\");\n\t\tHANDLEIT(UNDERFLOW, \"underflow\");\n\t\tHANDLEIT(INVALID, \"invalid\");\n\t}\n\n#undef HANDLEIT\n\n\treturn 0;\n}\n\n\n/* Checking the status flag clears it */\nstatic void\nPyUFunc_clearfperr()\n{\n\tint retstatus;\n\n\tUFUNC_CHECK_STATUS(retstatus)\n}\n\n\n#define UFUNC_NOSCALAR 0\n#define UFUNC_BOOL_SCALAR 1\n#define UFUNC_INTPOS_SCALAR 2\n#define UFUNC_INTNEG_SCALAR 3\n#define UFUNC_FLOAT_SCALAR 4\n#define UFUNC_COMPLEX_SCALAR 5\n#define UFUNC_OBJECT_SCALAR 6\n\n#define NO_UFUNCLOOP 0\n#define ZERODIM_REDUCELOOP 0\n#define ONE_UFUNCLOOP 1\n#define ONEDIM_REDUCELOOP 1\n#define NOBUFFER_UFUNCLOOP 2\n#define NOBUFFER_REDUCELOOP 2\n#define BUFFER_UFUNCLOOP 3\n#define BUFFER_REDUCELOOP 3\n\n\n#define UFUNC_REDUCE 0\n#define UFUNC_ACCUMULATE 1\n#define UFUNC_REDUCEAT 2\n#define UFUNC_OUTER 3\n\n\n\n\nstatic char\n_lowest_type(char intype)\n{\n switch(intype) {\n\t/* case PyArray_BYTE */\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\treturn PyArray_BYTE;\n\t/* case PyArray_UBYTE */\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\treturn PyArray_UBYTE;\n\t/* case PyArray_FLOAT:*/\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\treturn PyArray_FLOAT;\n\t/* case PyArray_CFLOAT:*/\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn PyArray_CFLOAT;\n default:\n return intype;\n }\n}\n\nstatic int \n_cancoerce(char thistype, char neededtype, char scalar) \n{\n\n\tswitch(scalar) {\n\tcase UFUNC_NOSCALAR:\n\tcase UFUNC_BOOL_SCALAR:\n\tcase UFUNC_OBJECT_SCALAR:\n\t\treturn PyArray_CanCastSafely(thistype, neededtype);\n\tcase UFUNC_INTPOS_SCALAR:\n\t\treturn (neededtype >= PyArray_UBYTE);\n\tcase UFUNC_INTNEG_SCALAR:\n\t\treturn (neededtype >= PyArray_BYTE) &&\t\t\\\n\t\t\t!(PyTypeNum_ISUNSIGNED(neededtype));\n\tcase UFUNC_FLOAT_SCALAR:\n\t\treturn (neededtype >= PyArray_FLOAT);\n\tcase UFUNC_COMPLEX_SCALAR:\n\t\treturn (neededtype >= PyArray_CFLOAT);\n\t}\n\tfprintf(stderr, \"\\n**Error** coerce fall through: %d %d %d\\n\\n\", \n\t\tthistype, neededtype, scalar);\n\treturn 1; /* should never get here... */ \n}\n\n\nstatic int \nselect_types(PyUFuncObject *self, int *arg_types, \n PyUFuncGenericFunction *function, void **data,\n\t char *scalars)\n{\n\n\tint i=0, j;\n\tchar start_type;\n\t\n\tif (PyTypeNum_ISUSERDEF((arg_types[0]))) {\n\t\tPyObject *key, *obj;\n\t\tfor (i=0; inin; i++) {\n\t\t\tif (arg_types[i] != arg_types[0]) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\t\t\"ufuncs on user defined\" \\\n\t\t\t\t\t\t\" types don't support \"\\\n\t\t\t\t\t\t\"coercion.\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfor (i=self->nin; inargs; i++) {\n\t\t\targ_types[i] = arg_types[0];\n\t\t}\n\t\t\n\t\tkey = PyInt_FromLong((long) arg_types[0]);\n\t\tif (key == NULL) return -1;\n\t\tobj = PyDict_GetItem(self->userloops, key);\n\t\tif (obj == NULL) {\n\t\t\tPy_DECREF(key);\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"no registered loop for this \"\t\\\n\t\t\t\t\t\"user-defined type.\");\n\t\t\treturn -1;\t\t\t\n\t\t}\n\t\tif PyTuple_Check(obj) {\n\t\t\t*function = (PyUFuncGenericFunction) \\\n\t\t\t\tPyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 0));\n\t\t\t*data = PyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 1));\n\t\t}\n\t\telse {\n\t\t\t*function = (PyUFuncGenericFunction)\t\\\n\t\t\t\tPyCObject_AsVoidPtr(obj);\n\t\t\t*data = NULL;\n\t\t}\n\t\tPy_DECREF(key);\n\t\treturn 0;\n\t}\n\t\n\n\tstart_type = arg_types[0];\n\t/* If the first argument is a scalar we need to place \n\t the start type as the lowest type in the class\n\t*/\n\tif (scalars[0] != UFUNC_NOSCALAR) {\n\t\tstart_type = _lowest_type(start_type);\n\t}\n\n\twhile (intypes && start_type > self->types[i*self->nargs]) \n\t\ti++;\n\n\tfor(;intypes; i++) {\n\t\tfor(j=0; jnin; j++) {\n\t\t\tif (!_cancoerce(arg_types[j], \n\t\t\t\t\tself->types[i*self->nargs+j],\n\t\t\t\t\tscalars[j]))\n\t\t\t\tbreak;\n\t\t}\n\t\tif (j == self->nin) break;\n\t}\n\tif(i>=self->ntypes) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"function not supported for these types, \"\\\n\t\t\t\t\"and can't coerce safely to supported types\");\n\t\treturn -1;\n\t}\n\tfor(j=0; jnargs; j++) \n\t\targ_types[j] = self->types[i*self->nargs+j];\n\n\t*data = self->data[i];\n\t*function = self->functions[i];\n\n\treturn 0;\n}\n\n\n\nstatic int\n_getintfromvar(char *str, int deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tint retval=deflt;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n thedict = PyEval_GetGlobals();\n ref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = (int) PyInt_AsLong(ref);\n if (ref == NULL || retval == -1) retval = deflt;\n PyErr_Clear();\n\treturn retval;\n}\n\nstatic PyObject *\n_getfuncfromvar(char *str, PyObject *deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tPyObject *retval;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n\t\tthedict = PyEval_GetGlobals();\n\t\tref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = ref;\n\telse retval = deflt;\n\tif (retval != Py_None && !PyCallable_Check(retval)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"%s if provided must be callable\", str);\n\t\treturn NULL;\n\t}\n\tPy_INCREF(retval);\n\treturn retval;\n}\n\n\nstatic char\n_scalar_kind(int typenum, PyArrayObject **arr) \n{\n\tif (PyTypeNum_ISSIGNED(typenum)) return UFUNC_INTNEG_SCALAR;\n\tif (PyTypeNum_ISFLOAT(typenum)) return UFUNC_FLOAT_SCALAR;\n\tif (PyTypeNum_ISCOMPLEX(typenum)) return UFUNC_COMPLEX_SCALAR;\n\tif (PyTypeNum_ISUNSIGNED(typenum)) return UFUNC_INTPOS_SCALAR;\n\tif (PyTypeNum_ISBOOL(typenum)) return UFUNC_BOOL_SCALAR;\n\treturn UFUNC_OBJECT_SCALAR;\n}\n\n\n/* Create copies for any arrays that are less than loop->bufsize\n in total size and are mis-behaved or in need\n of casting.\n*/\n\nstatic int\n_create_copies(PyUFuncLoopObject *loop, int *arg_types, PyArrayObject **mps)\n{\n\tint nin = loop->ufunc->nin;\n\tint i;\n\tintp size;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\n\tfor (i=0; ielsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\t\tif (size < loop->bufsize) {\n\t\t\tif (!(PyArray_ISBEHAVED_RO(mps[i])) ||\t\t\\\n\t\t\t PyArray_TYPE(mps[i]) != arg_types[i]) {\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST |\t\\\n\t\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\nstatic int\nconstruct_matrices(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps)\n{\n int nargs, i, cnt, cntcast, maxsize;\n int arg_types[MAX_ARGS];\n\tchar scalars[MAX_ARGS];\n\tPyUFuncObject *self=loop->ufunc;\n\tBool allscalars=TRUE;\n\tPyTypeObject *subtype=&PyArray_Type;\n\n /* Check number of arguments */\n nargs = PyTuple_Size(args);\n if ((nargs != self->nin) && (nargs != self->nargs)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of arguments\");\n return -1;\n }\n\n\n /* Get each input argument */\n for (i=0; inin; i++) {\n mps[i] = (PyArrayObject *)\\\n\t\t\tPyArray_FromAny(PyTuple_GET_ITEM(args,i), \n\t\t\t\t\tNULL, 0, 0, 0);\n if (mps[i] == NULL) return -1;\n arg_types[i] = PyArray_TYPE(mps[i]);\n if (PyTypeNum_ISFLEXIBLE(arg_types[i])) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"ufuncs do not support\"\t\\\n \" flexible arrays\");\n return -1;\n }\n\t\t/*\n\t\tfprintf(stderr, \"array %d has reference %d\\n\", i, \n\t\t (mps[i])->ob_refcnt);\n\t\t*/\n\n\t\t/* Scalars are 0-dimensional arrays\n\t\t at this point\n\t\t*/\n\t\tif (mps[i]->nd > 0) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t\tallscalars=FALSE;\n\t\t}\n\t\telse scalars[i] = _scalar_kind(arg_types[i], &(mps[i]));\n\n\t\t/* If any input is a big-array */\n\t\tif (!PyType_IsSubtype(mps[i]->ob_type, &PyArray_Type)) {\n\t\t\tsubtype = &PyBigArray_Type;\n\t\t}\n }\n\n\t/* If everything is a scalar, then use normal coercion rules */\n\tif (allscalars) {\n\t\tfor (i=0; inin; i++) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t}\n\t}\n \n /* Select an appropriate function for these argument types. */\n if (select_types(loop->ufunc, arg_types, &(loop->function), \n &(loop->funcdata), scalars) == -1)\n\t\treturn -1;\n\n\t/* This is the buffer size in number of elements.*/\n loop->bufsize = _getintfromvar(UFUNC_BUFSIZE_NAME, PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \"The buffer size (%d) is not \" \\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\treturn -1;\n\t}\n\t\n\t/* Create copies for some of the arrays if appropriate */\n\tif (_create_copies(loop, arg_types, mps) < 0) return -1;\n\t\n\t/* Create Iterators for the Inputs */\n\tfor (i=0; inin; i++) {\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n\t}\n \n /* Broadcast the result */\n loop->numiter = self->nin;\n if (PyArray_Broadcast((PyArrayMultiIterObject *)loop) < 0)\n\t\treturn -1;\n\t\n /* Get any return arguments */\n for (i=self->nin; idimensions, \n\t\t\t\t\t loop->dimensions, loop->nd)) {\n PyErr_SetString(PyExc_ValueError, \n \"invalid return array shape\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n if (!PyArray_ISWRITEABLE(mps[i])) {\n PyErr_SetString(PyExc_ValueError, \n \"return array is not writeable\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n }\n\n /* construct any missing return arrays and make output iterators */\n \n for (i=self->nin; inargs; i++) {\n\t\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\n if (mps[i] == NULL) {\n mps[i] = (PyArrayObject *)PyArray_New(subtype,\n loop->nd, \n loop->dimensions,\n arg_types[i], \n NULL, NULL,\n 0, 0, NULL);\n if (mps[i] == NULL) return -1;\n }\n\n\n\t\t/* reset types for outputs that are equivalent \n\t\t -- no sense casting uselessly\n\t\t*/\n\t\tif (mps[i]->descr->type_num != arg_types[i]) {\n\t\t\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\t\t\tntype.type_num = PyArray_TYPE(mps[i]);\n\t\t\tntype.itemsize = PyArray_ITEMSIZE(mps[i]);\n\t\t\tatype.type_num = arg_types[i];\n\t\t\tatype.itemsize = \\\n\t\t\t\tPyArray_DescrFromType(arg_types[i])->elsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\n\t\t/* still not the same -- or will we have to use buffers?*/\n\t\tif (mps[i]->descr->type_num != arg_types[i] ||\n\t\t !PyArray_ISBEHAVED_RO(mps[i])) {\n\t\t\tif (loop->size < loop->bufsize) {\n\t\t\t\tPyObject *new;\n\t\t\t\t/* Copy the array to a temporary copy \n\t\t\t\t and set the UPDATEIFCOPY flag\n\t\t\t\t*/\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST | \n\t\t\t\t\t\t BEHAVED_FLAGS_RO |\n\t\t\t\t\t\t UPDATEIFCOPY);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t\t\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n }\n\n\n /* If any of different type, or misaligned or swapped\n then must use buffers */\n\n loop->bufcnt = 0;\n\n loop->obj = 0;\n\n /* Determine looping method needed */\n loop->meth = NO_UFUNCLOOP;\n\n\tcnt = cntcast = 0; /* keeps track of bytes to allocate */\n\tmaxsize = 0;\n for (i=0; inargs; i++) {\n\t\tcnt += mps[i]->itemsize;\n if (arg_types[i] != mps[i]->descr->type_num) {\n\t\t\tPyArray_Descr *descr;\n\n loop->meth = BUFFER_UFUNCLOOP;\n\t\t\tdescr = PyArray_DescrFromType(arg_types[i]);\n\t\t\tcntcast += descr->elsize;\n if (i < self->nin) {\n loop->cast[i] = \\\n\t\t\t\t\tmps[i]->descr->cast[arg_types[i]];\n\t\t\t}\n else {\n loop->cast[i] = descr->\\\n\t\t\t\t\tcast[mps[i]->descr->type_num];\n\t\t\t}\n\n }\n loop->swap[i] = !(PyArray_ISNOTSWAPPED(mps[i]));\n if (!PyArray_ISBEHAVED_RO(mps[i])) {\n loop->meth = BUFFER_UFUNCLOOP;\n }\n if (!loop->obj && mps[i]->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n }\n \n if (loop->meth == NO_UFUNCLOOP) {\n \n loop->meth = ONE_UFUNCLOOP;\n\n /* All correct type and BEHAVED */\n /* Check for non-uniform stridedness */\n\n for (i=0; inargs; i++) {\n if (!(loop->iters[i]->contiguous)) {\n\t\t\t\t/* may still have uniform stride\n\t\t\t\t if (broadcated result) <= 1-d */\n\t\t\t\tif (mps[i]->nd != 0 &&\t\t\t\\\n\t\t\t\t (loop->iters[i]->nd_m1 > 0)) {\n\t\t\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n }\n\t\tif (loop->meth == ONE_UFUNCLOOP) {\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tloop->bufptr[i] = mps[i]->data;\n\t\t\t}\n\t\t}\n }\n\n loop->numiter = self->nargs;\n\n /* Fill in steps */\n if (loop->meth == NOBUFFER_UFUNCLOOP) {\n\t\tint ldim = 0;\n\t\tintp maxdim=-1;\n\t\tPyArrayIterObject *it;\n\n /* Fix iterators */\n\n /* Find the **largest** dimension */\n \n\t\tmaxdim = -1;\n\t\tfor (i=loop->nd - 1; i>=0; i--) {\n\t\t\tif (loop->dimensions[i] > maxdim) {\n\t\t\t\tldim = i;\n\t\t\t\tmaxdim = loop->dimensions[i];\n\t\t\t}\n\t\t}\n\n\t\tloop->size /= maxdim;\n loop->bufcnt = maxdim;\n\n /* Fix the iterators so the inner loop occurs over the \n\t\t largest dimensions -- This can be done by \n\t\t setting the size to 1 in that dimension \n\t\t (just in the iterators)\n */\n\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = loop->iters[i];\n it->contiguous = 0;\n\t\t\tit->size /= (it->dims_m1[ldim]+1);\n\t\t\tit->dims_m1[ldim] = 0;\n\t\t\tit->backstrides[ldim] = 0;\n\n\t\t\t/* (won't fix factors because we\n\t\t\t don't use PyArray_ITER_GOTO1D \n\t\t\t so don't change them) */\n\n\n\t\t\t/* Set the steps to the strides in that dimension */\n loop->steps[i] = it->strides[ldim];\n\t\t}\n\n }\n else if (loop->meth == BUFFER_UFUNCLOOP) {\n for (i=0; inargs; i++) {\n\t\t\tloop->steps[i] = mps[i]->itemsize; \n\t\t}\n }\n\telse { /* uniformly-strided case ONE_UFUNCLOOP */\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (mps[i]->nd == 0)\n\t\t\t\tloop->steps[i] = 0;\n\t\t\telse \n\t\t\t\tloop->steps[i] = mps[i]->strides[mps[i]->nd-1];\n\t\t}\n\t}\n \n\n\t/* Finally, create memory for buffers if we need them */\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\t\tchar *castptr;\n\t\tint oldsize=0;\n\t\tloop->buffer[0] = (char *)malloc(loop->bufsize*(cnt+cntcast));\n\t\t/* fprintf(stderr, \"Allocated buffer at %p of size %d, cnt=%d, cntcast=%d\\n\", loop->buffer[0], loop->bufsize * (cnt + cntcast), cnt, cntcast); */\n\t\tif (loop->buffer[0] == NULL) return -1;\n\t\tcastptr = loop->buffer[0] + loop->bufsize*cnt;\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (i > 0)\n\t\t\t\tloop->buffer[i] = loop->buffer[i-1] + \\\n\t\t\t\t\tloop->bufsize * mps[i-1]->itemsize;\n\t\t\t/* fprintf(stderr, \"buffer[%d] = %p\\n\", i, loop->buffer[i]); */\n\t\t\tif (loop->cast[i]) {\n\t\t\t\tloop->castbuf[i] = castptr + \n\t\t\t\t\tloop->bufsize*oldsize;\n\t\t\t\t/* fprintf(stderr, \"castbuf[%d] = %p\\n\", i, loop->castbuf[i]); */\n#define _PyD PyArray_DescrFromType\n\t\t\t\toldsize = _PyD(arg_types[i])->elsize;\n#undef _PyD\n\t\t\t\tloop->bufptr[i] = loop->castbuf[i];\n\t\t\t\tcastptr = loop->castbuf[i];\n\t\t\t\tloop->steps[i] = oldsize;\n\t\t\t}\n\t\t\telse\n\t\t\t\tloop->bufptr[i] = loop->buffer[i];\n\t\t\tloop->dptr[i] = loop->buffer[i];\n\t\t}\n\t}\n\n return nargs;\n}\n\nstatic PyTypeObject PyUFuncLoop_Type;\n\nstatic void ufuncloop_dealloc(PyUFuncLoopObject *);\n\nstatic PyUFuncLoopObject *\nconstruct_loop(PyUFuncObject *self, PyObject *args, PyArrayObject **mps)\n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\t\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\n\n\tif ((loop=PyObject_NEW(PyUFuncLoopObject, &PyUFuncLoop_Type)) == NULL)\n\t\treturn NULL;\n\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n\tloop->buffer[0] = NULL;\n for (i=0; inargs; i++) {\n loop->iters[i] = NULL;\n loop->cast[i] = NULL;\n }\n\tloop->errobj = NULL;\n\n\t/* Setup the matrices */\n\tif (construct_matrices(loop, args, mps) < 0) goto fail;\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString((self->name ? \\\n self->name : \"\")), \n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n\tPyUFunc_clearfperr();\n\n\treturn loop;\n\n fail:\n\tufuncloop_dealloc(loop);\n\treturn NULL;\n}\n\n\n/* \nstatic void\n_printbytebuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing byte buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %d\\n\", *(((byte *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbufptr(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->bufptr[bufnum]))+i));\n\t} \n}\n\n\n \nstatic void\n_printcastbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->castbuf[bufnum]))+i));\n\t} \n}\n\n*/\n\n\n\n\n/* currently generic ufuncs cannot be built for use on flexible arrays.\n\n The cast functions in the generic loop would need to be fixed to pass \n something besides NULL, NULL \n\n*/\n\n/* This generic function is called with the ufunc object, the arguments to it,\n and an array of (pointers to) PyArrayObjects which are NULL. The \n arguments are parsed and placed in mps in construct_loop (construct_matrices)\n*/\n\nstatic int \nPyUFunc_GenericFunction(PyUFuncObject *self, PyObject *args, \n\t\t\tPyArrayObject **mps) \n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\tint temp;\n BEGIN_THREADS_DEF\n\n\tif (!(loop = construct_loop(self, args, mps))) return -1;\n\n\tLOOP_BEGIN_THREADS\n\n\tswitch(loop->meth) {\n\tcase ONE_UFUNCLOOP:\n\t\t/* Everything is contiguous, notswapped, aligned,\n\t\t and of the right type. -- Fastest.\n\t\t Or if not contiguous, then a single-stride\n\t\t increment moves through the entire array. \n\t\t*/\n /* fprintf(stderr, \"ONE...%d\\n\", loop->size);*/\n\t\tloop->function((char **)loop->bufptr, &(loop->size), \n\t\t\t loop->steps, loop->funcdata);\n\t\tUFUNC_CHECK_ERROR();\n\t\tbreak;\n\tcase NOBUFFER_UFUNCLOOP:\n\t\t/* Everything is notswapped, aligned and of the \n\t\t right type but not contiguous. -- Almost as fast.\n\t\t*/\n /* fprintf(stderr, \"NOBUFFER...%d\\n\", loop->size);*/\n\t\twhile (loop->index < loop->size) {\n\t\t\tfor (i=0; inargs; i++) \n\t\t\t\tloop->bufptr[i] = loop->iters[i]->dataptr;\n\n\t\t\tloop->function((char **)loop->bufptr, &(loop->bufcnt),\n\t\t\t\t loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tPyArray_ITER_NEXT(loop->iters[i]);\n\t\t\t}\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\tcase BUFFER_UFUNCLOOP: {\n\t\t/* Make local copies of all loop variables */\n\t\t/* Optimizations needed:\n\t\t 1) move data better into the buffer better\n\t\t --- not one at a time -- this requires some \n pre-analysis and is only possible over \n the largest dimension.\n\t\t*/\n\n\t\tPyArray_CopySwapNFunc *copyswapn[MAX_ARGS];\n\t\tPyArrayIterObject **iters=loop->iters;\n\t\tint *swap=loop->swap;\n\t\tvoid **dptr=loop->dptr;\n\t\tint mpselsize[MAX_ARGS];\n\t\tintp index=loop->index, size=loop->size;\n\t\tint bufcnt=loop->bufcnt, bufsize=loop->bufsize;\n\t\tvoid **bufptr = loop->bufptr;\n\t\tvoid **buffer = loop->buffer;\n\t\tvoid **castbuf = loop->castbuf;\n\t\tintp *steps = loop->steps;\n\t\tBool pyobject[MAX_ARGS];\n\t\t\n\t\tfor (i=0; inargs; i++) {\n\t\t\tcopyswapn[i] = mps[i]->descr->copyswapn;\n\t\t\tmpselsize[i] = mps[i]->itemsize;\n\t\t\tpyobject[i] = (loop->obj && \\\n (mps[i]->descr->type_num == PyArray_OBJECT));\n\t\t}\n\t\t/* Do generic buffered looping here (works for any kind of\n\t\t arrays): Everything uses a buffer. \n\n\t\t 1. fill the input buffers.\n\t\t 2. If buffer is filled then \n\t\t a. cast any input buffers needing it. \n\t\t b. call inner function (which loops over the buffer).\n\t\t\t c. cast any output buffers needing it.\n\t\t\t d. copy output buffer back to output arrays.\n 3. goto next position\n\t\t*/ \n\t\tfprintf(stderr, \"BUFFER...%d\\n\", loop->size);\n\t\t/*\n\t\tfor (i=0; inargs; i++) {\n\t\t\tfprintf(stderr, \"iters[%d]->dataptr = %p, %p of size %d\\n\", i, \n\t\t\t\titers[i], iters[i]->ao->data, PyArray_NBYTES(iters[i]->ao));\n\t\t}\n\t\t*/\n\t\twhile (index < size) {\n\t\t\t/*copy input data */\n\t\t\tfor (i=0; inin; i++) {\n\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\tPy_INCREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t}\n\t\t\t\t/*\t\t\t\tfprintf(stderr, \"index = %d, i=%d, writing to %p\\n\", index, i, dptr[i]); */\n\t\t\t\tmemcpy(dptr[i], iters[i]->dataptr,\n\t\t\t\t mpselsize[i]);\n\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t}\n\t\t\tbufcnt++;\n\t\t\tindex++; \n\t\t\tif ((bufcnt == bufsize) || \\\n\t\t\t (index == size)) {\n\t\t\t\t\n\t\t\t\tfor (i=0; inin; i++) {\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping...\\n\");*/\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](buffer[i],\n\t\t\t\t\t\t\t castbuf[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t\tloop->function((char **)bufptr, \n\t\t\t\t\t &bufcnt, \n\t\t\t\t\t steps, loop->funcdata);\n \n\t\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\t\tfor (i=self->nin; inargs; i++) {\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](castbuf[i],\n\t\t\t\t\t\t\t buffer[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping back...\\n\"); */\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tfor (temp = 0; temp < bufcnt; temp++) {\n\t\t\t\t\t\t/* fprintf(stderr, \"temp=%d, i=%d; reading from %p\\n\", temp, i, dptr[i]);*/\n\t\t\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\t\t\tPy_XDECREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t\t\t\tPy_INCREF(*((PyObject **)dptr[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmemcpy(iters[i]->dataptr,\n\t\t\t\t\t\t dptr[i], mpselsize[i]);\n\t\t\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbufcnt = 0;\n\t\t\t\tfor (i=0; inargs; i++) \n\t\t\t\t\tdptr[i] = buffer[i];\n\t\t\t\t\n\t\t\t} \n\t\t}\n\t}\n\t}\t\n\t\n LOOP_END_THREADS\n\t\n Py_DECREF(loop);\n\treturn 0;\n\n fail:\n LOOP_END_THREADS\n \n\tPy_XDECREF(loop);\n\treturn -1;\n }\n\nstatic PyArrayObject *\n_getidentity(PyUFuncObject *self, int otype, char *str)\n{\n PyObject *obj, *arr;\n PyArray_Typecode typecode = {otype, 0, 0};\n\n if (self->identity == PyUFunc_None) {\n PyErr_Format(PyExc_ValueError, \n \"zero-size array to ufunc.%s \" \\\n \"without identity\", str);\n return NULL;\n }\n if (self->identity == PyUFunc_One) {\n obj = PyInt_FromLong((long) 1);\n } else {\n obj = PyInt_FromLong((long) 0);\n }\n\t\n arr = PyArray_FromAny(obj, &typecode, 0, 0, CARRAY_FLAGS);\n Py_DECREF(obj);\n return (PyArrayObject *)arr;\n}\n\nstatic int\n_create_reduce_copy(PyUFuncReduceObject *loop, PyArrayObject **arr, int rtype)\n{\n\tintp maxsize;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {rtype, 0, 0};\n\t\n\tmaxsize = PyArray_SIZE(*arr);\n\t\n\tif (maxsize < loop->bufsize) {\n\t\tif (!(PyArray_ISBEHAVED_RO(*arr)) ||\t\\\n\t\t PyArray_TYPE(*arr) != rtype) {\n\t\t\tnew = PyArray_FromAny((PyObject *)(*arr), \n\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t FORCECAST |\t\t\\\n\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\tif (new == NULL) return -1;\n\t\t\t*arr = (PyArrayObject *)new;\n\t\t\tloop->decref = new;\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\n\n\nstatic PyTypeObject PyUFuncReduce_Type;\n\nstatic void ufuncreduce_dealloc(PyUFuncReduceObject *);\n\nstatic PyUFuncReduceObject *\nconstruct_reduce(PyUFuncObject *self, PyArrayObject **arr, int axis, \n\t\t int otype, int operation, intp ind_size, char *str)\n{\n PyUFuncReduceObject *loop;\n PyArrayObject *idarr;\n\tPyArrayObject *aar;\n intp loop_i[MAX_DIMS];\n int arg_types[3] = {otype, otype, otype};\n\tchar scalars[3] = {UFUNC_NOSCALAR, UFUNC_NOSCALAR, UFUNC_NOSCALAR};\n\tint i, j;\n\tint nd = (*arr)->nd;\n\t/* Reduce type is the type requested of the input \n\t during reduction */\n\n\tif ((loop=PyObject_NEW(PyUFuncReduceObject, \n\t\t\t &PyUFuncReduce_Type)) == NULL)\n\t\treturn NULL;\n\n\n loop->swap = 0;\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n loop->cast = NULL;\n loop->buffer = NULL;\n loop->ret = NULL;\n\tloop->it = NULL;\n\tloop->rit = NULL;\n\tloop->errobj = NULL;\n\tloop->decref=NULL; \n loop->N = (*arr)->dimensions[axis];\n\tloop->instrides = (*arr)->strides[axis];\n\n\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t &(loop->funcdata), scalars) == -1) goto fail; \n\t\n\t/* output type may change -- if it does \n\t reduction is forced into that type \n\t and we need to select the reduction function again\n\t*/\n\tif (otype != arg_types[2]) {\n\t\totype = arg_types[2];\n\t\targ_types[0] = otype;\n\t\targ_types[1] = otype;\n\t\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t\t &(loop->funcdata), scalars) == -1) \n\t\t\tgoto fail; \t\t\n\t}\n\n\t/* Make bufsize depend on a local then module-level variable */\n\tloop->bufsize = _getintfromvar(\"UFUNC_BUFSIZE\", \n\t\t\t\t PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"The buffer size (%d) is not \"\t\\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\tgoto fail;\n\t}\n\t\n\t/* Make copy if misbehaved or not otype for small arrays */\n\tif (_create_reduce_copy(loop, arr, otype) < 0) goto fail; \n\taar = *arr;\n\t\n if (loop->N == 0) {\n loop->meth = ZERODIM_REDUCELOOP;\n }\n else if (PyArray_ISBEHAVED_RO(aar) &&\t\t\\\n otype == (aar)->descr->type_num) {\n\t\tif (loop->N == 1) {\n\t\t\tloop->meth = ONEDIM_REDUCELOOP;\n\t\t}\n\t\telse {\n\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\tloop->steps[0] = (aar)->strides[axis];\n\t\t\tloop->N -= 1;\n\t\t}\n }\n else {\n loop->meth = BUFFER_UFUNCLOOP;\n loop->swap = !(PyArray_ISNOTSWAPPED(aar));\n }\n\n if (loop->meth == ZERODIM_REDUCELOOP) {\n idarr = _getidentity(self, otype, str);\n if (idarr == NULL) goto fail;\n if (idarr->itemsize > UFUNC_MAXIDENTITY) {\n PyErr_Format(PyExc_RuntimeError, \n\t\t\t\t \"UFUNC_MAXIDENTITY (%d)\"\t\t\\\n \" is too small (needs to be at least %d)\",\n UFUNC_MAXIDENTITY, idarr->itemsize);\n Py_DECREF(idarr);\n goto fail;\n }\n memcpy(loop->idptr, idarr->data, idarr->itemsize);\n Py_DECREF(idarr);\n }\n\t\n /* Construct return array */\n\tswitch(operation) {\n\tcase UFUNC_REDUCE:\n\t\tfor (j=0, i=0; idimensions[i];\n\t\t\t\n\t\t}\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd-1, loop_i, otype, \n\t\t\t\t NULL, NULL, 0, 0, aar);\n\t\tbreak;\n\tcase UFUNC_ACCUMULATE:\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, aar->dimensions, \n\t\t\t\t otype, NULL, NULL, 0, 0, aar);\n\t\tbreak;\n\tcase UFUNC_REDUCEAT:\n\t\tmemcpy(loop_i, aar->dimensions, nd*sizeof(intp));\n\t\t/* Index is 1-d array */\n\t\tloop_i[axis] = ind_size; \n\t\tloop->ret = (PyArrayObject *)\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, loop_i, otype,\n\t\t\t\t NULL, NULL, 0, 0, aar);\n\t\tif (loop->ret == NULL) goto fail;\n\t\tif (ind_size == 0) {\n\t\t\tloop->meth = ZERODIM_REDUCELOOP;\n\t\t\treturn loop;\n\t\t}\n\t\tif (loop->meth == ONEDIM_REDUCELOOP)\n\t\t\tloop->meth = NOBUFFER_REDUCELOOP;\n\t\tbreak;\n\t}\n if (loop->ret == NULL) goto fail;\n loop->insize = aar->itemsize;\n loop->outsize = loop->ret->itemsize;\n loop->bufptr[1] = loop->ret->data;\n\n\tif (loop->meth == ZERODIM_REDUCELOOP) {\n\t\tloop->size = PyArray_SIZE(loop->ret);\n\t\treturn loop;\n\t}\n\n\tloop->it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)aar);\n if (loop->it == NULL) return NULL;\n\n\tif (loop->meth == ONEDIM_REDUCELOOP) {\n\t\tloop->size = loop->it->size;\t\t\n\t\treturn loop;\n\t}\n\n /* Fix iterator to loop over correct dimension */\n\t/* Set size in axis dimension to 1 */\n \n loop->it->contiguous = 0;\n loop->it->size /= (loop->it->dims_m1[axis]+1);\n loop->it->dims_m1[axis] = 0;\n loop->it->backstrides[axis] = 0;\n\n\n loop->size = loop->it->size;\n\n\tif (operation == UFUNC_REDUCE) {\n\t\tloop->steps[1] = 0;\n\t}\n\telse {\n\t\tloop->rit = (PyArrayIterObject *)\t\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)(loop->ret));\n\t\tif (loop->rit == NULL) return NULL;\t\t\n\n\t\t/* Fix iterator to loop over correct dimension */\n\t\t/* Set size in axis dimension to 1 */\n\t\t\n\t\tloop->rit->contiguous = 0;\n\t\tloop->rit->size /= (loop->rit->dims_m1[axis]+1);\n\t\tloop->rit->dims_m1[axis] = 0;\n\t\tloop->rit->backstrides[axis] = 0;\n\n\t\tif (operation == UFUNC_ACCUMULATE)\n\t\t\tloop->steps[1] = loop->ret->strides[axis];\n\t\telse \n\t\t\tloop->steps[1] = 0;\n\t}\n\tloop->steps[2] = loop->steps[1];\n\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[2];\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\n\t\tloop->steps[0] = loop->outsize;\n if (otype != aar->descr->type_num) {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n (loop->outsize + \\\n aar->itemsize));\n if (loop->buffer == NULL) goto fail;\n loop->castbuf = loop->buffer + \\\n loop->bufsize*aar->itemsize;\n loop->bufptr[0] = loop->castbuf; \n loop->cast = aar->descr->cast[otype];\n }\n else {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n loop->outsize);\n if (loop->buffer == NULL) goto fail;\n loop->bufptr[0] = loop->buffer;\n }\n\t}\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \\\n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t\t\t \n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString(str),\n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n /* Determine if object arrays are involved */\n if (otype == PyArray_OBJECT || aar->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n else\n loop->obj = 0;\n\n\tPyUFunc_clearfperr();\n\treturn loop;\n\n fail:\n ufuncreduce_dealloc(loop);\n\treturn NULL;\t\n}\n\n\n/* We have two basic kinds of loops */\n/* One is used when arr is not-swapped and aligned and output type\n is the same as input type.\n and another using buffers when one of these is not satisfied.\n\n Zero-length and one-length axes-to-be-reduced are handled separately.\n*/\n\nstatic PyObject *\nPyUFunc_Reduce(PyUFuncObject *self, PyArrayObject *arr, int axis, int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n BEGIN_THREADS_DEF\n \t\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCE, 0,\n\t\t\t\t\"reduce\");\n\tif (!loop) return NULL;\n\n LOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP:\n\t\t/*fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP:\n\t\t/*fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it)\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1];\n loop->index++; \n\t\t\tif (PyErr_Occurred()) goto fail;\n }\n break;\n case BUFFER_UFUNCLOOP:\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy first item over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %d\\n\", loop->size, \n\t\t loop->swap); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1]; \n loop->index++;\n }\n }\n\n LOOP_END_THREADS\n\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n LOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n\nstatic PyObject *\nPyUFunc_Accumulate(PyUFuncObject *self, PyArrayObject *arr, int axis, \n\t\t int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n \n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_ACCUMULATE, 0,\n\t\t\t\t\"accumulate\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n break;\n case BUFFER_UFUNCLOOP: /* Accumulate */\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy identity over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %p\\n\", loop->size, \n\t\t loop->cast); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n }\n\n\tLOOP_END_THREADS\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n\tLOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n/* Reduceat performs a reduce over an axis using the indices as a guide\n\nop.reduceat(array,indices) computes\nop.reduce(array[indices[i]:indices[i+1]] \n for i=0..end with an implicit indices[i+1]=len(array)\n assumed when i=end-1\n\nif indices[i+1] <= indices[i]+1 \n then the result is array[indices[i]] for that value\n\nop.accumulate(array) is the same as\nop.reduceat(array,indices)[::2]\nwhere indices is range(len(array)-1) with a zero placed in every other sample\n indices = zeros(len(array)*2-1)\n indices[1::2] = range(1,len(array))\n\noutput shape is based on the size of indices\n */\n\nstatic PyObject *\nPyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, \n int axis, int otype)\n{\t\n\tPyArrayObject *ret;\n PyUFuncReduceObject *loop;\n\tintp *ptr=(intp *)ind->data;\n\tintp nn=ind->dimensions[0];\t\t\n\tintp mm=arr->dimensions[axis]-1;\n\tintp n, i;\n\tint j;\n\tchar *dptr;\n\n\t/* Check for out-of-bounds values in indices array */\t\t\n\tfor (i=0; i mm)) {\n\t\t\tPyErr_Format(PyExc_IndexError, \n\t\t\t\t \"index out-of-bounds (0, %d)\", mm);\n\t\t\treturn NULL;\n\t\t}\n\t\tptr++;\n\t}\n\t\n\tptr = (intp *)ind->data;\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCEAT, nn,\n\t\t\t\t\"reduceat\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n\tswitch(loop->meth) {\n\t/* zero-length index -- return array immediately */\n\tcase ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..\\n\"); */\n\t\tbreak;\n\n\t/* NOBUFFER -- behaved array and same type */\n\tcase NOBUFFER_UFUNCLOOP: \t /* Reduceat */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[0] = loop->it->dataptr +\t\\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\tmemcpy(loop->bufptr[1], loop->bufptr[0],\n\t\t\t\t loop->outsize);\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis]-*ptr : \\\n\t\t\t\t *(ptr+1) - *ptr) - 1;\n\t\t\t\tif (mm > 0) {\n\t\t\t\t\tloop->bufptr[0] += loop->instrides;\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &mm, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t}\t\n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\n\t/* BUFFER -- misbehaved array or different types */ \n\tcase BUFFER_UFUNCLOOP: /* Reduceat */\n\t\t/* fprintf(stderr, \"BUFFERED..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[1], loop->idptr, \n\t\t\t\t loop->outsize);\n\t\t\t\tn = 0;\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis] - *ptr :\\\n\t\t\t\t *(ptr+1) - *ptr);\n\t\t\t\tif (mm < 1) mm = 1;\n\t\t\t\tloop->inptr = loop->it->dataptr + \\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\twhile (n < mm) {\n\t\t\t\t\t/* Copy up to loop->bufsize elements\n\t\t\t\t\t to buffer */\n\t\t\t\t\tdptr = loop->buffer;\n\t\t\t\t\tfor (j=0; jbufsize; j++, n++) {\n\t\t\t\t\t\tif (n == mm) break;\n\t\t\t\t\t\tarr->descr->copyswap\\\n\t\t\t\t\t\t\t(dptr,\n\t\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t\t loop->insize);\n\t\t\t\t\t\tloop->inptr += loop->instrides;\n\t\t\t\t\t\tdptr += loop->insize;\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast)\n\t\t\t\t\t\tloop->cast(loop->buffer,\n\t\t\t\t\t\t\t loop->castbuf,\n\t\t\t\t\t\t\t j, NULL, NULL);\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &j, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t} \n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\t}\n\n\tLOOP_END_THREADS\n\t\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\t\n fail:\n\tLOOP_END_THREADS\n\n\tPy_XDECREF(loop);\n\treturn NULL;\n}\n\n\n/* This code handles reduce, reduceat, and accumulate \n (accumulate and reduce are special cases of the more general reduceat \n but they are handled separately for speed) \n*/\n\nstatic PyObject * \nPyUFunc_GenericReduction(PyUFuncObject *self, PyObject *args, \n PyObject *kwds, int operation) \n{\n\tint axis=0;\n\tPyArrayObject *mp, *ret = NULL;\n\tPyObject *op, *res=NULL;\n\tPyObject *obj_ind; \n\tPyArrayObject *indices = NULL;\n\tPyArray_Typecode otype= {PyArray_NOTYPE, 0, 0};\n PyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tstatic char *kwlist1[] = {\"array\", \"axis\", \"rtype\", NULL};\n\tstatic char *kwlist2[] = {\"array\", \"indices\", \"axis\", \"rtype\", NULL}; \n static char *_reduce_type[] = {\"reduce\", \"accumulate\", \\\n\t\t\t\t \"reduceat\", NULL};\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\t\n\n\tif (self->nin != 2) {\n\t\tPyErr_Format(PyExc_ValueError, \n \"%s only supported for binary functions\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\tif (self->nout != 1) {\n\t\tPyErr_Format(PyExc_ValueError,\n \"%s only supported for functions \" \\\n \"returning a single value\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\n\tif (operation == UFUNC_REDUCEAT) {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|iO&\", kwlist2, \n\t\t\t\t\t\t&op, &obj_ind, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n indices = (PyArrayObject *)PyArray_FromAny(obj_ind, &indtype, \n\t\t\t\t\t\t\t 1, 1, CARRAY_FLAGS);\n if (indices == NULL) return NULL;\n\n\t}\n\telse {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|iO&\", kwlist1,\n\t\t\t\t\t\t&op, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n\t}\n\t\n\t/* Ensure input is an array */\t\n\tmp = (PyArrayObject *)PyArray_FromAny(op, NULL, 0, 0, 0);\n\tif (mp == NULL) return NULL;\n\n /* Check to see if input is zero-dimensional */\n if (mp->nd == 0) {\n PyErr_Format(PyExc_ValueError, \"cannot %s on a scalar\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL; \n }\n\n /* Check to see that type (and otype) is not FLEXIBLE */\n\tif (PyArray_ISFLEXIBLE(mp) || PyTypeNum_ISFLEXIBLE(otype.type_num)) {\n PyErr_Format(PyExc_ValueError, \n\t\t\t \"cannot perform %s with flexible type\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL;\n }\n\n\tif (axis < 0) axis += mp->nd;\n\tif (axis < 0 || axis >= mp->nd) {\n\t\tPyErr_SetString(PyExc_ValueError, \"axis not in array\");\n Py_DECREF(mp);\n\t\treturn NULL;\n\t}\n\n\n if (otype.type_num == PyArray_NOTYPE)\n otype.type_num = mp->descr->type_num;\n\n switch(operation) {\n case UFUNC_REDUCE:\n ret = (PyArrayObject *)PyUFunc_Reduce(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_ACCUMULATE:\n ret = (PyArrayObject *)PyUFunc_Accumulate(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_REDUCEAT:\n ret = (PyArrayObject *)PyUFunc_Reduceat(self, mp, indices, \n axis, otype.type_num);\n Py_DECREF(indices);\n\t\tbreak;\n }\n Py_DECREF(mp);\n\tif (ret==NULL) return NULL;\n\tif (op->ob_type != ret->ob_type) {\n\t\tres = PyObject_CallMethod(op, \"__array_wrap__\", \"O\", ret);\n\t}\n\tif (res == NULL) PyErr_Clear();\n\telse if (res == Py_None) Py_DECREF(res);\n\telse {\n\t\tPy_DECREF(ret);\n\t\treturn res;\n\t}\t\n\treturn PyArray_Return(ret);\n\t\n}\n\n\n\n/* ---------- */\n\nstatic PyObject *\n_find_array_wrap(PyObject *args)\n{\n\tint nargs, i;\n\tint np = 0;\n\tint argmax = 0;\n\tint val;\n\tdouble priority[MAX_ARGS];\n\tdouble maxpriority = PyArray_SUBTYPE_PRIORITY;\n\tPyObject *with_wrap[MAX_ARGS];\n\tPyObject *attr;\n\tPyObject *obj;\n\n\tnargs = PyTuple_Size(args);\n\tfor (i=0; i maxpriority) {\n\t\t\tmaxpriority = priority[i];\n\t\t\targmax = i;\n\t\t}\n\t}\n\n\treturn with_wrap[argmax];\n}\n\nstatic PyObject *\nufunc_generic_call(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyTupleObject *ret;\n\tPyArrayObject *mps[MAX_ARGS];\n\tPyObject *retobj[MAX_ARGS];\n\tPyObject *res;\n\tPyObject *obj;\n\t\n\t/* Initialize all array objects to NULL to make cleanup easier \n\t if something goes wrong. */\n\tfor(i=0; inargs; i++) mps[i] = NULL;\n\t\n\tif (PyUFunc_GenericFunction(self, args, mps) == -1) {\n\t\tfor(i=0; inargs; i++) Py_XDECREF(mps[i]);\n\t\treturn NULL;\n\t}\n\t\n\tfor(i=0; inin; i++) Py_DECREF(mps[i]);\n\n\t/* Use __array_wrap__ on all outputs \n\t if present on one of the input arguments.\n\t If present for multiple inputs:\n\t use __array_wrap__ of input object with largest \n\t\t__array_priority__ (default = 0.0)\n\t */\n\tobj = _find_array_wrap(args);\n\t\n\t/* wrap outputs */\n\tfor (i=0; inout; i++) {\n\t\tint j=self->nin+i;\n\t\t/* check to see if any UPDATEIFCOPY flags are set \n\t\t which meant that a temporary output was generated \n\t\t*/\n\t\tif (mps[j]->flags & UPDATEIFCOPY) {\n\t\t\tPyObject *old = mps[j]->base;\n\t\t\tPy_INCREF(old); /* we want to hang on to this */\n\t\t\tPy_DECREF(mps[j]); /* should trigger the copy \n\t\t\t\t\t back into old */\n\t\t\tmps[j] = (PyArrayObject *)old;\n\t\t}\n\t\tif (obj != NULL) {\n\t\t\tres = PyObject_CallMethod(obj, \"__array_wrap__\",\n\t\t\t\t\t\t \"O\", mps[j]);\n\t\t\tif (res == NULL) PyErr_Clear();\n\t\t\telse if (res == Py_None) Py_DECREF(res);\n\t\t\telse {\n\t\t\t\tPy_DECREF(mps[j]);\n\t\t\t\tretobj[i] = res;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tretobj[i] = PyArray_Return(mps[j]);\n\t}\n\t\n\tif (self->nout == 1) { \n\t\treturn retobj[0];\n\t} else { \n\t\tret = (PyTupleObject *)PyTuple_New(self->nout);\n\t\tfor(i=0; inout; i++) {\n\t\t\tPyTuple_SET_ITEM(ret, i, retobj[i]);\n\t\t}\n\t\treturn (PyObject *)ret;\n\t}\t\n\n}\n\nstatic PyUFuncGenericFunction pyfunc_functions[] = {PyUFunc_On_Om};\n\nstatic char \ndoc_frompyfunc[] = \"frompyfunc(func, nin, nout) take an arbitrary python function that takes nin objects as input and returns nout objects and return a universal function (ufunc). This ufunc always returns PyObject arrays\";\n\nstatic PyObject *\nufunc_frompyfunc(PyObject *dummy, PyObject *args, PyObject *kwds) {\n /* Keywords are ignored for now */\n \n PyObject *function, *pyname=NULL;\n int nin, nout, i;\n PyUFunc_PyFuncData *fdata;\n PyUFuncObject *self;\n char *fname, *str;\n int fname_len=-1;\n\n if (!PyArg_ParseTuple(args, \"Oii\", &function, &nin, &nout)) return NULL;\n\n if (!PyCallable_Check(function)) {\n PyErr_SetString(PyExc_TypeError, \"Function must be callable.\");\n return NULL;\n }\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\n\tself->userloops = NULL;\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = PyUFunc_None;\t\n\tself->functions = pyfunc_functions;\n\n\tself->ntypes = 1;\n\tself->check_return = 0;\n\n pyname = PyObject_GetAttrString(function, \"__name__\");\n if (pyname)\n (void) PyString_AsStringAndSize(pyname, &fname, &fname_len);\n \n if (PyErr_Occurred()) {\n fname = \"?\";\n fname_len = 1;\n PyErr_Clear();\n } \n Py_XDECREF(pyname);\n\n\n self->ptr = malloc((self->nargs)+sizeof(PyUFunc_PyFuncData)+sizeof(void *)+(fname_len+14));\n \n\tif (self->ptr == NULL) return PyErr_NoMemory();\n Py_INCREF(function);\n self->obj = function;\n\tfdata = (PyUFunc_PyFuncData *)(self->ptr + (nin+nout) + sizeof(void *));\n fdata->nin = nin;\n fdata->nout = nout;\n fdata->callable = function;\n \n self->data = (void **)(self->ptr + (nin+nout));\n self->data[0] = (void *)fdata;\n\n\n\tself->types = (char *)self->ptr;\n for (i=0; inargs; i++) self->types[i] = PyArray_OBJECT;\n\n str = (char *)(fdata + 1);\n memcpy(str, fname, fname_len);\n memcpy(str+fname_len, \" (vectorized)\", 14);\n \n self->name = str;\n\n /* Do a better job someday */\n self->doc = \"dynamic ufunc based on a python function\";\n \n\t\n\treturn (PyObject *)self;\n}\n\n\nstatic PyObject *\nPyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void **data, \n\t\t\tchar *types, int ntypes,\n\t\t\tint nin, int nout, int identity, \n\t\t\tchar *name, char *doc, int check_return) \n{\n\tPyUFuncObject *self;\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = identity;\n\t\n\tself->functions = func;\n\tself->data = data;\n\tself->types = types;\n\tself->ntypes = ntypes;\n\tself->check_return = check_return;\n self->ptr = NULL;\n self->obj = NULL;\n\tself->userloops=NULL;\n\t\n\tif (name == NULL) self->name = \"?\";\n\telse self->name = name;\n\t\n if (doc == NULL) self->doc = \"NULL\";\n\telse self->doc = doc;\n\t\n\treturn (PyObject *)self;\n}\n\nstatic int\nPyUFunc_RegisterLoopForType(PyUFuncObject *ufunc, \n\t\t\t int usertype,\n\t\t\t PyUFuncGenericFunction function,\n\t\t\t void *data)\n{\n\tPyArray_Descr *descr=PyArray_DescrFromType(usertype);\n \tPyObject *key, *cobj;\n\tint ret;\t\n\t\n\tif ((usertype < PyArray_USERDEF) || (descr==NULL)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Cannot register typenumber\");\n\t\treturn -1;\n\t}\n\tif (ufunc->userloops == NULL) {\n\t\tufunc->userloops = PyDict_New();\n\t}\n\tkey = PyInt_FromLong(usertype);\n\tif (key == NULL) return -1;\n\tcobj = PyCObject_FromVoidPtr((void *)function, NULL);\n\tif (cobj == NULL) {Py_DECREF(key); return -1;}\n\tif (data == NULL) {\n\t\tret = PyDict_SetItem(ufunc->userloops, key, cobj);\n\t\tPy_DECREF(cobj);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n\telse {\n\t\tPyObject *cobj2, *tmp;\n\t\tcobj2 = PyCObject_FromVoidPtr(data, NULL);\n\t\tif (cobj2 == NULL) {\n\t\t\tPy_DECREF(cobj); \n\t\t\tPy_DECREF(key);\n\t\t\treturn -1;\n\t\t}\n\t\ttmp=Py_BuildValue(\"NN\", cobj, cobj2);\n\t\tret = PyDict_SetItem(ufunc->userloops, key, tmp);\n\t\tPy_DECREF(tmp);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n}\n\nstatic void\nufuncreduce_dealloc(PyUFuncReduceObject *self)\n{\n if (self->ufunc) {\n Py_XDECREF(self->it);\n\t\tPy_XDECREF(self->rit);\n Py_XDECREF(self->ret);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_XDECREF(self->decref);\n if (self->buffer) free(self->buffer);\n Py_DECREF(self->ufunc);\n }\n PyObject_DEL(self);\n}\n\nstatic void\nufuncloop_dealloc(PyUFuncLoopObject *self)\n{\n\tint i;\n\t\n\tif (self->ufunc != NULL) {\n\t\tfor (i=0; iufunc->nargs; i++)\n\t\t\tPy_XDECREF(self->iters[i]);\n\t\tif (self->buffer[0]) free(self->buffer[0]);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_DECREF(self->ufunc);\n\t}\n\tPyObject_DEL(self);\n}\n\n\nstatic void\nufunc_dealloc(PyUFuncObject *self)\n{\n if (self->ptr) free(self->ptr);\n\tPy_XDECREF(self->userloops);\n Py_XDECREF(self->obj);\n\tPyObject_DEL(self);\n}\n\nstatic PyObject *\nufunc_repr(PyUFuncObject *self)\n{\n\tchar buf[100];\n\t\n\tsprintf(buf, \"\", self->name);\n\t\n\treturn PyString_FromString(buf);\n}\n\n\n/* -------------------------------------------------------- */\n\n/* op.outer(a,b) is equivalent to op(a[:,NewAxis,NewAxis,etc.],b)\n where a has b.ndim NewAxis terms appended.\n\n The result has dimensions a.ndim + b.ndim\n */\n\nstatic PyObject *\nufunc_outer(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyObject *ret;\n\tPyArrayObject *ap1=NULL, *ap2=NULL, *ap_new=NULL;\n\tPyObject *new_args, *tmp;\n\tPyObject *shape1, *shape2, *newshape;\n\n\tif(self->nin != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"outer product only supported \"\\\n\t\t\t\t\"for binary functions\");\n\t\treturn NULL;\n\t}\n\t\n\tif (PySequence_Length(args) != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"exactly two arguments expected\");\n\t\treturn NULL;\n\t}\n\t\n\ttmp = PySequence_GetItem(args, 0);\n\tif (tmp == NULL) return NULL;\n\tap1 = (PyArrayObject *)\t\t\t\t\t\\\n\t\tPyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap1 == NULL) return NULL;\n\t\n\ttmp = PySequence_GetItem(args, 1);\n\tif (tmp == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap2 == NULL) {Py_DECREF(ap1); return NULL;}\n\n\t/* Construct new shape tuple */\n\tshape1 = PyTuple_New(ap1->nd);\n\tif (shape1 == NULL) goto fail;\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape1, i, \n\t\t\t\t PyLong_FromLongLong((longlong)ap1->\t\\\n\t\t\t\t\t\t dimensions[i]));\n\t\n\tshape2 = PyTuple_New(ap2->nd);\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape2, i, PyInt_FromLong((long) 1));\n\tif (shape2 == NULL) {Py_DECREF(shape1); goto fail;}\n\tnewshape = PyNumber_Add(shape1, shape2);\n\tPy_DECREF(shape1);\n\tPy_DECREF(shape2);\n\tif (newshape == NULL) goto fail;\n\t\n\tap_new = (PyArrayObject *)PyArray_Reshape(ap1, newshape);\n\tPy_DECREF(newshape);\n\tif (ap_new == NULL) goto fail;\n\t\n\tnew_args = Py_BuildValue(\"(OO)\", ap_new, ap2);\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\tPy_DECREF(ap_new);\t\n\tret = ufunc_generic_call(self, new_args);\n\tPy_DECREF(new_args);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ap_new);\n\treturn NULL;\n\n}\n\n\nstatic PyObject *\nufunc_reduce(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCE);\n}\n\nstatic PyObject *\nufunc_accumulate(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_ACCUMULATE);\n}\n\nstatic PyObject *\nufunc_reduceat(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCEAT);\n}\n\n\nstatic struct PyMethodDef ufunc_methods[] = {\n\t{\"reduce\", (PyCFunction)ufunc_reduce, METH_VARARGS | METH_KEYWORDS},\n\t{\"accumulate\", (PyCFunction)ufunc_accumulate, \n\t METH_VARARGS | METH_KEYWORDS},\n\t{\"reduceat\", (PyCFunction)ufunc_reduceat, \n\t METH_VARARGS | METH_KEYWORDS},\t\n\t{\"outer\", (PyCFunction)ufunc_outer, METH_VARARGS},\n\t{NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\n\n/* construct the string\n y1,y2,...,yn\n*/\n\nstatic void\n_makeargs(int num, char ltr, char *str) \n{\n\tint ind=0;\n\tint k;\n\tstatic char *digits=\"123456789ABCDE\";\n\n\tif (num == 1) {\n\t\tstr[0] = ltr;\n\t\tind = 1;\n\t}\n\telse {\n\t\tfor (k=0; ktype)\n\nstatic PyObject *\nufunc_getattr(PyUFuncObject *self, char *name)\n{\n\tPyObject *obj;\n\t/* Put docstring first or FindMethod finds it...*/\n\t/* could so some introspection on name and nin + nout */\n\t/* to automate the first part of it */\n\t/* the doc string shouldn't need the calling convention */\n\tif (strcmp(name, \"__doc__\") == 0) {\n\t\tstatic char doc[256];\n\t\tstatic char tmp1[3*MAX_ARGS+2];\n\t\tstatic char tmp2[3*MAX_ARGS+2];\n\t\t/* construct \n\t\t y1,y2,,... = name(x1,x2,...) __doc__\n\t\t*/\t\t\n\t\t_makeargs(self->nout, 'y', tmp1);\n\t\t_makeargs(self->nin, 'x', tmp2);\n\t\tsnprintf(doc, 256, \"%s = %s(%s) %s\", tmp1, self->name, \n\t\t\t tmp2, self->doc);\n\t\treturn PyString_FromString(doc);\n\t}\n\tobj = Py_FindMethod(ufunc_methods, (PyObject *)self, name);\n\tif (obj != NULL) return obj;\n\tPyErr_Clear();\n\tif (strcmp(name, \"nin\") == 0) {\n\t\treturn PyInt_FromLong(self->nin);\n\t}\n\telse if (strcmp(name, \"nout\") == 0) {\n\t\treturn PyInt_FromLong(self->nout);\n\t}\n\telse if (strcmp(name, \"nargs\") == 0) {\n\t\treturn PyInt_FromLong(self->nargs);\n\t}\n\telse if (strcmp(name, \"ntypes\") == 0) {\n\t\treturn PyInt_FromLong(self->ntypes);\n\t}\n\telse if (strcmp(name, \"types\") == 0) {\n\t\t/* return a list with types grouped\n\t\t input->output */\n\t\tPyObject *list;\n\t\tPyObject *str;\n\t\tint k, j, n, nt=self->ntypes;\n\t\tint ni = self->nin;\n\t\tint no = self->nout;\n\t\tchar *t;\n\t\tlist = PyList_New(nt);\n\t\tif (list == NULL) return NULL;\n\t\tt = malloc(no+ni+2);\n\t\tn = 0;\n\t\tfor (k=0; ktypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tt[ni] = '-';\n\t\t\tt[ni+1] = '>';\n\t\t\tfor (j=0; jtypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tstr = PyString_FromStringAndSize(t, no+ni+2);\n\t\t\tPyList_SET_ITEM(list, k, str);\n\t\t}\n\t\tfree(t);\n\t\treturn list;\n\t\t\n\t}\n\telse if (strcmp(name, \"__name__\") == 0) {\n\t\treturn PyString_FromString(self->name);\n\t}\n\telse if (strcmp(name, \"identity\") == 0) {\n\t\tswitch(self->identity) {\n\t\tcase PyUFunc_One:\n\t\t\treturn PyInt_FromLong(1);\n\t\tcase PyUFunc_Zero:\n\t\t\treturn PyInt_FromLong(0);\n\t\tdefault:\n\t\t\tPy_INCREF(Py_None);\n\t\t\treturn Py_None;\n\t\t}\n\t}\n\tPyErr_SetString(PyExc_AttributeError, name);\n\treturn NULL;\n}\n\n#undef _typecharfromnum\n\nstatic int\nufunc_setattr(PyUFuncObject *self, char *name, PyObject *v) \n{\n\treturn -1;\n}\n\nstatic char Ufunctype__doc__[] = \n\t\"Optimized functions make it possible to implement arithmetic \"\\\n\t\"with arrays efficiently\";\n\nstatic PyTypeObject PyUFunc_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufunc\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncObject),\t\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufunc_dealloc,\t/*tp_dealloc*/\n\t(printfunc)0,\t\t /*tp_print*/\n\t(getattrfunc)ufunc_getattr,\t/*tp_getattr*/\n\t(setattrfunc)ufunc_setattr,\t/*tp_setattr*/\n\t(cmpfunc)0,\t \t/*tp_compare*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_repr*/\n\t0,\t\t\t /*tp_as_number*/\n\t0,\t\t /*tp_as_sequence*/\n\t0,\t\t /*tp_as_mapping*/\n\t(hashfunc)0,\t\t/*tp_hash*/\n\t(ternaryfunc)ufunc_generic_call,\t\t/*tp_call*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_str*/\n\t\t\n\t/* Space for future expansion */\n\t0L,0L,0L,0L,\n\tUfunctype__doc__ /* Documentation string */\n};\n\nstatic PyTypeObject PyUFuncLoop_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncloop\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncLoopObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncloop_dealloc\t/*tp_dealloc*/\n};\n\nstatic PyTypeObject PyUFuncReduce_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncreduce\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncReduceObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncreduce_dealloc\t/*tp_dealloc*/\n};\n\n\n/* End of code for ufunc objects */\n/* -------------------------------------------------------- */\n", "source_code_before": "\n/*\n Python Universal Functions Object -- Math for all types, plus fast \n arrays math\n \n Full description\n \n This supports mathematical (and Boolean) functions on arrays and other python\n objects. Math on large arrays of basic C types is rather efficient.\n\n Travis E. Oliphant (2005)\n Assistant Professor\n Brigham Young University\n\n based on the \n\n Original Implementation: \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n with inspiration and code from\n Numarray\n Space Science Telescope Institute\n J. Todd Miller\n Perry Greenfield\n \n*/\n\n\ntypedef double (DoubleBinaryFunc)(double x, double y);\ntypedef float (FloatBinaryFunc)(float x, float y);\ntypedef longdouble (LongdoubleBinaryFunc)(longdouble x, longdouble y);\n\ntypedef void (CdoubleBinaryFunc)(cdouble *x, cdouble *y, cdouble *res);\ntypedef void (CfloatBinaryFunc)(cfloat *x, cfloat *y, cfloat *res);\ntypedef void (ClongdoubleBinaryFunc)(clongdouble *x, clongdouble *y, \\\n\t\t\t\t clongdouble *res);\n\nstatic void\nPyUFunc_ff_f_As_dd_d(char **args, intp *dimensions, intp *steps, void *func)\n{\n\tregister intp i, n=dimensions[0];\n\tintp is1=steps[0],is2=steps[1],os=steps[2];\n\tchar *ip1=args[0], *ip2=args[1], *op=args[2];\n\t\n\tfor(i=0; inin, nout=data->nout;\n int ntot;\n PyObject *tocall = data->callable; \n char *ptrs[MAX_ARGS];\n PyObject *arglist, *result;\n PyObject *in, **op;\n\n ntot = nin+nout;\n\n for (j=0; j < ntot; j++) ptrs[j] = args[j];\n\tfor(i=0; i> UFUNC_SHIFT_##NAME, \\\n\t\t\t\t\t errobj, str, retstatus) < 0) \\\n\t\t\t\treturn -1;\t\t \\\n\t\t\t}}\n\n\tif (errmask && retstatus) {\n\t\tHANDLEIT(DIVIDEBYZERO, \"divide by zero\");\n\t\tHANDLEIT(OVERFLOW, \"overflow\");\n\t\tHANDLEIT(UNDERFLOW, \"underflow\");\n\t\tHANDLEIT(INVALID, \"invalid\");\n\t}\n\n#undef HANDLEIT\n\n\treturn 0;\n}\n\n\n/* Checking the status flag clears it */\nstatic void\nPyUFunc_clearfperr()\n{\n\tint retstatus;\n\n\tUFUNC_CHECK_STATUS(retstatus)\n}\n\n\n#define UFUNC_NOSCALAR 0\n#define UFUNC_BOOL_SCALAR 1\n#define UFUNC_INTPOS_SCALAR 2\n#define UFUNC_INTNEG_SCALAR 3\n#define UFUNC_FLOAT_SCALAR 4\n#define UFUNC_COMPLEX_SCALAR 5\n#define UFUNC_OBJECT_SCALAR 6\n\n#define NO_UFUNCLOOP 0\n#define ZERODIM_REDUCELOOP 0\n#define ONE_UFUNCLOOP 1\n#define ONEDIM_REDUCELOOP 1\n#define NOBUFFER_UFUNCLOOP 2\n#define NOBUFFER_REDUCELOOP 2\n#define BUFFER_UFUNCLOOP 3\n#define BUFFER_REDUCELOOP 3\n\n\n#define UFUNC_REDUCE 0\n#define UFUNC_ACCUMULATE 1\n#define UFUNC_REDUCEAT 2\n#define UFUNC_OUTER 3\n\n\n\n\nstatic char\n_lowest_type(char intype)\n{\n switch(intype) {\n\t/* case PyArray_BYTE */\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\treturn PyArray_BYTE;\n\t/* case PyArray_UBYTE */\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\treturn PyArray_UBYTE;\n\t/* case PyArray_FLOAT:*/\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\treturn PyArray_FLOAT;\n\t/* case PyArray_CFLOAT:*/\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn PyArray_CFLOAT;\n default:\n return intype;\n }\n}\n\nstatic int \n_cancoerce(char thistype, char neededtype, char scalar) \n{\n\n\tswitch(scalar) {\n\tcase UFUNC_NOSCALAR:\n\tcase UFUNC_BOOL_SCALAR:\n\tcase UFUNC_OBJECT_SCALAR:\n\t\treturn PyArray_CanCastSafely(thistype, neededtype);\n\tcase UFUNC_INTPOS_SCALAR:\n\t\treturn (neededtype >= PyArray_UBYTE);\n\tcase UFUNC_INTNEG_SCALAR:\n\t\treturn (neededtype >= PyArray_BYTE) &&\t\t\\\n\t\t\t!(PyTypeNum_ISUNSIGNED(neededtype));\n\tcase UFUNC_FLOAT_SCALAR:\n\t\treturn (neededtype >= PyArray_FLOAT);\n\tcase UFUNC_COMPLEX_SCALAR:\n\t\treturn (neededtype >= PyArray_CFLOAT);\n\t}\n\tfprintf(stderr, \"\\n**Error** coerce fall through: %d %d %d\\n\\n\", \n\t\tthistype, neededtype, scalar);\n\treturn 1; /* should never get here... */ \n}\n\n\nstatic int \nselect_types(PyUFuncObject *self, int *arg_types, \n PyUFuncGenericFunction *function, void **data,\n\t char *scalars)\n{\n\n\tint i=0, j;\n\tchar start_type;\n\t\n\tif (PyTypeNum_ISUSERDEF((arg_types[0]))) {\n\t\tPyObject *key, *obj;\n\t\tfor (i=0; inin; i++) {\n\t\t\tif (arg_types[i] != arg_types[0]) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\t\t\"ufuncs on user defined\" \\\n\t\t\t\t\t\t\" types don't support \"\\\n\t\t\t\t\t\t\"coercion.\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfor (i=self->nin; inargs; i++) {\n\t\t\targ_types[i] = arg_types[0];\n\t\t}\n\t\t\n\t\tkey = PyInt_FromLong((long) arg_types[0]);\n\t\tif (key == NULL) return -1;\n\t\tobj = PyDict_GetItem(self->userloops, key);\n\t\tif (obj == NULL) {\n\t\t\tPy_DECREF(key);\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"no registered loop for this \"\t\\\n\t\t\t\t\t\"user-defined type.\");\n\t\t\treturn -1;\t\t\t\n\t\t}\n\t\tif PyTuple_Check(obj) {\n\t\t\t*function = (PyUFuncGenericFunction) \\\n\t\t\t\tPyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 0));\n\t\t\t*data = PyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 1));\n\t\t}\n\t\telse {\n\t\t\t*function = (PyUFuncGenericFunction)\t\\\n\t\t\t\tPyCObject_AsVoidPtr(obj);\n\t\t\t*data = NULL;\n\t\t}\n\t\tPy_DECREF(key);\n\t\treturn 0;\n\t}\n\t\n\n\tstart_type = arg_types[0];\n\t/* If the first argument is a scalar we need to place \n\t the start type as the lowest type in the class\n\t*/\n\tif (scalars[0] != UFUNC_NOSCALAR) {\n\t\tstart_type = _lowest_type(start_type);\n\t}\n\n\twhile (intypes && start_type > self->types[i*self->nargs]) \n\t\ti++;\n\n\tfor(;intypes; i++) {\n\t\tfor(j=0; jnin; j++) {\n\t\t\tif (!_cancoerce(arg_types[j], \n\t\t\t\t\tself->types[i*self->nargs+j],\n\t\t\t\t\tscalars[j]))\n\t\t\t\tbreak;\n\t\t}\n\t\tif (j == self->nin) break;\n\t}\n\tif(i>=self->ntypes) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"function not supported for these types, \"\\\n\t\t\t\t\"and can't coerce safely to supported types\");\n\t\treturn -1;\n\t}\n\tfor(j=0; jnargs; j++) \n\t\targ_types[j] = self->types[i*self->nargs+j];\n\n\t*data = self->data[i];\n\t*function = self->functions[i];\n\n\treturn 0;\n}\n\n\n\nstatic int\n_getintfromvar(char *str, int deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tint retval=deflt;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n thedict = PyEval_GetGlobals();\n ref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = (int) PyInt_AsLong(ref);\n if (ref == NULL || retval == -1) retval = deflt;\n PyErr_Clear();\n\treturn retval;\n}\n\nstatic PyObject *\n_getfuncfromvar(char *str, PyObject *deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tPyObject *retval;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n\t\tthedict = PyEval_GetGlobals();\n\t\tref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = ref;\n\telse retval = deflt;\n\tif (retval != Py_None && !PyCallable_Check(retval)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"%s if provided must be callable\", str);\n\t\treturn NULL;\n\t}\n\tPy_INCREF(retval);\n\treturn retval;\n}\n\n\nstatic char\n_scalar_kind(int typenum, PyArrayObject **arr) \n{\n\tif (PyTypeNum_ISSIGNED(typenum)) return UFUNC_INTNEG_SCALAR;\n\tif (PyTypeNum_ISFLOAT(typenum)) return UFUNC_FLOAT_SCALAR;\n\tif (PyTypeNum_ISCOMPLEX(typenum)) return UFUNC_COMPLEX_SCALAR;\n\tif (PyTypeNum_ISUNSIGNED(typenum)) return UFUNC_INTPOS_SCALAR;\n\tif (PyTypeNum_ISBOOL(typenum)) return UFUNC_BOOL_SCALAR;\n\treturn UFUNC_OBJECT_SCALAR;\n}\n\n\n/* Create copies for any arrays that are less than loop->bufsize\n in total size and are mis-behaved or in need\n of casting.\n*/\n\nstatic int\n_create_copies(PyUFuncLoopObject *loop, int *arg_types, PyArrayObject **mps)\n{\n\tint nin = loop->ufunc->nin;\n\tint i;\n\tintp size;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\n\tfor (i=0; ielsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\t\tif (size < loop->bufsize) {\n\t\t\tif (!(PyArray_ISBEHAVED_RO(mps[i])) ||\t\t\\\n\t\t\t PyArray_TYPE(mps[i]) != arg_types[i]) {\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST |\t\\\n\t\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\nstatic int\nconstruct_matrices(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps)\n{\n int nargs, i, cnt, cntcast, maxsize;\n int arg_types[MAX_ARGS];\n\tchar scalars[MAX_ARGS];\n\tPyUFuncObject *self=loop->ufunc;\n\tBool allscalars=TRUE;\n\tPyTypeObject *subtype=&PyArray_Type;\n\n /* Check number of arguments */\n nargs = PyTuple_Size(args);\n if ((nargs != self->nin) && (nargs != self->nargs)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of arguments\");\n return -1;\n }\n\n\n /* Get each input argument */\n for (i=0; inin; i++) {\n mps[i] = (PyArrayObject *)\\\n\t\t\tPyArray_FromAny(PyTuple_GET_ITEM(args,i), \n\t\t\t\t\tNULL, 0, 0, 0);\n if (mps[i] == NULL) return -1;\n arg_types[i] = PyArray_TYPE(mps[i]);\n if (PyTypeNum_ISFLEXIBLE(arg_types[i])) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"ufuncs do not support\"\t\\\n \" flexible arrays\");\n return -1;\n }\n\t\t/*\n\t\tfprintf(stderr, \"array %d has reference %d\\n\", i, \n\t\t (mps[i])->ob_refcnt);\n\t\t*/\n\n\t\t/* Scalars are 0-dimensional arrays\n\t\t at this point\n\t\t*/\n\t\tif (mps[i]->nd > 0) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t\tallscalars=FALSE;\n\t\t}\n\t\telse scalars[i] = _scalar_kind(arg_types[i], &(mps[i]));\n\n\t\t/* If any input is a big-array */\n\t\tif (!PyType_IsSubtype(mps[i]->ob_type, &PyArray_Type)) {\n\t\t\tsubtype = &PyBigArray_Type;\n\t\t}\n }\n\n\t/* If everything is a scalar, then use normal coercion rules */\n\tif (allscalars) {\n\t\tfor (i=0; inin; i++) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t}\n\t}\n \n /* Select an appropriate function for these argument types. */\n if (select_types(loop->ufunc, arg_types, &(loop->function), \n &(loop->funcdata), scalars) == -1)\n\t\treturn -1;\n\n\t/* This is the buffer size in number of elements.*/\n loop->bufsize = _getintfromvar(UFUNC_BUFSIZE_NAME, PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \"The buffer size (%d) is not \" \\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\treturn -1;\n\t}\n\t\n\t/* Create copies for some of the arrays if appropriate */\n\tif (_create_copies(loop, arg_types, mps) < 0) return -1;\n\t\n\t/* Create Iterators for the Inputs */\n\tfor (i=0; inin; i++) {\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n\t}\n \n /* Broadcast the result */\n loop->numiter = self->nin;\n if (PyArray_Broadcast((PyArrayMultiIterObject *)loop) < 0)\n\t\treturn -1;\n\t\n /* Get any return arguments */\n for (i=self->nin; idimensions, \n\t\t\t\t\t loop->dimensions, loop->nd)) {\n PyErr_SetString(PyExc_ValueError, \n \"invalid return array shape\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n if (!PyArray_ISWRITEABLE(mps[i])) {\n PyErr_SetString(PyExc_ValueError, \n \"return array is not writeable\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n }\n\n /* construct any missing return arrays and make output iterators */\n \n for (i=self->nin; inargs; i++) {\n\t\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\n if (mps[i] == NULL) {\n mps[i] = (PyArrayObject *)PyArray_New(subtype,\n loop->nd, \n loop->dimensions,\n arg_types[i], \n NULL, NULL,\n 0, 0, NULL);\n if (mps[i] == NULL) return -1;\n }\n\n\n\t\t/* reset types for outputs that are equivalent \n\t\t -- no sense casting uselessly\n\t\t*/\n\t\tif (mps[i]->descr->type_num != arg_types[i]) {\n\t\t\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\t\t\tntype.type_num = PyArray_TYPE(mps[i]);\n\t\t\tntype.itemsize = PyArray_ITEMSIZE(mps[i]);\n\t\t\tatype.type_num = arg_types[i];\n\t\t\tatype.itemsize = \\\n\t\t\t\tPyArray_DescrFromType(arg_types[i])->elsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\n\t\t/* still not the same -- or will we have to use buffers?*/\n\t\tif (mps[i]->descr->type_num != arg_types[i] ||\n\t\t !PyArray_ISBEHAVED_RO(mps[i])) {\n\t\t\tif (loop->size < loop->bufsize) {\n\t\t\t\tPyObject *new;\n\t\t\t\t/* Copy the array to a temporary copy \n\t\t\t\t and set the UPDATEIFCOPY flag\n\t\t\t\t*/\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST | \n\t\t\t\t\t\t BEHAVED_FLAGS_RO |\n\t\t\t\t\t\t UPDATEIFCOPY);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t\t\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n }\n\n\n /* If any of different type, or misaligned or swapped\n then must use buffers */\n\n loop->bufcnt = 0;\n\n loop->obj = 0;\n\n /* Determine looping method needed */\n loop->meth = NO_UFUNCLOOP;\n\n\tcnt = cntcast = 0; /* keeps track of bytes to allocate */\n\tmaxsize = 0;\n for (i=0; inargs; i++) {\n\t\tcnt += mps[i]->itemsize;\n if (arg_types[i] != mps[i]->descr->type_num) {\n\t\t\tPyArray_Descr *descr;\n\n loop->meth = BUFFER_UFUNCLOOP;\n\t\t\tdescr = PyArray_DescrFromType(arg_types[i]);\n\t\t\tcntcast += descr->elsize;\n if (i < self->nin) {\n loop->cast[i] = \\\n\t\t\t\t\tmps[i]->descr->cast[arg_types[i]];\n\t\t\t}\n else {\n loop->cast[i] = descr->\\\n\t\t\t\t\tcast[mps[i]->descr->type_num];\n\t\t\t}\n\n }\n loop->swap[i] = !(PyArray_ISNOTSWAPPED(mps[i]));\n if (!PyArray_ISBEHAVED_RO(mps[i])) {\n loop->meth = BUFFER_UFUNCLOOP;\n }\n if (!loop->obj && mps[i]->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n }\n \n if (loop->meth == NO_UFUNCLOOP) {\n \n loop->meth = ONE_UFUNCLOOP;\n\n /* All correct type and BEHAVED */\n /* Check for non-uniform stridedness */\n\n for (i=0; inargs; i++) {\n if (!(loop->iters[i]->contiguous)) {\n\t\t\t\t/* may still have uniform stride\n\t\t\t\t if (broadcated result) <= 1-d */\n\t\t\t\tif (mps[i]->nd != 0 &&\t\t\t\\\n\t\t\t\t (loop->iters[i]->nd_m1 > 0)) {\n\t\t\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n }\n\t\tif (loop->meth == ONE_UFUNCLOOP) {\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tloop->bufptr[i] = mps[i]->data;\n\t\t\t}\n\t\t}\n }\n\n loop->numiter = self->nargs;\n\n /* Fill in steps */\n if (loop->meth == NOBUFFER_UFUNCLOOP) {\n\t\tint ldim = 0;\n\t\tintp maxdim=-1;\n\t\tPyArrayIterObject *it;\n\n /* Fix iterators */\n\n /* Find the **largest** dimension */\n \n\t\tmaxdim = -1;\n\t\tfor (i=loop->nd - 1; i>=0; i--) {\n\t\t\tif (loop->dimensions[i] > maxdim) {\n\t\t\t\tldim = i;\n\t\t\t\tmaxdim = loop->dimensions[i];\n\t\t\t}\n\t\t}\n\n\t\tloop->size /= maxdim;\n loop->bufcnt = maxdim;\n\n /* Fix the iterators so the inner loop occurs over the \n\t\t largest dimensions -- This can be done by \n\t\t setting the size to 1 in that dimension \n\t\t (just in the iterators)\n */\n\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = loop->iters[i];\n it->contiguous = 0;\n\t\t\tit->size /= (it->dims_m1[ldim]+1);\n\t\t\tit->dims_m1[ldim] = 0;\n\t\t\tit->backstrides[ldim] = 0;\n\n\t\t\t/* (won't fix factors because we\n\t\t\t don't use PyArray_ITER_GOTO1D \n\t\t\t so don't change them) */\n\n\n\t\t\t/* Set the steps to the strides in that dimension */\n loop->steps[i] = it->strides[ldim];\n\t\t}\n\n }\n else if (loop->meth == BUFFER_UFUNCLOOP) {\n for (i=0; inargs; i++) {\n\t\t\tloop->steps[i] = mps[i]->itemsize; \n\t\t}\n }\n\telse { /* uniformly-strided case ONE_UFUNCLOOP */\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (mps[i]->nd == 0)\n\t\t\t\tloop->steps[i] = 0;\n\t\t\telse \n\t\t\t\tloop->steps[i] = mps[i]->strides[mps[i]->nd-1];\n\t\t}\n\t}\n \n\n\t/* Finally, create memory for buffers if we need them */\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\t\tchar *castptr;\n\t\tint oldsize=0;\n\t\tloop->buffer[0] = (char *)malloc(loop->bufsize*(cnt+cntcast));\n\t\t/* fprintf(stderr, \"Allocated buffer at %p of size %d, cnt=%d, cntcast=%d\\n\", loop->buffer[0], loop->bufsize * (cnt + cntcast), cnt, cntcast); */\n\t\tif (loop->buffer[0] == NULL) return -1;\n\t\tcastptr = loop->buffer[0] + loop->bufsize*cnt;\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (i > 0)\n\t\t\t\tloop->buffer[i] = loop->buffer[i-1] + \\\n\t\t\t\t\tloop->bufsize * mps[i-1]->itemsize;\n\t\t\t/* fprintf(stderr, \"buffer[%d] = %p\\n\", i, loop->buffer[i]); */\n\t\t\tif (loop->cast[i]) {\n\t\t\t\tloop->castbuf[i] = castptr + \n\t\t\t\t\tloop->bufsize*oldsize;\n\t\t\t\t/* fprintf(stderr, \"castbuf[%d] = %p\\n\", i, loop->castbuf[i]); */\n#define _PyD PyArray_DescrFromType\n\t\t\t\toldsize = _PyD(arg_types[i])->elsize;\n#undef _PyD\n\t\t\t\tloop->bufptr[i] = loop->castbuf[i];\n\t\t\t\tcastptr = loop->castbuf[i];\n\t\t\t\tloop->steps[i] = oldsize;\n\t\t\t}\n\t\t\telse\n\t\t\t\tloop->bufptr[i] = loop->buffer[i];\n\t\t\tloop->dptr[i] = loop->buffer[i];\n\t\t}\n\t}\n\n return nargs;\n}\n\nstatic PyTypeObject PyUFuncLoop_Type;\n\nstatic void ufuncloop_dealloc(PyUFuncLoopObject *);\n\nstatic PyUFuncLoopObject *\nconstruct_loop(PyUFuncObject *self, PyObject *args, PyArrayObject **mps)\n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\t\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\n\n\tif ((loop=PyObject_NEW(PyUFuncLoopObject, &PyUFuncLoop_Type)) == NULL)\n\t\treturn NULL;\n\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n\tloop->buffer[0] = NULL;\n for (i=0; inargs; i++) {\n loop->iters[i] = NULL;\n loop->cast[i] = NULL;\n }\n\tloop->errobj = NULL;\n\n\t/* Setup the matrices */\n\tif (construct_matrices(loop, args, mps) < 0) goto fail;\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString((self->name ? \\\n self->name : \"\")), \n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n\tPyUFunc_clearfperr();\n\n\treturn loop;\n\n fail:\n\tufuncloop_dealloc(loop);\n\treturn NULL;\n}\n\n\n/* \nstatic void\n_printbytebuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing byte buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %d\\n\", *(((byte *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbufptr(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->bufptr[bufnum]))+i));\n\t} \n}\n\n\n \nstatic void\n_printcastbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->castbuf[bufnum]))+i));\n\t} \n}\n\n*/\n\n\n\n\n/* currently generic ufuncs cannot be built for use on flexible arrays.\n\n The cast functions in the generic loop would need to be fixed to pass \n something besides NULL, NULL \n\n*/\n\n/* This generic function is called with the ufunc object, the arguments to it,\n and an array of (pointers to) PyArrayObjects which are NULL. The \n arguments are parsed and placed in mps in construct_loop (construct_matrices)\n*/\n\nstatic int \nPyUFunc_GenericFunction(PyUFuncObject *self, PyObject *args, \n\t\t\tPyArrayObject **mps) \n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\tint temp;\n BEGIN_THREADS_DEF\n\n\tif (!(loop = construct_loop(self, args, mps))) return -1;\n\n\tLOOP_BEGIN_THREADS\n\n\tswitch(loop->meth) {\n\tcase ONE_UFUNCLOOP:\n\t\t/* Everything is contiguous, notswapped, aligned,\n\t\t and of the right type. -- Fastest.\n\t\t Or if not contiguous, then a single-stride\n\t\t increment moves through the entire array. \n\t\t*/\n /* fprintf(stderr, \"ONE...%d\\n\", loop->size);*/\n\t\tloop->function((char **)loop->bufptr, &(loop->size), \n\t\t\t loop->steps, loop->funcdata);\n\t\tUFUNC_CHECK_ERROR();\n\t\tbreak;\n\tcase NOBUFFER_UFUNCLOOP:\n\t\t/* Everything is notswapped, aligned and of the \n\t\t right type but not contiguous. -- Almost as fast.\n\t\t*/\n /* fprintf(stderr, \"NOBUFFER...%d\\n\", loop->size);*/\n\t\twhile (loop->index < loop->size) {\n\t\t\tfor (i=0; inargs; i++) \n\t\t\t\tloop->bufptr[i] = loop->iters[i]->dataptr;\n\n\t\t\tloop->function((char **)loop->bufptr, &(loop->bufcnt),\n\t\t\t\t loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tPyArray_ITER_NEXT(loop->iters[i]);\n\t\t\t}\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\tcase BUFFER_UFUNCLOOP: {\n\t\t/* Make local copies of all loop variables */\n\t\t/* Optimizations needed:\n\t\t 1) move data better into the buffer better\n\t\t --- not one at a time -- this requires some \n pre-analysis and is only possible over \n the largest dimension.\n\t\t*/\n\n\t\tPyArray_CopySwapNFunc *copyswapn[MAX_ARGS];\n\t\tPyArrayIterObject **iters=loop->iters;\n\t\tint *swap=loop->swap;\n\t\tvoid **dptr=loop->dptr;\n\t\tint mpselsize[MAX_ARGS];\n\t\tintp index=loop->index, size=loop->size;\n\t\tint bufcnt=loop->bufcnt, bufsize=loop->bufsize;\n\t\tvoid **bufptr = loop->bufptr;\n\t\tvoid **buffer = loop->buffer;\n\t\tvoid **castbuf = loop->castbuf;\n\t\tintp *steps = loop->steps;\n\t\tBool pyobject[MAX_ARGS];\n\t\t\n\t\tfor (i=0; inargs; i++) {\n\t\t\tcopyswapn[i] = mps[i]->descr->copyswapn;\n\t\t\tmpselsize[i] = mps[i]->itemsize;\n\t\t\tpyobject[i] = (loop->obj && \\\n (mps[i]->descr->type_num == PyArray_OBJECT));\n\t\t}\n\t\t/* Do generic buffered looping here (works for any kind of\n\t\t arrays): Everything uses a buffer. \n\n\t\t 1. fill the input buffers.\n\t\t 2. If buffer is filled then \n\t\t a. cast any input buffers needing it. \n\t\t b. call inner function (which loops over the buffer).\n\t\t\t c. cast any output buffers needing it.\n\t\t\t d. copy output buffer back to output arrays.\n 3. goto next position\n\t\t*/ \n\t\tfprintf(stderr, \"BUFFER...%d\\n\", loop->size);\n\t\t/*\n\t\tfor (i=0; inargs; i++) {\n\t\t\tfprintf(stderr, \"iters[%d]->dataptr = %p, %p of size %d\\n\", i, \n\t\t\t\titers[i], iters[i]->ao->data, PyArray_NBYTES(iters[i]->ao));\n\t\t}\n\t\t*/\n\t\twhile (index < size) {\n\t\t\t/*copy input data */\n\t\t\tfor (i=0; inin; i++) {\n\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\tPy_INCREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t}\n\t\t\t\t/*\t\t\t\tfprintf(stderr, \"index = %d, i=%d, writing to %p\\n\", index, i, dptr[i]); */\n\t\t\t\tmemcpy(dptr[i], iters[i]->dataptr,\n\t\t\t\t mpselsize[i]);\n\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t}\n\t\t\tbufcnt++;\n\t\t\tindex++; \n\t\t\tif ((bufcnt == bufsize) || \\\n\t\t\t (index == size)) {\n\t\t\t\t\n\t\t\t\tfor (i=0; inin; i++) {\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping...\\n\");*/\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](buffer[i],\n\t\t\t\t\t\t\t castbuf[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t\tloop->function((char **)bufptr, \n\t\t\t\t\t &bufcnt, \n\t\t\t\t\t steps, loop->funcdata);\n \n\t\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\t\tfor (i=self->nin; inargs; i++) {\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](castbuf[i],\n\t\t\t\t\t\t\t buffer[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping back...\\n\"); */\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tfor (temp = 0; temp < bufcnt; temp++) {\n\t\t\t\t\t\t/* fprintf(stderr, \"temp=%d, i=%d; reading from %p\\n\", temp, i, dptr[i]);*/\n\t\t\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\t\t\tPy_XDECREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t\t\t\tPy_INCREF(*((PyObject **)dptr[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmemcpy(iters[i]->dataptr,\n\t\t\t\t\t\t dptr[i], mpselsize[i]);\n\t\t\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbufcnt = 0;\n\t\t\t\tfor (i=0; inargs; i++) \n\t\t\t\t\tdptr[i] = buffer[i];\n\t\t\t\t\n\t\t\t} \n\t\t}\n\t}\n\t}\t\n\t\n LOOP_END_THREADS\n\t\n Py_DECREF(loop);\n\treturn 0;\n\n fail:\n LOOP_END_THREADS\n \n\tPy_XDECREF(loop);\n\treturn -1;\n }\n\nstatic PyArrayObject *\n_getidentity(PyUFuncObject *self, int otype, char *str)\n{\n PyObject *obj, *arr;\n PyArray_Typecode typecode = {otype, 0, 0};\n\n if (self->identity == PyUFunc_None) {\n PyErr_Format(PyExc_ValueError, \n \"zero-size array to ufunc.%s \" \\\n \"without identity\", str);\n return NULL;\n }\n if (self->identity == PyUFunc_One) {\n obj = PyInt_FromLong((long) 1);\n } else {\n obj = PyInt_FromLong((long) 0);\n }\n\t\n arr = PyArray_FromAny(obj, &typecode, 0, 0, CARRAY_FLAGS);\n Py_DECREF(obj);\n return (PyArrayObject *)arr;\n}\n\nstatic int\n_create_reduce_copy(PyUFuncReduceObject *loop, PyArrayObject **arr, int rtype)\n{\n\tintp maxsize;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {rtype, 0, 0};\n\t\n\tmaxsize = PyArray_SIZE(*arr);\n\t\n\tif (maxsize < loop->bufsize) {\n\t\tif (!(PyArray_ISBEHAVED_RO(*arr)) ||\t\\\n\t\t PyArray_TYPE(*arr) != rtype) {\n\t\t\tnew = PyArray_FromAny((PyObject *)(*arr), \n\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t FORCECAST |\t\t\\\n\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\tif (new == NULL) return -1;\n\t\t\t*arr = (PyArrayObject *)new;\n\t\t\tloop->decref = new;\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\n\n\nstatic PyTypeObject PyUFuncReduce_Type;\n\nstatic void ufuncreduce_dealloc(PyUFuncReduceObject *);\n\nstatic PyUFuncReduceObject *\nconstruct_reduce(PyUFuncObject *self, PyArrayObject **arr, int axis, \n\t\t int otype, int operation, intp ind_size, char *str)\n{\n PyUFuncReduceObject *loop;\n PyArrayObject *idarr;\n\tPyArrayObject *aar;\n intp loop_i[MAX_DIMS];\n int arg_types[3] = {otype, otype, otype};\n\tchar scalars[3] = {UFUNC_NOSCALAR, UFUNC_NOSCALAR, UFUNC_NOSCALAR};\n\tint i, j;\n\tint nd = (*arr)->nd;\n\t/* Reduce type is the type requested of the input \n\t during reduction */\n\n\tif ((loop=PyObject_NEW(PyUFuncReduceObject, \n\t\t\t &PyUFuncReduce_Type)) == NULL)\n\t\treturn NULL;\n\n\n loop->swap = 0;\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n loop->cast = NULL;\n loop->buffer = NULL;\n loop->ret = NULL;\n\tloop->it = NULL;\n\tloop->rit = NULL;\n\tloop->errobj = NULL;\n\tloop->decref=NULL; \n loop->N = (*arr)->dimensions[axis];\n\tloop->instrides = (*arr)->strides[axis];\n\n\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t &(loop->funcdata), scalars) == -1) goto fail; \n\t\n\t/* output type may change -- if it does \n\t reduction is forced into that type \n\t and we need to select the reduction function again\n\t*/\n\tif (otype != arg_types[2]) {\n\t\totype = arg_types[2];\n\t\targ_types[0] = otype;\n\t\targ_types[1] = otype;\n\t\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t\t &(loop->funcdata), scalars) == -1) \n\t\t\tgoto fail; \t\t\n\t}\n\n\t/* Make bufsize depend on a local then module-level variable */\n\tloop->bufsize = _getintfromvar(\"UFUNC_BUFSIZE\", \n\t\t\t\t PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"The buffer size (%d) is not \"\t\\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\tgoto fail;\n\t}\n\t\n\t/* Make copy if misbehaved or not otype for small arrays */\n\tif (_create_reduce_copy(loop, arr, otype) < 0) goto fail; \n\taar = *arr;\n\t\n if (loop->N == 0) {\n loop->meth = ZERODIM_REDUCELOOP;\n }\n else if (PyArray_ISBEHAVED_RO(aar) &&\t\t\\\n otype == (aar)->descr->type_num) {\n\t\tif (loop->N == 1) {\n\t\t\tloop->meth = ONEDIM_REDUCELOOP;\n\t\t}\n\t\telse {\n\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\tloop->steps[0] = (aar)->strides[axis];\n\t\t\tloop->N -= 1;\n\t\t}\n }\n else {\n loop->meth = BUFFER_UFUNCLOOP;\n loop->swap = !(PyArray_ISNOTSWAPPED(aar));\n }\n\n if (loop->meth == ZERODIM_REDUCELOOP) {\n idarr = _getidentity(self, otype, str);\n if (idarr == NULL) goto fail;\n if (idarr->itemsize > UFUNC_MAXIDENTITY) {\n PyErr_Format(PyExc_RuntimeError, \n\t\t\t\t \"UFUNC_MAXIDENTITY (%d)\"\t\t\\\n \" is too small (needs to be at least %d)\",\n UFUNC_MAXIDENTITY, idarr->itemsize);\n Py_DECREF(idarr);\n goto fail;\n }\n memcpy(loop->idptr, idarr->data, idarr->itemsize);\n Py_DECREF(idarr);\n }\n\t\n /* Construct return array */\n\tswitch(operation) {\n\tcase UFUNC_REDUCE:\n\t\tfor (j=0, i=0; idimensions[i];\n\t\t\t\n\t\t}\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd-1, loop_i, otype, \n\t\t\t\t NULL, NULL, 0, 0, aar);\n\t\tbreak;\n\tcase UFUNC_ACCUMULATE:\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, aar->dimensions, \n\t\t\t\t otype, NULL, NULL, 0, 0, aar);\n\t\tbreak;\n\tcase UFUNC_REDUCEAT:\n\t\tmemcpy(loop_i, aar->dimensions, nd*sizeof(intp));\n\t\t/* Index is 1-d array */\n\t\tloop_i[axis] = ind_size; \n\t\tloop->ret = (PyArrayObject *)\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, loop_i, otype,\n\t\t\t\t NULL, NULL, 0, 0, aar);\n\t\tif (loop->ret == NULL) goto fail;\n\t\tif (ind_size == 0) {\n\t\t\tloop->meth = ZERODIM_REDUCELOOP;\n\t\t\treturn loop;\n\t\t}\n\t\tif (loop->meth == ONEDIM_REDUCELOOP)\n\t\t\tloop->meth = NOBUFFER_REDUCELOOP;\n\t\tbreak;\n\t}\n if (loop->ret == NULL) goto fail;\n loop->insize = aar->itemsize;\n loop->outsize = loop->ret->itemsize;\n loop->bufptr[1] = loop->ret->data;\n\n\tif (loop->meth == ZERODIM_REDUCELOOP) {\n\t\tloop->size = PyArray_SIZE(loop->ret);\n\t\treturn loop;\n\t}\n\n\tloop->it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)aar);\n if (loop->it == NULL) return NULL;\n\n\tif (loop->meth == ONEDIM_REDUCELOOP) {\n\t\tloop->size = loop->it->size;\t\t\n\t\treturn loop;\n\t}\n\n /* Fix iterator to loop over correct dimension */\n\t/* Set size in axis dimension to 1 */\n \n loop->it->contiguous = 0;\n loop->it->size /= (loop->it->dims_m1[axis]+1);\n loop->it->dims_m1[axis] = 0;\n loop->it->backstrides[axis] = 0;\n\n\n loop->size = loop->it->size;\n\n\tif (operation == UFUNC_REDUCE) {\n\t\tloop->steps[1] = 0;\n\t}\n\telse {\n\t\tloop->rit = (PyArrayIterObject *)\t\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)(loop->ret));\n\t\tif (loop->rit == NULL) return NULL;\t\t\n\n\t\t/* Fix iterator to loop over correct dimension */\n\t\t/* Set size in axis dimension to 1 */\n\t\t\n\t\tloop->rit->contiguous = 0;\n\t\tloop->rit->size /= (loop->rit->dims_m1[axis]+1);\n\t\tloop->rit->dims_m1[axis] = 0;\n\t\tloop->rit->backstrides[axis] = 0;\n\n\t\tif (operation == UFUNC_ACCUMULATE)\n\t\t\tloop->steps[1] = loop->ret->strides[axis];\n\t\telse \n\t\t\tloop->steps[1] = 0;\n\t}\n\tloop->steps[2] = loop->steps[1];\n\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[2];\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\n\t\tloop->steps[0] = loop->outsize;\n if (otype != aar->descr->type_num) {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n (loop->outsize + \\\n aar->itemsize));\n if (loop->buffer == NULL) goto fail;\n loop->castbuf = loop->buffer + \\\n loop->bufsize*aar->itemsize;\n loop->bufptr[0] = loop->castbuf; \n loop->cast = aar->descr->cast[otype];\n }\n else {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n loop->outsize);\n if (loop->buffer == NULL) goto fail;\n loop->bufptr[0] = loop->buffer;\n }\n\t}\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \\\n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t\t\t \n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString(str),\n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n /* Determine if object arrays are involved */\n if (otype == PyArray_OBJECT || aar->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n else\n loop->obj = 0;\n\n\tPyUFunc_clearfperr();\n\treturn loop;\n\n fail:\n ufuncreduce_dealloc(loop);\n\treturn NULL;\t\n}\n\n\n/* We have two basic kinds of loops */\n/* One is used when arr is not-swapped and aligned and output type\n is the same as input type.\n and another using buffers when one of these is not satisfied.\n\n Zero-length and one-length axes-to-be-reduced are handled separately.\n*/\n\nstatic PyObject *\nPyUFunc_Reduce(PyUFuncObject *self, PyArrayObject *arr, int axis, int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n BEGIN_THREADS_DEF\n \t\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCE, 0,\n\t\t\t\t\"reduce\");\n\tif (!loop) return NULL;\n\n LOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP:\n\t\t/*fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP:\n\t\t/*fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it)\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1];\n loop->index++; \n\t\t\tif (PyErr_Occurred()) goto fail;\n }\n break;\n case BUFFER_UFUNCLOOP:\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy first item over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %d\\n\", loop->size, \n\t\t loop->swap); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1]; \n loop->index++;\n }\n }\n\n LOOP_END_THREADS\n\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n LOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n\nstatic PyObject *\nPyUFunc_Accumulate(PyUFuncObject *self, PyArrayObject *arr, int axis, \n\t\t int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n \n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_ACCUMULATE, 0,\n\t\t\t\t\"accumulate\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n break;\n case BUFFER_UFUNCLOOP: /* Accumulate */\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy identity over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %p\\n\", loop->size, \n\t\t loop->cast); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n }\n\n\tLOOP_END_THREADS\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n\tLOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n/* Reduceat performs a reduce over an axis using the indices as a guide\n\nop.reduceat(array,indices) computes\nop.reduce(array[indices[i]:indices[i+1]] \n for i=0..end with an implicit indices[i+1]=len(array)\n assumed when i=end-1\n\nif indices[i+1] <= indices[i]+1 \n then the result is array[indices[i]] for that value\n\nop.accumulate(array) is the same as\nop.reduceat(array,indices)[::2]\nwhere indices is range(len(array)-1) with a zero placed in every other sample\n indices = zeros(len(array)*2-1)\n indices[1::2] = range(1,len(array))\n\noutput shape is based on the size of indices\n */\n\nstatic PyObject *\nPyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, \n int axis, int otype)\n{\t\n\tPyArrayObject *ret;\n PyUFuncReduceObject *loop;\n\tintp *ptr=(intp *)ind->data;\n\tintp nn=ind->dimensions[0];\t\t\n\tintp mm=arr->dimensions[axis]-1;\n\tintp n, i;\n\tint j;\n\tchar *dptr;\n\n\t/* Check for out-of-bounds values in indices array */\t\t\n\tfor (i=0; i mm)) {\n\t\t\tPyErr_Format(PyExc_IndexError, \n\t\t\t\t \"index out-of-bounds (0, %d)\", mm);\n\t\t\treturn NULL;\n\t\t}\n\t\tptr++;\n\t}\n\t\n\tptr = (intp *)ind->data;\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCEAT, nn,\n\t\t\t\t\"reduceat\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n\tswitch(loop->meth) {\n\t/* zero-length index -- return array immediately */\n\tcase ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..\\n\"); */\n\t\tbreak;\n\n\t/* NOBUFFER -- behaved array and same type */\n\tcase NOBUFFER_UFUNCLOOP: \t /* Reduceat */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[0] = loop->it->dataptr +\t\\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\tmemcpy(loop->bufptr[1], loop->bufptr[0],\n\t\t\t\t loop->outsize);\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis]-*ptr : \\\n\t\t\t\t *(ptr+1) - *ptr) - 1;\n\t\t\t\tif (mm > 0) {\n\t\t\t\t\tloop->bufptr[0] += loop->instrides;\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &mm, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t}\t\n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\n\t/* BUFFER -- misbehaved array or different types */ \n\tcase BUFFER_UFUNCLOOP: /* Reduceat */\n\t\t/* fprintf(stderr, \"BUFFERED..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[1], loop->idptr, \n\t\t\t\t loop->outsize);\n\t\t\t\tn = 0;\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis] - *ptr :\\\n\t\t\t\t *(ptr+1) - *ptr);\n\t\t\t\tif (mm < 1) mm = 1;\n\t\t\t\tloop->inptr = loop->it->dataptr + \\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\twhile (n < mm) {\n\t\t\t\t\t/* Copy up to loop->bufsize elements\n\t\t\t\t\t to buffer */\n\t\t\t\t\tdptr = loop->buffer;\n\t\t\t\t\tfor (j=0; jbufsize; j++, n++) {\n\t\t\t\t\t\tif (n == mm) break;\n\t\t\t\t\t\tarr->descr->copyswap\\\n\t\t\t\t\t\t\t(dptr,\n\t\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t\t loop->insize);\n\t\t\t\t\t\tloop->inptr += loop->instrides;\n\t\t\t\t\t\tdptr += loop->insize;\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast)\n\t\t\t\t\t\tloop->cast(loop->buffer,\n\t\t\t\t\t\t\t loop->castbuf,\n\t\t\t\t\t\t\t j, NULL, NULL);\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &j, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t} \n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\t}\n\n\tLOOP_END_THREADS\n\t\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\t\n fail:\n\tLOOP_END_THREADS\n\n\tPy_XDECREF(loop);\n\treturn NULL;\n}\n\n\n/* This code handles reduce, reduceat, and accumulate \n (accumulate and reduce are special cases of the more general reduceat \n but they are handled separately for speed) \n*/\n\nstatic PyObject * \nPyUFunc_GenericReduction(PyUFuncObject *self, PyObject *args, \n PyObject *kwds, int operation) \n{\n\tint axis=0;\n\tPyArrayObject *mp, *ret = NULL;\n\tPyObject *op, *res=NULL;\n\tPyObject *obj_ind; \n\tPyArrayObject *indices = NULL;\n\tPyArray_Typecode otype= {PyArray_NOTYPE, 0, 0};\n PyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tstatic char *kwlist1[] = {\"array\", \"axis\", \"rtype\", NULL};\n\tstatic char *kwlist2[] = {\"array\", \"indices\", \"axis\", \"rtype\", NULL}; \n static char *_reduce_type[] = {\"reduce\", \"accumulate\", \\\n\t\t\t\t \"reduceat\", NULL};\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\t\n\n\tif (self->nin != 2) {\n\t\tPyErr_Format(PyExc_ValueError, \n \"%s only supported for binary functions\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\tif (self->nout != 1) {\n\t\tPyErr_Format(PyExc_ValueError,\n \"%s only supported for functions \" \\\n \"returning a single value\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\n\tif (operation == UFUNC_REDUCEAT) {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|iO&\", kwlist2, \n\t\t\t\t\t\t&op, &obj_ind, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n indices = (PyArrayObject *)PyArray_FromAny(obj_ind, &indtype, \n\t\t\t\t\t\t\t 1, 1, CARRAY_FLAGS);\n if (indices == NULL) return NULL;\n\n\t}\n\telse {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|iO&\", kwlist1,\n\t\t\t\t\t\t&op, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n\t}\n\t\n\t/* Ensure input is an array */\t\n\tmp = (PyArrayObject *)PyArray_FromAny(op, NULL, 0, 0, 0);\n\tif (mp == NULL) return NULL;\n\n /* Check to see if input is zero-dimensional */\n if (mp->nd == 0) {\n PyErr_Format(PyExc_ValueError, \"cannot %s on a scalar\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL; \n }\n\n /* Check to see that type (and otype) is not FLEXIBLE */\n\tif (PyArray_ISFLEXIBLE(mp) || PyTypeNum_ISFLEXIBLE(otype.type_num)) {\n PyErr_Format(PyExc_ValueError, \n\t\t\t \"cannot perform %s with flexible type\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL;\n }\n\n\tif (axis < 0) axis += mp->nd;\n\tif (axis < 0 || axis >= mp->nd) {\n\t\tPyErr_SetString(PyExc_ValueError, \"axis not in array\");\n Py_DECREF(mp);\n\t\treturn NULL;\n\t}\n\n\n if (otype.type_num == PyArray_NOTYPE)\n otype.type_num = mp->descr->type_num;\n\n switch(operation) {\n case UFUNC_REDUCE:\n ret = (PyArrayObject *)PyUFunc_Reduce(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_ACCUMULATE:\n ret = (PyArrayObject *)PyUFunc_Accumulate(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_REDUCEAT:\n ret = (PyArrayObject *)PyUFunc_Reduceat(self, mp, indices, \n axis, otype.type_num);\n Py_DECREF(indices);\n\t\tbreak;\n }\n Py_DECREF(mp);\n\tif (ret==NULL) return NULL;\n\tif (op->ob_type != ret->ob_type) {\n\t\tres = PyObject_CallMethod(op, \"__array_wrap__\", \"O\", ret);\n\t}\n\tif (res == NULL) PyErr_Clear();\n\telse if (res == Py_None) Py_DECREF(res);\n\telse {\n\t\tPy_DECREF(ret);\n\t\treturn res;\n\t}\t\n\treturn PyArray_Return(ret);\n\t\n}\n\n\n\n/* ---------- */\n\nstatic PyObject *\n_find_array_wrap(PyObject *args)\n{\n\tint nargs, i;\n\tint np = 0;\n\tint argmax = 0;\n\tint val;\n\tdouble priority[MAX_ARGS];\n\tdouble maxpriority = PyArray_SUBTYPE_PRIORITY;\n\tPyObject *with_wrap[MAX_ARGS];\n\tPyObject *attr;\n\tPyObject *obj;\n\n\tnargs = PyTuple_Size(args);\n\tfor (i=0; i maxpriority) {\n\t\t\tmaxpriority = priority[i];\n\t\t\targmax = i;\n\t\t}\n\t}\n\n\treturn with_wrap[argmax];\n}\n\nstatic PyObject *\nufunc_generic_call(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyTupleObject *ret;\n\tPyArrayObject *mps[MAX_ARGS];\n\tPyObject *retobj[MAX_ARGS];\n\tPyObject *res;\n\tPyObject *obj;\n\t\n\t/* Initialize all array objects to NULL to make cleanup easier \n\t if something goes wrong. */\n\tfor(i=0; inargs; i++) mps[i] = NULL;\n\t\n\tif (PyUFunc_GenericFunction(self, args, mps) == -1) {\n\t\tfor(i=0; inargs; i++) Py_XDECREF(mps[i]);\n\t\treturn NULL;\n\t}\n\t\n\tfor(i=0; inin; i++) Py_DECREF(mps[i]);\n\n\t/* Use __array_wrap__ on all outputs \n\t if present on one of the input arguments.\n\t If present for multiple inputs:\n\t use __array_wrap__ of input object with largest \n\t\t__array_priority__ (default = 0.0)\n\t */\n\tobj = _find_array_wrap(args);\n\t\n\t/* wrap outputs */\n\tfor (i=0; inout; i++) {\n\t\tint j=self->nin+i;\n\t\t/* check to see if any UPDATEIFCOPY flags are set \n\t\t which meant that a temporary output was generated \n\t\t*/\n\t\tif (mps[j]->flags & UPDATEIFCOPY) {\n\t\t\tPyObject *old = mps[j]->base;\n\t\t\tPy_INCREF(old); /* we want to hang on to this */\n\t\t\tPy_DECREF(mps[j]); /* should trigger the copy \n\t\t\t\t\t back into old */\n\t\t\tmps[j] = (PyArrayObject *)old;\n\t\t}\n\t\tif (obj != NULL) {\n\t\t\tres = PyObject_CallMethod(obj, \"__array_wrap__\",\n\t\t\t\t\t\t \"O\", mps[j]);\n\t\t\tif (res == NULL) PyErr_Clear();\n\t\t\telse if (res == Py_None) Py_DECREF(res);\n\t\t\telse {\n\t\t\t\tPy_DECREF(mps[j]);\n\t\t\t\tretobj[i] = res;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tretobj[i] = PyArray_Return(mps[j]);\n\t}\n\t\n\tif (self->nout == 1) { \n\t\treturn retobj[0];\n\t} else { \n\t\tret = (PyTupleObject *)PyTuple_New(self->nout);\n\t\tfor(i=0; inout; i++) {\n\t\t\tPyTuple_SET_ITEM(ret, i, retobj[i]);\n\t\t}\n\t\treturn (PyObject *)ret;\n\t}\t\n\n}\n\nstatic PyUFuncGenericFunction pyfunc_functions[] = {PyUFunc_On_Om};\n\nstatic char \ndoc_frompyfunc[] = \"frompyfunc(func, nin, nout) take an arbitrary python function that takes nin objects as input and returns nout objects and return a universal function (ufunc). This ufunc always returns PyObject arrays\";\n\nstatic PyObject *\nufunc_frompyfunc(PyObject *dummy, PyObject *args, PyObject *kwds) {\n /* Keywords are ignored for now */\n \n PyObject *function, *pyname=NULL;\n int nin, nout, i;\n PyUFunc_PyFuncData *fdata;\n PyUFuncObject *self;\n char *fname, *str;\n int fname_len=-1;\n\n if (!PyArg_ParseTuple(args, \"Oii\", &function, &nin, &nout)) return NULL;\n\n if (!PyCallable_Check(function)) {\n PyErr_SetString(PyExc_TypeError, \"Function must be callable.\");\n return NULL;\n }\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\n\tself->userloops = NULL;\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = PyUFunc_None;\t\n\tself->functions = pyfunc_functions;\n\n\tself->ntypes = 1;\n\tself->check_return = 0;\n\n pyname = PyObject_GetAttrString(function, \"__name__\");\n if (pyname)\n (void) PyString_AsStringAndSize(pyname, &fname, &fname_len);\n \n if (PyErr_Occurred()) {\n fname = \"?\";\n fname_len = 1;\n PyErr_Clear();\n } \n Py_XDECREF(pyname);\n\n\n self->ptr = malloc((self->nargs)+sizeof(PyUFunc_PyFuncData)+sizeof(void *)+(fname_len+14));\n \n\tif (self->ptr == NULL) return PyErr_NoMemory();\n Py_INCREF(function);\n self->obj = function;\n\tfdata = (PyUFunc_PyFuncData *)(self->ptr + (nin+nout) + sizeof(void *));\n fdata->nin = nin;\n fdata->nout = nout;\n fdata->callable = function;\n \n self->data = (void **)(self->ptr + (nin+nout));\n self->data[0] = (void *)fdata;\n\n\n\tself->types = (char *)self->ptr;\n for (i=0; inargs; i++) self->types[i] = PyArray_OBJECT;\n\n str = (char *)(fdata + 1);\n memcpy(str, fname, fname_len);\n memcpy(str+fname_len, \" (vectorized)\", 14);\n \n self->name = str;\n\n /* Do a better job someday */\n self->doc = \"dynamic ufunc based on a python function\";\n \n\t\n\treturn (PyObject *)self;\n}\n\n\nstatic PyObject *\nPyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void **data, \n\t\t\tchar *types, int ntypes,\n\t\t\tint nin, int nout, int identity, \n\t\t\tchar *name, char *doc, int check_return) \n{\n\tPyUFuncObject *self;\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = identity;\n\t\n\tself->functions = func;\n\tself->data = data;\n\tself->types = types;\n\tself->ntypes = ntypes;\n\tself->check_return = check_return;\n self->ptr = NULL;\n self->obj = NULL;\n\tself->userloops=NULL;\n\t\n\tif (name == NULL) self->name = \"?\";\n\telse self->name = name;\n\t\n if (doc == NULL) self->doc = \"NULL\";\n\telse self->doc = doc;\n\t\n\treturn (PyObject *)self;\n}\n\nstatic int\nPyUFunc_RegisterLoopForType(PyUFuncObject *ufunc, \n\t\t\t int usertype,\n\t\t\t PyUFuncGenericFunction function,\n\t\t\t void *data)\n{\n\tPyArray_Descr *descr=PyArray_DescrFromType(usertype);\n \tPyObject *key, *cobj;\n\tint ret;\t\n\t\n\tif ((usertype < PyArray_USERDEF) || (descr==NULL)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Cannot register typenumber\");\n\t\treturn -1;\n\t}\n\tif (ufunc->userloops == NULL) {\n\t\tufunc->userloops = PyDict_New();\n\t}\n\tkey = PyInt_FromLong(usertype);\n\tif (key == NULL) return -1;\n\tcobj = PyCObject_FromVoidPtr((void *)function, NULL);\n\tif (cobj == NULL) {Py_DECREF(key); return -1;}\n\tif (data == NULL) {\n\t\tret = PyDict_SetItem(ufunc->userloops, key, cobj);\n\t\tPy_DECREF(cobj);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n\telse {\n\t\tPyObject *cobj2, *tmp;\n\t\tcobj2 = PyCObject_FromVoidPtr(data, NULL);\n\t\tif (cobj2 == NULL) {\n\t\t\tPy_DECREF(cobj); \n\t\t\tPy_DECREF(key);\n\t\t\treturn -1;\n\t\t}\n\t\ttmp=Py_BuildValue(\"NN\", cobj, cobj2);\n\t\tret = PyDict_SetItem(ufunc->userloops, key, tmp);\n\t\tPy_DECREF(tmp);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n}\n\nstatic void\nufuncreduce_dealloc(PyUFuncReduceObject *self)\n{\n if (self->ufunc) {\n Py_XDECREF(self->it);\n\t\tPy_XDECREF(self->rit);\n Py_XDECREF(self->ret);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_XDECREF(self->decref);\n if (self->buffer) free(self->buffer);\n Py_DECREF(self->ufunc);\n }\n PyObject_DEL(self);\n}\n\nstatic void\nufuncloop_dealloc(PyUFuncLoopObject *self)\n{\n\tint i;\n\t\n\tif (self->ufunc != NULL) {\n\t\tfor (i=0; iufunc->nargs; i++)\n\t\t\tPy_XDECREF(self->iters[i]);\n\t\tif (self->buffer[0]) free(self->buffer[0]);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_DECREF(self->ufunc);\n\t}\n\tPyObject_DEL(self);\n}\n\n\nstatic void\nufunc_dealloc(PyUFuncObject *self)\n{\n if (self->ptr) free(self->ptr);\n\tPy_XDECREF(self->userloops);\n Py_XDECREF(self->obj);\n\tPyObject_DEL(self);\n}\n\nstatic PyObject *\nufunc_repr(PyUFuncObject *self)\n{\n\tchar buf[100];\n\t\n\tsprintf(buf, \"\", self->name);\n\t\n\treturn PyString_FromString(buf);\n}\n\n\n/* -------------------------------------------------------- */\n\n/* op.outer(a,b) is equivalent to op(a[:,NewAxis,NewAxis,etc.],b)\n where a has b.ndim NewAxis terms appended.\n\n The result has dimensions a.ndim + b.ndim\n */\n\nstatic PyObject *\nufunc_outer(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyObject *ret;\n\tPyArrayObject *ap1=NULL, *ap2=NULL, *ap_new=NULL;\n\tPyObject *new_args, *tmp;\n\tPyObject *shape1, *shape2, *newshape;\n\n\tif(self->nin != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"outer product only supported \"\\\n\t\t\t\t\"for binary functions\");\n\t\treturn NULL;\n\t}\n\t\n\tif (PySequence_Length(args) != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"exactly two arguments expected\");\n\t\treturn NULL;\n\t}\n\t\n\ttmp = PySequence_GetItem(args, 0);\n\tif (tmp == NULL) return NULL;\n\tap1 = (PyArrayObject *)\t\t\t\t\t\\\n\t\tPyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap1 == NULL) return NULL;\n\t\n\ttmp = PySequence_GetItem(args, 1);\n\tif (tmp == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap2 == NULL) {Py_DECREF(ap1); return NULL;}\n\n\t/* Construct new shape tuple */\n\tshape1 = PyTuple_New(ap1->nd);\n\tif (shape1 == NULL) goto fail;\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape1, i, \n\t\t\t\t PyLong_FromLongLong((longlong)ap1->\t\\\n\t\t\t\t\t\t dimensions[i]));\n\t\n\tshape2 = PyTuple_New(ap2->nd);\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape2, i, PyInt_FromLong((long) 1));\n\tif (shape2 == NULL) {Py_DECREF(shape1); goto fail;}\n\tnewshape = PyNumber_Add(shape1, shape2);\n\tPy_DECREF(shape1);\n\tPy_DECREF(shape2);\n\tif (newshape == NULL) goto fail;\n\t\n\tap_new = (PyArrayObject *)PyArray_Reshape(ap1, newshape);\n\tPy_DECREF(newshape);\n\tif (ap_new == NULL) goto fail;\n\t\n\tnew_args = Py_BuildValue(\"(OO)\", ap_new, ap2);\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\tPy_DECREF(ap_new);\t\n\tret = ufunc_generic_call(self, new_args);\n\tPy_DECREF(new_args);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ap_new);\n\treturn NULL;\n\n}\n\n\nstatic PyObject *\nufunc_reduce(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCE);\n}\n\nstatic PyObject *\nufunc_accumulate(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_ACCUMULATE);\n}\n\nstatic PyObject *\nufunc_reduceat(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCEAT);\n}\n\n\nstatic struct PyMethodDef ufunc_methods[] = {\n\t{\"reduce\", (PyCFunction)ufunc_reduce, METH_VARARGS | METH_KEYWORDS},\n\t{\"accumulate\", (PyCFunction)ufunc_accumulate, \n\t METH_VARARGS | METH_KEYWORDS},\n\t{\"reduceat\", (PyCFunction)ufunc_reduceat, \n\t METH_VARARGS | METH_KEYWORDS},\t\n\t{\"outer\", (PyCFunction)ufunc_outer, METH_VARARGS},\n\t{NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\n\n/* construct the string\n y1,y2,...,yn\n*/\n\nstatic void\n_makeargs(int num, char ltr, char *str) \n{\n\tint ind=0;\n\tint k;\n\tstatic char *digits=\"123456789ABCDE\";\n\n\tif (num == 1) {\n\t\tstr[0] = ltr;\n\t\tind = 1;\n\t}\n\telse {\n\t\tfor (k=0; ktype)\n\nstatic PyObject *\nufunc_getattr(PyUFuncObject *self, char *name)\n{\n\tPyObject *obj;\n\t/* Put docstring first or FindMethod finds it...*/\n\t/* could so some introspection on name and nin + nout */\n\t/* to automate the first part of it */\n\t/* the doc string shouldn't need the calling convention */\n\tif (strcmp(name, \"__doc__\") == 0) {\n\t\tstatic char doc[256];\n\t\tstatic char tmp1[3*MAX_ARGS+2];\n\t\tstatic char tmp2[3*MAX_ARGS+2];\n\t\t/* construct \n\t\t y1,y2,,... = name(x1,x2,...) __doc__\n\t\t*/\t\t\n\t\t_makeargs(self->nout, 'y', tmp1);\n\t\t_makeargs(self->nin, 'x', tmp2);\n\t\tsnprintf(doc, 256, \"%s = %s(%s) %s\", tmp1, self->name, \n\t\t\t tmp2, self->doc);\n\t\treturn PyString_FromString(doc);\n\t}\n\tobj = Py_FindMethod(ufunc_methods, (PyObject *)self, name);\n\tif (obj != NULL) return obj;\n\tPyErr_Clear();\n\tif (strcmp(name, \"nin\") == 0) {\n\t\treturn PyInt_FromLong(self->nin);\n\t}\n\telse if (strcmp(name, \"nout\") == 0) {\n\t\treturn PyInt_FromLong(self->nout);\n\t}\n\telse if (strcmp(name, \"nargs\") == 0) {\n\t\treturn PyInt_FromLong(self->nargs);\n\t}\n\telse if (strcmp(name, \"ntypes\") == 0) {\n\t\treturn PyInt_FromLong(self->ntypes);\n\t}\n\telse if (strcmp(name, \"types\") == 0) {\n\t\t/* return a list with types grouped\n\t\t input->output */\n\t\tPyObject *list;\n\t\tPyObject *str;\n\t\tint k, j, n, nt=self->ntypes;\n\t\tint ni = self->nin;\n\t\tint no = self->nout;\n\t\tchar *t;\n\t\tlist = PyList_New(nt);\n\t\tif (list == NULL) return NULL;\n\t\tt = malloc(no+ni+2);\n\t\tn = 0;\n\t\tfor (k=0; ktypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tt[ni] = '-';\n\t\t\tt[ni+1] = '>';\n\t\t\tfor (j=0; jtypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tstr = PyString_FromStringAndSize(t, no+ni+2);\n\t\t\tPyList_SET_ITEM(list, k, str);\n\t\t}\n\t\tfree(t);\n\t\treturn list;\n\t\t\n\t}\n\telse if (strcmp(name, \"__name__\") == 0) {\n\t\treturn PyString_FromString(self->name);\n\t}\n\telse if (strcmp(name, \"identity\") == 0) {\n\t\tswitch(self->identity) {\n\t\tcase PyUFunc_One:\n\t\t\treturn PyInt_FromLong(1);\n\t\tcase PyUFunc_Zero:\n\t\t\treturn PyInt_FromLong(0);\n\t\tdefault:\n\t\t\tPy_INCREF(Py_None);\n\t\t\treturn Py_None;\n\t\t}\n\t}\n\tPyErr_SetString(PyExc_AttributeError, name);\n\treturn NULL;\n}\n\n#undef _typecharfromnum\n\nstatic int\nufunc_setattr(PyUFuncObject *self, char *name, PyObject *v) \n{\n\treturn -1;\n}\n\nstatic char Ufunctype__doc__[] = \n\t\"Optimized functions make it possible to implement arithmetic \"\\\n\t\"with arrays efficiently\";\n\nstatic PyTypeObject PyUFunc_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufunc\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncObject),\t\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufunc_dealloc,\t/*tp_dealloc*/\n\t(printfunc)0,\t\t /*tp_print*/\n\t(getattrfunc)ufunc_getattr,\t/*tp_getattr*/\n\t(setattrfunc)ufunc_setattr,\t/*tp_setattr*/\n\t(cmpfunc)0,\t \t/*tp_compare*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_repr*/\n\t0,\t\t\t /*tp_as_number*/\n\t0,\t\t /*tp_as_sequence*/\n\t0,\t\t /*tp_as_mapping*/\n\t(hashfunc)0,\t\t/*tp_hash*/\n\t(ternaryfunc)ufunc_generic_call,\t\t/*tp_call*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_str*/\n\t\t\n\t/* Space for future expansion */\n\t0L,0L,0L,0L,\n\tUfunctype__doc__ /* Documentation string */\n};\n\nstatic PyTypeObject PyUFuncLoop_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncloop\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncLoopObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncloop_dealloc\t/*tp_dealloc*/\n};\n\nstatic PyTypeObject PyUFuncReduce_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncreduce\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncReduceObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncreduce_dealloc\t/*tp_dealloc*/\n};\n\n\n/* End of code for ufunc objects */\n/* -------------------------------------------------------- */\n", "methods": [ { "name": "PyUFunc_ff_f_As_dd_d", "long_name": "PyUFunc_ff_f_As_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 146, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 39, "end_line": 49, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_ff_f", "long_name": "PyUFunc_ff_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 52, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_dd_d", "long_name": "PyUFunc_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 137, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 66, "end_line": 77, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_gg_g", "long_name": "PyUFunc_gg_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 80, "end_line": 90, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F_As_DD_D", "long_name": "PyUFunc_FF_F_As_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 225, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 94, "end_line": 107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_DD_D", "long_name": "PyUFunc_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 110, "end_line": 123, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F", "long_name": "PyUFunc_FF_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 126, "end_line": 139, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_GG_G", "long_name": "PyUFunc_GG_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 142, "end_line": 157, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_OO_O", "long_name": "PyUFunc_OO_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 239, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 160, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f_As_d_d", "long_name": "PyUFunc_f_f_As_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 106, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 198, "end_line": 205, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_d_d", "long_name": "PyUFunc_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 208, "end_line": 215, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f", "long_name": "PyUFunc_f_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 218, "end_line": 225, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_g_g", "long_name": "PyUFunc_g_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 2, "token_count": 94, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 228, "end_line": 236, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F_As_D_D", "long_name": "PyUFunc_F_F_As_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 164, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 240, "end_line": 251, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F", "long_name": "PyUFunc_F_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 254, "end_line": 265, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_D_D", "long_name": "PyUFunc_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 269, "end_line": 280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_G_G", "long_name": "PyUFunc_G_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 284, "end_line": 295, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O", "long_name": "PyUFunc_O_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 18, "complexity": 5, "token_count": 152, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 298, "end_line": 318, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O_method", "long_name": "PyUFunc_O_O_method( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 24, "complexity": 6, "token_count": 193, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 321, "end_line": 348, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_On_Om", "long_name": "PyUFunc_On_Om( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 47, "complexity": 11, "token_count": 357, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 357, "end_line": 405, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "_error_handler", "long_name": "_error_handler( int method , PyObject * errobj , char * errtype , int retstatus)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 211, "parameters": [ "method", "errobj", "errtype", "retstatus" ], "start_line": 429, "end_line": 475, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "PyUFunc_checkfperr", "long_name": "PyUFunc_checkfperr( int errmask , PyObject * errobj)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 60, "parameters": [ "errmask", "errobj" ], "start_line": 479, "end_line": 508, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyUFunc_clearfperr", "long_name": "PyUFunc_clearfperr()", "filename": "ufuncobject.c", "nloc": 5, "complexity": 1, "token_count": 12, "parameters": [], "start_line": 513, "end_line": 518, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "_lowest_type", "long_name": "_lowest_type( char intype)", "filename": "ufuncobject.c", "nloc": 23, "complexity": 13, "token_count": 66, "parameters": [ "intype" ], "start_line": 548, "end_line": 574, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_cancoerce", "long_name": "_cancoerce( char thistype , char neededtype , char scalar)", "filename": "ufuncobject.c", "nloc": 21, "complexity": 9, "token_count": 101, "parameters": [ "thistype", "neededtype", "scalar" ], "start_line": 577, "end_line": 598, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "select_types", "long_name": "select_types( PyUFuncObject * self , int * arg_types , PyUFuncGenericFunction * function , ** data , char * scalars)", "filename": "ufuncobject.c", "nloc": 70, "complexity": 17, "token_count": 455, "parameters": [ "self", "arg_types", "function", "data", "scalars" ], "start_line": 602, "end_line": 683, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 82, "top_nesting_level": 0 }, { "name": "_getintfromvar", "long_name": "_getintfromvar( char * str , int deflt)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 6, "token_count": 123, "parameters": [ "str", "deflt" ], "start_line": 688, "end_line": 708, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_getfuncfromvar", "long_name": "_getfuncfromvar( char * str , PyObject * deflt)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 134, "parameters": [ "str", "deflt" ], "start_line": 711, "end_line": 736, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "_scalar_kind", "long_name": "_scalar_kind( int typenum , PyArrayObject ** arr)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 6, "token_count": 64, "parameters": [ "typenum", "arr" ], "start_line": 740, "end_line": 748, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "_create_copies", "long_name": "_create_copies( PyUFuncLoopObject * loop , int * arg_types , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 37, "complexity": 8, "token_count": 285, "parameters": [ "loop", "arg_types", "mps" ], "start_line": 757, "end_line": 799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "construct_matrices", "long_name": "construct_matrices( PyUFuncLoopObject * loop , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 246, "complexity": 59, "token_count": 1912, "parameters": [ "loop", "args", "mps" ], "start_line": 802, "end_line": 1144, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 343, "top_nesting_level": 0 }, { "name": "construct_loop", "long_name": "construct_loop( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 40, "complexity": 8, "token_count": 238, "parameters": [ "self", "args", "mps" ], "start_line": 1151, "end_line": 1200, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericFunction", "long_name": "PyUFunc_GenericFunction( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 117, "complexity": 24, "token_count": 838, "parameters": [ "self", "args", "mps" ], "start_line": 1268, "end_line": 1439, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 172, "top_nesting_level": 0 }, { "name": "_getidentity", "long_name": "_getidentity( PyUFuncObject * self , int otype , char * str)", "filename": "ufuncobject.c", "nloc": 19, "complexity": 3, "token_count": 118, "parameters": [ "self", "otype", "str" ], "start_line": 1442, "end_line": 1462, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_create_reduce_copy", "long_name": "_create_reduce_copy( PyUFuncReduceObject * loop , PyArrayObject ** arr , int rtype)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 5, "token_count": 127, "parameters": [ "loop", "arr", "rtype" ], "start_line": 1465, "end_line": 1487, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "construct_reduce", "long_name": "construct_reduce( PyUFuncObject * self , PyArrayObject ** arr , int axis , int otype , int operation , intp ind_size , char * str)", "filename": "ufuncobject.c", "nloc": 191, "complexity": 38, "token_count": 1408, "parameters": [ "self", "arr", "axis", "otype", "operation", "ind_size", "str" ], "start_line": 1496, "end_line": 1731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 236, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduce", "long_name": "PyUFunc_Reduce( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 100, "complexity": 16, "token_count": 660, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1743, "end_line": 1873, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Accumulate", "long_name": "PyUFunc_Accumulate( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 101, "complexity": 15, "token_count": 683, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1877, "end_line": 2007, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduceat", "long_name": "PyUFunc_Reduceat( PyUFuncObject * self , PyArrayObject * arr , PyArrayObject * ind , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 108, "complexity": 20, "token_count": 763, "parameters": [ "self", "arr", "ind", "axis", "otype" ], "start_line": 2029, "end_line": 2156, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 128, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericReduction", "long_name": "PyUFunc_GenericReduction( PyUFuncObject * self , PyObject * args , PyObject * kwds , int operation)", "filename": "ufuncobject.c", "nloc": 97, "complexity": 23, "token_count": 613, "parameters": [ "self", "args", "kwds", "operation" ], "start_line": 2165, "end_line": 2275, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 111, "top_nesting_level": 0 }, { "name": "_find_array_wrap", "long_name": "_find_array_wrap( PyObject * args)", "filename": "ufuncobject.c", "nloc": 49, "complexity": 12, "token_count": 260, "parameters": [ "args" ], "start_line": 2282, "end_line": 2334, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "ufunc_generic_call", "long_name": "ufunc_generic_call( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 46, "complexity": 12, "token_count": 356, "parameters": [ "self", "args" ], "start_line": 2337, "end_line": 2402, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 66, "top_nesting_level": 0 }, { "name": "ufunc_frompyfunc", "long_name": "ufunc_frompyfunc( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 50, "complexity": 8, "token_count": 432, "parameters": [ "dummy", "args", "kwds" ], "start_line": 2410, "end_line": 2481, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyUFunc_FromFuncAndData", "long_name": "PyUFunc_FromFuncAndData( PyUFuncGenericFunction * func , ** data , char * types , int ntypes , int nin , int nout , int identity , char * name , char * doc , int check_return)", "filename": "ufuncobject.c", "nloc": 26, "complexity": 4, "token_count": 181, "parameters": [ "func", "data", "types", "ntypes", "nin", "nout", "identity", "name", "doc", "check_return" ], "start_line": 2485, "end_line": 2516, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyUFunc_RegisterLoopForType", "long_name": "PyUFunc_RegisterLoopForType( PyUFuncObject * ufunc , int usertype , PyUFuncGenericFunction function , * data)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 241, "parameters": [ "ufunc", "usertype", "function", "data" ], "start_line": 2519, "end_line": 2560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "ufuncreduce_dealloc", "long_name": "ufuncreduce_dealloc( PyUFuncReduceObject * self)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 76, "parameters": [ "self" ], "start_line": 2563, "end_line": 2575, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufuncloop_dealloc", "long_name": "ufuncloop_dealloc( PyUFuncLoopObject * self)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 4, "token_count": 86, "parameters": [ "self" ], "start_line": 2578, "end_line": 2590, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufunc_dealloc", "long_name": "ufunc_dealloc( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 7, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 2594, "end_line": 2600, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "ufunc_repr", "long_name": "ufunc_repr( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 6, "complexity": 1, "token_count": 31, "parameters": [ "self" ], "start_line": 2603, "end_line": 2610, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "ufunc_outer", "long_name": "ufunc_outer( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 59, "complexity": 13, "token_count": 428, "parameters": [ "self", "args" ], "start_line": 2622, "end_line": 2691, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "ufunc_reduce", "long_name": "ufunc_reduce( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2695, "end_line": 2699, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_accumulate", "long_name": "ufunc_accumulate( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2702, "end_line": 2706, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_reduceat", "long_name": "ufunc_reduceat( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2709, "end_line": 2712, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "_makeargs", "long_name": "_makeargs( int num , char ltr , char * str)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 3, "token_count": 117, "parameters": [ "num", "ltr", "str" ], "start_line": 2732, "end_line": 2754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "ufunc_getattr", "long_name": "ufunc_getattr( PyUFuncObject * self , char * name)", "filename": "ufuncobject.c", "nloc": 74, "complexity": 16, "token_count": 520, "parameters": [ "self", "name" ], "start_line": 2759, "end_line": 2842, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 84, "top_nesting_level": 0 }, { "name": "ufunc_setattr", "long_name": "ufunc_setattr( PyUFuncObject * self , char * name , PyObject * v)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self", "name", "v" ], "start_line": 2847, "end_line": 2850, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyUFunc_ff_f_As_dd_d", "long_name": "PyUFunc_ff_f_As_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 145, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 39, "end_line": 49, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_ff_f", "long_name": "PyUFunc_ff_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 135, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 52, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_dd_d", "long_name": "PyUFunc_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 66, "end_line": 77, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_gg_g", "long_name": "PyUFunc_gg_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 135, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 80, "end_line": 90, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F_As_DD_D", "long_name": "PyUFunc_FF_F_As_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 227, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 94, "end_line": 109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_DD_D", "long_name": "PyUFunc_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 112, "end_line": 125, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F", "long_name": "PyUFunc_FF_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 128, "end_line": 141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_GG_G", "long_name": "PyUFunc_GG_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 144, "end_line": 159, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_OO_O", "long_name": "PyUFunc_OO_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 238, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 162, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f_As_d_d", "long_name": "PyUFunc_f_f_As_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 106, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 200, "end_line": 207, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_d_d", "long_name": "PyUFunc_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 210, "end_line": 217, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f", "long_name": "PyUFunc_f_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 220, "end_line": 227, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_g_g", "long_name": "PyUFunc_g_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 2, "token_count": 94, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 230, "end_line": 238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F_As_D_D", "long_name": "PyUFunc_F_F_As_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 164, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 242, "end_line": 253, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F", "long_name": "PyUFunc_F_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 256, "end_line": 267, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_D_D", "long_name": "PyUFunc_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 271, "end_line": 282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_G_G", "long_name": "PyUFunc_G_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 286, "end_line": 297, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O", "long_name": "PyUFunc_O_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 18, "complexity": 5, "token_count": 152, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 300, "end_line": 320, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O_method", "long_name": "PyUFunc_O_O_method( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 24, "complexity": 6, "token_count": 193, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 323, "end_line": 350, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_On_Om", "long_name": "PyUFunc_On_Om( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 47, "complexity": 11, "token_count": 357, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 359, "end_line": 407, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "_error_handler", "long_name": "_error_handler( int method , PyObject * errobj , char * errtype , int retstatus)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 211, "parameters": [ "method", "errobj", "errtype", "retstatus" ], "start_line": 431, "end_line": 477, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "PyUFunc_checkfperr", "long_name": "PyUFunc_checkfperr( int errmask , PyObject * errobj)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 60, "parameters": [ "errmask", "errobj" ], "start_line": 481, "end_line": 510, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyUFunc_clearfperr", "long_name": "PyUFunc_clearfperr()", "filename": "ufuncobject.c", "nloc": 5, "complexity": 1, "token_count": 12, "parameters": [], "start_line": 515, "end_line": 520, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "_lowest_type", "long_name": "_lowest_type( char intype)", "filename": "ufuncobject.c", "nloc": 23, "complexity": 13, "token_count": 66, "parameters": [ "intype" ], "start_line": 550, "end_line": 576, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_cancoerce", "long_name": "_cancoerce( char thistype , char neededtype , char scalar)", "filename": "ufuncobject.c", "nloc": 21, "complexity": 9, "token_count": 101, "parameters": [ "thistype", "neededtype", "scalar" ], "start_line": 579, "end_line": 600, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "select_types", "long_name": "select_types( PyUFuncObject * self , int * arg_types , PyUFuncGenericFunction * function , ** data , char * scalars)", "filename": "ufuncobject.c", "nloc": 70, "complexity": 17, "token_count": 455, "parameters": [ "self", "arg_types", "function", "data", "scalars" ], "start_line": 604, "end_line": 685, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 82, "top_nesting_level": 0 }, { "name": "_getintfromvar", "long_name": "_getintfromvar( char * str , int deflt)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 6, "token_count": 123, "parameters": [ "str", "deflt" ], "start_line": 690, "end_line": 710, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_getfuncfromvar", "long_name": "_getfuncfromvar( char * str , PyObject * deflt)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 134, "parameters": [ "str", "deflt" ], "start_line": 713, "end_line": 738, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "_scalar_kind", "long_name": "_scalar_kind( int typenum , PyArrayObject ** arr)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 6, "token_count": 64, "parameters": [ "typenum", "arr" ], "start_line": 742, "end_line": 750, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "_create_copies", "long_name": "_create_copies( PyUFuncLoopObject * loop , int * arg_types , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 37, "complexity": 8, "token_count": 285, "parameters": [ "loop", "arg_types", "mps" ], "start_line": 759, "end_line": 801, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "construct_matrices", "long_name": "construct_matrices( PyUFuncLoopObject * loop , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 246, "complexity": 59, "token_count": 1912, "parameters": [ "loop", "args", "mps" ], "start_line": 804, "end_line": 1146, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 343, "top_nesting_level": 0 }, { "name": "construct_loop", "long_name": "construct_loop( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 40, "complexity": 8, "token_count": 238, "parameters": [ "self", "args", "mps" ], "start_line": 1153, "end_line": 1202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericFunction", "long_name": "PyUFunc_GenericFunction( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 117, "complexity": 24, "token_count": 838, "parameters": [ "self", "args", "mps" ], "start_line": 1270, "end_line": 1441, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 172, "top_nesting_level": 0 }, { "name": "_getidentity", "long_name": "_getidentity( PyUFuncObject * self , int otype , char * str)", "filename": "ufuncobject.c", "nloc": 19, "complexity": 3, "token_count": 118, "parameters": [ "self", "otype", "str" ], "start_line": 1444, "end_line": 1464, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_create_reduce_copy", "long_name": "_create_reduce_copy( PyUFuncReduceObject * loop , PyArrayObject ** arr , int rtype)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 5, "token_count": 127, "parameters": [ "loop", "arr", "rtype" ], "start_line": 1467, "end_line": 1489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "construct_reduce", "long_name": "construct_reduce( PyUFuncObject * self , PyArrayObject ** arr , int axis , int otype , int operation , intp ind_size , char * str)", "filename": "ufuncobject.c", "nloc": 191, "complexity": 38, "token_count": 1408, "parameters": [ "self", "arr", "axis", "otype", "operation", "ind_size", "str" ], "start_line": 1498, "end_line": 1733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 236, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduce", "long_name": "PyUFunc_Reduce( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 100, "complexity": 16, "token_count": 660, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1745, "end_line": 1875, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Accumulate", "long_name": "PyUFunc_Accumulate( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 101, "complexity": 15, "token_count": 683, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1879, "end_line": 2009, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduceat", "long_name": "PyUFunc_Reduceat( PyUFuncObject * self , PyArrayObject * arr , PyArrayObject * ind , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 108, "complexity": 20, "token_count": 763, "parameters": [ "self", "arr", "ind", "axis", "otype" ], "start_line": 2031, "end_line": 2158, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 128, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericReduction", "long_name": "PyUFunc_GenericReduction( PyUFuncObject * self , PyObject * args , PyObject * kwds , int operation)", "filename": "ufuncobject.c", "nloc": 97, "complexity": 23, "token_count": 613, "parameters": [ "self", "args", "kwds", "operation" ], "start_line": 2167, "end_line": 2277, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 111, "top_nesting_level": 0 }, { "name": "_find_array_wrap", "long_name": "_find_array_wrap( PyObject * args)", "filename": "ufuncobject.c", "nloc": 49, "complexity": 12, "token_count": 260, "parameters": [ "args" ], "start_line": 2284, "end_line": 2336, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "ufunc_generic_call", "long_name": "ufunc_generic_call( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 46, "complexity": 12, "token_count": 356, "parameters": [ "self", "args" ], "start_line": 2339, "end_line": 2404, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 66, "top_nesting_level": 0 }, { "name": "ufunc_frompyfunc", "long_name": "ufunc_frompyfunc( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 50, "complexity": 8, "token_count": 432, "parameters": [ "dummy", "args", "kwds" ], "start_line": 2412, "end_line": 2483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyUFunc_FromFuncAndData", "long_name": "PyUFunc_FromFuncAndData( PyUFuncGenericFunction * func , ** data , char * types , int ntypes , int nin , int nout , int identity , char * name , char * doc , int check_return)", "filename": "ufuncobject.c", "nloc": 26, "complexity": 4, "token_count": 181, "parameters": [ "func", "data", "types", "ntypes", "nin", "nout", "identity", "name", "doc", "check_return" ], "start_line": 2487, "end_line": 2518, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyUFunc_RegisterLoopForType", "long_name": "PyUFunc_RegisterLoopForType( PyUFuncObject * ufunc , int usertype , PyUFuncGenericFunction function , * data)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 241, "parameters": [ "ufunc", "usertype", "function", "data" ], "start_line": 2521, "end_line": 2562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "ufuncreduce_dealloc", "long_name": "ufuncreduce_dealloc( PyUFuncReduceObject * self)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 76, "parameters": [ "self" ], "start_line": 2565, "end_line": 2577, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufuncloop_dealloc", "long_name": "ufuncloop_dealloc( PyUFuncLoopObject * self)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 4, "token_count": 86, "parameters": [ "self" ], "start_line": 2580, "end_line": 2592, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufunc_dealloc", "long_name": "ufunc_dealloc( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 7, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 2596, "end_line": 2602, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "ufunc_repr", "long_name": "ufunc_repr( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 6, "complexity": 1, "token_count": 31, "parameters": [ "self" ], "start_line": 2605, "end_line": 2612, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "ufunc_outer", "long_name": "ufunc_outer( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 59, "complexity": 13, "token_count": 428, "parameters": [ "self", "args" ], "start_line": 2624, "end_line": 2693, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "ufunc_reduce", "long_name": "ufunc_reduce( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2697, "end_line": 2701, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_accumulate", "long_name": "ufunc_accumulate( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2704, "end_line": 2708, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_reduceat", "long_name": "ufunc_reduceat( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2711, "end_line": 2714, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "_makeargs", "long_name": "_makeargs( int num , char ltr , char * str)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 3, "token_count": 117, "parameters": [ "num", "ltr", "str" ], "start_line": 2734, "end_line": 2756, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "ufunc_getattr", "long_name": "ufunc_getattr( PyUFuncObject * self , char * name)", "filename": "ufuncobject.c", "nloc": 74, "complexity": 16, "token_count": 520, "parameters": [ "self", "name" ], "start_line": 2761, "end_line": 2844, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 84, "top_nesting_level": 0 }, { "name": "ufunc_setattr", "long_name": "ufunc_setattr( PyUFuncObject * self , char * name , PyObject * v)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self", "name", "v" ], "start_line": 2849, "end_line": 2852, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "PyUFunc_ff_f_As_dd_d", "long_name": "PyUFunc_ff_f_As_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 146, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 39, "end_line": 49, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_gg_g", "long_name": "PyUFunc_gg_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 80, "end_line": 90, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_dd_d", "long_name": "PyUFunc_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 137, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 66, "end_line": 77, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F_As_DD_D", "long_name": "PyUFunc_FF_F_As_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 225, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 94, "end_line": 107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_OO_O", "long_name": "PyUFunc_OO_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 239, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 160, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_ff_f", "long_name": "PyUFunc_ff_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 52, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 } ], "nloc": 2136, "complexity": 438, "token_count": 15662, "diff_parsed": { "added": [ "\tregister intp is1=steps[0],is2=steps[1],os=steps[2];", "\tregister intp is1=steps[0],is2=steps[1],os=steps[2];", "\tregister intp is1=steps[0],is2=steps[1],os=steps[2];", "\tregister intp is1=steps[0],is2=steps[1],os=steps[2];", "\tregister intp i,n=dimensions[0],is1=steps[0],is2=steps[1],os=steps[2];", "\tregister intp i, is1=steps[0],is2=steps[1],os=steps[2], \\", "\t\tn=dimensions[0];" ], "deleted": [ "\tintp is1=steps[0],is2=steps[1],os=steps[2];", "\tintp is1=steps[0],is2=steps[1],os=steps[2];", "\tintp is1=steps[0],is2=steps[1],os=steps[2];", "\tintp is1=steps[0],is2=steps[1],os=steps[2];", "\tregister int i;", "\tintp is1=steps[0],is2=steps[1],os=steps[2];", "\tintp n=dimensions[0];", "\tint i, is1=steps[0],is2=steps[1],os=steps[2];", "\tint n=dimensions[0];" ] } } ] }, { "hash": "54a193f1a0cdd6ccf40e36d09daa9fb0dd658456", "msg": "Added Inf to base", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T09:01:49+00:00", "author_timezone": 0, "committer_date": "2005-10-07T09:01:49+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "e67afea77cf3b076c4d56a9c902e68d31bf80e6d" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 3, "insertions": 6, "lines": 9, "files": 2, "dmm_unit_size": 1.0, "dmm_unit_complexity": 1.0, "dmm_unit_interfacing": 1.0, "modified_files": [ { "old_path": "scipy/base/numeric.py", "new_path": "scipy/base/numeric.py", "filename": "numeric.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -380,8 +380,8 @@ def getbufsize(size):\n seterr(where='builtin')\n setbufsize(UFUNC_BUFSIZE_DEFAULT,where='builtin')\n \n-inf = PINF\n-nan = NAN\n+Inf = inf = infty = Infinity = PINF\n+nan = NaN = NAN\n from oldnumeric import *\n \n \n", "added_lines": 2, "deleted_lines": 2, "source_code": "\nimport sys\nimport types, math\n\nimport multiarray\nimport umath\nfrom umath import *\nfrom numerictypes import *\nfrom _compiled_base import _insert\n\nnewaxis = None\n\nndarray = multiarray.ndarray\nbigndarray = multiarray.bigndarray\nufunc = type(sin)\n\narange = multiarray.arange\narray = multiarray.array\nzeros = multiarray.zeros\nempty = multiarray.empty\nfromstring = multiarray.fromstring\nfromfile = multiarray.fromfile\nfrombuffer = multiarray.frombuffer\nwhere = multiarray.where\nconcatenate = multiarray.concatenate\nfastCopyAndTranspose = multiarray._fastCopyAndTranspose\nregister_dtype = multiarray.register_dtype\ncan_cast = multiarray.can_cast\n\n\ndef asarray(a, dtype=None):\n \"\"\"asarray(a,dtype=None) returns a as an array. Unlike array(),\n no copy is performed if a is already an array. Will return a subclass\n of array. \n \"\"\"\n return array(a, dtype, copy=0)\n\ndef asndarray(a, dtype=None):\n \"\"\"asndarray(a, dtype=None) always returns an actual ndarray object.\n No copy is performed if a is already an array.\n Meant primarily for debugging. \n \"\"\"\n dtype = obj2dtype(dtype)\n # exact check\n while 1:\n if type(a) is ndarray:\n if dtype is None or a.dtype is dtype:\n return a\n else:\n return a.astype(dtype)\n try:\n if dtype is None:\n return a.__array__()\n else:\n return a.__array__(dtype)\n except AttributeError:\n a = array(a,dtype) # copy irrelevant\n dtype = None\n\ndef isfortran(a):\n return a.flags['FNC']\n\n# from Fernando Perez's IPython\ndef zeros_like(a):\n \"\"\"Return an array of zeros of the shape and typecode of a.\n\n If you don't explicitly need the array to be zeroed, you should instead\n use empty_like(), which is faster as it only allocates memory.\"\"\"\n\n a = asarray(a)\n return a.__array_wrap__(zeros(a.shape,a.dtype,\n a.flags['FORTRAN'] and a.ndim > 1))\n\ndef empty_like(a):\n \"\"\"Return an empty (uninitialized) array of the shape and typecode of a.\n\n Note that this does NOT initialize the returned array. If you require\n your array to be initialized, you should use zeros_like().\n\n \"\"\"\n asarray(a)\n return a.__array_wrap__(empty(a.shape,a.dtype,\n a.flags['FORTRAN'] and a.ndim > 1))\n\n# end Fernando's utilities\n\n_mode_from_name_dict = {'v': 0,\n 's' : 1,\n 'f' : 2}\n\ndef _mode_from_name(mode):\n if isinstance(mode, type(\"\")):\n return _mode_from_name_dict[mode.lower()[0]]\n return mode\n \ndef correlate(a,v,mode='valid'):\n mode = _mode_from_name(mode)\n return multiarray.correlate(a,v,mode)\n\n\ndef convolve(a,v,mode='full'):\n \"\"\"Returns the discrete, linear convolution of 1-D\n sequences a and v; mode can be 0 (valid), 1 (same), or 2 (full)\n to specify size of the resulting sequence.\n \"\"\"\n if (len(v) > len(a)):\n a, v = v, a\n mode = _mode_from_name(mode)\n return correlate(a,asarray(v)[::-1],mode)\n\n\ninner = multiarray.inner\ndot = multiarray.dot\n\ndef outer(a,b):\n \"\"\"outer(a,b) returns the outer product of two vectors.\n result(i,j) = a(i)*b(j) when a and b are vectors\n Will accept any arguments that can be made into vectors.\n \"\"\"\n a = asndarray(a)\n b = asndarray(b)\n return a.ravel()[:,newaxis]*b.ravel()[newaxis,:]\n\ndef vdot(a, b):\n \"\"\"Returns the dot product of 2 vectors (or anything that can be made into\n a vector). NB: this is not the same as `dot`, as it takes the conjugate\n of its first argument if complex and always returns a scalar.\"\"\"\n return dot(asarray(a).ravel().conj(), asarray(b).ravel())\n\n# try to import blas optimized dot if available\ntry:\n # importing this changes the dot function for basic 4 types\n # to blas-optimized versions.\n from scipy.lib._dotblas import dot, vdot, inner, alterdot, restoredot\nexcept ImportError:\n def alterdot():\n pass\n def restoredot():\n pass\n\n\ndef _move_axis_to_0(a, axis):\n if axis == 0:\n return a\n n = a.ndim\n if axis < 0:\n axis += n\n axes = range(1, axis+1) + [0,] + range(axis+1, n)\n return a.transpose(axes)\n\ndef cross(a, b, axisa=-1, axisb=-1, axisc=-1):\n \"\"\"Return the cross product of two (arrays of) vectors.\n\n The cross product is performed over the last axis of a and b by default,\n and can handle axes with dimensions 2 and 3. For a dimension of 2,\n the z-component of the equivalent three-dimensional cross product is\n returned.\n \"\"\"\n a = _move_axis_to_0(asndarray(a), axisa)\n b = _move_axis_to_0(asndarray(b), axisb)\n msg = \"incompatible dimensions for cross product\\n\"\\\n \"(dimension must be 2 or 3)\"\n if (a.shape[0] not in [2,3]) or (b.shape[0] not in [2,3]):\n raise ValueError(msg)\n if a.shape[0] == 2:\n if (b.shape[0] == 2):\n cp = a[0]*b[1] - a[1]*b[0]\n if cp.ndim == 0:\n return cp\n else:\n return cp.swapaxes(0,axisc)\n else:\n x = a[1]*b[2]\n y = -a[0]*b[2]\n z = a[0]*b[1] - a[1]*b[0]\n elif a.shape[0] == 3:\n if (b.shape[0] == 3):\n x = a[1]*b[2] - a[2]*b[1]\n y = a[2]*b[0] - a[0]*b[2]\n z = a[0]*b[1] - a[1]*b[0]\n else:\n x = -a[2]*b[1]\n y = a[2]*b[0]\n z = a[0]*b[1] - a[1]*b[0]\n cp = array([x,y,z])\n if cp.ndim == 1:\n return cp\n else:\n return cp.swapaxes(0,axisc)\n \n\n#Use numarray's printing function\nfrom arrayprint import array2string, get_printoptions, set_printoptions\n\n_typelessdata = [int_, float_, complex_]\nif issubclass(intc, int):\n _typelessdata.append(intc)\n\ndef array_repr(arr, max_line_width=None, precision=None, suppress_small=None):\n if arr.size > 0 or arr.shape==(0,):\n lst = array2string(arr, max_line_width, precision, suppress_small,\n ', ', \"array(\")\n else: # show zero-length shape unless it is (0,)\n lst = \"[], shape=%s\" % (repr(arr.shape),)\n typeless = arr.dtype in _typelessdata\n\n if arr.__class__ is not ndarray:\n cName= arr.__class__.__name__\n else:\n cName = \"array\"\n if typeless and arr.size:\n return cName + \"(%s)\" % lst\n else:\n typename=arr.dtype.__name__[:-8]\n return cName + \"(%s, dtype=%s)\" % (lst, typename)\n\ndef array_str(a, max_line_width = None, precision = None, suppress_small = None):\n return array2string(a, max_line_width, precision, suppress_small, ' ', \"\")\n\nset_string_function = multiarray.set_string_function\nset_string_function(array_str, 0)\nset_string_function(array_repr, 1)\n\n\nlittle_endian = (sys.byteorder == 'little')\n\ndef indices(dimensions, dtype=intp):\n \"\"\"indices(dimensions,dtype=intp) returns an array representing a grid\n of indices with row-only, and column-only variation.\n \"\"\"\n tmp = ones(dimensions, dtype)\n lst = []\n for i in range(len(dimensions)):\n lst.append( add.accumulate(tmp, i, )-1 )\n return array(lst)\n\ndef fromfunction(function, dimensions, **kwargs):\n \"\"\"fromfunction(function, dimensions) returns an array constructed by\n calling function on a tuple of number grids. The function should\n accept as many arguments as there are dimensions which is a list of\n numbers indicating the length of the desired output for each axis.\n\n The function can also accept keyword arguments which will be\n passed in as well. \n \"\"\"\n args = indices(dimensions)\n return function(*args,**kwargs)\n \n\nfrom cPickle import load, loads\n_cload = load\n_file = file\n\ndef load(file):\n if isinstance(file, type(\"\")):\n file = _file(file,\"rb\")\n return _cload(file)\n\n\n# These are all essentially abbreviations\n# These might wind up in a special abbreviations module\n\ndef ones(shape, dtype=intp, fortran=0):\n \"\"\"ones(shape, dtype=intp) returns an array of the given\n dimensions which is initialized to all ones. \n \"\"\"\n a=zeros(shape, dtype, fortran)\n a+=1\n ### a[...]=1 -- slower?\n return a\n \ndef identity(n,dtype=intp):\n \"\"\"identity(n) returns the identity matrix of shape n x n.\n \"\"\"\n a = array([1]+n*[0],dtype=dtype)\n b = empty((n,n),dtype=dtype)\n b.flat = a\n return b\n\ndef allclose (a, b, rtol=1.e-5, atol=1.e-8):\n \"\"\" allclose(a,b,rtol=1.e-5,atol=1.e-8)\n Returns true if all components of a and b are equal\n subject to given tolerances.\n The relative error rtol must be positive and << 1.0\n The absolute error atol comes into play for those elements\n of y that are very small or zero; it says how small x must be also.\n \"\"\"\n x = array(a, copy=0)\n y = array(b, copy=0)\n d = less(absolute(x-y), atol + rtol * absolute(y))\n return alltrue(ravel(d))\n \n\n_errdict = {\"ignore\":ERR_IGNORE,\n \"warn\":ERR_WARN,\n \"raise\":ERR_RAISE,\n \"call\":ERR_CALL}\n\n_errdict_rev = {}\nfor key in _errdict.keys():\n _errdict_rev[_errdict[key]] = key\ndel key\n\ndef seterr(divide=\"ignore\", over=\"ignore\", under=\"ignore\", invalid=\"ignore\", where=0):\n maskvalue = (_errdict[divide] << SHIFT_DIVIDEBYZERO) + \\\n (_errdict[over] << SHIFT_OVERFLOW ) + \\\n (_errdict[under] << SHIFT_UNDERFLOW) + \\\n (_errdict[invalid] << SHIFT_INVALID)\n frame = sys._getframe().f_back\n try:\n wh = where.lower()[0]\n except (AttributeError, TypeError, IndexError):\n wh = None\n if where==0 or wh == 'l':\n frame.f_locals[UFUNC_ERRMASK_NAME] = maskvalue\n elif where == 1 or wh == 'g':\n frame.f_globals[UFUNC_ERRMASK_NAME] = maskvalue\n elif where == 2 or wh == 'b':\n frame.f_builtins[UFUNC_ERRMASK_NAME] = maskvalue\n return\n\n frame.f_locals[UFUNC_ERRMASK_NAME] = maskvalue\n return\n\nseterr()\n\ndef geterr():\n frame = sys._getframe().f_back\n try:\n maskvalue = frame.f_locals[UFUNC_ERRMASK_NAME]\n except KeyError:\n maskvalue = ERR_DEFAULT\n\n mask = 3\n res = {}\n val = (maskvalue >> SHIFT_DIVIDEBYZERO) & mask\n res['divide'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_OVERFLOW) & mask\n res['over'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_UNDERFLOW) & mask\n res['under'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_INVALID) & mask\n res['invalid'] = _errdict_rev[val]\n return res\n\ndef setbufsize(size, where=0):\n if size > 10e6:\n raise ValueError, \"Very big buffers.. %s\" % size\n frame = sys._getframe().f_back\n try:\n wh = where.lower()[0]\n except (AttributeError, TypeError, IndexError):\n wh = None\n if where == 0 or wh == 'l':\n frame.f_locals[UFUNC_BUFSIZE_NAME] = size\n elif where == 1 or wh == 'g':\n frame.f_globals[UFUNC_BUFSIZE_NAME] = size\n elif where == 2 or wh == 'b':\n frame.f_builtins[UFUNC_BUFSIZE_NAME] = size\n return\n\nsetbufsize(10000, 1)\n\ndef getbufsize(size):\n frame = sys._getframe().f_back\n try:\n retval = frame.f_locals[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retval = frame.f_globals[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retval = frame.f_builtins[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retvalue = UFUNC_BUFSIZE_DEFAULT\n\n return retval\n\n\n# Set the UFUNC_BUFSIZE_NAME to something\n# Set the UFUNC_ERRMASK_NAME to something\nseterr(where='builtin')\nsetbufsize(UFUNC_BUFSIZE_DEFAULT,where='builtin')\n\nInf = inf = infty = Infinity = PINF\nnan = NaN = NAN\nfrom oldnumeric import *\n\n\n", "source_code_before": "\nimport sys\nimport types, math\n\nimport multiarray\nimport umath\nfrom umath import *\nfrom numerictypes import *\nfrom _compiled_base import _insert\n\nnewaxis = None\n\nndarray = multiarray.ndarray\nbigndarray = multiarray.bigndarray\nufunc = type(sin)\n\narange = multiarray.arange\narray = multiarray.array\nzeros = multiarray.zeros\nempty = multiarray.empty\nfromstring = multiarray.fromstring\nfromfile = multiarray.fromfile\nfrombuffer = multiarray.frombuffer\nwhere = multiarray.where\nconcatenate = multiarray.concatenate\nfastCopyAndTranspose = multiarray._fastCopyAndTranspose\nregister_dtype = multiarray.register_dtype\ncan_cast = multiarray.can_cast\n\n\ndef asarray(a, dtype=None):\n \"\"\"asarray(a,dtype=None) returns a as an array. Unlike array(),\n no copy is performed if a is already an array. Will return a subclass\n of array. \n \"\"\"\n return array(a, dtype, copy=0)\n\ndef asndarray(a, dtype=None):\n \"\"\"asndarray(a, dtype=None) always returns an actual ndarray object.\n No copy is performed if a is already an array.\n Meant primarily for debugging. \n \"\"\"\n dtype = obj2dtype(dtype)\n # exact check\n while 1:\n if type(a) is ndarray:\n if dtype is None or a.dtype is dtype:\n return a\n else:\n return a.astype(dtype)\n try:\n if dtype is None:\n return a.__array__()\n else:\n return a.__array__(dtype)\n except AttributeError:\n a = array(a,dtype) # copy irrelevant\n dtype = None\n\ndef isfortran(a):\n return a.flags['FNC']\n\n# from Fernando Perez's IPython\ndef zeros_like(a):\n \"\"\"Return an array of zeros of the shape and typecode of a.\n\n If you don't explicitly need the array to be zeroed, you should instead\n use empty_like(), which is faster as it only allocates memory.\"\"\"\n\n a = asarray(a)\n return a.__array_wrap__(zeros(a.shape,a.dtype,\n a.flags['FORTRAN'] and a.ndim > 1))\n\ndef empty_like(a):\n \"\"\"Return an empty (uninitialized) array of the shape and typecode of a.\n\n Note that this does NOT initialize the returned array. If you require\n your array to be initialized, you should use zeros_like().\n\n \"\"\"\n asarray(a)\n return a.__array_wrap__(empty(a.shape,a.dtype,\n a.flags['FORTRAN'] and a.ndim > 1))\n\n# end Fernando's utilities\n\n_mode_from_name_dict = {'v': 0,\n 's' : 1,\n 'f' : 2}\n\ndef _mode_from_name(mode):\n if isinstance(mode, type(\"\")):\n return _mode_from_name_dict[mode.lower()[0]]\n return mode\n \ndef correlate(a,v,mode='valid'):\n mode = _mode_from_name(mode)\n return multiarray.correlate(a,v,mode)\n\n\ndef convolve(a,v,mode='full'):\n \"\"\"Returns the discrete, linear convolution of 1-D\n sequences a and v; mode can be 0 (valid), 1 (same), or 2 (full)\n to specify size of the resulting sequence.\n \"\"\"\n if (len(v) > len(a)):\n a, v = v, a\n mode = _mode_from_name(mode)\n return correlate(a,asarray(v)[::-1],mode)\n\n\ninner = multiarray.inner\ndot = multiarray.dot\n\ndef outer(a,b):\n \"\"\"outer(a,b) returns the outer product of two vectors.\n result(i,j) = a(i)*b(j) when a and b are vectors\n Will accept any arguments that can be made into vectors.\n \"\"\"\n a = asndarray(a)\n b = asndarray(b)\n return a.ravel()[:,newaxis]*b.ravel()[newaxis,:]\n\ndef vdot(a, b):\n \"\"\"Returns the dot product of 2 vectors (or anything that can be made into\n a vector). NB: this is not the same as `dot`, as it takes the conjugate\n of its first argument if complex and always returns a scalar.\"\"\"\n return dot(asarray(a).ravel().conj(), asarray(b).ravel())\n\n# try to import blas optimized dot if available\ntry:\n # importing this changes the dot function for basic 4 types\n # to blas-optimized versions.\n from scipy.lib._dotblas import dot, vdot, inner, alterdot, restoredot\nexcept ImportError:\n def alterdot():\n pass\n def restoredot():\n pass\n\n\ndef _move_axis_to_0(a, axis):\n if axis == 0:\n return a\n n = a.ndim\n if axis < 0:\n axis += n\n axes = range(1, axis+1) + [0,] + range(axis+1, n)\n return a.transpose(axes)\n\ndef cross(a, b, axisa=-1, axisb=-1, axisc=-1):\n \"\"\"Return the cross product of two (arrays of) vectors.\n\n The cross product is performed over the last axis of a and b by default,\n and can handle axes with dimensions 2 and 3. For a dimension of 2,\n the z-component of the equivalent three-dimensional cross product is\n returned.\n \"\"\"\n a = _move_axis_to_0(asndarray(a), axisa)\n b = _move_axis_to_0(asndarray(b), axisb)\n msg = \"incompatible dimensions for cross product\\n\"\\\n \"(dimension must be 2 or 3)\"\n if (a.shape[0] not in [2,3]) or (b.shape[0] not in [2,3]):\n raise ValueError(msg)\n if a.shape[0] == 2:\n if (b.shape[0] == 2):\n cp = a[0]*b[1] - a[1]*b[0]\n if cp.ndim == 0:\n return cp\n else:\n return cp.swapaxes(0,axisc)\n else:\n x = a[1]*b[2]\n y = -a[0]*b[2]\n z = a[0]*b[1] - a[1]*b[0]\n elif a.shape[0] == 3:\n if (b.shape[0] == 3):\n x = a[1]*b[2] - a[2]*b[1]\n y = a[2]*b[0] - a[0]*b[2]\n z = a[0]*b[1] - a[1]*b[0]\n else:\n x = -a[2]*b[1]\n y = a[2]*b[0]\n z = a[0]*b[1] - a[1]*b[0]\n cp = array([x,y,z])\n if cp.ndim == 1:\n return cp\n else:\n return cp.swapaxes(0,axisc)\n \n\n#Use numarray's printing function\nfrom arrayprint import array2string, get_printoptions, set_printoptions\n\n_typelessdata = [int_, float_, complex_]\nif issubclass(intc, int):\n _typelessdata.append(intc)\n\ndef array_repr(arr, max_line_width=None, precision=None, suppress_small=None):\n if arr.size > 0 or arr.shape==(0,):\n lst = array2string(arr, max_line_width, precision, suppress_small,\n ', ', \"array(\")\n else: # show zero-length shape unless it is (0,)\n lst = \"[], shape=%s\" % (repr(arr.shape),)\n typeless = arr.dtype in _typelessdata\n\n if arr.__class__ is not ndarray:\n cName= arr.__class__.__name__\n else:\n cName = \"array\"\n if typeless and arr.size:\n return cName + \"(%s)\" % lst\n else:\n typename=arr.dtype.__name__[:-8]\n return cName + \"(%s, dtype=%s)\" % (lst, typename)\n\ndef array_str(a, max_line_width = None, precision = None, suppress_small = None):\n return array2string(a, max_line_width, precision, suppress_small, ' ', \"\")\n\nset_string_function = multiarray.set_string_function\nset_string_function(array_str, 0)\nset_string_function(array_repr, 1)\n\n\nlittle_endian = (sys.byteorder == 'little')\n\ndef indices(dimensions, dtype=intp):\n \"\"\"indices(dimensions,dtype=intp) returns an array representing a grid\n of indices with row-only, and column-only variation.\n \"\"\"\n tmp = ones(dimensions, dtype)\n lst = []\n for i in range(len(dimensions)):\n lst.append( add.accumulate(tmp, i, )-1 )\n return array(lst)\n\ndef fromfunction(function, dimensions, **kwargs):\n \"\"\"fromfunction(function, dimensions) returns an array constructed by\n calling function on a tuple of number grids. The function should\n accept as many arguments as there are dimensions which is a list of\n numbers indicating the length of the desired output for each axis.\n\n The function can also accept keyword arguments which will be\n passed in as well. \n \"\"\"\n args = indices(dimensions)\n return function(*args,**kwargs)\n \n\nfrom cPickle import load, loads\n_cload = load\n_file = file\n\ndef load(file):\n if isinstance(file, type(\"\")):\n file = _file(file,\"rb\")\n return _cload(file)\n\n\n# These are all essentially abbreviations\n# These might wind up in a special abbreviations module\n\ndef ones(shape, dtype=intp, fortran=0):\n \"\"\"ones(shape, dtype=intp) returns an array of the given\n dimensions which is initialized to all ones. \n \"\"\"\n a=zeros(shape, dtype, fortran)\n a+=1\n ### a[...]=1 -- slower?\n return a\n \ndef identity(n,dtype=intp):\n \"\"\"identity(n) returns the identity matrix of shape n x n.\n \"\"\"\n a = array([1]+n*[0],dtype=dtype)\n b = empty((n,n),dtype=dtype)\n b.flat = a\n return b\n\ndef allclose (a, b, rtol=1.e-5, atol=1.e-8):\n \"\"\" allclose(a,b,rtol=1.e-5,atol=1.e-8)\n Returns true if all components of a and b are equal\n subject to given tolerances.\n The relative error rtol must be positive and << 1.0\n The absolute error atol comes into play for those elements\n of y that are very small or zero; it says how small x must be also.\n \"\"\"\n x = array(a, copy=0)\n y = array(b, copy=0)\n d = less(absolute(x-y), atol + rtol * absolute(y))\n return alltrue(ravel(d))\n \n\n_errdict = {\"ignore\":ERR_IGNORE,\n \"warn\":ERR_WARN,\n \"raise\":ERR_RAISE,\n \"call\":ERR_CALL}\n\n_errdict_rev = {}\nfor key in _errdict.keys():\n _errdict_rev[_errdict[key]] = key\ndel key\n\ndef seterr(divide=\"ignore\", over=\"ignore\", under=\"ignore\", invalid=\"ignore\", where=0):\n maskvalue = (_errdict[divide] << SHIFT_DIVIDEBYZERO) + \\\n (_errdict[over] << SHIFT_OVERFLOW ) + \\\n (_errdict[under] << SHIFT_UNDERFLOW) + \\\n (_errdict[invalid] << SHIFT_INVALID)\n frame = sys._getframe().f_back\n try:\n wh = where.lower()[0]\n except (AttributeError, TypeError, IndexError):\n wh = None\n if where==0 or wh == 'l':\n frame.f_locals[UFUNC_ERRMASK_NAME] = maskvalue\n elif where == 1 or wh == 'g':\n frame.f_globals[UFUNC_ERRMASK_NAME] = maskvalue\n elif where == 2 or wh == 'b':\n frame.f_builtins[UFUNC_ERRMASK_NAME] = maskvalue\n return\n\n frame.f_locals[UFUNC_ERRMASK_NAME] = maskvalue\n return\n\nseterr()\n\ndef geterr():\n frame = sys._getframe().f_back\n try:\n maskvalue = frame.f_locals[UFUNC_ERRMASK_NAME]\n except KeyError:\n maskvalue = ERR_DEFAULT\n\n mask = 3\n res = {}\n val = (maskvalue >> SHIFT_DIVIDEBYZERO) & mask\n res['divide'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_OVERFLOW) & mask\n res['over'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_UNDERFLOW) & mask\n res['under'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_INVALID) & mask\n res['invalid'] = _errdict_rev[val]\n return res\n\ndef setbufsize(size, where=0):\n if size > 10e6:\n raise ValueError, \"Very big buffers.. %s\" % size\n frame = sys._getframe().f_back\n try:\n wh = where.lower()[0]\n except (AttributeError, TypeError, IndexError):\n wh = None\n if where == 0 or wh == 'l':\n frame.f_locals[UFUNC_BUFSIZE_NAME] = size\n elif where == 1 or wh == 'g':\n frame.f_globals[UFUNC_BUFSIZE_NAME] = size\n elif where == 2 or wh == 'b':\n frame.f_builtins[UFUNC_BUFSIZE_NAME] = size\n return\n\nsetbufsize(10000, 1)\n\ndef getbufsize(size):\n frame = sys._getframe().f_back\n try:\n retval = frame.f_locals[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retval = frame.f_globals[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retval = frame.f_builtins[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retvalue = UFUNC_BUFSIZE_DEFAULT\n\n return retval\n\n\n# Set the UFUNC_BUFSIZE_NAME to something\n# Set the UFUNC_ERRMASK_NAME to something\nseterr(where='builtin')\nsetbufsize(UFUNC_BUFSIZE_DEFAULT,where='builtin')\n\ninf = PINF\nnan = NAN\nfrom oldnumeric import *\n\n\n", "methods": [ { "name": "asarray", "long_name": "asarray( a , dtype = None )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 21, "parameters": [ "a", "dtype" ], "start_line": 31, "end_line": 36, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "asndarray", "long_name": "asndarray( a , dtype = None )", "filename": "numeric.py", "nloc": 16, "complexity": 7, "token_count": 85, "parameters": [ "a", "dtype" ], "start_line": 38, "end_line": 58, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "isfortran", "long_name": "isfortran( a )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 12, "parameters": [ "a" ], "start_line": 60, "end_line": 61, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "zeros_like", "long_name": "zeros_like( a )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 41, "parameters": [ "a" ], "start_line": 64, "end_line": 72, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "empty_like", "long_name": "empty_like( a )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 39, "parameters": [ "a" ], "start_line": 74, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "_mode_from_name", "long_name": "_mode_from_name( mode )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 30, "parameters": [ "mode" ], "start_line": 91, "end_line": 94, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "correlate", "long_name": "correlate( a , v , mode = 'valid' )", "filename": "numeric.py", "nloc": 3, "complexity": 1, "token_count": 28, "parameters": [ "a", "v", "mode" ], "start_line": 96, "end_line": 98, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 0 }, { "name": "convolve", "long_name": "convolve( a , v , mode = 'full' )", "filename": "numeric.py", "nloc": 5, "complexity": 2, "token_count": 55, "parameters": [ "a", "v", "mode" ], "start_line": 101, "end_line": 109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "outer", "long_name": "outer( a , b )", "filename": "numeric.py", "nloc": 4, "complexity": 1, "token_count": 42, "parameters": [ "a", "b" ], "start_line": 115, "end_line": 122, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "vdot", "long_name": "vdot( a , b )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 33, "parameters": [ "a", "b" ], "start_line": 124, "end_line": 128, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "alterdot", "long_name": "alterdot( )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 5, "parameters": [], "start_line": 136, "end_line": 137, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "restoredot", "long_name": "restoredot( )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 5, "parameters": [], "start_line": 138, "end_line": 139, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "_move_axis_to_0", "long_name": "_move_axis_to_0( a , axis )", "filename": "numeric.py", "nloc": 8, "complexity": 3, "token_count": 58, "parameters": [ "a", "axis" ], "start_line": 142, "end_line": 149, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "cross", "long_name": "cross( a , b , axisa = - 1 , axisb = - 1 , axisc = - 1 )", "filename": "numeric.py", "nloc": 32, "complexity": 9, "token_count": 360, "parameters": [ "a", "b", "axisa", "axisb", "axisc" ], "start_line": 151, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( arr , max_line_width = None , precision = None , suppress_small = None )", "filename": "numeric.py", "nloc": 16, "complexity": 6, "token_count": 128, "parameters": [ "arr", "max_line_width", "precision", "suppress_small" ], "start_line": 199, "end_line": 215, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( a , max_line_width = None , precision = None , suppress_small = None )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 32, "parameters": [ "a", "max_line_width", "precision", "suppress_small" ], "start_line": 217, "end_line": 218, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "indices", "long_name": "indices( dimensions , dtype = intp )", "filename": "numeric.py", "nloc": 6, "complexity": 2, "token_count": 54, "parameters": [ "dimensions", "dtype" ], "start_line": 227, "end_line": 235, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "fromfunction", "long_name": "fromfunction( function , dimensions , ** kwargs )", "filename": "numeric.py", "nloc": 3, "complexity": 1, "token_count": 26, "parameters": [ "function", "dimensions", "kwargs" ], "start_line": 237, "end_line": 247, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "load", "long_name": "load( file )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 29, "parameters": [ "file" ], "start_line": 254, "end_line": 257, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "ones", "long_name": "ones( shape , dtype = intp , fortran = 0 )", "filename": "numeric.py", "nloc": 4, "complexity": 1, "token_count": 29, "parameters": [ "shape", "dtype", "fortran" ], "start_line": 263, "end_line": 270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "identity", "long_name": "identity( n , dtype = intp )", "filename": "numeric.py", "nloc": 5, "complexity": 1, "token_count": 49, "parameters": [ "n", "dtype" ], "start_line": 272, "end_line": 278, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "allclose", "long_name": "allclose( a , b , rtol = 1 . e - 5 , atol = 1 . e - 8 )", "filename": "numeric.py", "nloc": 5, "complexity": 1, "token_count": 72, "parameters": [ "a", "b", "rtol", "atol" ], "start_line": 280, "end_line": 291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "seterr", "long_name": "seterr( divide = \"ignore\" , over = \"ignore\" , under = \"ignore\" , invalid = \"ignore\" , where = 0 )", "filename": "numeric.py", "nloc": 19, "complexity": 8, "token_count": 161, "parameters": [ "divide", "over", "under", "invalid", "where" ], "start_line": 304, "end_line": 323, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "geterr", "long_name": "geterr( )", "filename": "numeric.py", "nloc": 17, "complexity": 2, "token_count": 114, "parameters": [], "start_line": 327, "end_line": 344, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "setbufsize", "long_name": "setbufsize( size , where = 0 )", "filename": "numeric.py", "nloc": 15, "complexity": 9, "token_count": 105, "parameters": [ "size", "where" ], "start_line": 346, "end_line": 360, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "getbufsize", "long_name": "getbufsize( size )", "filename": "numeric.py", "nloc": 11, "complexity": 4, "token_count": 54, "parameters": [ "size" ], "start_line": 364, "end_line": 375, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 } ], "methods_before": [ { "name": "asarray", "long_name": "asarray( a , dtype = None )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 21, "parameters": [ "a", "dtype" ], "start_line": 31, "end_line": 36, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "asndarray", "long_name": "asndarray( a , dtype = None )", "filename": "numeric.py", "nloc": 16, "complexity": 7, "token_count": 85, "parameters": [ "a", "dtype" ], "start_line": 38, "end_line": 58, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "isfortran", "long_name": "isfortran( a )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 12, "parameters": [ "a" ], "start_line": 60, "end_line": 61, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "zeros_like", "long_name": "zeros_like( a )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 41, "parameters": [ "a" ], "start_line": 64, "end_line": 72, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "empty_like", "long_name": "empty_like( a )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 39, "parameters": [ "a" ], "start_line": 74, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "_mode_from_name", "long_name": "_mode_from_name( mode )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 30, "parameters": [ "mode" ], "start_line": 91, "end_line": 94, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "correlate", "long_name": "correlate( a , v , mode = 'valid' )", "filename": "numeric.py", "nloc": 3, "complexity": 1, "token_count": 28, "parameters": [ "a", "v", "mode" ], "start_line": 96, "end_line": 98, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 0 }, { "name": "convolve", "long_name": "convolve( a , v , mode = 'full' )", "filename": "numeric.py", "nloc": 5, "complexity": 2, "token_count": 55, "parameters": [ "a", "v", "mode" ], "start_line": 101, "end_line": 109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "outer", "long_name": "outer( a , b )", "filename": "numeric.py", "nloc": 4, "complexity": 1, "token_count": 42, "parameters": [ "a", "b" ], "start_line": 115, "end_line": 122, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "vdot", "long_name": "vdot( a , b )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 33, "parameters": [ "a", "b" ], "start_line": 124, "end_line": 128, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "alterdot", "long_name": "alterdot( )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 5, "parameters": [], "start_line": 136, "end_line": 137, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "restoredot", "long_name": "restoredot( )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 5, "parameters": [], "start_line": 138, "end_line": 139, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "_move_axis_to_0", "long_name": "_move_axis_to_0( a , axis )", "filename": "numeric.py", "nloc": 8, "complexity": 3, "token_count": 58, "parameters": [ "a", "axis" ], "start_line": 142, "end_line": 149, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "cross", "long_name": "cross( a , b , axisa = - 1 , axisb = - 1 , axisc = - 1 )", "filename": "numeric.py", "nloc": 32, "complexity": 9, "token_count": 360, "parameters": [ "a", "b", "axisa", "axisb", "axisc" ], "start_line": 151, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( arr , max_line_width = None , precision = None , suppress_small = None )", "filename": "numeric.py", "nloc": 16, "complexity": 6, "token_count": 128, "parameters": [ "arr", "max_line_width", "precision", "suppress_small" ], "start_line": 199, "end_line": 215, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( a , max_line_width = None , precision = None , suppress_small = None )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 32, "parameters": [ "a", "max_line_width", "precision", "suppress_small" ], "start_line": 217, "end_line": 218, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "indices", "long_name": "indices( dimensions , dtype = intp )", "filename": "numeric.py", "nloc": 6, "complexity": 2, "token_count": 54, "parameters": [ "dimensions", "dtype" ], "start_line": 227, "end_line": 235, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "fromfunction", "long_name": "fromfunction( function , dimensions , ** kwargs )", "filename": "numeric.py", "nloc": 3, "complexity": 1, "token_count": 26, "parameters": [ "function", "dimensions", "kwargs" ], "start_line": 237, "end_line": 247, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "load", "long_name": "load( file )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 29, "parameters": [ "file" ], "start_line": 254, "end_line": 257, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "ones", "long_name": "ones( shape , dtype = intp , fortran = 0 )", "filename": "numeric.py", "nloc": 4, "complexity": 1, "token_count": 29, "parameters": [ "shape", "dtype", "fortran" ], "start_line": 263, "end_line": 270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "identity", "long_name": "identity( n , dtype = intp )", "filename": "numeric.py", "nloc": 5, "complexity": 1, "token_count": 49, "parameters": [ "n", "dtype" ], "start_line": 272, "end_line": 278, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "allclose", "long_name": "allclose( a , b , rtol = 1 . e - 5 , atol = 1 . e - 8 )", "filename": "numeric.py", "nloc": 5, "complexity": 1, "token_count": 72, "parameters": [ "a", "b", "rtol", "atol" ], "start_line": 280, "end_line": 291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "seterr", "long_name": "seterr( divide = \"ignore\" , over = \"ignore\" , under = \"ignore\" , invalid = \"ignore\" , where = 0 )", "filename": "numeric.py", "nloc": 19, "complexity": 8, "token_count": 161, "parameters": [ "divide", "over", "under", "invalid", "where" ], "start_line": 304, "end_line": 323, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "geterr", "long_name": "geterr( )", "filename": "numeric.py", "nloc": 17, "complexity": 2, "token_count": 114, "parameters": [], "start_line": 327, "end_line": 344, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "setbufsize", "long_name": "setbufsize( size , where = 0 )", "filename": "numeric.py", "nloc": 15, "complexity": 9, "token_count": 105, "parameters": [ "size", "where" ], "start_line": 346, "end_line": 360, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "getbufsize", "long_name": "getbufsize( size )", "filename": "numeric.py", "nloc": 11, "complexity": 4, "token_count": 54, "parameters": [ "size" ], "start_line": 364, "end_line": 375, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 } ], "changed_methods": [], "nloc": 254, "complexity": 72, "token_count": 1993, "diff_parsed": { "added": [ "Inf = inf = infty = Infinity = PINF", "nan = NaN = NAN" ], "deleted": [ "inf = PINF", "nan = NAN" ] } }, { "old_path": "scipy/base/type_check.py", "new_path": "scipy/base/type_check.py", "filename": "type_check.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -10,7 +10,7 @@\n __all__ = ['iscomplexobj','isrealobj','imag','iscomplex',\n 'isscalar',\n 'isreal','nan_to_num','real','real_if_close',\n- 'typename','asfarray','mintypecode']\n+ 'typename','asfarray','mintypecode','asscalar']\n \n _typecodes_by_elsize = 'GDFgdfQqLlIiHhBb?'\n \n@@ -128,6 +128,9 @@ def real_if_close(a,tol=100):\n return a\n \n \n+def asscalar(a):\n+ return a.toscalar()\n+\n #-----------------------------------------------------------------------------\n \n _namefromtype = {'S1' : 'character',\n", "added_lines": 4, "deleted_lines": 1, "source_code": "## Automatically adapted for scipy Sep 19, 2005 by convertcode.py\n\nimport types\nimport numeric as _nx\nfrom numeric import ndarray, asarray, array, isinf, isnan, isfinite, signbit, \\\n ufunc, ScalarType, obj2dtype\nfrom ufunclike import isneginf, isposinf\nimport umath\n\n__all__ = ['iscomplexobj','isrealobj','imag','iscomplex',\n 'isscalar',\n 'isreal','nan_to_num','real','real_if_close',\n 'typename','asfarray','mintypecode','asscalar']\n\n_typecodes_by_elsize = 'GDFgdfQqLlIiHhBb?'\n\ndef mintypecode(typechars,typeset='GDFgdf',default='d'):\n \"\"\" Return a minimum data type character from typeset that\n handles all typechars given\n\n The returned type character must be the smallest size such that\n an array of the returned type can handle the data from an array of\n type t for each t in typechars (or if typechars is an array,\n then its dtypechar).\n\n If the typechars does not intersect with the typeset, then default\n is returned.\n\n If t in typechars is not a string then t=asarray(t).dtypechar is\n applied.\n \"\"\"\n typecodes = [(type(t) is type('') and t) or asarray(t).dtypechar\\\n for t in typechars]\n intersection = [t for t in typecodes if t in typeset]\n if not intersection:\n return default\n if 'F' in intersection and 'd' in intersection:\n return 'D'\n l = []\n for t in intersection:\n i = _typecodes_by_elsize.index(t)\n l.append((i,t))\n l.sort()\n return l[0][1]\n\ndef asfarray(a, dtype=_nx.float_):\n \"\"\"asfarray(a,dtype=None) returns a as a float array.\"\"\"\n dtype = _nx.obj2dtype(dtype)\n if not issubclass(dtype, _nx.inexact):\n dtype = _nx.float_\n a = asarray(a,dtype=dtype)\n return a\n \ndef isscalar(num):\n if isinstance(num, _nx.generic):\n return True\n else:\n return type(num) in ScalarType\n\ndef real(val):\n return asarray(val).real\n\ndef imag(val):\n return asarray(val).imag\n\ndef iscomplex(x):\n return imag(x) != _nx.zeros_like(x)\n\ndef isreal(x):\n return imag(x) == _nx.zeros_like(x)\n\ndef iscomplexobj(x):\n return issubclass( asarray(x).dtype, _nx.complexfloating)\n\ndef isrealobj(x):\n return not issubclass( asarray(x).dtype, _nx.complexfloating)\n\n#-----------------------------------------------------------------------------\n\ndef _getmaxmin(t):\n import getlimits\n f = getlimits.finfo(t)\n return f.max, f.min\n \ndef nan_to_num(x):\n # mapping:\n # NaN -> 0\n # Inf -> limits.double_max\n # -Inf -> limits.double_min\n try:\n t = x.dtype\n except AttributeError:\n t = obj2dtype(type(x))\n if issubclass(t, _nx.complexfloating):\n y = nan_to_num(x.real) + 1j * nan_to_num(x.imag)\n elif issubclass(t, _nx.integer):\n y = array(x)\n else: \n y = array(x)\n if not y.shape:\n y = array([x])\n scalar = True\n else:\n scalar = False\n are_inf = isposinf(y)\n are_neg_inf = isneginf(y)\n are_nan = isnan(y)\n maxf, minf = _getmaxmin(y.dtype)\n y[are_nan] = 0\n y[are_inf] = maxf\n y[are_neg_inf] = minf\n if scalar:\n y = y[0]\n return y\n\n#-----------------------------------------------------------------------------\n\ndef real_if_close(a,tol=100):\n a = asarray(a)\n if a.dtypechar not in 'FDG':\n return a\n if tol > 1:\n import getlimits\n f = getlimits.finfo(a.dtype)\n tol = f.eps * tol\n if _nx.allclose(a.imag, 0, atol=tol):\n a = a.real\n return a\n\n\ndef asscalar(a):\n return a.toscalar()\n\n#-----------------------------------------------------------------------------\n\n_namefromtype = {'S1' : 'character',\n '?' : 'bool',\n 'b' : 'signed char',\n 'B' : 'unsigned char',\n 'h' : 'short',\n 'H' : 'unsigned short',\n 'i' : 'integer',\n 'I' : 'unsigned integer',\n 'l' : 'long integer',\n 'L' : 'unsigned long integer',\n 'q' : 'long long integer',\n 'Q' : 'unsigned long long integer',\n 'f' : 'single precision',\n 'd' : 'double precision',\n 'g' : 'long precision',\n 'F' : 'complex single precision',\n 'D' : 'complex double precision',\n 'G' : 'complex long double precision',\n 'S' : 'string',\n 'U' : 'unicode',\n 'V' : 'void',\n 'O' : 'object'\n }\n\ndef typename(char):\n \"\"\"Return an english description for the given data type character.\n \"\"\"\n return _namefromtype[char]\n\n#-----------------------------------------------------------------------------\n\n#determine the \"minimum common type code\" for a group of arrays.\narray_kind = {'i':0, 'l': 0, 'f': 0, 'd': 0, 'g':0, 'F': 1, 'D': 1, 'G':1}\narray_precision = {'i': 1, 'l': 1,\n 'f': 0, 'd': 1, 'g':2,\n 'F': 0, 'D': 1, 'G':2}\narray_type = [['f', 'd', 'g'], ['F', 'D', 'G']]\ndef common_type(*arrays):\n kind = 0\n precision = 0\n for a in arrays:\n t = a.dtypechar\n kind = max(kind, array_kind[t])\n precision = max(precision, array_precision[t])\n return array_type[kind][precision]\n\nif __name__ == '__main__':\n print \"Nothing...\"\n", "source_code_before": "## Automatically adapted for scipy Sep 19, 2005 by convertcode.py\n\nimport types\nimport numeric as _nx\nfrom numeric import ndarray, asarray, array, isinf, isnan, isfinite, signbit, \\\n ufunc, ScalarType, obj2dtype\nfrom ufunclike import isneginf, isposinf\nimport umath\n\n__all__ = ['iscomplexobj','isrealobj','imag','iscomplex',\n 'isscalar',\n 'isreal','nan_to_num','real','real_if_close',\n 'typename','asfarray','mintypecode']\n\n_typecodes_by_elsize = 'GDFgdfQqLlIiHhBb?'\n\ndef mintypecode(typechars,typeset='GDFgdf',default='d'):\n \"\"\" Return a minimum data type character from typeset that\n handles all typechars given\n\n The returned type character must be the smallest size such that\n an array of the returned type can handle the data from an array of\n type t for each t in typechars (or if typechars is an array,\n then its dtypechar).\n\n If the typechars does not intersect with the typeset, then default\n is returned.\n\n If t in typechars is not a string then t=asarray(t).dtypechar is\n applied.\n \"\"\"\n typecodes = [(type(t) is type('') and t) or asarray(t).dtypechar\\\n for t in typechars]\n intersection = [t for t in typecodes if t in typeset]\n if not intersection:\n return default\n if 'F' in intersection and 'd' in intersection:\n return 'D'\n l = []\n for t in intersection:\n i = _typecodes_by_elsize.index(t)\n l.append((i,t))\n l.sort()\n return l[0][1]\n\ndef asfarray(a, dtype=_nx.float_):\n \"\"\"asfarray(a,dtype=None) returns a as a float array.\"\"\"\n dtype = _nx.obj2dtype(dtype)\n if not issubclass(dtype, _nx.inexact):\n dtype = _nx.float_\n a = asarray(a,dtype=dtype)\n return a\n \ndef isscalar(num):\n if isinstance(num, _nx.generic):\n return True\n else:\n return type(num) in ScalarType\n\ndef real(val):\n return asarray(val).real\n\ndef imag(val):\n return asarray(val).imag\n\ndef iscomplex(x):\n return imag(x) != _nx.zeros_like(x)\n\ndef isreal(x):\n return imag(x) == _nx.zeros_like(x)\n\ndef iscomplexobj(x):\n return issubclass( asarray(x).dtype, _nx.complexfloating)\n\ndef isrealobj(x):\n return not issubclass( asarray(x).dtype, _nx.complexfloating)\n\n#-----------------------------------------------------------------------------\n\ndef _getmaxmin(t):\n import getlimits\n f = getlimits.finfo(t)\n return f.max, f.min\n \ndef nan_to_num(x):\n # mapping:\n # NaN -> 0\n # Inf -> limits.double_max\n # -Inf -> limits.double_min\n try:\n t = x.dtype\n except AttributeError:\n t = obj2dtype(type(x))\n if issubclass(t, _nx.complexfloating):\n y = nan_to_num(x.real) + 1j * nan_to_num(x.imag)\n elif issubclass(t, _nx.integer):\n y = array(x)\n else: \n y = array(x)\n if not y.shape:\n y = array([x])\n scalar = True\n else:\n scalar = False\n are_inf = isposinf(y)\n are_neg_inf = isneginf(y)\n are_nan = isnan(y)\n maxf, minf = _getmaxmin(y.dtype)\n y[are_nan] = 0\n y[are_inf] = maxf\n y[are_neg_inf] = minf\n if scalar:\n y = y[0]\n return y\n\n#-----------------------------------------------------------------------------\n\ndef real_if_close(a,tol=100):\n a = asarray(a)\n if a.dtypechar not in 'FDG':\n return a\n if tol > 1:\n import getlimits\n f = getlimits.finfo(a.dtype)\n tol = f.eps * tol\n if _nx.allclose(a.imag, 0, atol=tol):\n a = a.real\n return a\n\n\n#-----------------------------------------------------------------------------\n\n_namefromtype = {'S1' : 'character',\n '?' : 'bool',\n 'b' : 'signed char',\n 'B' : 'unsigned char',\n 'h' : 'short',\n 'H' : 'unsigned short',\n 'i' : 'integer',\n 'I' : 'unsigned integer',\n 'l' : 'long integer',\n 'L' : 'unsigned long integer',\n 'q' : 'long long integer',\n 'Q' : 'unsigned long long integer',\n 'f' : 'single precision',\n 'd' : 'double precision',\n 'g' : 'long precision',\n 'F' : 'complex single precision',\n 'D' : 'complex double precision',\n 'G' : 'complex long double precision',\n 'S' : 'string',\n 'U' : 'unicode',\n 'V' : 'void',\n 'O' : 'object'\n }\n\ndef typename(char):\n \"\"\"Return an english description for the given data type character.\n \"\"\"\n return _namefromtype[char]\n\n#-----------------------------------------------------------------------------\n\n#determine the \"minimum common type code\" for a group of arrays.\narray_kind = {'i':0, 'l': 0, 'f': 0, 'd': 0, 'g':0, 'F': 1, 'D': 1, 'G':1}\narray_precision = {'i': 1, 'l': 1,\n 'f': 0, 'd': 1, 'g':2,\n 'F': 0, 'D': 1, 'G':2}\narray_type = [['f', 'd', 'g'], ['F', 'D', 'G']]\ndef common_type(*arrays):\n kind = 0\n precision = 0\n for a in arrays:\n t = a.dtypechar\n kind = max(kind, array_kind[t])\n precision = max(precision, array_precision[t])\n return array_type[kind][precision]\n\nif __name__ == '__main__':\n print \"Nothing...\"\n", "methods": [ { "name": "mintypecode", "long_name": "mintypecode( typechars , typeset = 'GDFgdf' , default = 'd' )", "filename": "type_check.py", "nloc": 14, "complexity": 10, "token_count": 113, "parameters": [ "typechars", "typeset", "default" ], "start_line": 17, "end_line": 44, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "asfarray", "long_name": "asfarray( a , dtype = _nx . float_ )", "filename": "type_check.py", "nloc": 6, "complexity": 2, "token_count": 48, "parameters": [ "a", "dtype" ], "start_line": 46, "end_line": 52, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "isscalar", "long_name": "isscalar( num )", "filename": "type_check.py", "nloc": 5, "complexity": 2, "token_count": 26, "parameters": [ "num" ], "start_line": 54, "end_line": 58, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "real", "long_name": "real( val )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 12, "parameters": [ "val" ], "start_line": 60, "end_line": 61, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "imag", "long_name": "imag( val )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 12, "parameters": [ "val" ], "start_line": 63, "end_line": 64, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "iscomplex", "long_name": "iscomplex( x )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 17, "parameters": [ "x" ], "start_line": 66, "end_line": 67, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "isreal", "long_name": "isreal( x )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 17, "parameters": [ "x" ], "start_line": 69, "end_line": 70, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "iscomplexobj", "long_name": "iscomplexobj( x )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 19, "parameters": [ "x" ], "start_line": 72, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "isrealobj", "long_name": "isrealobj( x )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 20, "parameters": [ "x" ], "start_line": 75, "end_line": 76, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "_getmaxmin", "long_name": "_getmaxmin( t )", "filename": "type_check.py", "nloc": 4, "complexity": 1, "token_count": 23, "parameters": [ "t" ], "start_line": 80, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "nan_to_num", "long_name": "nan_to_num( x )", "filename": "type_check.py", "nloc": 26, "complexity": 6, "token_count": 154, "parameters": [ "x" ], "start_line": 85, "end_line": 114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "real_if_close", "long_name": "real_if_close( a , tol = 100 )", "filename": "type_check.py", "nloc": 11, "complexity": 4, "token_count": 72, "parameters": [ "a", "tol" ], "start_line": 118, "end_line": 128, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "asscalar", "long_name": "asscalar( a )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "a" ], "start_line": 131, "end_line": 132, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "typename", "long_name": "typename( char )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "char" ], "start_line": 160, "end_line": 163, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "common_type", "long_name": "common_type( * arrays )", "filename": "type_check.py", "nloc": 8, "complexity": 2, "token_count": 52, "parameters": [ "arrays" ], "start_line": 173, "end_line": 180, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 } ], "methods_before": [ { "name": "mintypecode", "long_name": "mintypecode( typechars , typeset = 'GDFgdf' , default = 'd' )", "filename": "type_check.py", "nloc": 14, "complexity": 10, "token_count": 113, "parameters": [ "typechars", "typeset", "default" ], "start_line": 17, "end_line": 44, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "asfarray", "long_name": "asfarray( a , dtype = _nx . float_ )", "filename": "type_check.py", "nloc": 6, "complexity": 2, "token_count": 48, "parameters": [ "a", "dtype" ], "start_line": 46, "end_line": 52, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "isscalar", "long_name": "isscalar( num )", "filename": "type_check.py", "nloc": 5, "complexity": 2, "token_count": 26, "parameters": [ "num" ], "start_line": 54, "end_line": 58, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "real", "long_name": "real( val )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 12, "parameters": [ "val" ], "start_line": 60, "end_line": 61, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "imag", "long_name": "imag( val )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 12, "parameters": [ "val" ], "start_line": 63, "end_line": 64, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "iscomplex", "long_name": "iscomplex( x )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 17, "parameters": [ "x" ], "start_line": 66, "end_line": 67, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "isreal", "long_name": "isreal( x )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 17, "parameters": [ "x" ], "start_line": 69, "end_line": 70, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "iscomplexobj", "long_name": "iscomplexobj( x )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 19, "parameters": [ "x" ], "start_line": 72, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "isrealobj", "long_name": "isrealobj( x )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 20, "parameters": [ "x" ], "start_line": 75, "end_line": 76, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "_getmaxmin", "long_name": "_getmaxmin( t )", "filename": "type_check.py", "nloc": 4, "complexity": 1, "token_count": 23, "parameters": [ "t" ], "start_line": 80, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "nan_to_num", "long_name": "nan_to_num( x )", "filename": "type_check.py", "nloc": 26, "complexity": 6, "token_count": 154, "parameters": [ "x" ], "start_line": 85, "end_line": 114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "real_if_close", "long_name": "real_if_close( a , tol = 100 )", "filename": "type_check.py", "nloc": 11, "complexity": 4, "token_count": 72, "parameters": [ "a", "tol" ], "start_line": 118, "end_line": 128, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "typename", "long_name": "typename( char )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "char" ], "start_line": 157, "end_line": 160, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "common_type", "long_name": "common_type( * arrays )", "filename": "type_check.py", "nloc": 8, "complexity": 2, "token_count": 52, "parameters": [ "arrays" ], "start_line": 170, "end_line": 177, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "asscalar", "long_name": "asscalar( a )", "filename": "type_check.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "a" ], "start_line": 131, "end_line": 132, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 } ], "nloc": 131, "complexity": 35, "token_count": 878, "diff_parsed": { "added": [ " 'typename','asfarray','mintypecode','asscalar']", "def asscalar(a):", " return a.toscalar()", "" ], "deleted": [ " 'typename','asfarray','mintypecode']" ] } } ] }, { "hash": "06e8eab1b5e379bbaf8b5a6e6c1513053edb3343", "msg": "Fixed import problem.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T09:02:50+00:00", "author_timezone": 0, "committer_date": "2005-10-07T09:02:50+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "54a193f1a0cdd6ccf40e36d09daa9fb0dd658456" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 1, "insertions": 1, "lines": 2, "files": 1, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": "scipy/fftpack/helper.py", "new_path": "scipy/fftpack/helper.py", "filename": "helper.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -3,7 +3,7 @@\n \"\"\"\n # Created by Pearu Peterson, September 2002\n \n-__all__ = ['fftshift','ifftshift','fftfreq','rfftfreq']\n+__all__ = ['fftshift','ifftshift','fftfreq']\n \n from scipy.base import asarray, concatenate, arange, take, \\\n \t\tarray, integer\n", "added_lines": 1, "deleted_lines": 1, "source_code": "\"\"\"\nDiscrete Fourier Transforms - helper.py\n\"\"\"\n# Created by Pearu Peterson, September 2002\n\n__all__ = ['fftshift','ifftshift','fftfreq']\n\nfrom scipy.base import asarray, concatenate, arange, take, \\\n\t\tarray, integer\nimport types\n\ndef fftshift(x,axes=None):\n \"\"\" fftshift(x, axes=None) -> y\n\n Shift zero-frequency component to center of spectrum.\n\n This function swaps half-spaces for all axes listed (defaults to all).\n\n Notes:\n If len(x) is even then the Nyquist component is y[0].\n \"\"\"\n tmp = asarray(x)\n ndim = len(tmp.shape)\n if axes is None:\n axes = range(ndim)\n y = tmp\n for k in axes:\n n = tmp.shape[k]\n p2 = (n+1)/2\n mylist = concatenate((arange(p2,n),arange(p2)))\n y = take(y,mylist,k)\n return y\n\n\ndef ifftshift(x,axes=None):\n \"\"\" ifftshift(x,axes=None) - > y\n\n Inverse of fftshift.\n \"\"\"\n tmp = asarray(x)\n ndim = len(tmp.shape)\n if axes is None:\n axes = range(ndim)\n y = tmp\n for k in axes:\n n = tmp.shape[k]\n p2 = n-(n+1)/2\n mylist = concatenate((arange(p2,n),arange(p2)))\n y = take(y,mylist,k)\n return y\n\ndef fftfreq(n,d=1.0):\n \"\"\" fftfreq(n, d=1.0) -> f\n\n DFT sample frequencies\n\n The returned float array contains the frequency bins in\n cycles/unit (with zero at the start) given a window length n and a\n sample spacing d:\n\n f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even\n f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd\n \"\"\"\n assert isinstance(n,types.IntType) or isinstance(n, integer)\n k = range(0,(n-1)/2+1)+range(-(n/2),0)\n return array(k,'d')/(n*d)\n\n", "source_code_before": "\"\"\"\nDiscrete Fourier Transforms - helper.py\n\"\"\"\n# Created by Pearu Peterson, September 2002\n\n__all__ = ['fftshift','ifftshift','fftfreq','rfftfreq']\n\nfrom scipy.base import asarray, concatenate, arange, take, \\\n\t\tarray, integer\nimport types\n\ndef fftshift(x,axes=None):\n \"\"\" fftshift(x, axes=None) -> y\n\n Shift zero-frequency component to center of spectrum.\n\n This function swaps half-spaces for all axes listed (defaults to all).\n\n Notes:\n If len(x) is even then the Nyquist component is y[0].\n \"\"\"\n tmp = asarray(x)\n ndim = len(tmp.shape)\n if axes is None:\n axes = range(ndim)\n y = tmp\n for k in axes:\n n = tmp.shape[k]\n p2 = (n+1)/2\n mylist = concatenate((arange(p2,n),arange(p2)))\n y = take(y,mylist,k)\n return y\n\n\ndef ifftshift(x,axes=None):\n \"\"\" ifftshift(x,axes=None) - > y\n\n Inverse of fftshift.\n \"\"\"\n tmp = asarray(x)\n ndim = len(tmp.shape)\n if axes is None:\n axes = range(ndim)\n y = tmp\n for k in axes:\n n = tmp.shape[k]\n p2 = n-(n+1)/2\n mylist = concatenate((arange(p2,n),arange(p2)))\n y = take(y,mylist,k)\n return y\n\ndef fftfreq(n,d=1.0):\n \"\"\" fftfreq(n, d=1.0) -> f\n\n DFT sample frequencies\n\n The returned float array contains the frequency bins in\n cycles/unit (with zero at the start) given a window length n and a\n sample spacing d:\n\n f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even\n f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd\n \"\"\"\n assert isinstance(n,types.IntType) or isinstance(n, integer)\n k = range(0,(n-1)/2+1)+range(-(n/2),0)\n return array(k,'d')/(n*d)\n\n", "methods": [ { "name": "fftshift", "long_name": "fftshift( x , axes = None )", "filename": "helper.py", "nloc": 12, "complexity": 3, "token_count": 90, "parameters": [ "x", "axes" ], "start_line": 12, "end_line": 32, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "ifftshift", "long_name": "ifftshift( x , axes = None )", "filename": "helper.py", "nloc": 12, "complexity": 3, "token_count": 92, "parameters": [ "x", "axes" ], "start_line": 35, "end_line": 50, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "fftfreq", "long_name": "fftfreq( n , d = 1 . 0 )", "filename": "helper.py", "nloc": 4, "complexity": 2, "token_count": 69, "parameters": [ "n", "d" ], "start_line": 52, "end_line": 66, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 } ], "methods_before": [ { "name": "fftshift", "long_name": "fftshift( x , axes = None )", "filename": "helper.py", "nloc": 12, "complexity": 3, "token_count": 90, "parameters": [ "x", "axes" ], "start_line": 12, "end_line": 32, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "ifftshift", "long_name": "ifftshift( x , axes = None )", "filename": "helper.py", "nloc": 12, "complexity": 3, "token_count": 92, "parameters": [ "x", "axes" ], "start_line": 35, "end_line": 50, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "fftfreq", "long_name": "fftfreq( n , d = 1 . 0 )", "filename": "helper.py", "nloc": 4, "complexity": 2, "token_count": 69, "parameters": [ "n", "d" ], "start_line": 52, "end_line": 66, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 } ], "changed_methods": [], "nloc": 35, "complexity": 8, "token_count": 283, "diff_parsed": { "added": [ "__all__ = ['fftshift','ifftshift','fftfreq']" ], "deleted": [ "__all__ = ['fftshift','ifftshift','fftfreq','rfftfreq']" ] } } ] }, { "hash": "d2b5deb37fbb1aa3619837c96b3865a5d79a7be0", "msg": "r188@Blasphemy: kern | 2005-10-07 02:37:24 -0700\n Move scipy.stats to scipy.random. Add logarithmic-series distribution.", "author": { "name": "Robert Kern", "email": "robert.kern@gmail.com" }, "committer": { "name": "Robert Kern", "email": "robert.kern@gmail.com" }, "author_date": "2005-10-07T09:40:12+00:00", "author_timezone": 0, "committer_date": "2005-10-07T09:40:12+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "06e8eab1b5e379bbaf8b5a6e6c1513053edb3343" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 1216, "insertions": 1390, "lines": 2606, "files": 5, "dmm_unit_size": 0.12727272727272726, "dmm_unit_complexity": 0.12727272727272726, "dmm_unit_interfacing": 0.19090909090909092, "modified_files": [ { "old_path": "scipy/corelib/mtrand/distributions.c", "new_path": "scipy/corelib/mtrand/distributions.c", "filename": "distributions.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -772,4 +772,19 @@ double rk_triangular(rk_state *state, double left, double mode, double right)\n {\n return right - sqrt((1.0 - U) * rightprod); \n }\n+}\n+\n+long rk_logseries(rk_state *state, double p)\n+{\n+ double q, r, U, V;\n+ \n+ r = log(1.0 - p);\n+ \n+ V = rk_double(state);\n+ if (V >= p) return 1;\n+ U = rk_double(state);\n+ q = 1.0 - exp(r*U);\n+ if (V <= q*q) return (long)floor(1 + log(V)/log(q));\n+ if (V <= q) return 1;\n+ return 2;\n }\n\\ No newline at end of file\n", "added_lines": 15, "deleted_lines": 0, "source_code": "/* Copyright 2005 Robert Kern (robert.kern@gmail.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n * \n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/* The implementations of rk_hypergeometric_hyp(), rk_hypergeometric_hrua(),\n * and rk_triangular() were adapted from Ivan Frohne's rv.py which has this \n * license:\n * \n * Copyright 1998 by Ivan Frohne; Wasilla, Alaska, U.S.A.\n * All Rights Reserved\n *\n * Permission to use, copy, modify and distribute this software and its\n * documentation for any purpose, free of charge, is granted subject to the\n * following conditions:\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the software.\n *\n * THE SOFTWARE AND DOCUMENTATION IS PROVIDED WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR\n * OR COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM OR DAMAGES IN A CONTRACT\n * ACTION, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR ITS DOCUMENTATION.\n */\n\n#include \n#include \"distributions.h\"\n#include \"mconf.h\"\n#include \n\n#ifndef min\n#define min(x,y) ((xy)?x:y)\n#endif\n\ndouble rk_normal(rk_state *state, double loc, double scale)\n{\n return loc + scale*rk_gauss(state);\n}\n\ndouble rk_standard_exponential(rk_state *state)\n{\n /* We use -log(1-U) since U is [0, 1) */\n return -log(1.0 - rk_double(state));\n}\n\ndouble rk_exponential(rk_state *state, double scale)\n{\n return scale * rk_standard_exponential(state);\n}\n\ndouble rk_uniform(rk_state *state, double loc, double scale)\n{\n return loc + scale*rk_double(state);\n}\n\n#define LOG4 1.3862943611198906\n#define ONELOG92 2.5040773967762742\n\ndouble rk_standard_gamma(rk_state *state, double shape)\n{\n double b, c, lam;\n double U, V, X, Y, Z, R;\n\n if (shape == 1.0)\n {\n return rk_standard_exponential(state);\n }\n else if (shape < 1.0)\n {\n while (1)\n {\n U = rk_double(state);\n V = rk_standard_exponential(state);\n if (U <= 1.0 - shape)\n {\n X = pow(U, 1./shape);\n if (X <= V)\n {\n return X;\n }\n }\n else\n {\n Y = -log((1-U)/shape);\n X = pow(1.0 - shape + shape*Y, 1./shape);\n if (X <= (V + Y))\n {\n return X;\n }\n }\n }\n }\n else\n {\n b = shape - LOG4;\n lam = sqrt(2.0*shape - 1.0);\n c = shape + lam;\n \n while (1)\n {\n U = rk_double(state);\n V = rk_double(state);\n Y = log(V/(1.0-V))/lam;\n X = shape*exp(Y); \n Z = U*V*V;\n R = b + c*Y - X;\n if ((R >= 4.5*Z - ONELOG92) || (R >= log(Z)))\n {\n break;\n }\n }\n return X;\n }\n}\n\n#undef LOG4\n#undef ONELOG92\n\ndouble rk_gamma(rk_state *state, double shape, double scale)\n{\n return scale * rk_standard_gamma(state, shape);\n}\n\ndouble rk_beta(rk_state *state, double a, double b)\n{\n double Ga, Gb;\n\n if ((a <= 1.0) && (b <= 1.0))\n {\n double U, V, X, Y;\n /* Use Jonk's algorithm */\n\n while (1)\n {\n U = rk_double(state);\n V = rk_double(state);\n X = pow(U, 1.0/a);\n Y = pow(V, 1.0/b);\n\n if ((X + Y) <= 1.0)\n {\n return X;\n }\n }\n }\n else\n {\n Ga = rk_standard_gamma(state, a);\n Gb = rk_standard_gamma(state, b);\n return Ga/(Ga + Gb);\n }\n}\n\ndouble rk_chisquare(rk_state *state, double df)\n{\n return 2.0*rk_standard_gamma(state, df/2.0);\n}\n\ndouble rk_noncentral_chisquare(rk_state *state, double df, double nonc)\n{\n double Chi2, N;\n\n Chi2 = rk_chisquare(state, df-1);\n N = rk_gauss(state) + sqrt(nonc);\n return Chi2 + N*N;\n}\n\ndouble rk_f(rk_state *state, double dfnum, double dfden)\n{\n return rk_chisquare(state, dfnum) / rk_chisquare(state, dfden);\n}\n\ndouble rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc)\n{\n return ((rk_noncentral_chisquare(state, dfnum, nonc)*dfden) /\n (rk_chisquare(state, dfden)*dfnum));\n}\n\nlong rk_binomial_btpe(rk_state *state, long n, double p)\n{\n double r,q,fm,p1,xm,xl,xr,c,laml,lamr,p2,p3,p4;\n double a,u,v,s,F,rho,t,A,nrq,x1,x2,f1,f2,z,z2,w,w2,x;\n long m,y,k,i;\n\n if (!(state->has_binomial) || \n (state->nsave != n) ||\n (state->psave != p))\n {\n /* initialize */\n state->nsave = n;\n state->psave = p;\n state->has_binomial = 1;\n state->r = r = min(p, 1.0-p);\n state->q = q = 1.0 - r;\n state->fm = fm = n*r+r;\n state->m = m = (long)floor(state->fm);\n state->p1 = p1 = floor(2.195*sqrt(n*r*q)-4.6*q) + 0.5;\n state->xm = xm = m + 0.5;\n state->xl = xl = xm - p1;\n state->xr = xr = xm + p1;\n state->c = c = 0.134 + 20.5/(15.3 + m);\n a = (fm - xl)/(fm-xl*r);\n state->laml = laml = a*(1.0 + a/2.0);\n a = (xr - fm)/(xr*q);\n state->lamr = lamr = a*(1.0 + a/2.0);\n state->p2 = p2 = p1*(1.0 + 2.0*c);\n state->p3 = p3 = p2 + c/laml;\n state->p4 = p4 = p3 + c/lamr;\n }\n else\n {\n r = state->r;\n q = state->q;\n fm = state->fm;\n m = state->m;\n p1 = state->p1;\n xm = state->xm;\n xl = state->xl;\n xr = state->xr;\n c = state->c;\n laml = state->laml;\n lamr = state->lamr;\n p2 = state->p2;\n p3 = state->p3;\n p4 = state->p4;\n }\n\n /* sigh ... */\n Step10:\n nrq = n*r*q;\n u = rk_double(state)*p4;\n v = rk_double(state);\n if (u > p1) goto Step20;\n y = (long)floor(xm - p1*v + u);\n goto Step60;\n\n Step20:\n if (u > p2) goto Step30;\n x = xl + (u - p1)/c;\n v = v*c + 1.0 - fabs(m - x + 0.5)/p1;\n if (v > 1.0) goto Step10;\n y = (long)floor(x);\n goto Step50;\n\n Step30:\n if (u > p3) goto Step40;\n y = (long)floor(xl + log(v)/laml);\n if (y < 0) goto Step10;\n v = v*(u-p2)*laml;\n goto Step50;\n\n Step40:\n y = (int)floor(xr - log(v)/lamr);\n if (y > n) goto Step10;\n v = v*(u-p3)*lamr;\n\n Step50:\n k = fabs(y - m);\n if ((k > 20) && (k < ((nrq)/2.0 - 1))) goto Step52;\n\n s = r/q;\n a = s*(n+1);\n F = 1.0;\n if (m < y)\n {\n for (i=m; i<=y; i++)\n {\n F *= (a/i - s);\n }\n }\n else if (m > y)\n {\n for (i=y; i<=m; i++)\n {\n F /= (a/i - s);\n }\n }\n else\n {\n if (v > F) goto Step10;\n goto Step60;\n }\n\n Step52:\n rho = (k/(nrq))*((k*(k/3.0 + 0.625) + 0.16666666666666666)/nrq + 0.5);\n t = -k*k/(2*nrq);\n A = log(v);\n if (A < (t - rho)) goto Step60;\n if (A > (t + rho)) goto Step10;\n\n x1 = y+1;\n f1 = m+1;\n z = n+1-m;\n w = n-y+1;\n x2 = x1*x1;\n f2 = f1*f1;\n z2 = z*z;\n w2 = w*w;\n if (A > (xm*log(f1/x1)\n + (n-m+0.5)*log(z/w)\n + (y-m)*log(w*r/(x1*q))\n + (13680.-(462.-(132.-(99.-140./f2)/f2)/f2)/f2)/f1/166320.\n + (13680.-(462.-(132.-(99.-140./z2)/z2)/z2)/z2)/z/166320.\n + (13680.-(462.-(132.-(99.-140./x2)/x2)/x2)/x2)/x1/166320.\n + (13680.-(462.-(132.-(99.-140./w2)/w2)/w2)/w2)/w/166320.))\n {\n goto Step10;\n }\n\n Step60:\n if (p > 0.5)\n {\n y = n - y;\n }\n\n return y;\n}\n\nlong rk_binomial_waiting(rk_state *state, long n, double p)\n{\n double q, E, Sum;\n long X;\n\n q = -log(1.0 - p);\n\n X = 0;\n Sum = 0.0;\n\n while (Sum <= q)\n {\n if (X == n)\n {\n X += 1;\n break;\n }\n E = rk_standard_exponential(state);\n Sum += E / (n - X);\n X++;\n }\n return X-1;\n}\n\nlong rk_binomial(rk_state *state, long n, double p)\n{\n double q;\n\n if (p <= 0.5)\n {\n if (p*n <= 30.0)\n {\n return rk_binomial_waiting(state, n, p);\n }\n else\n {\n return rk_binomial_btpe(state, n, p);\n }\n }\n else\n {\n q = 1.0-p;\n if (q*n <= 30.0)\n {\n return n - rk_binomial_waiting(state, n, q);\n }\n else\n {\n return n - rk_binomial_btpe(state, n, q);\n }\n }\n\n}\n\nlong rk_negative_binomial(rk_state *state, long n, double p)\n{\n double Y;\n\n Y = rk_gamma(state, n, (1-p)/p);\n return rk_poisson(state, Y);\n}\n\nlong rk_poisson_mult(rk_state *state, double lam)\n{\n long X;\n double prod, U, enlam;\n\n enlam = exp(-lam);\n X = 0;\n prod = 1.0;\n while (1)\n {\n U = rk_double(state);\n prod *= U;\n if (prod > enlam)\n {\n X += 1;\n }\n else\n {\n return X;\n }\n }\n}\n\n#define LS2PI 0.91893853320467267\n#define TWELFTH 0.083333333333333333333333\nlong rk_poisson_ptrs(rk_state *state, double lam)\n{\n long k;\n double U, V, slam, loglam, a, b, invalpha, vr, us;\n\n slam = sqrt(lam);\n loglam = log(lam);\n b = 0.931 + 2.53*slam;\n a = -0.059 + 0.02483*b;\n invalpha = 1.1239 + 1.1328/(b-3.4);\n vr = 0.9277 - 3.6224/(b-2);\n\n while (1)\n {\n U = rk_double(state) - 0.5;\n V = rk_double(state);\n us = 0.5 - fabs(U);\n k = (long)floor((2*a/us + b)*U + lam + 0.43);\n if ((us >= 0.07) && (V <= vr))\n {\n return k;\n }\n if ((k < 0) ||\n ((us < 0.013) && (V > us)))\n {\n continue;\n }\n if ((log(V) + log(invalpha) - log(a/(us*us)+b)) <=\n (-lam + k*loglam - lgam(k+1)))\n {\n return k;\n }\n\n \n }\n\n}\n\nlong rk_poisson(rk_state *state, double lam)\n{\n if (lam >= 10)\n {\n return rk_poisson_ptrs(state, lam);\n }\n else\n {\n return rk_poisson_mult(state, lam);\n }\n}\n\ndouble rk_standard_cauchy(rk_state *state)\n{\n return rk_gauss(state) / rk_gauss(state);\n}\n\ndouble rk_standard_t(rk_state *state, double df)\n{\n double N, G, X;\n\n N = rk_gauss(state);\n G = rk_standard_gamma(state, df/2);\n X = sqrt(df/2)*N/sqrt(G);\n return X;\n}\n\ndouble rk_vonmises(rk_state *state, double mu, double kappa)\n{\n double r, rho, s;\n double U, V, W, Y, Z;\n double result, mod;\n\n if (kappa < 1e-8)\n {\n return M_PI * (2*rk_double(state)-1);\n }\n else\n {\n r = 1 + sqrt(1 + 4*kappa*kappa);\n rho = (r - sqrt(2*r))/(2*kappa);\n s = (1 + rho*rho)/(2*rho);\n\n while (1)\n {\n U = 2*rk_double(state) - 1;\n V = 2*rk_double(state) - 1;\n Z = cos(M_PI*U);\n W = (1 + s*Z)/(s + Z);\n Y = kappa * (s - W);\n if ((Y*(2-Y) - V >= 0) || (log(Y/V)+1 - Y >= 0))\n {\n break;\n }\n }\n\n if (U < 0)\n {\n result = acos(W);\n }\n else\n {\n result = -acos(W);\n }\n result += mu + M_PI;\n mod = fmod(result, 2*M_PI);\n if (mod && (mod < 0))\n {\n mod += 2*M_PI;\n }\n return mod - M_PI;\n }\n}\n\ndouble rk_pareto(rk_state *state, double a)\n{\n return exp(rk_standard_exponential(state)/a) - 1;\n}\n\ndouble rk_weibull(rk_state *state, double a)\n{\n return pow(rk_standard_exponential(state), 1./a);\n}\n\ndouble rk_power(rk_state *state, double a)\n{\n return pow(1 - exp(-rk_standard_exponential(state)), 1./a);\n}\n\ndouble rk_laplace(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = rk_double(state);\n if (U < 0.5)\n {\n U = loc + scale * log(U + U);\n } else \n {\n U = loc - scale * log(2.0 - U - U);\n }\n return U;\n}\n\ndouble rk_gumbel(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = 1.0 - rk_double(state);\n return loc - scale * log(-log(U));\n}\n\ndouble rk_logistic(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = rk_double(state);\n return loc + scale * log(U/(1.0 - U));\n}\n\ndouble rk_lognormal(rk_state *state, double mean, double sigma)\n{\n return exp(rk_normal(state, mean, sigma));\n}\n\ndouble rk_rayleigh(rk_state *state, double mode)\n{\n return mode*sqrt(-2.0 * log(1.0 - rk_double(state)));\n}\n\ndouble rk_wald(rk_state *state, double mean, double scale)\n{\n double U, X, Y;\n double mu_2l;\n \n mu_2l = mean / (2*scale);\n Y = rk_gauss(state);\n Y = mean*Y*Y;\n X = mean + mu_2l*(Y - sqrt(4*scale*Y + Y*Y));\n U = rk_double(state);\n if (U <= mean/(mean+X))\n {\n return X;\n } else\n {\n return mean*mean/X;\n }\n}\n\nlong rk_zipf(rk_state *state, double a)\n{\n double T, U, V;\n long X;\n double b;\n \n b = pow(2.0, a-1.0);\n do\n {\n U = rk_double(state);\n V = rk_double(state);\n X = (long)floor(pow(U, -1.0/(a-1.0)));\n T = pow(1.0 + 1.0/X, a-1.0); \n } while ((V *X*(T-1.0)/(b-1.0)) > (T/b));\n return X;\n}\n\nlong rk_geometric_search(rk_state *state, double p)\n{\n double U;\n long X;\n double sum, prod, q;\n \n X = 1;\n sum = prod = p;\n q = 1.0 - p;\n U = rk_double(state);\n while (U > sum)\n {\n prod *= q;\n sum += prod;\n X++;\n }\n return X;\n}\n\nlong rk_geometric_inversion(rk_state *state, double p)\n{\n return (long)ceil(log(1.0-rk_double(state))/log(1.0-p));\n}\n\nlong rk_geometric(rk_state *state, double p)\n{\n if (p >= 0.333333333333333333333333)\n {\n return rk_geometric_search(state, p);\n } else\n {\n return rk_geometric_inversion(state, p);\n }\n}\n\nlong rk_hypergeometric_hyp(rk_state *state, long good, long bad, long sample)\n{\n long d1, K, Z;\n double d2, U, Y;\n \n d1 = bad + good - sample;\n d2 = (double)min(bad, good);\n \n Y = d2;\n K = sample;\n while (Y > 0.0)\n {\n U = rk_double(state);\n Y -= (long)floor(U + Y/(d1 + K));\n K--;\n if (K == 0) break;\n }\n Z = (long)(d2 - Y);\n if (bad > good) Z = sample - Z;\n return Z;\n}\n\n/* D1 = 2*sqrt(2/e) */\n/* D2 = 3 - 2*sqrt(3/e) */\n#define D1 1.7155277699214135\n#define D2 0.8989161620588988\nlong rk_hypergeometric_hrua(rk_state *state, long good, long bad, long sample)\n{\n long mingoodbad, maxgoodbad, popsize, m, d9;\n double d4, d5, d6, d7, d8, d10, d11;\n long Z;\n double T, W, X, Y;\n \n mingoodbad = min(good, bad);\n popsize = good + bad;\n maxgoodbad = max(good, bad);\n m = min(sample, popsize - sample);\n d4 = ((double)mingoodbad) / popsize;\n d5 = 1.0 - d4;\n d6 = m*d4 + 0.5;\n d7 = sqrt((popsize - m) * sample * d4 *d5 / (popsize-1) + 0.5);\n d8 = D1*d7 + D2;\n d9 = (long)floor((double)((m+1)*(mingoodbad+1))/(popsize+2));\n d10 = (lgam(d9+1) + lgam(mingoodbad-d9+1) + lgam(m-d9+1) + \n lgam(maxgoodbad-m+d9+1));\n d11 = min(min(m, mingoodbad)+1.0, floor(d6+16*d7));\n /* 16 for 16-decimal-digit precision in D1 and D2 */\n \n while (1)\n {\n X = rk_double(state);\n Y = rk_double(state);\n W = d6 + d8*(Y- 0.5)/X;\n \n /* fast rejection: */\n if ((W < 0.0) || (W >= d11)) continue;\n \n Z = (long)floor(W);\n T = d10 - (lgam(Z+1) + lgam(mingoodbad-Z+1) + lgam(m-Z+1) +\n lgam(maxgoodbad-m+Z+1));\n \n /* fast acceptance: */\n if ((X*(4.0-X)-3.0) <= T) break;\n \n /* fast rejection: */\n if (X*(X-T) >= 1) continue;\n\n if (2.0*log(X) <= T) break; /* acceptance */\n }\n \n /* this is a correction to HRUA* by Ivan Frohne in rv.py */\n if (bad > good) Z = m - Z;\n \n /* another fix from rv.py to allow sample to exceed popsize/2 */\n if (m < sample) Z = bad - Z;\n \n return Z;\n}\n#undef D1\n#undef D2\n\nlong rk_hypergeometric(rk_state *state, long good, long bad, long sample)\n{\n if (sample > 10)\n {\n return rk_hypergeometric_hrua(state, good, bad, sample);\n } else\n {\n return rk_hypergeometric_hyp(state, good, bad, sample);\n }\n}\n\ndouble rk_triangular(rk_state *state, double left, double mode, double right)\n{\n double base, leftbase, ratio, leftprod, rightprod;\n double U;\n \n base = right - left;\n leftbase = mode - left;\n ratio = leftbase / base;\n leftprod = leftbase*base;\n rightprod = (right - mode)*base;\n \n U = rk_double(state);\n if (U <= ratio)\n {\n return left + sqrt(U*leftprod);\n } else \n {\n return right - sqrt((1.0 - U) * rightprod); \n }\n}\n\nlong rk_logseries(rk_state *state, double p)\n{\n double q, r, U, V;\n \n r = log(1.0 - p);\n \n V = rk_double(state);\n if (V >= p) return 1;\n U = rk_double(state);\n q = 1.0 - exp(r*U);\n if (V <= q*q) return (long)floor(1 + log(V)/log(q));\n if (V <= q) return 1;\n return 2;\n}", "source_code_before": "/* Copyright 2005 Robert Kern (robert.kern@gmail.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n * \n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/* The implementations of rk_hypergeometric_hyp(), rk_hypergeometric_hrua(),\n * and rk_triangular() were adapted from Ivan Frohne's rv.py which has this \n * license:\n * \n * Copyright 1998 by Ivan Frohne; Wasilla, Alaska, U.S.A.\n * All Rights Reserved\n *\n * Permission to use, copy, modify and distribute this software and its\n * documentation for any purpose, free of charge, is granted subject to the\n * following conditions:\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the software.\n *\n * THE SOFTWARE AND DOCUMENTATION IS PROVIDED WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR\n * OR COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM OR DAMAGES IN A CONTRACT\n * ACTION, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR ITS DOCUMENTATION.\n */\n\n#include \n#include \"distributions.h\"\n#include \"mconf.h\"\n#include \n\n#ifndef min\n#define min(x,y) ((xy)?x:y)\n#endif\n\ndouble rk_normal(rk_state *state, double loc, double scale)\n{\n return loc + scale*rk_gauss(state);\n}\n\ndouble rk_standard_exponential(rk_state *state)\n{\n /* We use -log(1-U) since U is [0, 1) */\n return -log(1.0 - rk_double(state));\n}\n\ndouble rk_exponential(rk_state *state, double scale)\n{\n return scale * rk_standard_exponential(state);\n}\n\ndouble rk_uniform(rk_state *state, double loc, double scale)\n{\n return loc + scale*rk_double(state);\n}\n\n#define LOG4 1.3862943611198906\n#define ONELOG92 2.5040773967762742\n\ndouble rk_standard_gamma(rk_state *state, double shape)\n{\n double b, c, lam;\n double U, V, X, Y, Z, R;\n\n if (shape == 1.0)\n {\n return rk_standard_exponential(state);\n }\n else if (shape < 1.0)\n {\n while (1)\n {\n U = rk_double(state);\n V = rk_standard_exponential(state);\n if (U <= 1.0 - shape)\n {\n X = pow(U, 1./shape);\n if (X <= V)\n {\n return X;\n }\n }\n else\n {\n Y = -log((1-U)/shape);\n X = pow(1.0 - shape + shape*Y, 1./shape);\n if (X <= (V + Y))\n {\n return X;\n }\n }\n }\n }\n else\n {\n b = shape - LOG4;\n lam = sqrt(2.0*shape - 1.0);\n c = shape + lam;\n \n while (1)\n {\n U = rk_double(state);\n V = rk_double(state);\n Y = log(V/(1.0-V))/lam;\n X = shape*exp(Y); \n Z = U*V*V;\n R = b + c*Y - X;\n if ((R >= 4.5*Z - ONELOG92) || (R >= log(Z)))\n {\n break;\n }\n }\n return X;\n }\n}\n\n#undef LOG4\n#undef ONELOG92\n\ndouble rk_gamma(rk_state *state, double shape, double scale)\n{\n return scale * rk_standard_gamma(state, shape);\n}\n\ndouble rk_beta(rk_state *state, double a, double b)\n{\n double Ga, Gb;\n\n if ((a <= 1.0) && (b <= 1.0))\n {\n double U, V, X, Y;\n /* Use Jonk's algorithm */\n\n while (1)\n {\n U = rk_double(state);\n V = rk_double(state);\n X = pow(U, 1.0/a);\n Y = pow(V, 1.0/b);\n\n if ((X + Y) <= 1.0)\n {\n return X;\n }\n }\n }\n else\n {\n Ga = rk_standard_gamma(state, a);\n Gb = rk_standard_gamma(state, b);\n return Ga/(Ga + Gb);\n }\n}\n\ndouble rk_chisquare(rk_state *state, double df)\n{\n return 2.0*rk_standard_gamma(state, df/2.0);\n}\n\ndouble rk_noncentral_chisquare(rk_state *state, double df, double nonc)\n{\n double Chi2, N;\n\n Chi2 = rk_chisquare(state, df-1);\n N = rk_gauss(state) + sqrt(nonc);\n return Chi2 + N*N;\n}\n\ndouble rk_f(rk_state *state, double dfnum, double dfden)\n{\n return rk_chisquare(state, dfnum) / rk_chisquare(state, dfden);\n}\n\ndouble rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc)\n{\n return ((rk_noncentral_chisquare(state, dfnum, nonc)*dfden) /\n (rk_chisquare(state, dfden)*dfnum));\n}\n\nlong rk_binomial_btpe(rk_state *state, long n, double p)\n{\n double r,q,fm,p1,xm,xl,xr,c,laml,lamr,p2,p3,p4;\n double a,u,v,s,F,rho,t,A,nrq,x1,x2,f1,f2,z,z2,w,w2,x;\n long m,y,k,i;\n\n if (!(state->has_binomial) || \n (state->nsave != n) ||\n (state->psave != p))\n {\n /* initialize */\n state->nsave = n;\n state->psave = p;\n state->has_binomial = 1;\n state->r = r = min(p, 1.0-p);\n state->q = q = 1.0 - r;\n state->fm = fm = n*r+r;\n state->m = m = (long)floor(state->fm);\n state->p1 = p1 = floor(2.195*sqrt(n*r*q)-4.6*q) + 0.5;\n state->xm = xm = m + 0.5;\n state->xl = xl = xm - p1;\n state->xr = xr = xm + p1;\n state->c = c = 0.134 + 20.5/(15.3 + m);\n a = (fm - xl)/(fm-xl*r);\n state->laml = laml = a*(1.0 + a/2.0);\n a = (xr - fm)/(xr*q);\n state->lamr = lamr = a*(1.0 + a/2.0);\n state->p2 = p2 = p1*(1.0 + 2.0*c);\n state->p3 = p3 = p2 + c/laml;\n state->p4 = p4 = p3 + c/lamr;\n }\n else\n {\n r = state->r;\n q = state->q;\n fm = state->fm;\n m = state->m;\n p1 = state->p1;\n xm = state->xm;\n xl = state->xl;\n xr = state->xr;\n c = state->c;\n laml = state->laml;\n lamr = state->lamr;\n p2 = state->p2;\n p3 = state->p3;\n p4 = state->p4;\n }\n\n /* sigh ... */\n Step10:\n nrq = n*r*q;\n u = rk_double(state)*p4;\n v = rk_double(state);\n if (u > p1) goto Step20;\n y = (long)floor(xm - p1*v + u);\n goto Step60;\n\n Step20:\n if (u > p2) goto Step30;\n x = xl + (u - p1)/c;\n v = v*c + 1.0 - fabs(m - x + 0.5)/p1;\n if (v > 1.0) goto Step10;\n y = (long)floor(x);\n goto Step50;\n\n Step30:\n if (u > p3) goto Step40;\n y = (long)floor(xl + log(v)/laml);\n if (y < 0) goto Step10;\n v = v*(u-p2)*laml;\n goto Step50;\n\n Step40:\n y = (int)floor(xr - log(v)/lamr);\n if (y > n) goto Step10;\n v = v*(u-p3)*lamr;\n\n Step50:\n k = fabs(y - m);\n if ((k > 20) && (k < ((nrq)/2.0 - 1))) goto Step52;\n\n s = r/q;\n a = s*(n+1);\n F = 1.0;\n if (m < y)\n {\n for (i=m; i<=y; i++)\n {\n F *= (a/i - s);\n }\n }\n else if (m > y)\n {\n for (i=y; i<=m; i++)\n {\n F /= (a/i - s);\n }\n }\n else\n {\n if (v > F) goto Step10;\n goto Step60;\n }\n\n Step52:\n rho = (k/(nrq))*((k*(k/3.0 + 0.625) + 0.16666666666666666)/nrq + 0.5);\n t = -k*k/(2*nrq);\n A = log(v);\n if (A < (t - rho)) goto Step60;\n if (A > (t + rho)) goto Step10;\n\n x1 = y+1;\n f1 = m+1;\n z = n+1-m;\n w = n-y+1;\n x2 = x1*x1;\n f2 = f1*f1;\n z2 = z*z;\n w2 = w*w;\n if (A > (xm*log(f1/x1)\n + (n-m+0.5)*log(z/w)\n + (y-m)*log(w*r/(x1*q))\n + (13680.-(462.-(132.-(99.-140./f2)/f2)/f2)/f2)/f1/166320.\n + (13680.-(462.-(132.-(99.-140./z2)/z2)/z2)/z2)/z/166320.\n + (13680.-(462.-(132.-(99.-140./x2)/x2)/x2)/x2)/x1/166320.\n + (13680.-(462.-(132.-(99.-140./w2)/w2)/w2)/w2)/w/166320.))\n {\n goto Step10;\n }\n\n Step60:\n if (p > 0.5)\n {\n y = n - y;\n }\n\n return y;\n}\n\nlong rk_binomial_waiting(rk_state *state, long n, double p)\n{\n double q, E, Sum;\n long X;\n\n q = -log(1.0 - p);\n\n X = 0;\n Sum = 0.0;\n\n while (Sum <= q)\n {\n if (X == n)\n {\n X += 1;\n break;\n }\n E = rk_standard_exponential(state);\n Sum += E / (n - X);\n X++;\n }\n return X-1;\n}\n\nlong rk_binomial(rk_state *state, long n, double p)\n{\n double q;\n\n if (p <= 0.5)\n {\n if (p*n <= 30.0)\n {\n return rk_binomial_waiting(state, n, p);\n }\n else\n {\n return rk_binomial_btpe(state, n, p);\n }\n }\n else\n {\n q = 1.0-p;\n if (q*n <= 30.0)\n {\n return n - rk_binomial_waiting(state, n, q);\n }\n else\n {\n return n - rk_binomial_btpe(state, n, q);\n }\n }\n\n}\n\nlong rk_negative_binomial(rk_state *state, long n, double p)\n{\n double Y;\n\n Y = rk_gamma(state, n, (1-p)/p);\n return rk_poisson(state, Y);\n}\n\nlong rk_poisson_mult(rk_state *state, double lam)\n{\n long X;\n double prod, U, enlam;\n\n enlam = exp(-lam);\n X = 0;\n prod = 1.0;\n while (1)\n {\n U = rk_double(state);\n prod *= U;\n if (prod > enlam)\n {\n X += 1;\n }\n else\n {\n return X;\n }\n }\n}\n\n#define LS2PI 0.91893853320467267\n#define TWELFTH 0.083333333333333333333333\nlong rk_poisson_ptrs(rk_state *state, double lam)\n{\n long k;\n double U, V, slam, loglam, a, b, invalpha, vr, us;\n\n slam = sqrt(lam);\n loglam = log(lam);\n b = 0.931 + 2.53*slam;\n a = -0.059 + 0.02483*b;\n invalpha = 1.1239 + 1.1328/(b-3.4);\n vr = 0.9277 - 3.6224/(b-2);\n\n while (1)\n {\n U = rk_double(state) - 0.5;\n V = rk_double(state);\n us = 0.5 - fabs(U);\n k = (long)floor((2*a/us + b)*U + lam + 0.43);\n if ((us >= 0.07) && (V <= vr))\n {\n return k;\n }\n if ((k < 0) ||\n ((us < 0.013) && (V > us)))\n {\n continue;\n }\n if ((log(V) + log(invalpha) - log(a/(us*us)+b)) <=\n (-lam + k*loglam - lgam(k+1)))\n {\n return k;\n }\n\n \n }\n\n}\n\nlong rk_poisson(rk_state *state, double lam)\n{\n if (lam >= 10)\n {\n return rk_poisson_ptrs(state, lam);\n }\n else\n {\n return rk_poisson_mult(state, lam);\n }\n}\n\ndouble rk_standard_cauchy(rk_state *state)\n{\n return rk_gauss(state) / rk_gauss(state);\n}\n\ndouble rk_standard_t(rk_state *state, double df)\n{\n double N, G, X;\n\n N = rk_gauss(state);\n G = rk_standard_gamma(state, df/2);\n X = sqrt(df/2)*N/sqrt(G);\n return X;\n}\n\ndouble rk_vonmises(rk_state *state, double mu, double kappa)\n{\n double r, rho, s;\n double U, V, W, Y, Z;\n double result, mod;\n\n if (kappa < 1e-8)\n {\n return M_PI * (2*rk_double(state)-1);\n }\n else\n {\n r = 1 + sqrt(1 + 4*kappa*kappa);\n rho = (r - sqrt(2*r))/(2*kappa);\n s = (1 + rho*rho)/(2*rho);\n\n while (1)\n {\n U = 2*rk_double(state) - 1;\n V = 2*rk_double(state) - 1;\n Z = cos(M_PI*U);\n W = (1 + s*Z)/(s + Z);\n Y = kappa * (s - W);\n if ((Y*(2-Y) - V >= 0) || (log(Y/V)+1 - Y >= 0))\n {\n break;\n }\n }\n\n if (U < 0)\n {\n result = acos(W);\n }\n else\n {\n result = -acos(W);\n }\n result += mu + M_PI;\n mod = fmod(result, 2*M_PI);\n if (mod && (mod < 0))\n {\n mod += 2*M_PI;\n }\n return mod - M_PI;\n }\n}\n\ndouble rk_pareto(rk_state *state, double a)\n{\n return exp(rk_standard_exponential(state)/a) - 1;\n}\n\ndouble rk_weibull(rk_state *state, double a)\n{\n return pow(rk_standard_exponential(state), 1./a);\n}\n\ndouble rk_power(rk_state *state, double a)\n{\n return pow(1 - exp(-rk_standard_exponential(state)), 1./a);\n}\n\ndouble rk_laplace(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = rk_double(state);\n if (U < 0.5)\n {\n U = loc + scale * log(U + U);\n } else \n {\n U = loc - scale * log(2.0 - U - U);\n }\n return U;\n}\n\ndouble rk_gumbel(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = 1.0 - rk_double(state);\n return loc - scale * log(-log(U));\n}\n\ndouble rk_logistic(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = rk_double(state);\n return loc + scale * log(U/(1.0 - U));\n}\n\ndouble rk_lognormal(rk_state *state, double mean, double sigma)\n{\n return exp(rk_normal(state, mean, sigma));\n}\n\ndouble rk_rayleigh(rk_state *state, double mode)\n{\n return mode*sqrt(-2.0 * log(1.0 - rk_double(state)));\n}\n\ndouble rk_wald(rk_state *state, double mean, double scale)\n{\n double U, X, Y;\n double mu_2l;\n \n mu_2l = mean / (2*scale);\n Y = rk_gauss(state);\n Y = mean*Y*Y;\n X = mean + mu_2l*(Y - sqrt(4*scale*Y + Y*Y));\n U = rk_double(state);\n if (U <= mean/(mean+X))\n {\n return X;\n } else\n {\n return mean*mean/X;\n }\n}\n\nlong rk_zipf(rk_state *state, double a)\n{\n double T, U, V;\n long X;\n double b;\n \n b = pow(2.0, a-1.0);\n do\n {\n U = rk_double(state);\n V = rk_double(state);\n X = (long)floor(pow(U, -1.0/(a-1.0)));\n T = pow(1.0 + 1.0/X, a-1.0); \n } while ((V *X*(T-1.0)/(b-1.0)) > (T/b));\n return X;\n}\n\nlong rk_geometric_search(rk_state *state, double p)\n{\n double U;\n long X;\n double sum, prod, q;\n \n X = 1;\n sum = prod = p;\n q = 1.0 - p;\n U = rk_double(state);\n while (U > sum)\n {\n prod *= q;\n sum += prod;\n X++;\n }\n return X;\n}\n\nlong rk_geometric_inversion(rk_state *state, double p)\n{\n return (long)ceil(log(1.0-rk_double(state))/log(1.0-p));\n}\n\nlong rk_geometric(rk_state *state, double p)\n{\n if (p >= 0.333333333333333333333333)\n {\n return rk_geometric_search(state, p);\n } else\n {\n return rk_geometric_inversion(state, p);\n }\n}\n\nlong rk_hypergeometric_hyp(rk_state *state, long good, long bad, long sample)\n{\n long d1, K, Z;\n double d2, U, Y;\n \n d1 = bad + good - sample;\n d2 = (double)min(bad, good);\n \n Y = d2;\n K = sample;\n while (Y > 0.0)\n {\n U = rk_double(state);\n Y -= (long)floor(U + Y/(d1 + K));\n K--;\n if (K == 0) break;\n }\n Z = (long)(d2 - Y);\n if (bad > good) Z = sample - Z;\n return Z;\n}\n\n/* D1 = 2*sqrt(2/e) */\n/* D2 = 3 - 2*sqrt(3/e) */\n#define D1 1.7155277699214135\n#define D2 0.8989161620588988\nlong rk_hypergeometric_hrua(rk_state *state, long good, long bad, long sample)\n{\n long mingoodbad, maxgoodbad, popsize, m, d9;\n double d4, d5, d6, d7, d8, d10, d11;\n long Z;\n double T, W, X, Y;\n \n mingoodbad = min(good, bad);\n popsize = good + bad;\n maxgoodbad = max(good, bad);\n m = min(sample, popsize - sample);\n d4 = ((double)mingoodbad) / popsize;\n d5 = 1.0 - d4;\n d6 = m*d4 + 0.5;\n d7 = sqrt((popsize - m) * sample * d4 *d5 / (popsize-1) + 0.5);\n d8 = D1*d7 + D2;\n d9 = (long)floor((double)((m+1)*(mingoodbad+1))/(popsize+2));\n d10 = (lgam(d9+1) + lgam(mingoodbad-d9+1) + lgam(m-d9+1) + \n lgam(maxgoodbad-m+d9+1));\n d11 = min(min(m, mingoodbad)+1.0, floor(d6+16*d7));\n /* 16 for 16-decimal-digit precision in D1 and D2 */\n \n while (1)\n {\n X = rk_double(state);\n Y = rk_double(state);\n W = d6 + d8*(Y- 0.5)/X;\n \n /* fast rejection: */\n if ((W < 0.0) || (W >= d11)) continue;\n \n Z = (long)floor(W);\n T = d10 - (lgam(Z+1) + lgam(mingoodbad-Z+1) + lgam(m-Z+1) +\n lgam(maxgoodbad-m+Z+1));\n \n /* fast acceptance: */\n if ((X*(4.0-X)-3.0) <= T) break;\n \n /* fast rejection: */\n if (X*(X-T) >= 1) continue;\n\n if (2.0*log(X) <= T) break; /* acceptance */\n }\n \n /* this is a correction to HRUA* by Ivan Frohne in rv.py */\n if (bad > good) Z = m - Z;\n \n /* another fix from rv.py to allow sample to exceed popsize/2 */\n if (m < sample) Z = bad - Z;\n \n return Z;\n}\n#undef D1\n#undef D2\n\nlong rk_hypergeometric(rk_state *state, long good, long bad, long sample)\n{\n if (sample > 10)\n {\n return rk_hypergeometric_hrua(state, good, bad, sample);\n } else\n {\n return rk_hypergeometric_hyp(state, good, bad, sample);\n }\n}\n\ndouble rk_triangular(rk_state *state, double left, double mode, double right)\n{\n double base, leftbase, ratio, leftprod, rightprod;\n double U;\n \n base = right - left;\n leftbase = mode - left;\n ratio = leftbase / base;\n leftprod = leftbase*base;\n rightprod = (right - mode)*base;\n \n U = rk_double(state);\n if (U <= ratio)\n {\n return left + sqrt(U*leftprod);\n } else \n {\n return right - sqrt((1.0 - U) * rightprod); \n }\n}", "methods": [ { "name": "rk_normal", "long_name": "rk_normal( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "loc", "scale" ], "start_line": 54, "end_line": 57, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_exponential", "long_name": "rk_standard_exponential( rk_state * state)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "state" ], "start_line": 59, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "rk_exponential", "long_name": "rk_exponential( rk_state * state , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "state", "scale" ], "start_line": 65, "end_line": 68, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_uniform", "long_name": "rk_uniform( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "loc", "scale" ], "start_line": 70, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_gamma", "long_name": "rk_standard_gamma( rk_state * state , double shape)", "filename": "distributions.c", "nloc": 54, "complexity": 10, "token_count": 271, "parameters": [ "state", "shape" ], "start_line": 78, "end_line": 133, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "rk_gamma", "long_name": "rk_gamma( rk_state * state , double shape , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "shape", "scale" ], "start_line": 138, "end_line": 141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_beta", "long_name": "rk_beta( rk_state * state , double a , double b)", "filename": "distributions.c", "nloc": 25, "complexity": 5, "token_count": 131, "parameters": [ "state", "a", "b" ], "start_line": 143, "end_line": 171, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "rk_chisquare", "long_name": "rk_chisquare( rk_state * state , double df)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 23, "parameters": [ "state", "df" ], "start_line": 173, "end_line": 176, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_noncentral_chisquare", "long_name": "rk_noncentral_chisquare( rk_state * state , double df , double nonc)", "filename": "distributions.c", "nloc": 7, "complexity": 1, "token_count": 49, "parameters": [ "state", "df", "nonc" ], "start_line": 178, "end_line": 185, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "rk_f", "long_name": "rk_f( rk_state * state , double dfnum , double dfden)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 29, "parameters": [ "state", "dfnum", "dfden" ], "start_line": 187, "end_line": 190, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_noncentral_f", "long_name": "rk_noncentral_f( rk_state * state , double dfnum , double dfden , double nonc)", "filename": "distributions.c", "nloc": 5, "complexity": 1, "token_count": 44, "parameters": [ "state", "dfnum", "dfden", "nonc" ], "start_line": 192, "end_line": 196, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "rk_binomial_btpe", "long_name": "rk_binomial_btpe( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 126, "complexity": 21, "token_count": 1119, "parameters": [ "state", "n", "p" ], "start_line": 198, "end_line": 336, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "rk_binomial_waiting", "long_name": "rk_binomial_waiting( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 20, "complexity": 3, "token_count": 89, "parameters": [ "state", "n", "p" ], "start_line": 338, "end_line": 360, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "rk_binomial", "long_name": "rk_binomial( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 27, "complexity": 4, "token_count": 104, "parameters": [ "state", "n", "p" ], "start_line": 362, "end_line": 390, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "rk_negative_binomial", "long_name": "rk_negative_binomial( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 42, "parameters": [ "state", "n", "p" ], "start_line": 392, "end_line": 398, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_poisson_mult", "long_name": "rk_poisson_mult( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 21, "complexity": 3, "token_count": 73, "parameters": [ "state", "lam" ], "start_line": 400, "end_line": 421, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "rk_poisson_ptrs", "long_name": "rk_poisson_ptrs( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 32, "complexity": 8, "token_count": 236, "parameters": [ "state", "lam" ], "start_line": 425, "end_line": 461, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "rk_poisson", "long_name": "rk_poisson( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 11, "complexity": 2, "token_count": 38, "parameters": [ "state", "lam" ], "start_line": 463, "end_line": 473, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "rk_standard_cauchy", "long_name": "rk_standard_cauchy( rk_state * state)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "state" ], "start_line": 475, "end_line": 478, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_t", "long_name": "rk_standard_t( rk_state * state , double df)", "filename": "distributions.c", "nloc": 8, "complexity": 1, "token_count": 55, "parameters": [ "state", "df" ], "start_line": 480, "end_line": 488, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "rk_vonmises", "long_name": "rk_vonmises( rk_state * state , double mu , double kappa)", "filename": "distributions.c", "nloc": 43, "complexity": 8, "token_count": 278, "parameters": [ "state", "mu", "kappa" ], "start_line": 490, "end_line": 535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "rk_pareto", "long_name": "rk_pareto( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "a" ], "start_line": 537, "end_line": 540, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_weibull", "long_name": "rk_weibull( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "a" ], "start_line": 542, "end_line": 545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_power", "long_name": "rk_power( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 30, "parameters": [ "state", "a" ], "start_line": 547, "end_line": 550, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_laplace", "long_name": "rk_laplace( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 13, "complexity": 2, "token_count": 66, "parameters": [ "state", "loc", "scale" ], "start_line": 552, "end_line": 565, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "rk_gumbel", "long_name": "rk_gumbel( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 40, "parameters": [ "state", "loc", "scale" ], "start_line": 567, "end_line": 573, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_logistic", "long_name": "rk_logistic( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 40, "parameters": [ "state", "loc", "scale" ], "start_line": 575, "end_line": 581, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_lognormal", "long_name": "rk_lognormal( rk_state * state , double mean , double sigma)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "state", "mean", "sigma" ], "start_line": 583, "end_line": 586, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_rayleigh", "long_name": "rk_rayleigh( rk_state * state , double mode)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 30, "parameters": [ "state", "mode" ], "start_line": 588, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_wald", "long_name": "rk_wald( rk_state * state , double mean , double scale)", "filename": "distributions.c", "nloc": 17, "complexity": 2, "token_count": 106, "parameters": [ "state", "mean", "scale" ], "start_line": 593, "end_line": 610, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "rk_zipf", "long_name": "rk_zipf( rk_state * state , double a)", "filename": "distributions.c", "nloc": 15, "complexity": 2, "token_count": 119, "parameters": [ "state", "a" ], "start_line": 612, "end_line": 627, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "rk_geometric_search", "long_name": "rk_geometric_search( rk_state * state , double p)", "filename": "distributions.c", "nloc": 17, "complexity": 2, "token_count": 70, "parameters": [ "state", "p" ], "start_line": 629, "end_line": 646, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "rk_geometric_inversion", "long_name": "rk_geometric_inversion( rk_state * state , double p)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 35, "parameters": [ "state", "p" ], "start_line": 648, "end_line": 651, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_geometric", "long_name": "rk_geometric( rk_state * state , double p)", "filename": "distributions.c", "nloc": 10, "complexity": 2, "token_count": 38, "parameters": [ "state", "p" ], "start_line": 653, "end_line": 662, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "rk_hypergeometric_hyp", "long_name": "rk_hypergeometric_hyp( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 19, "complexity": 4, "token_count": 129, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 664, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "rk_hypergeometric_hrua", "long_name": "rk_hypergeometric_hrua( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 36, "complexity": 9, "token_count": 416, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 690, "end_line": 741, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "rk_hypergeometric", "long_name": "rk_hypergeometric( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 10, "complexity": 2, "token_count": 52, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 745, "end_line": 754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "rk_triangular", "long_name": "rk_triangular( rk_state * state , double left , double mode , double right)", "filename": "distributions.c", "nloc": 18, "complexity": 2, "token_count": 107, "parameters": [ "state", "left", "mode", "right" ], "start_line": 756, "end_line": 775, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "rk_logseries", "long_name": "rk_logseries( rk_state * state , double p)", "filename": "distributions.c", "nloc": 12, "complexity": 4, "token_count": 102, "parameters": [ "state", "p" ], "start_line": 777, "end_line": 790, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "methods_before": [ { "name": "rk_normal", "long_name": "rk_normal( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "loc", "scale" ], "start_line": 54, "end_line": 57, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_exponential", "long_name": "rk_standard_exponential( rk_state * state)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "state" ], "start_line": 59, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "rk_exponential", "long_name": "rk_exponential( rk_state * state , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "state", "scale" ], "start_line": 65, "end_line": 68, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_uniform", "long_name": "rk_uniform( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "loc", "scale" ], "start_line": 70, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_gamma", "long_name": "rk_standard_gamma( rk_state * state , double shape)", "filename": "distributions.c", "nloc": 54, "complexity": 10, "token_count": 271, "parameters": [ "state", "shape" ], "start_line": 78, "end_line": 133, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "rk_gamma", "long_name": "rk_gamma( rk_state * state , double shape , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "shape", "scale" ], "start_line": 138, "end_line": 141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_beta", "long_name": "rk_beta( rk_state * state , double a , double b)", "filename": "distributions.c", "nloc": 25, "complexity": 5, "token_count": 131, "parameters": [ "state", "a", "b" ], "start_line": 143, "end_line": 171, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "rk_chisquare", "long_name": "rk_chisquare( rk_state * state , double df)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 23, "parameters": [ "state", "df" ], "start_line": 173, "end_line": 176, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_noncentral_chisquare", "long_name": "rk_noncentral_chisquare( rk_state * state , double df , double nonc)", "filename": "distributions.c", "nloc": 7, "complexity": 1, "token_count": 49, "parameters": [ "state", "df", "nonc" ], "start_line": 178, "end_line": 185, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "rk_f", "long_name": "rk_f( rk_state * state , double dfnum , double dfden)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 29, "parameters": [ "state", "dfnum", "dfden" ], "start_line": 187, "end_line": 190, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_noncentral_f", "long_name": "rk_noncentral_f( rk_state * state , double dfnum , double dfden , double nonc)", "filename": "distributions.c", "nloc": 5, "complexity": 1, "token_count": 44, "parameters": [ "state", "dfnum", "dfden", "nonc" ], "start_line": 192, "end_line": 196, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "rk_binomial_btpe", "long_name": "rk_binomial_btpe( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 126, "complexity": 21, "token_count": 1119, "parameters": [ "state", "n", "p" ], "start_line": 198, "end_line": 336, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "rk_binomial_waiting", "long_name": "rk_binomial_waiting( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 20, "complexity": 3, "token_count": 89, "parameters": [ "state", "n", "p" ], "start_line": 338, "end_line": 360, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "rk_binomial", "long_name": "rk_binomial( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 27, "complexity": 4, "token_count": 104, "parameters": [ "state", "n", "p" ], "start_line": 362, "end_line": 390, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "rk_negative_binomial", "long_name": "rk_negative_binomial( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 42, "parameters": [ "state", "n", "p" ], "start_line": 392, "end_line": 398, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_poisson_mult", "long_name": "rk_poisson_mult( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 21, "complexity": 3, "token_count": 73, "parameters": [ "state", "lam" ], "start_line": 400, "end_line": 421, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "rk_poisson_ptrs", "long_name": "rk_poisson_ptrs( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 32, "complexity": 8, "token_count": 236, "parameters": [ "state", "lam" ], "start_line": 425, "end_line": 461, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "rk_poisson", "long_name": "rk_poisson( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 11, "complexity": 2, "token_count": 38, "parameters": [ "state", "lam" ], "start_line": 463, "end_line": 473, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "rk_standard_cauchy", "long_name": "rk_standard_cauchy( rk_state * state)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "state" ], "start_line": 475, "end_line": 478, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_t", "long_name": "rk_standard_t( rk_state * state , double df)", "filename": "distributions.c", "nloc": 8, "complexity": 1, "token_count": 55, "parameters": [ "state", "df" ], "start_line": 480, "end_line": 488, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "rk_vonmises", "long_name": "rk_vonmises( rk_state * state , double mu , double kappa)", "filename": "distributions.c", "nloc": 43, "complexity": 8, "token_count": 278, "parameters": [ "state", "mu", "kappa" ], "start_line": 490, "end_line": 535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "rk_pareto", "long_name": "rk_pareto( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "a" ], "start_line": 537, "end_line": 540, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_weibull", "long_name": "rk_weibull( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "a" ], "start_line": 542, "end_line": 545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_power", "long_name": "rk_power( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 30, "parameters": [ "state", "a" ], "start_line": 547, "end_line": 550, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_laplace", "long_name": "rk_laplace( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 13, "complexity": 2, "token_count": 66, "parameters": [ "state", "loc", "scale" ], "start_line": 552, "end_line": 565, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "rk_gumbel", "long_name": "rk_gumbel( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 40, "parameters": [ "state", "loc", "scale" ], "start_line": 567, "end_line": 573, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_logistic", "long_name": "rk_logistic( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 40, "parameters": [ "state", "loc", "scale" ], "start_line": 575, "end_line": 581, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_lognormal", "long_name": "rk_lognormal( rk_state * state , double mean , double sigma)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "state", "mean", "sigma" ], "start_line": 583, "end_line": 586, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_rayleigh", "long_name": "rk_rayleigh( rk_state * state , double mode)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 30, "parameters": [ "state", "mode" ], "start_line": 588, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_wald", "long_name": "rk_wald( rk_state * state , double mean , double scale)", "filename": "distributions.c", "nloc": 17, "complexity": 2, "token_count": 106, "parameters": [ "state", "mean", "scale" ], "start_line": 593, "end_line": 610, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "rk_zipf", "long_name": "rk_zipf( rk_state * state , double a)", "filename": "distributions.c", "nloc": 15, "complexity": 2, "token_count": 119, "parameters": [ "state", "a" ], "start_line": 612, "end_line": 627, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "rk_geometric_search", "long_name": "rk_geometric_search( rk_state * state , double p)", "filename": "distributions.c", "nloc": 17, "complexity": 2, "token_count": 70, "parameters": [ "state", "p" ], "start_line": 629, "end_line": 646, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "rk_geometric_inversion", "long_name": "rk_geometric_inversion( rk_state * state , double p)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 35, "parameters": [ "state", "p" ], "start_line": 648, "end_line": 651, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_geometric", "long_name": "rk_geometric( rk_state * state , double p)", "filename": "distributions.c", "nloc": 10, "complexity": 2, "token_count": 38, "parameters": [ "state", "p" ], "start_line": 653, "end_line": 662, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "rk_hypergeometric_hyp", "long_name": "rk_hypergeometric_hyp( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 19, "complexity": 4, "token_count": 129, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 664, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "rk_hypergeometric_hrua", "long_name": "rk_hypergeometric_hrua( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 36, "complexity": 9, "token_count": 416, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 690, "end_line": 741, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "rk_hypergeometric", "long_name": "rk_hypergeometric( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 10, "complexity": 2, "token_count": 52, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 745, "end_line": 754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "rk_triangular", "long_name": "rk_triangular( rk_state * state , double left , double mode , double right)", "filename": "distributions.c", "nloc": 18, "complexity": 2, "token_count": 107, "parameters": [ "state", "left", "mode", "right" ], "start_line": 756, "end_line": 775, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "rk_triangular", "long_name": "rk_triangular( rk_state * state , double left , double mode , double right)", "filename": "distributions.c", "nloc": 18, "complexity": 2, "token_count": 107, "parameters": [ "state", "left", "mode", "right" ], "start_line": 756, "end_line": 775, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "rk_logseries", "long_name": "rk_logseries( rk_state * state , double p)", "filename": "distributions.c", "nloc": 12, "complexity": 4, "token_count": 102, "parameters": [ "state", "p" ], "start_line": 777, "end_line": 790, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "nloc": 624, "complexity": 115, "token_count": 4213, "diff_parsed": { "added": [ "}", "", "long rk_logseries(rk_state *state, double p)", "{", " double q, r, U, V;", "", " r = log(1.0 - p);", "", " V = rk_double(state);", " if (V >= p) return 1;", " U = rk_double(state);", " q = 1.0 - exp(r*U);", " if (V <= q*q) return (long)floor(1 + log(V)/log(q));", " if (V <= q) return 1;", " return 2;" ], "deleted": [] } }, { "old_path": "scipy/corelib/mtrand/distributions.h", "new_path": "scipy/corelib/mtrand/distributions.h", "filename": "distributions.h", "extension": "h", "change_type": "MODIFY", "diff": "@@ -170,6 +170,9 @@ extern long rk_hypergeometric_hrua(rk_state *state, long good, long bad, long sa\n /* Triangular distribution */\n extern double rk_triangular(rk_state *state, double left, double mode, double right);\n \n+/* Logarithmic series distribution */\n+extern long rk_logseries(rk_state *state, double p);\n+\n #ifdef __cplusplus\n }\n #endif\n", "added_lines": 3, "deleted_lines": 0, "source_code": "/* Copyright 2005 Robert Kern (robert.kern@gmail.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n * \n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n#ifndef _RK_DISTR_\n#define _RK_DISTR_\n\n#include \"randomkit.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* References:\n * \n * Devroye, Luc. _Non-Uniform Random Variate Generation_.\n * Springer-Verlag, New York, 1986.\n * http://cgm.cs.mcgill.ca/~luc/rnbookindex.html\n * \n * Kachitvichyanukul, V. and Schmeiser, B. W. Binomial Random Variate\n * Generation. Communications of the ACM, 31, 2 (February, 1988) 216.\n *\n * Hoermann, W. The Transformed Rejection Method for Generating Poisson Random\n * Variables, Insurance: Mathematics and Economics, (to appear)\n * http://citeseer.csail.mit.edu/151115.html\n */\n\n/* Normal distribution with mean=loc and standard deviation=scale. */\nextern double rk_normal(rk_state *state, double loc, double scale);\n\n/* Standard exponential distribution (mean=1) computed by inversion of the \n * CDF. */\nextern double rk_standard_exponential(rk_state *state);\n\n/* Exponential distribution with mean=scale. */\nextern double rk_exponential(rk_state *state, double scale);\n\n/* Uniform distribution on interval [loc, loc+scale). */\nextern double rk_uniform(rk_state *state, double loc, double scale);\n\n/* Standard gamma distribution with shape parameter. \n * When shape < 1, the algorithm given by (Devroye p. 304) is used.\n * When shape == 1, a Exponential variate is generated.\n * When shape > 1, Cheng's GB rejection algorithm from Devroye p. 413 with the\n * corrections given in the Errata is used.\n */\nextern double rk_standard_gamma(rk_state *state, double shape);\n\n/* Gamma distribution with shape and scale. */\nextern double rk_gamma(rk_state *state, double shape, double scale);\n\n/* Beta distribution computed by combining two gamma variates (Devroye p. 432).\n */\nextern double rk_beta(rk_state *state, double a, double b);\n\n/* Chi^2 distribution computed by transforming a gamma variate (it being a\n * special case Gamma(df/2, 2)). */\nextern double rk_chisquare(rk_state *state, double df);\n\n/* Noncentral Chi^2 distribution computed by modifying a Chi^2 variate. */\nextern double rk_noncentral_chisquare(rk_state *state, double df, double nonc);\n\n/* F distribution computed by taking the ratio of two Chi^2 variates. */\nextern double rk_f(rk_state *state, double dfnum, double dfden);\n\n/* Noncentral F distribution computed by taking the ratio of a noncentral Chi^2\n * and a Chi^2 variate. */\nextern double rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc);\n\n/* Binomial distribution with n Bernoulli trials with success probability p.\n * When n*p <= 30, the \"Second waiting time method\" given by (Devroye p. 525) is\n * used. Otherwise, the BTPE algorithm of (Kachitvichyanukul and Schmeiser 1988)\n * is used. */\nextern long rk_binomial(rk_state *state, long n, double p);\n\n/* Binomial distribution using BTPE. */\nextern long rk_binomial_btpe(rk_state *state, long n, double p);\n\n/* Binomial distribution using the waiting time algorithm. */\nextern long rk_binomial_waiting(rk_state *state, long n, double p);\n\n/* Negative binomial distribution computed by generating a Gamma(n, (1-p)/p)\n * variate Y and returning a Poisson(Y) variate (Devroye p. 543). */\nextern long rk_negative_binomial(rk_state *state, long n, double p);\n\n/* Poisson distribution with mean=lam.\n * When lam < 10, a basic algorithm using repeated multiplications of uniform\n * variates is used (Devroye p. 504).\n * When lam >= 10, algorithm PTRS from (Hoermann 1992) is used.\n */\nextern long rk_poisson(rk_state *state, double lam);\n\n/* Poisson distribution computed by repeated multiplication of uniform variates.\n */\nextern long rk_poisson_mult(rk_state *state, double lam);\n\n/* Poisson distribution computer by the PTRS algorithm. */\nextern long rk_poisson_ptrs(rk_state *state, double lam);\n\n/* Standard Cauchy distribution computed by dividing standard gaussians \n * (Devroye p. 451). */\nextern double rk_standard_cauchy(rk_state *state);\n\n/* Standard t-distribution with df degrees of freedom (Devroye p. 445 as\n * corrected in the Errata). */\nextern double rk_standard_t(rk_state *state, double df);\n\n/* von Mises circular distribution with center mu and shape kappa on [-pi,pi]\n * (Devroye p. 476 as corrected in the Errata). */\nextern double rk_vonmises(rk_state *state, double mu, double kappa);\n\n/* Pareto distribution via inversion (Devroye p. 262) */\nextern double rk_pareto(rk_state *state, double a);\n\n/* Weibull distribution via inversion (Devroye p. 262) */\nextern double rk_weibull(rk_state *state, double a);\n\n/* Power distribution via inversion (Devroye p. 262) */\nextern double rk_power(rk_state *state, double a);\n\n/* Laplace distribution */\nextern double rk_laplace(rk_state *state, double loc, double scale);\n\n/* Gumbel distribution */\nextern double rk_gumbel(rk_state *state, double loc, double scale);\n\n/* Logistic distribution */\nextern double rk_logistic(rk_state *state, double loc, double scale);\n\n/* Log-normal distribution */\nextern double rk_lognormal(rk_state *state, double mean, double sigma);\n\n/* Rayleigh distribution */\nextern double rk_rayleigh(rk_state *state, double mode);\n\n/* Wald distribution */\nextern double rk_wald(rk_state *state, double mean, double scale);\n\n/* Zipf distribution */\nextern long rk_zipf(rk_state *state, double a);\n\n/* Geometric distribution */\nextern long rk_geometric(rk_state *state, double p);\nextern long rk_geometric_search(rk_state *state, double p);\nextern long rk_geometric_inversion(rk_state *state, double p);\n\n/* Hypergeometric distribution */\nextern long rk_hypergeometric(rk_state *state, long good, long bad, long sample);\nextern long rk_hypergeometric_hyp(rk_state *state, long good, long bad, long sample);\nextern long rk_hypergeometric_hrua(rk_state *state, long good, long bad, long sample);\n\n/* Triangular distribution */\nextern double rk_triangular(rk_state *state, double left, double mode, double right);\n\n/* Logarithmic series distribution */\nextern long rk_logseries(rk_state *state, double p);\n\n#ifdef __cplusplus\n}\n#endif\n\n\n#endif /* _RK_DISTR_ */\n", "source_code_before": "/* Copyright 2005 Robert Kern (robert.kern@gmail.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n * \n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n#ifndef _RK_DISTR_\n#define _RK_DISTR_\n\n#include \"randomkit.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* References:\n * \n * Devroye, Luc. _Non-Uniform Random Variate Generation_.\n * Springer-Verlag, New York, 1986.\n * http://cgm.cs.mcgill.ca/~luc/rnbookindex.html\n * \n * Kachitvichyanukul, V. and Schmeiser, B. W. Binomial Random Variate\n * Generation. Communications of the ACM, 31, 2 (February, 1988) 216.\n *\n * Hoermann, W. The Transformed Rejection Method for Generating Poisson Random\n * Variables, Insurance: Mathematics and Economics, (to appear)\n * http://citeseer.csail.mit.edu/151115.html\n */\n\n/* Normal distribution with mean=loc and standard deviation=scale. */\nextern double rk_normal(rk_state *state, double loc, double scale);\n\n/* Standard exponential distribution (mean=1) computed by inversion of the \n * CDF. */\nextern double rk_standard_exponential(rk_state *state);\n\n/* Exponential distribution with mean=scale. */\nextern double rk_exponential(rk_state *state, double scale);\n\n/* Uniform distribution on interval [loc, loc+scale). */\nextern double rk_uniform(rk_state *state, double loc, double scale);\n\n/* Standard gamma distribution with shape parameter. \n * When shape < 1, the algorithm given by (Devroye p. 304) is used.\n * When shape == 1, a Exponential variate is generated.\n * When shape > 1, Cheng's GB rejection algorithm from Devroye p. 413 with the\n * corrections given in the Errata is used.\n */\nextern double rk_standard_gamma(rk_state *state, double shape);\n\n/* Gamma distribution with shape and scale. */\nextern double rk_gamma(rk_state *state, double shape, double scale);\n\n/* Beta distribution computed by combining two gamma variates (Devroye p. 432).\n */\nextern double rk_beta(rk_state *state, double a, double b);\n\n/* Chi^2 distribution computed by transforming a gamma variate (it being a\n * special case Gamma(df/2, 2)). */\nextern double rk_chisquare(rk_state *state, double df);\n\n/* Noncentral Chi^2 distribution computed by modifying a Chi^2 variate. */\nextern double rk_noncentral_chisquare(rk_state *state, double df, double nonc);\n\n/* F distribution computed by taking the ratio of two Chi^2 variates. */\nextern double rk_f(rk_state *state, double dfnum, double dfden);\n\n/* Noncentral F distribution computed by taking the ratio of a noncentral Chi^2\n * and a Chi^2 variate. */\nextern double rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc);\n\n/* Binomial distribution with n Bernoulli trials with success probability p.\n * When n*p <= 30, the \"Second waiting time method\" given by (Devroye p. 525) is\n * used. Otherwise, the BTPE algorithm of (Kachitvichyanukul and Schmeiser 1988)\n * is used. */\nextern long rk_binomial(rk_state *state, long n, double p);\n\n/* Binomial distribution using BTPE. */\nextern long rk_binomial_btpe(rk_state *state, long n, double p);\n\n/* Binomial distribution using the waiting time algorithm. */\nextern long rk_binomial_waiting(rk_state *state, long n, double p);\n\n/* Negative binomial distribution computed by generating a Gamma(n, (1-p)/p)\n * variate Y and returning a Poisson(Y) variate (Devroye p. 543). */\nextern long rk_negative_binomial(rk_state *state, long n, double p);\n\n/* Poisson distribution with mean=lam.\n * When lam < 10, a basic algorithm using repeated multiplications of uniform\n * variates is used (Devroye p. 504).\n * When lam >= 10, algorithm PTRS from (Hoermann 1992) is used.\n */\nextern long rk_poisson(rk_state *state, double lam);\n\n/* Poisson distribution computed by repeated multiplication of uniform variates.\n */\nextern long rk_poisson_mult(rk_state *state, double lam);\n\n/* Poisson distribution computer by the PTRS algorithm. */\nextern long rk_poisson_ptrs(rk_state *state, double lam);\n\n/* Standard Cauchy distribution computed by dividing standard gaussians \n * (Devroye p. 451). */\nextern double rk_standard_cauchy(rk_state *state);\n\n/* Standard t-distribution with df degrees of freedom (Devroye p. 445 as\n * corrected in the Errata). */\nextern double rk_standard_t(rk_state *state, double df);\n\n/* von Mises circular distribution with center mu and shape kappa on [-pi,pi]\n * (Devroye p. 476 as corrected in the Errata). */\nextern double rk_vonmises(rk_state *state, double mu, double kappa);\n\n/* Pareto distribution via inversion (Devroye p. 262) */\nextern double rk_pareto(rk_state *state, double a);\n\n/* Weibull distribution via inversion (Devroye p. 262) */\nextern double rk_weibull(rk_state *state, double a);\n\n/* Power distribution via inversion (Devroye p. 262) */\nextern double rk_power(rk_state *state, double a);\n\n/* Laplace distribution */\nextern double rk_laplace(rk_state *state, double loc, double scale);\n\n/* Gumbel distribution */\nextern double rk_gumbel(rk_state *state, double loc, double scale);\n\n/* Logistic distribution */\nextern double rk_logistic(rk_state *state, double loc, double scale);\n\n/* Log-normal distribution */\nextern double rk_lognormal(rk_state *state, double mean, double sigma);\n\n/* Rayleigh distribution */\nextern double rk_rayleigh(rk_state *state, double mode);\n\n/* Wald distribution */\nextern double rk_wald(rk_state *state, double mean, double scale);\n\n/* Zipf distribution */\nextern long rk_zipf(rk_state *state, double a);\n\n/* Geometric distribution */\nextern long rk_geometric(rk_state *state, double p);\nextern long rk_geometric_search(rk_state *state, double p);\nextern long rk_geometric_inversion(rk_state *state, double p);\n\n/* Hypergeometric distribution */\nextern long rk_hypergeometric(rk_state *state, long good, long bad, long sample);\nextern long rk_hypergeometric_hyp(rk_state *state, long good, long bad, long sample);\nextern long rk_hypergeometric_hrua(rk_state *state, long good, long bad, long sample);\n\n/* Triangular distribution */\nextern double rk_triangular(rk_state *state, double left, double mode, double right);\n\n#ifdef __cplusplus\n}\n#endif\n\n\n#endif /* _RK_DISTR_ */\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": 42, "complexity": 0, "token_count": 546, "diff_parsed": { "added": [ "/* Logarithmic series distribution */", "extern long rk_logseries(rk_state *state, double p);", "" ], "deleted": [] } }, { "old_path": "scipy/corelib/mtrand/mtrand.c", "new_path": "scipy/corelib/mtrand/mtrand.c", "filename": "mtrand.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -1,4 +1,4 @@\n-/* Generated by Pyrex 0.9.3.1 on Thu Oct 6 21:56:32 2005 */\n+/* Generated by Pyrex 0.9.3.1 on Fri Oct 7 02:05:13 2005 */\n \n #include \"Python.h\"\n #include \"structmember.h\"\n@@ -109,6 +109,7 @@ static PyObject *__pyx_k54;\n static PyObject *__pyx_k55;\n static PyObject *__pyx_k56;\n static PyObject *__pyx_k57;\n+static PyObject *__pyx_k58;\n static PyObject *(__pyx_f_6mtrand_cont0_array(rk_state (*),double ((*)(rk_state (*))),PyObject *)); /*proto*/\n static PyObject *(__pyx_f_6mtrand_cont1_array(rk_state (*),double ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/\n static PyObject *(__pyx_f_6mtrand_cont2_array(rk_state (*),double ((*)(rk_state (*),double ,double )),PyObject *,double ,double )); /*proto*/\n@@ -163,6 +164,7 @@ static PyObject *__pyx_n_poisson;\n static PyObject *__pyx_n_zipf;\n static PyObject *__pyx_n_geometric;\n static PyObject *__pyx_n_hypergeometric;\n+static PyObject *__pyx_n_logseries;\n static PyObject *__pyx_n_multivariate_normal;\n static PyObject *__pyx_n_multinomial;\n static PyObject *__pyx_n_shuffle;\n@@ -185,12 +187,12 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":123 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":124 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":124 */\n- __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":125 */\n+ __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -198,19 +200,19 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":126 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":127 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n- __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n- __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n@@ -218,22 +220,22 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":127 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":128 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":128 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":129 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":129 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":130 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":130 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":131 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":131 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":132 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -267,12 +269,12 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":139 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":140 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":140 */\n- __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":141 */\n+ __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -280,19 +282,19 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":142 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":143 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n- __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n- __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n@@ -300,22 +302,22 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":143 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":144 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":144 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":145 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":145 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":146 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":146 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":147 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":147 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":148 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -349,12 +351,12 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":156 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":157 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":157 */\n- __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":158 */\n+ __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -362,19 +364,19 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":159 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":160 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n- __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n- __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n@@ -382,22 +384,22 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":160 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":161 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":161 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":162 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":162 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":163 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":163 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":164 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":164 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":165 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -431,12 +433,12 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":174 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":175 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":175 */\n- __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":176 */\n+ __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -444,19 +446,19 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":177 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":178 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n- __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n- __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n@@ -464,22 +466,22 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":178 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":179 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":179 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":180 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":180 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":181 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":181 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":182 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":182 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":183 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -515,12 +517,12 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*_\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":190 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":191 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":191 */\n- __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":192 */\n+ __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -528,19 +530,19 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*_\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":193 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":194 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n- __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n- __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n@@ -548,22 +550,22 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*_\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":194 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":195 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":195 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":196 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":196 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":197 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":197 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":198 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":198 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":199 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -597,12 +599,12 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":206 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":207 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":207 */\n- __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":208 */\n+ __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -610,19 +612,19 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":209 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":210 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n- __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n- __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n@@ -630,22 +632,22 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":210 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":211 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":211 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":212 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":212 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":213 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":213 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":214 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":214 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":215 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -679,12 +681,12 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":223 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":224 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":224 */\n- __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":225 */\n+ __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -692,19 +694,19 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":226 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":227 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n- __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n- __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n@@ -712,22 +714,22 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":227 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":228 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":228 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":229 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":229 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":230 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":230 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":231 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":231 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":232 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -761,12 +763,12 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*_\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":239 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":240 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":240 */\n- __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":241 */\n+ __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -774,19 +776,19 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*_\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":242 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":243 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n- __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n+ __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n- __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n@@ -794,22 +796,22 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*_\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":243 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":244 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":244 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":245 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":245 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":246 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":246 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":247 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":247 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":248 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -838,31 +840,31 @@ static double __pyx_f_6mtrand_kahan_sum(double (*__pyx_v_darr),long __pyx_v_n) {\n long __pyx_v_i;\n double __pyx_r;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":252 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":253 */\n __pyx_v_sum = (__pyx_v_darr[0]);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":253 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":254 */\n __pyx_v_c = 0.0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":254 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":255 */\n for (__pyx_v_i = 1; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":255 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":256 */\n __pyx_v_y = ((__pyx_v_darr[__pyx_v_i]) - __pyx_v_c);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":256 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":257 */\n __pyx_v_t = (__pyx_v_sum + __pyx_v_y);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":257 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":258 */\n __pyx_v_c = ((__pyx_v_t - __pyx_v_sum) - __pyx_v_y);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":258 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":259 */\n __pyx_v_sum = __pyx_v_t;\n __pyx_L2:;\n }\n __pyx_L3:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":259 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":260 */\n __pyx_r = __pyx_v_sum;\n goto __pyx_L0;\n \n@@ -889,15 +891,15 @@ static int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObje\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_seed);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":282 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":283 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state (*))PyMem_Malloc((sizeof(rk_state ))));\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":284 */\n- __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":285 */\n+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_seed);\n- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -921,11 +923,11 @@ static void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {\n int __pyx_1;\n Py_INCREF(__pyx_v_self);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":287 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":288 */\n __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":288 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":289 */\n PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n@@ -960,41 +962,41 @@ static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyOb\n Py_INCREF(__pyx_v_seed);\n __pyx_v_obj = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_obj);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":302 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":303 */\n __pyx_1 = __pyx_v_seed == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":303 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":304 */\n __pyx_v_errcode = rk_randomseed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_seed);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n __pyx_1 = __pyx_4 == __pyx_2;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":305 */\n- __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":306 */\n+ __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; goto __pyx_L1;}\n rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":307 */\n- __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":308 */\n+ __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_3;\n __pyx_3 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":308 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":309 */\n init_by_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,((unsigned long (*))__pyx_v_obj->data),(__pyx_v_obj->dimensions[0]));\n }\n __pyx_L2:;\n@@ -1031,20 +1033,20 @@ static PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n __pyx_v_state = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_state);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":317 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":318 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n- __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n- __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n+ __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n __pyx_1 = 0;\n __pyx_4 = 0;\n- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_INCREF(((PyObject *)__pyx_1));\n@@ -1052,12 +1054,12 @@ static PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self,\n __pyx_v_state = ((PyObject *)__pyx_1);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":318 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":319 */\n memcpy(((void (*))__pyx_v_state->data),((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,(624 * (sizeof(long ))));\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":319 */\n- __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":320 */\n+ __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}\n Py_INCREF(__pyx_n_MT19937);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_n_MT19937);\n Py_INCREF(((PyObject *)__pyx_v_state));\n@@ -1085,11 +1087,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self,\n \n static PyObject *__pyx_n_ValueError;\n \n-static PyObject *__pyx_k60p;\n static PyObject *__pyx_k61p;\n+static PyObject *__pyx_k62p;\n \n-static char (__pyx_k60[]) = \"algorithm must be 'MT19937'\";\n-static char (__pyx_k61[]) = \"state must be 624 longs\";\n+static char (__pyx_k61[]) = \"algorithm must be 'MT19937'\";\n+static char (__pyx_k62[]) = \"state must be 624 longs\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_set_state[] = \"Set the state from a tuple.\\n \\n state = (\\'MT19937\\', int key[624], int pos)\\n \\n set_state(state)\\n \";\n@@ -1112,76 +1114,76 @@ static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self,\n __pyx_v_algorithm_name = Py_None; Py_INCREF(__pyx_v_algorithm_name);\n __pyx_v_key = Py_None; Py_INCREF(__pyx_v_key);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":330 */\n- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":331 */\n+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_algorithm_name);\n __pyx_v_algorithm_name = __pyx_2;\n __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":331 */\n- if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":332 */\n+ if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n __pyx_3 = __pyx_3 != 0;\n if (__pyx_3) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":332 */\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n- Py_INCREF(__pyx_k60p);\n- PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k60p);\n- __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":333 */\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k61p);\n+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k61p);\n+ __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":333 */\n- __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n- __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":334 */\n+ __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n+ __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_v_key);\n __pyx_v_key = __pyx_2;\n __pyx_2 = 0;\n- __pyx_4 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n- __pyx_3 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n+ __pyx_4 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n+ __pyx_3 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_v_pos = __pyx_3;\n- if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n+ if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":334 */\n- __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":335 */\n+ __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_4;\n __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":335 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":336 */\n __pyx_3 = ((__pyx_v_obj->dimensions[0]) != 624);\n if (__pyx_3) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":336 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}\n- __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}\n- Py_INCREF(__pyx_k61p);\n- PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k61p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":337 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k62p);\n+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k62p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":337 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":338 */\n memcpy(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,((void (*))__pyx_v_obj->data),(624 * (sizeof(long ))));\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":338 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":339 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos;\n \n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n@@ -1211,10 +1213,10 @@ static PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_se\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":342 */\n- __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}\n- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":343 */\n+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_r = __pyx_3;\n@@ -1246,12 +1248,12 @@ static PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_se\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_state);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":345 */\n- __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":346 */\n+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n Py_INCREF(__pyx_v_state);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_state);\n- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -1270,7 +1272,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_se\n return __pyx_r;\n }\n \n-static PyObject *__pyx_n_stats;\n+static PyObject *__pyx_n_random;\n static PyObject *__pyx_n___RandomState_ctor;\n \n static PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n@@ -1285,19 +1287,19 @@ static PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":348 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stats); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":349 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n+ __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n- __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n- __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n+ __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_5);\n@@ -1335,8 +1337,8 @@ static PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_s\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":356 */\n- __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":357 */\n+ __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n@@ -1365,8 +1367,8 @@ static PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":363 */\n- __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":364 */\n+ __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n@@ -1383,9 +1385,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k62p;\n+static PyObject *__pyx_k63p;\n \n-static char (__pyx_k62[]) = \"low >= high\";\n+static char (__pyx_k63[]) = \"low >= high\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_randint[] = \"Return random integers x such that low <= x < high.\\n\\n randint(low, high=None, size=None) -> random values\\n\\n If high is None, then 0 <= x < low.\\n \";\n@@ -1416,58 +1418,58 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":378 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":379 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":379 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":380 */\n __pyx_v_lo = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":380 */\n- __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":381 */\n+ __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n goto __pyx_L2;\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":382 */\n- __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":383 */\n+ __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}\n __pyx_v_lo = __pyx_2;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":383 */\n- __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":384 */\n+ __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":385 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":386 */\n __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":386 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":387 */\n __pyx_1 = (__pyx_v_diff < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":387 */\n- __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}\n- __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}\n- Py_INCREF(__pyx_k62p);\n- PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k62p);\n- __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":388 */\n+ __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k63p);\n+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k63p);\n+ __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __Pyx_Raise(__pyx_5, 0, 0);\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":389 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":390 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":390 */\n- __pyx_3 = PyLong_FromUnsignedLong(rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":391 */\n+ __pyx_3 = PyLong_FromUnsignedLong(rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n@@ -1475,19 +1477,19 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":392 */\n- __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n- __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":393 */\n+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n+ __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n- __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n __pyx_4 = 0;\n- __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n@@ -1495,22 +1497,22 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":393 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":394 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":394 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":395 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":395 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":396 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":396 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":397 */\n (__pyx_v_array_data[__pyx_v_i]) = (__pyx_v_lo + rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state));\n __pyx_L5:;\n }\n __pyx_L6:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":397 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":398 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -1547,22 +1549,22 @@ static PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyO\n Py_INCREF(__pyx_v_self);\n __pyx_v_bytestring = Py_None; Py_INCREF(__pyx_v_bytestring);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":405 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":406 */\n __pyx_v_bytes = PyMem_Malloc(__pyx_v_length);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":406 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":407 */\n rk_fill(__pyx_v_bytes,__pyx_v_length,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":407 */\n- __pyx_1 = PyString_FromString(((char (*))__pyx_v_bytes)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":408 */\n+ __pyx_1 = PyString_FromString(((char (*))__pyx_v_bytes)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; goto __pyx_L1;}\n Py_DECREF(__pyx_v_bytestring);\n __pyx_v_bytestring = __pyx_1;\n __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":408 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":409 */\n PyMem_Free(__pyx_v_bytes);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":409 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":410 */\n Py_INCREF(__pyx_v_bytestring);\n __pyx_r = __pyx_v_bytestring;\n goto __pyx_L0;\n@@ -1595,8 +1597,8 @@ static PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":416 */\n- __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_low,(__pyx_v_high - __pyx_v_low)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":417 */\n+ __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_low,(__pyx_v_high - __pyx_v_low)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n@@ -1637,25 +1639,25 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyOb\n }\n Py_INCREF(__pyx_v_self);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":425 */\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":426 */\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);\n- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}\n- if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}\n+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n+ if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n __pyx_4 = __pyx_4 == 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":426 */\n- __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":427 */\n+ __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n@@ -1665,12 +1667,12 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyOb\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":428 */\n- __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}\n- __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}\n- if (PyDict_SetItem(__pyx_1, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}\n- __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":429 */\n+ __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n+ __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n+ if (PyDict_SetItem(__pyx_1, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n+ __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n@@ -1716,25 +1718,25 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyO\n }\n Py_INCREF(__pyx_v_self);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":436 */\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":437 */\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);\n- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}\n- if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}\n+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n+ if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n __pyx_4 = __pyx_4 == 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":437 */\n- __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":438 */\n+ __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n@@ -1744,12 +1746,12 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyO\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":439 */\n- __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":440 */\n+ __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_args);\n- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; goto __pyx_L1;}\n+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n@@ -1794,17 +1796,17 @@ static PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v\n Py_INCREF(__pyx_v_high);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":448 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":449 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":449 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":450 */\n Py_INCREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n __pyx_v_high = __pyx_v_low;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":450 */\n- __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":451 */\n+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n Py_DECREF(__pyx_v_low);\n __pyx_v_low = __pyx_2;\n __pyx_2 = 0;\n@@ -1812,19 +1814,19 @@ static PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":451 */\n- __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n- __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n- __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":452 */\n+ __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n+ __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_INCREF(__pyx_v_low);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_low);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_size);\n __pyx_4 = 0;\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_4;\n@@ -1859,8 +1861,8 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":459 */\n- __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":460 */\n+ __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n@@ -1877,9 +1879,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k64p;\n+static PyObject *__pyx_k65p;\n \n-static char (__pyx_k64[]) = \"scale <= 0\";\n+static char (__pyx_k65[]) = \"scale <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_normal[] = \"Normal distribution (mean=loc, stdev=scale).\\n\\n normal(loc=0.0, scale=1.0, size=None) -> random values\\n \";\n@@ -1900,27 +1902,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, Py\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":466 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":467 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":467 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}\n- Py_INCREF(__pyx_k64p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k64p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":468 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k65p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k65p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":468 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":469 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -1939,11 +1941,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, Py\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k65p;\n static PyObject *__pyx_k66p;\n+static PyObject *__pyx_k67p;\n \n-static char (__pyx_k65[]) = \"a <= 0\";\n-static char (__pyx_k66[]) = \"b <= 0\";\n+static char (__pyx_k66[]) = \"a <= 0\";\n+static char (__pyx_k67[]) = \"b <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_beta[] = \"Beta distribution over [0, 1].\\n\\n beta(a, b, size=None) -> random values\\n \";\n@@ -1962,43 +1964,43 @@ static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyOb\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":475 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":476 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":476 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}\n- Py_INCREF(__pyx_k65p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k65p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":477 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k66p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_b <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":478 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}\n- Py_INCREF(__pyx_k66p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":479 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k67p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":479 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_a,__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":480 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_a,__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2017,9 +2019,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyOb\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k67p;\n+static PyObject *__pyx_k68p;\n \n-static char (__pyx_k67[]) = \"scale <= 0\";\n+static char (__pyx_k68[]) = \"scale <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_exponential[] = \"Exponential distribution.\\n\\n exponential(scale=1.0, size=None) -> random values\\n \";\n@@ -2038,27 +2040,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_sel\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":486 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":487 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":487 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}\n- Py_INCREF(__pyx_k67p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":488 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k68p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":488 */\n- __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":489 */\n+ __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2089,8 +2091,8 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":495 */\n- __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":496 */\n+ __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n@@ -2107,9 +2109,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k68p;\n+static PyObject *__pyx_k69p;\n \n-static char (__pyx_k68[]) = \"shape <= 0\";\n+static char (__pyx_k69[]) = \"shape <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_standard_gamma[] = \"Standard Gamma distribution.\\n\\n standard_gamma(shape, size=None) -> random values\\n \";\n@@ -2127,27 +2129,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":502 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":503 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":503 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}\n- Py_INCREF(__pyx_k68p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":504 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k69p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":504 */\n- __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":505 */\n+ __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2166,11 +2168,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k69p;\n static PyObject *__pyx_k70p;\n+static PyObject *__pyx_k71p;\n \n-static char (__pyx_k69[]) = \"shape <= 0\";\n-static char (__pyx_k70[]) = \"scale <= 0\";\n+static char (__pyx_k70[]) = \"shape <= 0\";\n+static char (__pyx_k71[]) = \"scale <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_gamma[] = \"Gamma distribution.\\n\\n gamma(shape, scale=1.0, size=None) -> random values\\n \";\n@@ -2190,43 +2192,43 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyO\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":511 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":512 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":512 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}\n- Py_INCREF(__pyx_k69p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":513 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k70p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":514 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}\n- Py_INCREF(__pyx_k70p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":515 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k71p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":515 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_shape,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":516 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_shape,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2245,11 +2247,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyO\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k71p;\n static PyObject *__pyx_k72p;\n+static PyObject *__pyx_k73p;\n \n-static char (__pyx_k71[]) = \"dfnum <= 0\";\n-static char (__pyx_k72[]) = \"dfden <= 0\";\n+static char (__pyx_k72[]) = \"dfnum <= 0\";\n+static char (__pyx_k73[]) = \"dfden <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_f[] = \"F distribution.\\n\\n f(dfnum, dfden, size=None) -> random values\\n \";\n@@ -2268,43 +2270,43 @@ static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObjec\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":522 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":523 */\n __pyx_1 = (__pyx_v_dfnum <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":523 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}\n- Py_INCREF(__pyx_k71p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":524 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k72p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":525 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}\n- Py_INCREF(__pyx_k72p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":526 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k73p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":526 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":527 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2323,13 +2325,13 @@ static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObjec\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k73p;\n static PyObject *__pyx_k74p;\n static PyObject *__pyx_k75p;\n+static PyObject *__pyx_k76p;\n \n-static char (__pyx_k73[]) = \"dfnum <= 1\";\n-static char (__pyx_k74[]) = \"dfden <= 0\";\n-static char (__pyx_k75[]) = \"nonc < 0\";\n+static char (__pyx_k74[]) = \"dfnum <= 1\";\n+static char (__pyx_k75[]) = \"dfden <= 0\";\n+static char (__pyx_k76[]) = \"nonc < 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_noncentral_f[] = \"Noncentral F distribution.\\n\\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\\n \";\n@@ -2349,59 +2351,59 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_se\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":533 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":534 */\n __pyx_1 = (__pyx_v_dfnum <= 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":534 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}\n- Py_INCREF(__pyx_k73p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":535 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k74p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":536 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}\n- Py_INCREF(__pyx_k74p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":537 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k75p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":538 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}\n- Py_INCREF(__pyx_k75p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":539 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k76p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":539 */\n- __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":540 */\n+ __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2420,9 +2422,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_se\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k76p;\n+static PyObject *__pyx_k77p;\n \n-static char (__pyx_k76[]) = \"df <= 0\";\n+static char (__pyx_k77[]) = \"df <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_chisquare[] = \"Chi^2 distribution.\\n\\n chisquare(df, size=None) -> random values\\n \";\n@@ -2440,27 +2442,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":547 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":548 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":548 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}\n- Py_INCREF(__pyx_k76p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":549 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k77p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":549 */\n- __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":550 */\n+ __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2479,11 +2481,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k77p;\n static PyObject *__pyx_k78p;\n+static PyObject *__pyx_k79p;\n \n-static char (__pyx_k77[]) = \"df <= 1\";\n-static char (__pyx_k78[]) = \"nonc < 0\";\n+static char (__pyx_k78[]) = \"df <= 1\";\n+static char (__pyx_k79[]) = \"nonc < 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_noncentral_chisquare[] = \"Noncentral Chi^2 distribution.\\n\\n noncentral_chisquare(df, nonc, size=None) -> random values\\n \";\n@@ -2502,43 +2504,43 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":556 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":557 */\n __pyx_1 = (__pyx_v_df <= 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":557 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}\n- Py_INCREF(__pyx_k77p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":558 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k78p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":559 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}\n- Py_INCREF(__pyx_k78p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":560 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k79p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":560 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_df,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":561 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_df,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2569,8 +2571,8 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":568 */\n- __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":569 */\n+ __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n@@ -2587,9 +2589,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k79p;\n+static PyObject *__pyx_k80p;\n \n-static char (__pyx_k79[]) = \"df <= 0\";\n+static char (__pyx_k80[]) = \"df <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_standard_t[] = \"Standard Student\\'s t distribution with df degrees of freedom.\\n\\n standard_t(df, size=None)\\n \";\n@@ -2607,27 +2609,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":575 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":576 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":576 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}\n- Py_INCREF(__pyx_k79p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":577 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k80p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":577 */\n- __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":578 */\n+ __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2646,9 +2648,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k80p;\n+static PyObject *__pyx_k81p;\n \n-static char (__pyx_k80[]) = \"kappa < 0\";\n+static char (__pyx_k81[]) = \"kappa < 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_vonmises[] = \"von Mises circular distribution with mode mu and dispersion parameter\\n kappa on [-pi, pi].\\n\\n vonmises(mu, kappa, size=None)\\n \";\n@@ -2667,27 +2669,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":585 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":586 */\n __pyx_1 = (__pyx_v_kappa < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":586 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}\n- Py_INCREF(__pyx_k80p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":587 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k81p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":587 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_mu,__pyx_v_kappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":588 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_mu,__pyx_v_kappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2706,9 +2708,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k81p;\n+static PyObject *__pyx_k82p;\n \n-static char (__pyx_k81[]) = \"a <= 0\";\n+static char (__pyx_k82[]) = \"a <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_pareto[] = \"Pareto distribution.\\n\\n pareto(a, size=None)\\n \";\n@@ -2726,27 +2728,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, Py\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":594 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":595 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":595 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}\n- Py_INCREF(__pyx_k81p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":596 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k82p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":596 */\n- __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":597 */\n+ __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2765,9 +2767,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, Py\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k82p;\n+static PyObject *__pyx_k83p;\n \n-static char (__pyx_k82[]) = \"a <= 0\";\n+static char (__pyx_k83[]) = \"a <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_weibull[] = \"Weibull distribution.\\n\\n weibull(a, size=None)\\n \";\n@@ -2785,27 +2787,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":603 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":604 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":604 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}\n- Py_INCREF(__pyx_k82p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":605 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k83p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":605 */\n- __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":606 */\n+ __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2824,9 +2826,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, P\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k83p;\n+static PyObject *__pyx_k84p;\n \n-static char (__pyx_k83[]) = \"a <= 0\";\n+static char (__pyx_k84[]) = \"a <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_power[] = \"Power distribution.\\n\\n power(a, size=None)\\n \";\n@@ -2844,27 +2846,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyO\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":612 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":613 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":613 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}\n- Py_INCREF(__pyx_k83p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":614 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k84p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":614 */\n- __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":615 */\n+ __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2883,9 +2885,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyO\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k84p;\n+static PyObject *__pyx_k85p;\n \n-static char (__pyx_k84[]) = \"scale <= 0.0\";\n+static char (__pyx_k85[]) = \"scale <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_laplace[] = \"Laplace distribution.\\n \\n laplace(loc=0.0, scale=1.0, size=None)\\n \";\n@@ -2906,27 +2908,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":621 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":622 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":622 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}\n- Py_INCREF(__pyx_k84p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":623 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k85p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":623 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":624 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -2945,9 +2947,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, P\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k85p;\n+static PyObject *__pyx_k86p;\n \n-static char (__pyx_k85[]) = \"scale <= 0.0\";\n+static char (__pyx_k86[]) = \"scale <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_gumbel[] = \"Gumbel distribution.\\n \\n gumbel(loc=0.0, scale=1.0, size=None)\\n \";\n@@ -2968,27 +2970,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, Py\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":630 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":631 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":631 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}\n- Py_INCREF(__pyx_k85p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":632 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k86p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":632 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":633 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3007,9 +3009,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, Py\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k86p;\n+static PyObject *__pyx_k87p;\n \n-static char (__pyx_k86[]) = \"scale <= 0.0\";\n+static char (__pyx_k87[]) = \"scale <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_logistic[] = \"Logistic distribution.\\n \\n logistic(loc=0.0, scale=1.0, size=None)\\n \";\n@@ -3030,27 +3032,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":639 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":640 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":640 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}\n- Py_INCREF(__pyx_k86p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":641 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k87p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":641 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":642 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3069,9 +3071,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k87p;\n+static PyObject *__pyx_k88p;\n \n-static char (__pyx_k87[]) = \"sigma <= 0.0\";\n+static char (__pyx_k88[]) = \"sigma <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_lognormal[] = \"Log-normal distribution.\\n \\n Note that the mean parameter is not the mean of this distribution, but \\n the underlying normal distribution.\\n \\n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\\n \\n lognormal(mean=0.0, sigma=1.0, size=None)\\n \";\n@@ -3092,27 +3094,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":653 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":654 */\n __pyx_1 = (__pyx_v_sigma <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":654 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}\n- Py_INCREF(__pyx_k87p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":655 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k88p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":655 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_mean,__pyx_v_sigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":656 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_mean,__pyx_v_sigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3131,9 +3133,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k88p;\n+static PyObject *__pyx_k89p;\n \n-static char (__pyx_k88[]) = \"mode <= 0.0\";\n+static char (__pyx_k89[]) = \"mode <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_rayleigh[] = \"Rayleigh distribution.\\n \\n rayleigh(mode, size=None)\\n \";\n@@ -3151,27 +3153,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":662 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":663 */\n __pyx_1 = (__pyx_v_mode <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":663 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}\n- Py_INCREF(__pyx_k88p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":664 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k89p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":664 */\n- __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_mode); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":665 */\n+ __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_mode); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3190,11 +3192,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k89p;\n static PyObject *__pyx_k90p;\n+static PyObject *__pyx_k91p;\n \n-static char (__pyx_k89[]) = \"mean <= 0.0\";\n-static char (__pyx_k90[]) = \"scale <= 0.0\";\n+static char (__pyx_k90[]) = \"mean <= 0.0\";\n+static char (__pyx_k91[]) = \"scale <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_wald[] = \"Wald (inverse Gaussian) distribution.\\n \\n wald(mean, scale, size=None)\\n \";\n@@ -3213,43 +3215,43 @@ static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyOb\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":671 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":672 */\n __pyx_1 = (__pyx_v_mean <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":672 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}\n- Py_INCREF(__pyx_k89p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":673 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k90p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":674 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}\n- Py_INCREF(__pyx_k90p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":675 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k91p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":675 */\n- __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_mean,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":676 */\n+ __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_mean,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3268,13 +3270,13 @@ static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyOb\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k91p;\n static PyObject *__pyx_k92p;\n static PyObject *__pyx_k93p;\n+static PyObject *__pyx_k94p;\n \n-static char (__pyx_k91[]) = \"left > mode\";\n-static char (__pyx_k92[]) = \"mode > right\";\n-static char (__pyx_k93[]) = \"left == right\";\n+static char (__pyx_k92[]) = \"left > mode\";\n+static char (__pyx_k93[]) = \"mode > right\";\n+static char (__pyx_k94[]) = \"left == right\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_triangular[] = \"Triangular distribution starting at left, peaking at mode, and \\n ending at right (left <= mode <= right).\\n \\n triangular(left, mode, right, size=None)\\n \";\n@@ -3294,59 +3296,59 @@ static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":683 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":684 */\n __pyx_1 = (__pyx_v_left > __pyx_v_mode);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":684 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}\n- Py_INCREF(__pyx_k91p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":685 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k92p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_mode > __pyx_v_right);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":686 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}\n- Py_INCREF(__pyx_k92p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":687 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k93p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_left == __pyx_v_right);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":688 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}\n- Py_INCREF(__pyx_k93p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":689 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k94p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":689 */\n- __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_left,__pyx_v_mode,__pyx_v_right); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":690 */\n+ __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_left,__pyx_v_mode,__pyx_v_right); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3365,13 +3367,13 @@ static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k94p;\n static PyObject *__pyx_k95p;\n static PyObject *__pyx_k96p;\n+static PyObject *__pyx_k97p;\n \n-static char (__pyx_k94[]) = \"n <= 0\";\n-static char (__pyx_k95[]) = \"p < 0\";\n-static char (__pyx_k96[]) = \"p > 1\";\n+static char (__pyx_k95[]) = \"n <= 0\";\n+static char (__pyx_k96[]) = \"p < 0\";\n+static char (__pyx_k97[]) = \"p > 1\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_binomial[] = \"Binomial distribution of n trials and p probability of success.\\n\\n binomial(n, p, size=None) -> random values\\n \";\n@@ -3390,59 +3392,59 @@ static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":698 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":699 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":699 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}\n- Py_INCREF(__pyx_k94p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":700 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k95p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":701 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}\n- Py_INCREF(__pyx_k95p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":702 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k96p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":703 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}\n- Py_INCREF(__pyx_k96p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":704 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k97p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":704 */\n- __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":705 */\n+ __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3461,13 +3463,13 @@ static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k97p;\n static PyObject *__pyx_k98p;\n static PyObject *__pyx_k99p;\n+static PyObject *__pyx_k100p;\n \n-static char (__pyx_k97[]) = \"n <= 0\";\n-static char (__pyx_k98[]) = \"p < 0\";\n-static char (__pyx_k99[]) = \"p > 1\";\n+static char (__pyx_k98[]) = \"n <= 0\";\n+static char (__pyx_k99[]) = \"p < 0\";\n+static char (__pyx_k100[]) = \"p > 1\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_negative_binomial[] = \"Negative Binomial distribution.\\n\\n negative_binomial(n, p, size=None) -> random values\\n \";\n@@ -3486,59 +3488,59 @@ static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":711 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":712 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":712 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}\n- Py_INCREF(__pyx_k97p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":713 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k98p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":714 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}\n- Py_INCREF(__pyx_k98p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":715 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k99p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":716 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}\n- Py_INCREF(__pyx_k99p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":717 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k100p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":717 */\n- __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":718 */\n+ __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3557,9 +3559,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k100p;\n+static PyObject *__pyx_k101p;\n \n-static char (__pyx_k100[]) = \"lam <= 0\";\n+static char (__pyx_k101[]) = \"lam <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_poisson[] = \"Poisson distribution.\\n\\n poisson(lam=1.0, size=None) -> random values\\n \";\n@@ -3578,27 +3580,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":725 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":726 */\n __pyx_1 = (__pyx_v_lam <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":726 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}\n- Py_INCREF(__pyx_k100p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":727 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k101p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":727 */\n- __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_lam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":728 */\n+ __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_lam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3617,9 +3619,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, P\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k101p;\n+static PyObject *__pyx_k102p;\n \n-static char (__pyx_k101[]) = \"a <= 1.0\";\n+static char (__pyx_k102[]) = \"a <= 1.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_zipf[] = \"Zipf distribution.\\n \\n zipf(a, size=None)\\n \";\n@@ -3637,27 +3639,27 @@ static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyOb\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":734 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":735 */\n __pyx_1 = (__pyx_v_a <= 1.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":735 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}\n- Py_INCREF(__pyx_k101p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":736 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k102p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":736 */\n- __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":737 */\n+ __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3676,11 +3678,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyOb\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k102p;\n static PyObject *__pyx_k103p;\n+static PyObject *__pyx_k104p;\n \n-static char (__pyx_k102[]) = \"p < 0.0\";\n-static char (__pyx_k103[]) = \"p > 1.0\";\n+static char (__pyx_k103[]) = \"p < 0.0\";\n+static char (__pyx_k104[]) = \"p > 1.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_geometric[] = \"Geometric distribution with p being the probability of \\\"success\\\" on\\n an individual trial.\\n \\n geometric(p, size=None)\\n \";\n@@ -3698,43 +3700,43 @@ static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":744 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":745 */\n __pyx_1 = (__pyx_v_p < 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":745 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}\n- Py_INCREF(__pyx_k102p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":746 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k103p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":747 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}\n- Py_INCREF(__pyx_k103p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":748 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k104p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":748 */\n- __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":749 */\n+ __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3753,15 +3755,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k104p;\n static PyObject *__pyx_k105p;\n static PyObject *__pyx_k106p;\n static PyObject *__pyx_k107p;\n+static PyObject *__pyx_k108p;\n \n-static char (__pyx_k104[]) = \"ngood < 1\";\n-static char (__pyx_k105[]) = \"nbad < 1\";\n-static char (__pyx_k106[]) = \"ngood + nbad < nsample\";\n-static char (__pyx_k107[]) = \"nsample < 1\";\n+static char (__pyx_k105[]) = \"ngood < 1\";\n+static char (__pyx_k106[]) = \"nbad < 1\";\n+static char (__pyx_k107[]) = \"ngood + nbad < nsample\";\n+static char (__pyx_k108[]) = \"nsample < 1\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_hypergeometric[] = \"Hypergeometric distribution.\\n \\n Consider an urn with ngood \\\"good\\\" balls and nbad \\\"bad\\\" balls. If one \\n were to draw nsample balls from the urn without replacement, then \\n the hypergeometric distribution describes the distribution of \\\"good\\\" \\n balls in the sample.\\n \\n hypergeometric(ngood, nbad, nsample, size=None) \\n \";\n@@ -3781,75 +3783,75 @@ static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":760 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":761 */\n __pyx_1 = (__pyx_v_ngood < 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":761 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}\n- Py_INCREF(__pyx_k104p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":762 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k105p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nbad < 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":763 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}\n- Py_INCREF(__pyx_k105p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":764 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k106p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = ((__pyx_v_ngood + __pyx_v_nbad) < __pyx_v_nsample);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":765 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}\n- Py_INCREF(__pyx_k106p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":766 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k107p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nsample < 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":767 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}\n- Py_INCREF(__pyx_k107p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);\n- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":768 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k108p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k108p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":768 */\n- __pyx_2 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ngood,__pyx_v_nbad,__pyx_v_nsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":769 */\n+ __pyx_2 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ngood,__pyx_v_nbad,__pyx_v_nsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3868,6 +3870,83 @@ static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_\n return __pyx_r;\n }\n \n+static PyObject *__pyx_k109p;\n+static PyObject *__pyx_k110p;\n+\n+static char (__pyx_k109[]) = \"p < 0\";\n+static char (__pyx_k110[]) = \"p > 1\";\n+\n+static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n+static char __pyx_doc_6mtrand_11RandomState_logseries[] = \"Logarithmic series distribution.\\n \\n logseries(p, size=None)\\n \";\n+static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n+ double __pyx_v_p;\n+ PyObject *__pyx_v_size = 0;\n+ PyObject *__pyx_r;\n+ int __pyx_1;\n+ PyObject *__pyx_2 = 0;\n+ PyObject *__pyx_3 = 0;\n+ PyObject *__pyx_4 = 0;\n+ static char *__pyx_argnames[] = {\"p\",\"size\",0};\n+ __pyx_v_size = __pyx_k56;\n+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;\n+ Py_INCREF(__pyx_v_self);\n+ Py_INCREF(__pyx_v_size);\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":777 */\n+ __pyx_1 = (__pyx_v_p < 0);\n+ if (__pyx_1) {\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":778 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k109p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+ Py_DECREF(__pyx_3); __pyx_3 = 0;\n+ __Pyx_Raise(__pyx_4, 0, 0);\n+ Py_DECREF(__pyx_4); __pyx_4 = 0;\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n+ goto __pyx_L2;\n+ }\n+ __pyx_1 = (__pyx_v_p > 1);\n+ if (__pyx_1) {\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":780 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k110p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k110p);\n+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+ Py_DECREF(__pyx_3); __pyx_3 = 0;\n+ __Pyx_Raise(__pyx_4, 0, 0);\n+ Py_DECREF(__pyx_4); __pyx_4 = 0;\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n+ goto __pyx_L2;\n+ }\n+ __pyx_L2:;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":781 */\n+ __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; goto __pyx_L1;}\n+ __pyx_r = __pyx_2;\n+ __pyx_2 = 0;\n+ goto __pyx_L0;\n+\n+ __pyx_r = Py_None; Py_INCREF(__pyx_r);\n+ goto __pyx_L0;\n+ __pyx_L1:;\n+ Py_XDECREF(__pyx_2);\n+ Py_XDECREF(__pyx_3);\n+ Py_XDECREF(__pyx_4);\n+ __Pyx_AddTraceback(\"mtrand.RandomState.logseries\");\n+ __pyx_r = 0;\n+ __pyx_L0:;\n+ Py_DECREF(__pyx_v_self);\n+ Py_DECREF(__pyx_v_size);\n+ return __pyx_r;\n+}\n+\n static PyObject *__pyx_n_array;\n static PyObject *__pyx_n_shape;\n static PyObject *__pyx_n_ArgumentError;\n@@ -3883,13 +3962,13 @@ static PyObject *__pyx_n_sqrt;\n static PyObject *__pyx_n_add;\n static PyObject *__pyx_n_tuple;\n \n-static PyObject *__pyx_k108p;\n-static PyObject *__pyx_k109p;\n-static PyObject *__pyx_k110p;\n+static PyObject *__pyx_k111p;\n+static PyObject *__pyx_k112p;\n+static PyObject *__pyx_k113p;\n \n-static char (__pyx_k108[]) = \"mean must be 1 dimensional\";\n-static char (__pyx_k109[]) = \"cov must be 2 dimensional and square\";\n-static char (__pyx_k110[]) = \"mean and cov must have same length\";\n+static char (__pyx_k111[]) = \"mean must be 1 dimensional\";\n+static char (__pyx_k112[]) = \"cov must be 2 dimensional and square\";\n+static char (__pyx_k113[]) = \"mean and cov must have same length\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_multivariate_normal[] = \"Return an array containing multivariate normally distributed random numbers\\n with specified mean and covariance.\\n\\n multivariate_normal(mean, cov) -> random values\\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\\n\\n mean must be a 1 dimensional array. cov must be a square two dimensional\\n array with the same number of rows and columns as mean has elements.\\n\\n The first form returns a single 1-D array containing a multivariate\\n normal.\\n\\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\\n normal.\\n \";\n@@ -3910,7 +3989,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n int __pyx_4;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"cov\",\"size\",0};\n- __pyx_v_size = __pyx_k56;\n+ __pyx_v_size = __pyx_k57;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"OO|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_cov, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_mean);\n@@ -3923,40 +4002,40 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s);\n __pyx_v_v = Py_None; Py_INCREF(__pyx_v_v);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":790 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":802 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}\n+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_INCREF(__pyx_v_mean);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_mean);\n- __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_mean);\n __pyx_v_mean = __pyx_3;\n __pyx_3 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":791 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}\n- __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":803 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n+ __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_INCREF(__pyx_v_cov);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_cov);\n- __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}\n+ __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_cov);\n __pyx_v_cov = __pyx_2;\n __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":792 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":804 */\n __pyx_4 = __pyx_v_size == Py_None;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":793 */\n- __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":805 */\n+ __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_1;\n __pyx_1 = 0;\n@@ -3964,140 +4043,140 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":795 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":807 */\n Py_INCREF(__pyx_v_size);\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_v_size;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":796 */\n- __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n- __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":808 */\n+ __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);\n __pyx_2 = 0;\n- __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n+ __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n- if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n+ if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":797 */\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}\n- Py_INCREF(__pyx_k108p);\n- PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k108p);\n- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":809 */\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k111p);\n+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k111p);\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_3, 0, 0);\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":798 */\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":810 */\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n __pyx_2 = 0;\n- __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n+ __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n- if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (!__pyx_4) {\n- __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n- __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n- __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n- __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n- __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n+ if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n }\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":799 */\n- __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}\n- Py_INCREF(__pyx_k109p);\n- PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k109p);\n- __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":811 */\n+ __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k112p);\n+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);\n+ __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_1, 0, 0);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n goto __pyx_L4;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":800 */\n- __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n- __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":812 */\n+ __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n+ __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n- __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n+ __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n+ __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n- if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n+ if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":801 */\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}\n- __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}\n- Py_INCREF(__pyx_k110p);\n- PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k110p);\n- __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":813 */\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k113p);\n+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k113p);\n+ __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __Pyx_Raise(__pyx_2, 0, 0);\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n goto __pyx_L5;\n }\n __pyx_L5:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":803 */\n- __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n- __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":815 */\n+ __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_5, 1, __pyx_1);\n __pyx_1 = 0;\n- __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n+ __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n- __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n+ __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":804 */\n- __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":816 */\n+ __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyList_SET_ITEM(__pyx_1, 0, __pyx_v_shape);\n Py_DECREF(__pyx_v_shape);\n@@ -4107,178 +4186,178 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n }\n __pyx_L6:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":805 */\n- __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n- __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":817 */\n+ __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n+ __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);\n __pyx_5 = 0;\n- __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n+ __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_final_shape);\n __pyx_v_final_shape = __pyx_1;\n __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":806 */\n- __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n- __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n- __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":818 */\n+ __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n+ __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n+ __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n __pyx_1 = 0;\n- __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n+ __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":810 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n- __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":822 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n+ __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n- __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);\n- __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);\n __pyx_3 = 0;\n- __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n+ __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_x);\n __pyx_v_x = __pyx_5;\n __pyx_5 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":811 */\n- __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n- __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":823 */\n+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n+ __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_final_shape);\n- __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n- __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n+ __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n- __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n- __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_1);\n __pyx_1 = 0;\n- __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n- __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n- __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n- __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n+ __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n+ __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n+ __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);\n PyTuple_SET_ITEM(__pyx_1, 1, __pyx_5);\n __pyx_3 = 0;\n __pyx_5 = 0;\n- if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":821 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_linalg); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":833 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_linalg); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_singular_value_decomposition); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n+ __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_singular_value_decomposition); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_INCREF(__pyx_v_cov);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_cov);\n- __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n+ __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n+ __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_u);\n __pyx_v_u = __pyx_3;\n __pyx_3 = 0;\n- __pyx_5 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n+ __pyx_5 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_s);\n __pyx_v_s = __pyx_5;\n __pyx_5 = 0;\n- __pyx_1 = __Pyx_UnpackItem(__pyx_2, 2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n+ __pyx_1 = __Pyx_UnpackItem(__pyx_2, 2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_v);\n __pyx_v_v = __pyx_1;\n __pyx_1 = 0;\n- if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n+ if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":822 */\n- __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n- __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_matrixmultiply); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":834 */\n+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n+ __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_matrixmultiply); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_INCREF(__pyx_v_s);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_s);\n- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n+ __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n Py_INCREF(__pyx_v_v);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_v);\n __pyx_2 = 0;\n- __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n+ __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_x);\n __pyx_v_x = __pyx_1;\n __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":825 */\n- __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}\n- __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":837 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n+ __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_INCREF(__pyx_v_mean);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_mean);\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_x);\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_x);\n- __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}\n+ __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":826 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}\n- __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":838 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);\n- __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n- if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":827 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":839 */\n Py_INCREF(__pyx_v_x);\n __pyx_r = __pyx_v_x;\n goto __pyx_L0;\n@@ -4308,9 +4387,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n \n static PyObject *__pyx_n_zeros;\n \n-static PyObject *__pyx_k111p;\n+static PyObject *__pyx_k114p;\n \n-static char (__pyx_k111[]) = \"sum(pvals) > 1.0\";\n+static char (__pyx_k114[]) = \"sum(pvals) > 1.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_multinomial[] = \"Multinomial distribution.\\n \\n multinomial(n, pvals, size=None) -> random values\\n\\n pvals is a sequence of probabilities that should sum to 1 (however, the\\n last element is always assumed to account for the remaining probability\\n as long as sum(pvals[:-1]) <= 1).\\n \";\n@@ -4337,7 +4416,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n long __pyx_4;\n int __pyx_5;\n static char *__pyx_argnames[] = {\"n\",\"pvals\",\"size\",0};\n- __pyx_v_size = __pyx_k57;\n+ __pyx_v_size = __pyx_k58;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lO|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_pvals, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_pvals);\n@@ -4347,53 +4426,53 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape);\n __pyx_v_multin = Py_None; Py_INCREF(__pyx_v_multin);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":845 */\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":857 */\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_INCREF(__pyx_v_pvals);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_pvals);\n- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}\n+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_v_d = __pyx_4;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":846 */\n- __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":858 */\n+ __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_parr));\n __pyx_v_parr = __pyx_1;\n __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":847 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":859 */\n __pyx_v_pix = ((double (*))__pyx_v_parr->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":849 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":861 */\n __pyx_5 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix,(__pyx_v_d - 1)) > 1.0);\n if (__pyx_5) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":850 */\n- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}\n- Py_INCREF(__pyx_k111p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k111p);\n- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":862 */\n+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n+ Py_INCREF(__pyx_k114p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k114p);\n+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_1, 0, 0);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}\n+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":852 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":864 */\n __pyx_5 = __pyx_v_size == Py_None;\n if (__pyx_5) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":853 */\n- __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":865 */\n+ __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n@@ -4401,22 +4480,22 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n __pyx_3 = 0;\n goto __pyx_L3;\n }\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n __pyx_5 = __pyx_3 == __pyx_1;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_5) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":855 */\n- __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; goto __pyx_L1;}\n- __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":867 */\n+ __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);\n@@ -4428,12 +4507,12 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":857 */\n- __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":869 */\n+ __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);\n __pyx_1 = 0;\n- __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n+ __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n@@ -4441,90 +4520,90 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n }\n __pyx_L3:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":859 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":871 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n- __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n+ __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_1);\n __pyx_1 = 0;\n- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_multin);\n __pyx_v_multin = __pyx_1;\n __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":860 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":872 */\n Py_INCREF(((PyObject *)__pyx_v_multin));\n Py_DECREF(((PyObject *)__pyx_v_mnarr));\n __pyx_v_mnarr = ((PyObject *)__pyx_v_multin);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":861 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":873 */\n __pyx_v_mnix = ((long (*))__pyx_v_mnarr->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":862 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":874 */\n __pyx_v_i = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":863 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":875 */\n while (1) {\n __pyx_L4:;\n __pyx_5 = (__pyx_v_i < PyArray_SIZE(__pyx_v_mnarr));\n if (!__pyx_5) break;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":864 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":876 */\n __pyx_v_Sum = 1.0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":865 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":877 */\n __pyx_v_dn = __pyx_v_n;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":866 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":878 */\n __pyx_4 = (__pyx_v_d - 1);\n for (__pyx_v_j = 0; __pyx_v_j < __pyx_4; ++__pyx_v_j) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":867 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":879 */\n (__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));\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":868 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":880 */\n __pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]));\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":869 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":881 */\n __pyx_5 = (__pyx_v_dn <= 0);\n if (__pyx_5) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":870 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":882 */\n goto __pyx_L7;\n goto __pyx_L8;\n }\n __pyx_L8:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":871 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":883 */\n __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j]));\n __pyx_L6:;\n }\n __pyx_L7:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":872 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":884 */\n __pyx_5 = (__pyx_v_dn > 0);\n if (__pyx_5) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":873 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":885 */\n (__pyx_v_mnix[((__pyx_v_i + __pyx_v_d) - 1)]) = __pyx_v_dn;\n goto __pyx_L9;\n }\n __pyx_L9:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":875 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":887 */\n __pyx_v_i = (__pyx_v_i + __pyx_v_d);\n }\n __pyx_L5:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":877 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":889 */\n Py_INCREF(__pyx_v_multin);\n __pyx_r = __pyx_v_multin;\n goto __pyx_L0;\n@@ -4565,48 +4644,48 @@ static PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":888 */\n- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":900 */\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n- __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n+ __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n+ __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_v_i = __pyx_4;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":889 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":901 */\n while (1) {\n __pyx_L2:;\n __pyx_5 = (__pyx_v_i > 0);\n if (!__pyx_5) break;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":890 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":902 */\n __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":891 */\n- __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n- __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":903 */\n+ __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n+ __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n- __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n- __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n+ __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n- __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n- if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n+ __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n+ if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n- if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n+ __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n+ if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":892 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":904 */\n __pyx_v_i = (__pyx_v_i - 1);\n }\n __pyx_L3:;\n@@ -4628,7 +4707,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, P\n static PyObject *__pyx_n_arange;\n \n static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n-static char __pyx_doc_6mtrand_11RandomState_permutation[] = \"Given an integer, return a shuffled sequence of integers >= 0 and \\n < x.\\n\\n permutation(x)\\n \";\n+static char __pyx_doc_6mtrand_11RandomState_permutation[] = \"Given an integer, return a shuffled sequence of integers >= 0 and \\n < x; given a sequence, return a shuffled array copy.\\n\\n permutation(x)\\n \";\n static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_x = 0;\n PyObject *__pyx_v_arr;\n@@ -4636,37 +4715,71 @@ static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_sel\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n+ int __pyx_4;\n static char *__pyx_argnames[] = {\"x\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_x)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n __pyx_v_arr = Py_None; Py_INCREF(__pyx_v_arr);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":900 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_arange); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":912 */\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n- PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x);\n- __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n+ __pyx_4 = __pyx_3 == __pyx_1;\n+ Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- Py_DECREF(__pyx_v_arr);\n- __pyx_v_arr = __pyx_3;\n- __pyx_3 = 0;\n+ if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":901 */\n- __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; goto __pyx_L1;}\n- __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":913 */\n+ __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n+ __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_arange); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n+ Py_INCREF(__pyx_v_x);\n+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x);\n+ __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n+ Py_DECREF(__pyx_3); __pyx_3 = 0;\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ Py_DECREF(__pyx_v_arr);\n+ __pyx_v_arr = __pyx_2;\n+ __pyx_2 = 0;\n+ goto __pyx_L2;\n+ }\n+ /*else*/ {\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":915 */\n+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n+ __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n+ Py_DECREF(__pyx_3); __pyx_3 = 0;\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n+ Py_INCREF(__pyx_v_x);\n+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+ Py_DECREF(__pyx_v_arr);\n+ __pyx_v_arr = __pyx_3;\n+ __pyx_3 = 0;\n+ }\n+ __pyx_L2:;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":916 */\n+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_INCREF(__pyx_v_arr);\n- PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_arr);\n- __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_arr);\n+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":902 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":917 */\n Py_INCREF(__pyx_v_arr);\n __pyx_r = __pyx_v_arr;\n goto __pyx_L0;\n@@ -4719,6 +4832,7 @@ static __Pyx_InternTabEntry __pyx_intern_tab[] = {\n {&__pyx_n_list, \"list\"},\n {&__pyx_n_logistic, \"logistic\"},\n {&__pyx_n_lognormal, \"lognormal\"},\n+ {&__pyx_n_logseries, \"logseries\"},\n {&__pyx_n_matrixmultiply, \"matrixmultiply\"},\n {&__pyx_n_multinomial, \"multinomial\"},\n {&__pyx_n_multiply, \"multiply\"},\n@@ -4734,6 +4848,7 @@ static __Pyx_InternTabEntry __pyx_intern_tab[] = {\n {&__pyx_n_rand, \"rand\"},\n {&__pyx_n_randint, \"randint\"},\n {&__pyx_n_randn, \"randn\"},\n+ {&__pyx_n_random, \"random\"},\n {&__pyx_n_random_integers, \"random_integers\"},\n {&__pyx_n_random_sample, \"random_sample\"},\n {&__pyx_n_rayleigh, \"rayleigh\"},\n@@ -4751,7 +4866,6 @@ static __Pyx_InternTabEntry __pyx_intern_tab[] = {\n {&__pyx_n_standard_gamma, \"standard_gamma\"},\n {&__pyx_n_standard_normal, \"standard_normal\"},\n {&__pyx_n_standard_t, \"standard_t\"},\n- {&__pyx_n_stats, \"stats\"},\n {&__pyx_n_triangular, \"triangular\"},\n {&__pyx_n_tuple, \"tuple\"},\n {&__pyx_n_type, \"type\"},\n@@ -4765,10 +4879,9 @@ static __Pyx_InternTabEntry __pyx_intern_tab[] = {\n };\n \n static __Pyx_StringTabEntry __pyx_string_tab[] = {\n- {&__pyx_k60p, __pyx_k60, sizeof(__pyx_k60)},\n {&__pyx_k61p, __pyx_k61, sizeof(__pyx_k61)},\n {&__pyx_k62p, __pyx_k62, sizeof(__pyx_k62)},\n- {&__pyx_k64p, __pyx_k64, sizeof(__pyx_k64)},\n+ {&__pyx_k63p, __pyx_k63, sizeof(__pyx_k63)},\n {&__pyx_k65p, __pyx_k65, sizeof(__pyx_k65)},\n {&__pyx_k66p, __pyx_k66, sizeof(__pyx_k66)},\n {&__pyx_k67p, __pyx_k67, sizeof(__pyx_k67)},\n@@ -4816,6 +4929,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {\n {&__pyx_k109p, __pyx_k109, sizeof(__pyx_k109)},\n {&__pyx_k110p, __pyx_k110, sizeof(__pyx_k110)},\n {&__pyx_k111p, __pyx_k111, sizeof(__pyx_k111)},\n+ {&__pyx_k112p, __pyx_k112, sizeof(__pyx_k112)},\n+ {&__pyx_k113p, __pyx_k113, sizeof(__pyx_k113)},\n+ {&__pyx_k114p, __pyx_k114, sizeof(__pyx_k114)},\n {0, 0, 0}\n };\n \n@@ -4895,6 +5011,7 @@ static struct PyMethodDef __pyx_methods_6mtrand_RandomState[] = {\n {\"zipf\", (PyCFunction)__pyx_f_6mtrand_11RandomState_zipf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_zipf},\n {\"geometric\", (PyCFunction)__pyx_f_6mtrand_11RandomState_geometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_geometric},\n {\"hypergeometric\", (PyCFunction)__pyx_f_6mtrand_11RandomState_hypergeometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_hypergeometric},\n+ {\"logseries\", (PyCFunction)__pyx_f_6mtrand_11RandomState_logseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logseries},\n {\"multivariate_normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_multivariate_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multivariate_normal},\n {\"multinomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_multinomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multinomial},\n {\"shuffle\", (PyCFunction)__pyx_f_6mtrand_11RandomState_shuffle, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_shuffle},\n@@ -5034,182 +5151,182 @@ DL_EXPORT(void) initmtrand(void) {\n if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n __pyx_ptype_6mtrand_ArrayType = __Pyx_ImportType(\"scipy\", \"ArrayType\", sizeof(PyArrayObject)); if (!__pyx_ptype_6mtrand_ArrayType) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; goto __pyx_L1;}\n- if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}\n- if (PyObject_SetAttrString(__pyx_m, \"RandomState\", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}\n+ if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}\n+ if (PyObject_SetAttrString(__pyx_m, \"RandomState\", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}\n __pyx_ptype_6mtrand_RandomState = &__pyx_type_6mtrand_RandomState;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":113 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":114 */\n import_array();\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":115 */\n- __pyx_1 = __Pyx_Import(__pyx_n_scipy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}\n- if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":116 */\n+ __pyx_1 = __Pyx_Import(__pyx_n_scipy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":281 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":282 */\n Py_INCREF(Py_None);\n __pyx_k2 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":290 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":291 */\n Py_INCREF(Py_None);\n __pyx_k3 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":351 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":352 */\n Py_INCREF(Py_None);\n __pyx_k4 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":358 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":359 */\n Py_INCREF(Py_None);\n __pyx_k5 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":365 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":366 */\n Py_INCREF(Py_None);\n __pyx_k6 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k7 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":411 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":412 */\n __pyx_k8 = 0.0;\n __pyx_k9 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k10 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":441 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":442 */\n Py_INCREF(Py_None);\n __pyx_k11 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k12 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":454 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":455 */\n Py_INCREF(Py_None);\n __pyx_k13 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":461 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":462 */\n __pyx_k14 = 0.0;\n __pyx_k15 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k16 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":470 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":471 */\n Py_INCREF(Py_None);\n __pyx_k17 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":481 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":482 */\n __pyx_k18 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k19 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":490 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":491 */\n Py_INCREF(Py_None);\n __pyx_k20 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":497 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":498 */\n Py_INCREF(Py_None);\n __pyx_k21 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":506 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":507 */\n __pyx_k22 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k23 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":517 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":518 */\n Py_INCREF(Py_None);\n __pyx_k24 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":528 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":529 */\n Py_INCREF(Py_None);\n __pyx_k25 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":542 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":543 */\n Py_INCREF(Py_None);\n __pyx_k26 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":551 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":552 */\n Py_INCREF(Py_None);\n __pyx_k27 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":563 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":564 */\n Py_INCREF(Py_None);\n __pyx_k28 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":570 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":571 */\n Py_INCREF(Py_None);\n __pyx_k29 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":579 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":580 */\n Py_INCREF(Py_None);\n __pyx_k30 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":589 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":590 */\n Py_INCREF(Py_None);\n __pyx_k31 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":598 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":599 */\n Py_INCREF(Py_None);\n __pyx_k32 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":607 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":608 */\n Py_INCREF(Py_None);\n __pyx_k33 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":616 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":617 */\n __pyx_k34 = 0.0;\n __pyx_k35 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k36 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":625 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":626 */\n __pyx_k37 = 0.0;\n __pyx_k38 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k39 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":634 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":635 */\n __pyx_k40 = 0.0;\n __pyx_k41 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k42 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":643 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":644 */\n __pyx_k43 = 0.0;\n __pyx_k44 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k45 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":657 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":658 */\n Py_INCREF(Py_None);\n __pyx_k46 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":666 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":667 */\n Py_INCREF(Py_None);\n __pyx_k47 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":677 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":678 */\n Py_INCREF(Py_None);\n __pyx_k48 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":693 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":694 */\n Py_INCREF(Py_None);\n __pyx_k49 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":706 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":707 */\n Py_INCREF(Py_None);\n __pyx_k50 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":720 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":721 */\n __pyx_k51 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k52 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":729 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":730 */\n Py_INCREF(Py_None);\n __pyx_k53 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":738 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":739 */\n Py_INCREF(Py_None);\n __pyx_k54 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":750 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":751 */\n Py_INCREF(Py_None);\n __pyx_k55 = Py_None;\n \n@@ -5217,316 +5334,327 @@ DL_EXPORT(void) initmtrand(void) {\n Py_INCREF(Py_None);\n __pyx_k56 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":829 */\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":784 */\n Py_INCREF(Py_None);\n __pyx_k57 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":905 */\n- __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;}\n- __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":906 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_get_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":907 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_set_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":908 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":909 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":910 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_bytes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":911 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_uniform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":912 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rand); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":913 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randn); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":914 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_integers); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":915 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":916 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":917 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_beta); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":918 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}\n- Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}\n- Py_DECREF(__pyx_2); __pyx_2 = 0;\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":841 */\n+ Py_INCREF(Py_None);\n+ __pyx_k58 = Py_None;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":919 */\n- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n+ __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n+ __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":920 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_get_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":921 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_set_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":922 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":923 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":924 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_bytes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":925 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_uniform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":926 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_cauchy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rand); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":927 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randn); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":928 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_vonmises); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_integers); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":929 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_pareto); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":930 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_weibull); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":931 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_power); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_beta); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":932 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_laplace); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":933 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gumbel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":934 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logistic); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":935 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lognormal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":936 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rayleigh); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":937 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_wald); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":938 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_triangular); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":939 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":940 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_cauchy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":941 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_negative_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":942 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_poisson); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_vonmises); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":943 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zipf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_pareto); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":944 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_geometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_weibull); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":945 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_hypergeometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_power); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":946 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_laplace); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":947 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multivariate_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gumbel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":948 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multinomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logistic); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":949 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lognormal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":950 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rayleigh); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":951 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n- __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_permutation); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_wald); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":952 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_triangular); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":954 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":955 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_negative_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":956 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_poisson); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":957 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zipf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":958 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_geometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":959 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_hypergeometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":960 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logseries); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_logseries, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":962 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multivariate_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":963 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multinomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":965 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n+ Py_DECREF(__pyx_1); __pyx_1 = 0;\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n+ Py_DECREF(__pyx_2); __pyx_2 = 0;\n+\n+ /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":966 */\n+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n+ __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_permutation); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n- if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n+ if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n return;\n __pyx_L1:;\n", "added_lines": 1338, "deleted_lines": 1210, "source_code": "/* Generated by Pyrex 0.9.3.1 on Fri Oct 7 02:05:13 2005 */\n\n#include \"Python.h\"\n#include \"structmember.h\"\n#ifndef PY_LONG_LONG\n #define PY_LONG_LONG LONG_LONG\n#endif\n#include \"string.h\"\n#include \"math.h\"\n#include \"scipy/arrayobject.h\"\n#include \"randomkit.h\"\n#include \"distributions.h\"\n#include \"initarray.h\"\n\n\ntypedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/\ntypedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/\nstatic PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/\nstatic int __Pyx_EndUnpack(PyObject *, int); /*proto*/\nstatic int __Pyx_PrintItem(PyObject *); /*proto*/\nstatic int __Pyx_PrintNewline(void); /*proto*/\nstatic void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/\nstatic void __Pyx_ReRaise(void); /*proto*/\nstatic PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/\nstatic PyObject *__Pyx_GetExcValue(void); /*proto*/\nstatic int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/\nstatic int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/\nstatic int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/\nstatic void __Pyx_WriteUnraisable(char *name); /*proto*/\nstatic void __Pyx_AddTraceback(char *funcname); /*proto*/\nstatic PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/\nstatic int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/\nstatic int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/\nstatic PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/\nstatic int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/\nstatic int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/\nstatic PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/\n\nstatic PyObject *__pyx_m;\nstatic PyObject *__pyx_b;\nstatic int __pyx_lineno;\nstatic char *__pyx_filename;\nstaticforward char **__pyx_f;\n\n/* Declarations from mtrand */\n\nstaticforward PyTypeObject __pyx_type_6mtrand_RandomState;\n\nstruct __pyx_obj_6mtrand_RandomState {\n PyObject_HEAD\n rk_state (*internal_state);\n};\n\nstatic PyTypeObject *__pyx_ptype_6mtrand_ArrayType = 0;\nstatic PyTypeObject *__pyx_ptype_6mtrand_RandomState = 0;\nstatic PyObject *__pyx_k2;\nstatic PyObject *__pyx_k3;\nstatic PyObject *__pyx_k4;\nstatic PyObject *__pyx_k5;\nstatic PyObject *__pyx_k6;\nstatic PyObject *__pyx_k7;\nstatic double __pyx_k8;\nstatic double __pyx_k9;\nstatic PyObject *__pyx_k10;\nstatic PyObject *__pyx_k11;\nstatic PyObject *__pyx_k12;\nstatic PyObject *__pyx_k13;\nstatic double __pyx_k14;\nstatic double __pyx_k15;\nstatic PyObject *__pyx_k16;\nstatic PyObject *__pyx_k17;\nstatic double __pyx_k18;\nstatic PyObject *__pyx_k19;\nstatic PyObject *__pyx_k20;\nstatic PyObject *__pyx_k21;\nstatic double __pyx_k22;\nstatic PyObject *__pyx_k23;\nstatic PyObject *__pyx_k24;\nstatic PyObject *__pyx_k25;\nstatic PyObject *__pyx_k26;\nstatic PyObject *__pyx_k27;\nstatic PyObject *__pyx_k28;\nstatic PyObject *__pyx_k29;\nstatic PyObject *__pyx_k30;\nstatic PyObject *__pyx_k31;\nstatic PyObject *__pyx_k32;\nstatic PyObject *__pyx_k33;\nstatic double __pyx_k34;\nstatic double __pyx_k35;\nstatic PyObject *__pyx_k36;\nstatic double __pyx_k37;\nstatic double __pyx_k38;\nstatic PyObject *__pyx_k39;\nstatic double __pyx_k40;\nstatic double __pyx_k41;\nstatic PyObject *__pyx_k42;\nstatic double __pyx_k43;\nstatic double __pyx_k44;\nstatic PyObject *__pyx_k45;\nstatic PyObject *__pyx_k46;\nstatic PyObject *__pyx_k47;\nstatic PyObject *__pyx_k48;\nstatic PyObject *__pyx_k49;\nstatic PyObject *__pyx_k50;\nstatic double __pyx_k51;\nstatic PyObject *__pyx_k52;\nstatic PyObject *__pyx_k53;\nstatic PyObject *__pyx_k54;\nstatic PyObject *__pyx_k55;\nstatic PyObject *__pyx_k56;\nstatic PyObject *__pyx_k57;\nstatic PyObject *__pyx_k58;\nstatic PyObject *(__pyx_f_6mtrand_cont0_array(rk_state (*),double ((*)(rk_state (*))),PyObject *)); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont1_array(rk_state (*),double ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont2_array(rk_state (*),double ((*)(rk_state (*),double ,double )),PyObject *,double ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont3_array(rk_state (*),double ((*)(rk_state (*),double ,double ,double )),PyObject *,double ,double ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_disc0_array(rk_state (*),long ((*)(rk_state (*))),PyObject *)); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discnp_array(rk_state (*),long ((*)(rk_state (*),long ,double )),PyObject *,long ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discnmN_array(rk_state (*),long ((*)(rk_state (*),long ,long ,long )),PyObject *,long ,long ,long )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discd_array(rk_state (*),long ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/\nstatic double (__pyx_f_6mtrand_kahan_sum(double (*),long )); /*proto*/\n\n/* Implementation of mtrand */\n\n\nstatic PyObject *__pyx_n__sp;\nstatic PyObject *__pyx_n__rand;\nstatic PyObject *__pyx_n_get_state;\nstatic PyObject *__pyx_n_set_state;\nstatic PyObject *__pyx_n_random_sample;\nstatic PyObject *__pyx_n_randint;\nstatic PyObject *__pyx_n_bytes;\nstatic PyObject *__pyx_n_uniform;\nstatic PyObject *__pyx_n_rand;\nstatic PyObject *__pyx_n_randn;\nstatic PyObject *__pyx_n_random_integers;\nstatic PyObject *__pyx_n_standard_normal;\nstatic PyObject *__pyx_n_normal;\nstatic PyObject *__pyx_n_beta;\nstatic PyObject *__pyx_n_exponential;\nstatic PyObject *__pyx_n_standard_exponential;\nstatic PyObject *__pyx_n_standard_gamma;\nstatic PyObject *__pyx_n_gamma;\nstatic PyObject *__pyx_n_f;\nstatic PyObject *__pyx_n_noncentral_f;\nstatic PyObject *__pyx_n_chisquare;\nstatic PyObject *__pyx_n_noncentral_chisquare;\nstatic PyObject *__pyx_n_standard_cauchy;\nstatic PyObject *__pyx_n_standard_t;\nstatic PyObject *__pyx_n_vonmises;\nstatic PyObject *__pyx_n_pareto;\nstatic PyObject *__pyx_n_weibull;\nstatic PyObject *__pyx_n_power;\nstatic PyObject *__pyx_n_laplace;\nstatic PyObject *__pyx_n_gumbel;\nstatic PyObject *__pyx_n_logistic;\nstatic PyObject *__pyx_n_lognormal;\nstatic PyObject *__pyx_n_rayleigh;\nstatic PyObject *__pyx_n_wald;\nstatic PyObject *__pyx_n_triangular;\nstatic PyObject *__pyx_n_binomial;\nstatic PyObject *__pyx_n_negative_binomial;\nstatic PyObject *__pyx_n_poisson;\nstatic PyObject *__pyx_n_zipf;\nstatic PyObject *__pyx_n_geometric;\nstatic PyObject *__pyx_n_hypergeometric;\nstatic PyObject *__pyx_n_logseries;\nstatic PyObject *__pyx_n_multivariate_normal;\nstatic PyObject *__pyx_n_multinomial;\nstatic PyObject *__pyx_n_shuffle;\nstatic PyObject *__pyx_n_permutation;\nstatic PyObject *__pyx_n_scipy;\n\nstatic PyObject *__pyx_n_empty;\nstatic PyObject *__pyx_n_Float64;\n\nstatic PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":124 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":125 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":127 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":128 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":129 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":130 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":131 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":132 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont0_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":140 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":141 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":143 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":144 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":145 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":146 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":147 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":148 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont1_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":157 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":158 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":160 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":161 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":162 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":163 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":164 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":165 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont2_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b,double __pyx_v_c) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":175 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":176 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":178 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":179 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":180 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":181 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":182 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":183 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont3_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_Int;\n\nstatic PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":191 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":192 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":194 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":195 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":196 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":197 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":198 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":199 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.disc0_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,double )),PyObject *__pyx_v_size,long __pyx_v_n,double __pyx_v_p) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":207 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":208 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":210 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":211 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":212 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":213 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":214 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":215 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discnp_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,long ,long )),PyObject *__pyx_v_size,long __pyx_v_n,long __pyx_v_m,long __pyx_v_N) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":224 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":225 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":227 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":228 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":229 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":230 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":231 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":232 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discnmN_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":240 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":241 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":243 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":244 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":245 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":246 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":247 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":248 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discd_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic double __pyx_f_6mtrand_kahan_sum(double (*__pyx_v_darr),long __pyx_v_n) {\n double __pyx_v_c;\n double __pyx_v_y;\n double __pyx_v_t;\n double __pyx_v_sum;\n long __pyx_v_i;\n double __pyx_r;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":253 */\n __pyx_v_sum = (__pyx_v_darr[0]);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":254 */\n __pyx_v_c = 0.0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":255 */\n for (__pyx_v_i = 1; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":256 */\n __pyx_v_y = ((__pyx_v_darr[__pyx_v_i]) - __pyx_v_c);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":257 */\n __pyx_v_t = (__pyx_v_sum + __pyx_v_y);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":258 */\n __pyx_v_c = ((__pyx_v_t - __pyx_v_sum) - __pyx_v_y);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":259 */\n __pyx_v_sum = __pyx_v_t;\n __pyx_L2:;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":260 */\n __pyx_r = __pyx_v_sum;\n goto __pyx_L0;\n\n __pyx_r = 0;\n goto __pyx_L0;\n __pyx_L1:;\n __Pyx_WriteUnraisable(\"mtrand.kahan_sum\");\n __pyx_L0:;\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_seed;\n\nstatic int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_seed = 0;\n int __pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {\"seed\",0};\n __pyx_v_seed = __pyx_k2;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_seed)) return -1;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_seed);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":283 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state (*))PyMem_Malloc((sizeof(rk_state ))));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":285 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_seed);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n __pyx_r = 0;\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__init__\");\n __pyx_r = -1;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_seed);\n return __pyx_r;\n}\n\nstatic void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self); /*proto*/\nstatic void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {\n int __pyx_1;\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":288 */\n __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":289 */\n PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n goto __pyx_L0;\n __pyx_L1:;\n __Pyx_AddTraceback(\"mtrand.RandomState.__dealloc__\");\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n}\n\nstatic PyObject *__pyx_n_type;\nstatic PyObject *__pyx_n_int;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_seed[] = \"Seed the generator.\\n\\n seed(seed=None)\\n\\n seed can be an integer, an array (or other sequence) of integers of any\\n length, or None. If seed is None, then RandomState will try to read data\\n from /dev/urandom (or the Windows analogue) if available or seed from\\n the clock otherwise.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_seed = 0;\n rk_error __pyx_v_errcode;\n PyArrayObject *__pyx_v_obj;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n unsigned long __pyx_5;\n static char *__pyx_argnames[] = {\"seed\",0};\n __pyx_v_seed = __pyx_k3;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_seed)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_seed);\n __pyx_v_obj = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_obj);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":303 */\n __pyx_1 = __pyx_v_seed == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":304 */\n __pyx_v_errcode = rk_randomseed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_seed);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n __pyx_1 = __pyx_4 == __pyx_2;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":306 */\n __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; goto __pyx_L1;}\n rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":308 */\n __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_3;\n __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":309 */\n init_by_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,((unsigned long (*))__pyx_v_obj->data),(__pyx_v_obj->dimensions[0]));\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.seed\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_obj);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_seed);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_MT19937;\n\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_get_state[] = \"Return a tuple representing the internal state of the generator.\\n\\n get_state() -> (\\'MT19937\\', int key[624], int pos)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyArrayObject *__pyx_v_state;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n __pyx_v_state = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":318 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n __pyx_1 = 0;\n __pyx_4 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_INCREF(((PyObject *)__pyx_1));\n Py_DECREF(((PyObject *)__pyx_v_state));\n __pyx_v_state = ((PyObject *)__pyx_1);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":319 */\n memcpy(((void (*))__pyx_v_state->data),((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,(624 * (sizeof(long ))));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":320 */\n __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}\n Py_INCREF(__pyx_n_MT19937);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_n_MT19937);\n Py_INCREF(((PyObject *)__pyx_v_state));\n PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_state));\n PyTuple_SET_ITEM(__pyx_2, 2, __pyx_4);\n __pyx_4 = 0;\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.get_state\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_state);\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_ValueError;\n\nstatic PyObject *__pyx_k61p;\nstatic PyObject *__pyx_k62p;\n\nstatic char (__pyx_k61[]) = \"algorithm must be 'MT19937'\";\nstatic char (__pyx_k62[]) = \"state must be 624 longs\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_set_state[] = \"Set the state from a tuple.\\n \\n state = (\\'MT19937\\', int key[624], int pos)\\n \\n set_state(state)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_state = 0;\n PyArrayObject *__pyx_v_obj;\n int __pyx_v_pos;\n PyObject *__pyx_v_algorithm_name;\n PyObject *__pyx_v_key;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n int __pyx_3;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"state\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_state)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_state);\n __pyx_v_obj = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_obj);\n __pyx_v_algorithm_name = Py_None; Py_INCREF(__pyx_v_algorithm_name);\n __pyx_v_key = Py_None; Py_INCREF(__pyx_v_key);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":331 */\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_algorithm_name);\n __pyx_v_algorithm_name = __pyx_2;\n __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":332 */\n if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n __pyx_3 = __pyx_3 != 0;\n if (__pyx_3) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":333 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_INCREF(__pyx_k61p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k61p);\n __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":334 */\n __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_v_key);\n __pyx_v_key = __pyx_2;\n __pyx_2 = 0;\n __pyx_4 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n __pyx_3 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_v_pos = __pyx_3;\n if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":335 */\n __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_4;\n __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":336 */\n __pyx_3 = ((__pyx_v_obj->dimensions[0]) != 624);\n if (__pyx_3) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":337 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n Py_INCREF(__pyx_k62p);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k62p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":338 */\n memcpy(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,((void (*))__pyx_v_obj->data),(624 * (sizeof(long ))));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":339 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.set_state\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_obj);\n Py_DECREF(__pyx_v_algorithm_name);\n Py_DECREF(__pyx_v_key);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_state);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":343 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__getstate__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_state = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {\"state\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_state)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":346 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n Py_INCREF(__pyx_v_state);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_state);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__setstate__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_state);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_random;\nstatic PyObject *__pyx_n___RandomState_ctor;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":349 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_5);\n __pyx_1 = 0;\n __pyx_2 = 0;\n __pyx_5 = 0;\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.__reduce__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_random_sample[] = \"Return random floats in the half-open interval [0.0, 1.0).\\n\\n random_sample(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k4;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":357 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.random_sample\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_tomaxint[] = \"Returns random integers x such that 0 <= x <= sys.maxint.\\n\\n tomaxint(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k5;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":364 */\n __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.tomaxint\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k63p;\n\nstatic char (__pyx_k63[]) = \"low >= high\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_randint[] = \"Return random integers x such that low <= x < high.\\n\\n randint(low, high=None, size=None) -> random values\\n\\n If high is None, then 0 <= x < low.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_low = 0;\n PyObject *__pyx_v_high = 0;\n PyObject *__pyx_v_size = 0;\n long __pyx_v_lo;\n long __pyx_v_hi;\n long __pyx_v_diff;\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n long __pyx_2;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_high = __pyx_k6;\n __pyx_v_size = __pyx_k7;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O|OO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_low);\n Py_INCREF(__pyx_v_high);\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":379 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":380 */\n __pyx_v_lo = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":381 */\n __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":383 */\n __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}\n __pyx_v_lo = __pyx_2;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":384 */\n __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":386 */\n __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":387 */\n __pyx_1 = (__pyx_v_diff < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":388 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n Py_INCREF(__pyx_k63p);\n PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k63p);\n __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __Pyx_Raise(__pyx_5, 0, 0);\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":390 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":391 */\n __pyx_3 = PyLong_FromUnsignedLong(rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n goto __pyx_L4;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":393 */\n __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":394 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":395 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":396 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":397 */\n (__pyx_v_array_data[__pyx_v_i]) = (__pyx_v_lo + rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state));\n __pyx_L5:;\n }\n __pyx_L6:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":398 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L4:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.randint\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_bytes[] = \"Return random bytes.\\n\\n bytes(length) -> str\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n unsigned int __pyx_v_length;\n void (*__pyx_v_bytes);\n PyObject *__pyx_v_bytestring;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"length\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"i\", __pyx_argnames, &__pyx_v_length)) return 0;\n Py_INCREF(__pyx_v_self);\n __pyx_v_bytestring = Py_None; Py_INCREF(__pyx_v_bytestring);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":406 */\n __pyx_v_bytes = PyMem_Malloc(__pyx_v_length);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":407 */\n rk_fill(__pyx_v_bytes,__pyx_v_length,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":408 */\n __pyx_1 = PyString_FromString(((char (*))__pyx_v_bytes)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; goto __pyx_L1;}\n Py_DECREF(__pyx_v_bytestring);\n __pyx_v_bytestring = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":409 */\n PyMem_Free(__pyx_v_bytes);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":410 */\n Py_INCREF(__pyx_v_bytestring);\n __pyx_r = __pyx_v_bytestring;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.bytes\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_bytestring);\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_uniform[] = \"Uniform distribution over [low, high).\\n\\n uniform(low=0.0, high=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_low;\n double __pyx_v_high;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_low = __pyx_k8;\n __pyx_v_high = __pyx_k9;\n __pyx_v_size = __pyx_k10;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":417 */\n __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_low,(__pyx_v_high - __pyx_v_low)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.uniform\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_len;\nstatic PyObject *__pyx_n_size;\n\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_rand[] = \"Return an array of the given dimensions which is initialized to \\n random numbers from a uniform distribution in the range [0,1).\\n\\n randn(d0, d1, ..., dn) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_args = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {0};\n if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0) < 0) return 0;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) {\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n Py_XDECREF(__pyx_v_args);\n return 0;\n }\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":426 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n __pyx_4 = __pyx_4 == 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":427 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":429 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n if (PyDict_SetItem(__pyx_1, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_r = __pyx_5;\n __pyx_5 = 0;\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.rand\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_XDECREF(__pyx_v_args);\n Py_DECREF(__pyx_v_self);\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_randn[] = \"Returns zero-mean, unit-variance Gaussian random numbers in an \\n array of shape (d0, d1, ..., dn).\\n\\n randn(d0, d1, ..., dn) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_args = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n static char *__pyx_argnames[] = {0};\n if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0) < 0) return 0;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) {\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n Py_XDECREF(__pyx_v_args);\n return 0;\n }\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":437 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n __pyx_4 = __pyx_4 == 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":438 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":440 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_args);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.randn\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_XDECREF(__pyx_v_args);\n Py_DECREF(__pyx_v_self);\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_random_integers[] = \"Return random integers x such that low <= x <= high.\\n\\n random_integers(low, high=None, size=None) -> random values.\\n\\n If high is None, then 1 <= x <= low.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_low = 0;\n PyObject *__pyx_v_high = 0;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_high = __pyx_k11;\n __pyx_v_size = __pyx_k12;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O|OO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_low);\n Py_INCREF(__pyx_v_high);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":449 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":450 */\n Py_INCREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n __pyx_v_high = __pyx_v_low;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":451 */\n __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n Py_DECREF(__pyx_v_low);\n __pyx_v_low = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":452 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_INCREF(__pyx_v_low);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_low);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_size);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_4;\n __pyx_4 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.random_integers\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_normal[] = \"Standard Normal distribution (mean=0, stdev=1).\\n\\n standard_normal(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k13;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":460 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k65p;\n\nstatic char (__pyx_k65[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_normal[] = \"Normal distribution (mean=loc, stdev=scale).\\n\\n normal(loc=0.0, scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k14;\n __pyx_v_scale = __pyx_k15;\n __pyx_v_size = __pyx_k16;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":467 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":468 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n Py_INCREF(__pyx_k65p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k65p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":469 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k66p;\nstatic PyObject *__pyx_k67p;\n\nstatic char (__pyx_k66[]) = \"a <= 0\";\nstatic char (__pyx_k67[]) = \"b <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_beta[] = \"Beta distribution over [0, 1].\\n\\n beta(a, b, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n double __pyx_v_b;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"b\",\"size\",0};\n __pyx_v_size = __pyx_k17;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":476 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":477 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n Py_INCREF(__pyx_k66p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_b <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":479 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n Py_INCREF(__pyx_k67p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":480 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_a,__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.beta\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k68p;\n\nstatic char (__pyx_k68[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_exponential[] = \"Exponential distribution.\\n\\n exponential(scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"scale\",\"size\",0};\n __pyx_v_scale = __pyx_k18;\n __pyx_v_size = __pyx_k19;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":487 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":488 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n Py_INCREF(__pyx_k68p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":489 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.exponential\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_exponential[] = \"Standard exponential distribution (scale=1).\\n\\n standard_exponential(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k20;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":496 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_exponential\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k69p;\n\nstatic char (__pyx_k69[]) = \"shape <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_gamma[] = \"Standard Gamma distribution.\\n\\n standard_gamma(shape, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_shape;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"shape\",\"size\",0};\n __pyx_v_size = __pyx_k21;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_shape, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":503 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":504 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n Py_INCREF(__pyx_k69p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":505 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_gamma\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k70p;\nstatic PyObject *__pyx_k71p;\n\nstatic char (__pyx_k70[]) = \"shape <= 0\";\nstatic char (__pyx_k71[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_gamma[] = \"Gamma distribution.\\n\\n gamma(shape, scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_shape;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"shape\",\"scale\",\"size\",0};\n __pyx_v_scale = __pyx_k22;\n __pyx_v_size = __pyx_k23;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|dO\", __pyx_argnames, &__pyx_v_shape, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":512 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":513 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n Py_INCREF(__pyx_k70p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":515 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n Py_INCREF(__pyx_k71p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":516 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_shape,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.gamma\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k72p;\nstatic PyObject *__pyx_k73p;\n\nstatic char (__pyx_k72[]) = \"dfnum <= 0\";\nstatic char (__pyx_k73[]) = \"dfden <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_f[] = \"F distribution.\\n\\n f(dfnum, dfden, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_dfnum;\n double __pyx_v_dfden;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"dfnum\",\"dfden\",\"size\",0};\n __pyx_v_size = __pyx_k24;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":523 */\n __pyx_1 = (__pyx_v_dfnum <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":524 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n Py_INCREF(__pyx_k72p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":526 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n Py_INCREF(__pyx_k73p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":527 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.f\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k74p;\nstatic PyObject *__pyx_k75p;\nstatic PyObject *__pyx_k76p;\n\nstatic char (__pyx_k74[]) = \"dfnum <= 1\";\nstatic char (__pyx_k75[]) = \"dfden <= 0\";\nstatic char (__pyx_k76[]) = \"nonc < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_noncentral_f[] = \"Noncentral F distribution.\\n\\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_dfnum;\n double __pyx_v_dfden;\n double __pyx_v_nonc;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"dfnum\",\"dfden\",\"nonc\",\"size\",0};\n __pyx_v_size = __pyx_k25;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ddd|O\", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_nonc, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":534 */\n __pyx_1 = (__pyx_v_dfnum <= 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":535 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n Py_INCREF(__pyx_k74p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":537 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n Py_INCREF(__pyx_k75p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":539 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n Py_INCREF(__pyx_k76p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":540 */\n __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.noncentral_f\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k77p;\n\nstatic char (__pyx_k77[]) = \"df <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_chisquare[] = \"Chi^2 distribution.\\n\\n chisquare(df, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"size\",0};\n __pyx_v_size = __pyx_k26;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":548 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":549 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n Py_INCREF(__pyx_k77p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":550 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.chisquare\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k78p;\nstatic PyObject *__pyx_k79p;\n\nstatic char (__pyx_k78[]) = \"df <= 1\";\nstatic char (__pyx_k79[]) = \"nonc < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_noncentral_chisquare[] = \"Noncentral Chi^2 distribution.\\n\\n noncentral_chisquare(df, nonc, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n double __pyx_v_nonc;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"nonc\",\"size\",0};\n __pyx_v_size = __pyx_k27;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_nonc, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":557 */\n __pyx_1 = (__pyx_v_df <= 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":558 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n Py_INCREF(__pyx_k78p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":560 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n Py_INCREF(__pyx_k79p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":561 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_df,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.noncentral_chisquare\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_cauchy[] = \"Standard Cauchy with mode=0.\\n\\n standard_cauchy(size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k28;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":569 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_cauchy\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k80p;\n\nstatic char (__pyx_k80[]) = \"df <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_t[] = \"Standard Student\\'s t distribution with df degrees of freedom.\\n\\n standard_t(df, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"size\",0};\n __pyx_v_size = __pyx_k29;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":576 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":577 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n Py_INCREF(__pyx_k80p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":578 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_t\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k81p;\n\nstatic char (__pyx_k81[]) = \"kappa < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_vonmises[] = \"von Mises circular distribution with mode mu and dispersion parameter\\n kappa on [-pi, pi].\\n\\n vonmises(mu, kappa, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mu;\n double __pyx_v_kappa;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mu\",\"kappa\",\"size\",0};\n __pyx_v_size = __pyx_k30;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_mu, &__pyx_v_kappa, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":586 */\n __pyx_1 = (__pyx_v_kappa < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":587 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n Py_INCREF(__pyx_k81p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":588 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_mu,__pyx_v_kappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.vonmises\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k82p;\n\nstatic char (__pyx_k82[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_pareto[] = \"Pareto distribution.\\n\\n pareto(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k31;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":595 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":596 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n Py_INCREF(__pyx_k82p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":597 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.pareto\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k83p;\n\nstatic char (__pyx_k83[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_weibull[] = \"Weibull distribution.\\n\\n weibull(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k32;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":604 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":605 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n Py_INCREF(__pyx_k83p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":606 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.weibull\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k84p;\n\nstatic char (__pyx_k84[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_power[] = \"Power distribution.\\n\\n power(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k33;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":613 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":614 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n Py_INCREF(__pyx_k84p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":615 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.power\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k85p;\n\nstatic char (__pyx_k85[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_laplace[] = \"Laplace distribution.\\n \\n laplace(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k34;\n __pyx_v_scale = __pyx_k35;\n __pyx_v_size = __pyx_k36;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":622 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":623 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n Py_INCREF(__pyx_k85p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":624 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.laplace\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k86p;\n\nstatic char (__pyx_k86[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_gumbel[] = \"Gumbel distribution.\\n \\n gumbel(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k37;\n __pyx_v_scale = __pyx_k38;\n __pyx_v_size = __pyx_k39;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":631 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":632 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n Py_INCREF(__pyx_k86p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":633 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.gumbel\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k87p;\n\nstatic char (__pyx_k87[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_logistic[] = \"Logistic distribution.\\n \\n logistic(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k40;\n __pyx_v_scale = __pyx_k41;\n __pyx_v_size = __pyx_k42;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":640 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":641 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n Py_INCREF(__pyx_k87p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":642 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.logistic\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k88p;\n\nstatic char (__pyx_k88[]) = \"sigma <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_lognormal[] = \"Log-normal distribution.\\n \\n Note that the mean parameter is not the mean of this distribution, but \\n the underlying normal distribution.\\n \\n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\\n \\n lognormal(mean=0.0, sigma=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mean;\n double __pyx_v_sigma;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"sigma\",\"size\",0};\n __pyx_v_mean = __pyx_k43;\n __pyx_v_sigma = __pyx_k44;\n __pyx_v_size = __pyx_k45;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_sigma, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":654 */\n __pyx_1 = (__pyx_v_sigma <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":655 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n Py_INCREF(__pyx_k88p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":656 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_mean,__pyx_v_sigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.lognormal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k89p;\n\nstatic char (__pyx_k89[]) = \"mode <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_rayleigh[] = \"Rayleigh distribution.\\n \\n rayleigh(mode, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mode;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mode\",\"size\",0};\n __pyx_v_size = __pyx_k46;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_mode, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":663 */\n __pyx_1 = (__pyx_v_mode <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":664 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n Py_INCREF(__pyx_k89p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":665 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_mode); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.rayleigh\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k90p;\nstatic PyObject *__pyx_k91p;\n\nstatic char (__pyx_k90[]) = \"mean <= 0.0\";\nstatic char (__pyx_k91[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_wald[] = \"Wald (inverse Gaussian) distribution.\\n \\n wald(mean, scale, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mean;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"scale\",\"size\",0};\n __pyx_v_size = __pyx_k47;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":672 */\n __pyx_1 = (__pyx_v_mean <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":673 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n Py_INCREF(__pyx_k90p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":675 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n Py_INCREF(__pyx_k91p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":676 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_mean,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.wald\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k92p;\nstatic PyObject *__pyx_k93p;\nstatic PyObject *__pyx_k94p;\n\nstatic char (__pyx_k92[]) = \"left > mode\";\nstatic char (__pyx_k93[]) = \"mode > right\";\nstatic char (__pyx_k94[]) = \"left == right\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_triangular[] = \"Triangular distribution starting at left, peaking at mode, and \\n ending at right (left <= mode <= right).\\n \\n triangular(left, mode, right, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_left;\n double __pyx_v_mode;\n double __pyx_v_right;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"left\",\"mode\",\"right\",\"size\",0};\n __pyx_v_size = __pyx_k48;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ddd|O\", __pyx_argnames, &__pyx_v_left, &__pyx_v_mode, &__pyx_v_right, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":684 */\n __pyx_1 = (__pyx_v_left > __pyx_v_mode);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":685 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n Py_INCREF(__pyx_k92p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_mode > __pyx_v_right);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":687 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n Py_INCREF(__pyx_k93p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_left == __pyx_v_right);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":689 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n Py_INCREF(__pyx_k94p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":690 */\n __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_left,__pyx_v_mode,__pyx_v_right); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.triangular\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k95p;\nstatic PyObject *__pyx_k96p;\nstatic PyObject *__pyx_k97p;\n\nstatic char (__pyx_k95[]) = \"n <= 0\";\nstatic char (__pyx_k96[]) = \"p < 0\";\nstatic char (__pyx_k97[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_binomial[] = \"Binomial distribution of n trials and p probability of success.\\n\\n binomial(n, p, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"n\",\"p\",\"size\",0};\n __pyx_v_size = __pyx_k49;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ld|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":699 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":700 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n Py_INCREF(__pyx_k95p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":702 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n Py_INCREF(__pyx_k96p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":704 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n Py_INCREF(__pyx_k97p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":705 */\n __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.binomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k98p;\nstatic PyObject *__pyx_k99p;\nstatic PyObject *__pyx_k100p;\n\nstatic char (__pyx_k98[]) = \"n <= 0\";\nstatic char (__pyx_k99[]) = \"p < 0\";\nstatic char (__pyx_k100[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_negative_binomial[] = \"Negative Binomial distribution.\\n\\n negative_binomial(n, p, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"n\",\"p\",\"size\",0};\n __pyx_v_size = __pyx_k50;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ld|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":712 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":713 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n Py_INCREF(__pyx_k98p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":715 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n Py_INCREF(__pyx_k99p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":717 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n Py_INCREF(__pyx_k100p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":718 */\n __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.negative_binomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k101p;\n\nstatic char (__pyx_k101[]) = \"lam <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_poisson[] = \"Poisson distribution.\\n\\n poisson(lam=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_lam;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"lam\",\"size\",0};\n __pyx_v_lam = __pyx_k51;\n __pyx_v_size = __pyx_k52;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_lam, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":726 */\n __pyx_1 = (__pyx_v_lam <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":727 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n Py_INCREF(__pyx_k101p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":728 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_lam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.poisson\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k102p;\n\nstatic char (__pyx_k102[]) = \"a <= 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_zipf[] = \"Zipf distribution.\\n \\n zipf(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k53;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":735 */\n __pyx_1 = (__pyx_v_a <= 1.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":736 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n Py_INCREF(__pyx_k102p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":737 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.zipf\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k103p;\nstatic PyObject *__pyx_k104p;\n\nstatic char (__pyx_k103[]) = \"p < 0.0\";\nstatic char (__pyx_k104[]) = \"p > 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_geometric[] = \"Geometric distribution with p being the probability of \\\"success\\\" on\\n an individual trial.\\n \\n geometric(p, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"p\",\"size\",0};\n __pyx_v_size = __pyx_k54;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":745 */\n __pyx_1 = (__pyx_v_p < 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":746 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n Py_INCREF(__pyx_k103p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":748 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n Py_INCREF(__pyx_k104p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":749 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.geometric\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k105p;\nstatic PyObject *__pyx_k106p;\nstatic PyObject *__pyx_k107p;\nstatic PyObject *__pyx_k108p;\n\nstatic char (__pyx_k105[]) = \"ngood < 1\";\nstatic char (__pyx_k106[]) = \"nbad < 1\";\nstatic char (__pyx_k107[]) = \"ngood + nbad < nsample\";\nstatic char (__pyx_k108[]) = \"nsample < 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_hypergeometric[] = \"Hypergeometric distribution.\\n \\n Consider an urn with ngood \\\"good\\\" balls and nbad \\\"bad\\\" balls. If one \\n were to draw nsample balls from the urn without replacement, then \\n the hypergeometric distribution describes the distribution of \\\"good\\\" \\n balls in the sample.\\n \\n hypergeometric(ngood, nbad, nsample, size=None) \\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_ngood;\n long __pyx_v_nbad;\n long __pyx_v_nsample;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"ngood\",\"nbad\",\"nsample\",\"size\",0};\n __pyx_v_size = __pyx_k55;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lll|O\", __pyx_argnames, &__pyx_v_ngood, &__pyx_v_nbad, &__pyx_v_nsample, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":761 */\n __pyx_1 = (__pyx_v_ngood < 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":762 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n Py_INCREF(__pyx_k105p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nbad < 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":764 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n Py_INCREF(__pyx_k106p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = ((__pyx_v_ngood + __pyx_v_nbad) < __pyx_v_nsample);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":766 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n Py_INCREF(__pyx_k107p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nsample < 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":768 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n Py_INCREF(__pyx_k108p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k108p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":769 */\n __pyx_2 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ngood,__pyx_v_nbad,__pyx_v_nsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.hypergeometric\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k109p;\nstatic PyObject *__pyx_k110p;\n\nstatic char (__pyx_k109[]) = \"p < 0\";\nstatic char (__pyx_k110[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_logseries[] = \"Logarithmic series distribution.\\n \\n logseries(p, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"p\",\"size\",0};\n __pyx_v_size = __pyx_k56;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":777 */\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":778 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n Py_INCREF(__pyx_k109p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":780 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n Py_INCREF(__pyx_k110p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k110p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":781 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.logseries\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_array;\nstatic PyObject *__pyx_n_shape;\nstatic PyObject *__pyx_n_ArgumentError;\nstatic PyObject *__pyx_n_isinstance;\nstatic PyObject *__pyx_n_list;\nstatic PyObject *__pyx_n_append;\nstatic PyObject *__pyx_n_multiply;\nstatic PyObject *__pyx_n_reduce;\nstatic PyObject *__pyx_n_linalg;\nstatic PyObject *__pyx_n_singular_value_decomposition;\nstatic PyObject *__pyx_n_matrixmultiply;\nstatic PyObject *__pyx_n_sqrt;\nstatic PyObject *__pyx_n_add;\nstatic PyObject *__pyx_n_tuple;\n\nstatic PyObject *__pyx_k111p;\nstatic PyObject *__pyx_k112p;\nstatic PyObject *__pyx_k113p;\n\nstatic char (__pyx_k111[]) = \"mean must be 1 dimensional\";\nstatic char (__pyx_k112[]) = \"cov must be 2 dimensional and square\";\nstatic char (__pyx_k113[]) = \"mean and cov must have same length\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_multivariate_normal[] = \"Return an array containing multivariate normally distributed random numbers\\n with specified mean and covariance.\\n\\n multivariate_normal(mean, cov) -> random values\\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\\n\\n mean must be a 1 dimensional array. cov must be a square two dimensional\\n array with the same number of rows and columns as mean has elements.\\n\\n The first form returns a single 1-D array containing a multivariate\\n normal.\\n\\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\\n normal.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_mean = 0;\n PyObject *__pyx_v_cov = 0;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_v_shape;\n PyObject *__pyx_v_final_shape;\n PyObject *__pyx_v_x;\n PyObject *__pyx_v_u;\n PyObject *__pyx_v_s;\n PyObject *__pyx_v_v;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"cov\",\"size\",0};\n __pyx_v_size = __pyx_k57;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"OO|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_cov, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_mean);\n Py_INCREF(__pyx_v_cov);\n Py_INCREF(__pyx_v_size);\n __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape);\n __pyx_v_final_shape = Py_None; Py_INCREF(__pyx_v_final_shape);\n __pyx_v_x = Py_None; Py_INCREF(__pyx_v_x);\n __pyx_v_u = Py_None; Py_INCREF(__pyx_v_u);\n __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s);\n __pyx_v_v = Py_None; Py_INCREF(__pyx_v_v);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":802 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_INCREF(__pyx_v_mean);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_mean);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_mean);\n __pyx_v_mean = __pyx_3;\n __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":803 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_INCREF(__pyx_v_cov);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_cov);\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_cov);\n __pyx_v_cov = __pyx_2;\n __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":804 */\n __pyx_4 = __pyx_v_size == Py_None;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":805 */\n __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":807 */\n Py_INCREF(__pyx_v_size);\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_v_size;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":808 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);\n __pyx_2 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":809 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n Py_INCREF(__pyx_k111p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k111p);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_3, 0, 0);\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":810 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n __pyx_2 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (!__pyx_4) {\n __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n }\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":811 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_INCREF(__pyx_k112p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);\n __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_1, 0, 0);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n goto __pyx_L4;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":812 */\n __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":813 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n Py_INCREF(__pyx_k113p);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k113p);\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __Pyx_Raise(__pyx_2, 0, 0);\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n goto __pyx_L5;\n }\n __pyx_L5:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":815 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_5, 1, __pyx_1);\n __pyx_1 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":816 */\n __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyList_SET_ITEM(__pyx_1, 0, __pyx_v_shape);\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L6;\n }\n __pyx_L6:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":817 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);\n __pyx_5 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_final_shape);\n __pyx_v_final_shape = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":818 */\n __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":822 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);\n __pyx_3 = 0;\n __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_x);\n __pyx_v_x = __pyx_5;\n __pyx_5 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":823 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_final_shape);\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);\n PyTuple_SET_ITEM(__pyx_1, 1, __pyx_5);\n __pyx_3 = 0;\n __pyx_5 = 0;\n if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":833 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_linalg); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_singular_value_decomposition); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_INCREF(__pyx_v_cov);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_cov);\n __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_u);\n __pyx_v_u = __pyx_3;\n __pyx_3 = 0;\n __pyx_5 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_s);\n __pyx_v_s = __pyx_5;\n __pyx_5 = 0;\n __pyx_1 = __Pyx_UnpackItem(__pyx_2, 2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_v);\n __pyx_v_v = __pyx_1;\n __pyx_1 = 0;\n if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":834 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_matrixmultiply); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_INCREF(__pyx_v_s);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_s);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n Py_INCREF(__pyx_v_v);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_v);\n __pyx_2 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_x);\n __pyx_v_x = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":837 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_INCREF(__pyx_v_mean);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_mean);\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_x);\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_x);\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":838 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":839 */\n Py_INCREF(__pyx_v_x);\n __pyx_r = __pyx_v_x;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.multivariate_normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_shape);\n Py_DECREF(__pyx_v_final_shape);\n Py_DECREF(__pyx_v_x);\n Py_DECREF(__pyx_v_u);\n Py_DECREF(__pyx_v_s);\n Py_DECREF(__pyx_v_v);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_mean);\n Py_DECREF(__pyx_v_cov);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_zeros;\n\nstatic PyObject *__pyx_k114p;\n\nstatic char (__pyx_k114[]) = \"sum(pvals) > 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_multinomial[] = \"Multinomial distribution.\\n \\n multinomial(n, pvals, size=None) -> random values\\n\\n pvals is a sequence of probabilities that should sum to 1 (however, the\\n last element is always assumed to account for the remaining probability\\n as long as sum(pvals[:-1]) <= 1).\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n PyObject *__pyx_v_pvals = 0;\n PyObject *__pyx_v_size = 0;\n long __pyx_v_d;\n PyArrayObject *__pyx_v_parr;\n PyArrayObject *__pyx_v_mnarr;\n double (*__pyx_v_pix);\n long (*__pyx_v_mnix);\n long __pyx_v_i;\n long __pyx_v_j;\n long __pyx_v_dn;\n double __pyx_v_Sum;\n double __pyx_v_prob;\n PyObject *__pyx_v_shape;\n PyObject *__pyx_v_multin;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n long __pyx_4;\n int __pyx_5;\n static char *__pyx_argnames[] = {\"n\",\"pvals\",\"size\",0};\n __pyx_v_size = __pyx_k58;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lO|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_pvals, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_pvals);\n Py_INCREF(__pyx_v_size);\n __pyx_v_parr = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_parr);\n __pyx_v_mnarr = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_mnarr);\n __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape);\n __pyx_v_multin = Py_None; Py_INCREF(__pyx_v_multin);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":857 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_INCREF(__pyx_v_pvals);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_pvals);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_v_d = __pyx_4;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":858 */\n __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_parr));\n __pyx_v_parr = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":859 */\n __pyx_v_pix = ((double (*))__pyx_v_parr->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":861 */\n __pyx_5 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix,(__pyx_v_d - 1)) > 1.0);\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":862 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n Py_INCREF(__pyx_k114p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k114p);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_1, 0, 0);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":864 */\n __pyx_5 = __pyx_v_size == Py_None;\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":865 */\n __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L3;\n }\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n __pyx_5 = __pyx_3 == __pyx_1;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":867 */\n __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);\n __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L3;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":869 */\n __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":871 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_1);\n __pyx_1 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_multin);\n __pyx_v_multin = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":872 */\n Py_INCREF(((PyObject *)__pyx_v_multin));\n Py_DECREF(((PyObject *)__pyx_v_mnarr));\n __pyx_v_mnarr = ((PyObject *)__pyx_v_multin);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":873 */\n __pyx_v_mnix = ((long (*))__pyx_v_mnarr->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":874 */\n __pyx_v_i = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":875 */\n while (1) {\n __pyx_L4:;\n __pyx_5 = (__pyx_v_i < PyArray_SIZE(__pyx_v_mnarr));\n if (!__pyx_5) break;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":876 */\n __pyx_v_Sum = 1.0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":877 */\n __pyx_v_dn = __pyx_v_n;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":878 */\n __pyx_4 = (__pyx_v_d - 1);\n for (__pyx_v_j = 0; __pyx_v_j < __pyx_4; ++__pyx_v_j) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":879 */\n (__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));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":880 */\n __pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":881 */\n __pyx_5 = (__pyx_v_dn <= 0);\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":882 */\n goto __pyx_L7;\n goto __pyx_L8;\n }\n __pyx_L8:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":883 */\n __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j]));\n __pyx_L6:;\n }\n __pyx_L7:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":884 */\n __pyx_5 = (__pyx_v_dn > 0);\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":885 */\n (__pyx_v_mnix[((__pyx_v_i + __pyx_v_d) - 1)]) = __pyx_v_dn;\n goto __pyx_L9;\n }\n __pyx_L9:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":887 */\n __pyx_v_i = (__pyx_v_i + __pyx_v_d);\n }\n __pyx_L5:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":889 */\n Py_INCREF(__pyx_v_multin);\n __pyx_r = __pyx_v_multin;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.multinomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_parr);\n Py_DECREF(__pyx_v_mnarr);\n Py_DECREF(__pyx_v_shape);\n Py_DECREF(__pyx_v_multin);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_pvals);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_shuffle[] = \"Modify a sequence in-place by shuffling its contents.\\n \\n shuffle(x)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_x = 0;\n long __pyx_v_i;\n long __pyx_v_j;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n long __pyx_4;\n int __pyx_5;\n static char *__pyx_argnames[] = {\"x\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_x)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":900 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_v_i = __pyx_4;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":901 */\n while (1) {\n __pyx_L2:;\n __pyx_5 = (__pyx_v_i > 0);\n if (!__pyx_5) break;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":902 */\n __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":903 */\n __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":904 */\n __pyx_v_i = (__pyx_v_i - 1);\n }\n __pyx_L3:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.shuffle\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_x);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_arange;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_permutation[] = \"Given an integer, return a shuffled sequence of integers >= 0 and \\n < x; given a sequence, return a shuffled array copy.\\n\\n permutation(x)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_x = 0;\n PyObject *__pyx_v_arr;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n static char *__pyx_argnames[] = {\"x\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_x)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n __pyx_v_arr = Py_None; Py_INCREF(__pyx_v_arr);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":912 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n __pyx_4 = __pyx_3 == __pyx_1;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":913 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_arange); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x);\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_arr);\n __pyx_v_arr = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":915 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_arr);\n __pyx_v_arr = __pyx_3;\n __pyx_3 = 0;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":916 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_INCREF(__pyx_v_arr);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_arr);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":917 */\n Py_INCREF(__pyx_v_arr);\n __pyx_r = __pyx_v_arr;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.permutation\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_arr);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_x);\n return __pyx_r;\n}\n\nstatic __Pyx_InternTabEntry __pyx_intern_tab[] = {\n {&__pyx_n_ArgumentError, \"ArgumentError\"},\n {&__pyx_n_Float64, \"Float64\"},\n {&__pyx_n_Int, \"Int\"},\n {&__pyx_n_MT19937, \"MT19937\"},\n {&__pyx_n_ValueError, \"ValueError\"},\n {&__pyx_n___RandomState_ctor, \"__RandomState_ctor\"},\n {&__pyx_n__rand, \"_rand\"},\n {&__pyx_n__sp, \"_sp\"},\n {&__pyx_n_add, \"add\"},\n {&__pyx_n_append, \"append\"},\n {&__pyx_n_arange, \"arange\"},\n {&__pyx_n_array, \"array\"},\n {&__pyx_n_beta, \"beta\"},\n {&__pyx_n_binomial, \"binomial\"},\n {&__pyx_n_bytes, \"bytes\"},\n {&__pyx_n_chisquare, \"chisquare\"},\n {&__pyx_n_empty, \"empty\"},\n {&__pyx_n_exponential, \"exponential\"},\n {&__pyx_n_f, \"f\"},\n {&__pyx_n_gamma, \"gamma\"},\n {&__pyx_n_geometric, \"geometric\"},\n {&__pyx_n_get_state, \"get_state\"},\n {&__pyx_n_gumbel, \"gumbel\"},\n {&__pyx_n_hypergeometric, \"hypergeometric\"},\n {&__pyx_n_int, \"int\"},\n {&__pyx_n_isinstance, \"isinstance\"},\n {&__pyx_n_laplace, \"laplace\"},\n {&__pyx_n_len, \"len\"},\n {&__pyx_n_linalg, \"linalg\"},\n {&__pyx_n_list, \"list\"},\n {&__pyx_n_logistic, \"logistic\"},\n {&__pyx_n_lognormal, \"lognormal\"},\n {&__pyx_n_logseries, \"logseries\"},\n {&__pyx_n_matrixmultiply, \"matrixmultiply\"},\n {&__pyx_n_multinomial, \"multinomial\"},\n {&__pyx_n_multiply, \"multiply\"},\n {&__pyx_n_multivariate_normal, \"multivariate_normal\"},\n {&__pyx_n_negative_binomial, \"negative_binomial\"},\n {&__pyx_n_noncentral_chisquare, \"noncentral_chisquare\"},\n {&__pyx_n_noncentral_f, \"noncentral_f\"},\n {&__pyx_n_normal, \"normal\"},\n {&__pyx_n_pareto, \"pareto\"},\n {&__pyx_n_permutation, \"permutation\"},\n {&__pyx_n_poisson, \"poisson\"},\n {&__pyx_n_power, \"power\"},\n {&__pyx_n_rand, \"rand\"},\n {&__pyx_n_randint, \"randint\"},\n {&__pyx_n_randn, \"randn\"},\n {&__pyx_n_random, \"random\"},\n {&__pyx_n_random_integers, \"random_integers\"},\n {&__pyx_n_random_sample, \"random_sample\"},\n {&__pyx_n_rayleigh, \"rayleigh\"},\n {&__pyx_n_reduce, \"reduce\"},\n {&__pyx_n_scipy, \"scipy\"},\n {&__pyx_n_seed, \"seed\"},\n {&__pyx_n_set_state, \"set_state\"},\n {&__pyx_n_shape, \"shape\"},\n {&__pyx_n_shuffle, \"shuffle\"},\n {&__pyx_n_singular_value_decomposition, \"singular_value_decomposition\"},\n {&__pyx_n_size, \"size\"},\n {&__pyx_n_sqrt, \"sqrt\"},\n {&__pyx_n_standard_cauchy, \"standard_cauchy\"},\n {&__pyx_n_standard_exponential, \"standard_exponential\"},\n {&__pyx_n_standard_gamma, \"standard_gamma\"},\n {&__pyx_n_standard_normal, \"standard_normal\"},\n {&__pyx_n_standard_t, \"standard_t\"},\n {&__pyx_n_triangular, \"triangular\"},\n {&__pyx_n_tuple, \"tuple\"},\n {&__pyx_n_type, \"type\"},\n {&__pyx_n_uniform, \"uniform\"},\n {&__pyx_n_vonmises, \"vonmises\"},\n {&__pyx_n_wald, \"wald\"},\n {&__pyx_n_weibull, \"weibull\"},\n {&__pyx_n_zeros, \"zeros\"},\n {&__pyx_n_zipf, \"zipf\"},\n {0, 0}\n};\n\nstatic __Pyx_StringTabEntry __pyx_string_tab[] = {\n {&__pyx_k61p, __pyx_k61, sizeof(__pyx_k61)},\n {&__pyx_k62p, __pyx_k62, sizeof(__pyx_k62)},\n {&__pyx_k63p, __pyx_k63, sizeof(__pyx_k63)},\n {&__pyx_k65p, __pyx_k65, sizeof(__pyx_k65)},\n {&__pyx_k66p, __pyx_k66, sizeof(__pyx_k66)},\n {&__pyx_k67p, __pyx_k67, sizeof(__pyx_k67)},\n {&__pyx_k68p, __pyx_k68, sizeof(__pyx_k68)},\n {&__pyx_k69p, __pyx_k69, sizeof(__pyx_k69)},\n {&__pyx_k70p, __pyx_k70, sizeof(__pyx_k70)},\n {&__pyx_k71p, __pyx_k71, sizeof(__pyx_k71)},\n {&__pyx_k72p, __pyx_k72, sizeof(__pyx_k72)},\n {&__pyx_k73p, __pyx_k73, sizeof(__pyx_k73)},\n {&__pyx_k74p, __pyx_k74, sizeof(__pyx_k74)},\n {&__pyx_k75p, __pyx_k75, sizeof(__pyx_k75)},\n {&__pyx_k76p, __pyx_k76, sizeof(__pyx_k76)},\n {&__pyx_k77p, __pyx_k77, sizeof(__pyx_k77)},\n {&__pyx_k78p, __pyx_k78, sizeof(__pyx_k78)},\n {&__pyx_k79p, __pyx_k79, sizeof(__pyx_k79)},\n {&__pyx_k80p, __pyx_k80, sizeof(__pyx_k80)},\n {&__pyx_k81p, __pyx_k81, sizeof(__pyx_k81)},\n {&__pyx_k82p, __pyx_k82, sizeof(__pyx_k82)},\n {&__pyx_k83p, __pyx_k83, sizeof(__pyx_k83)},\n {&__pyx_k84p, __pyx_k84, sizeof(__pyx_k84)},\n {&__pyx_k85p, __pyx_k85, sizeof(__pyx_k85)},\n {&__pyx_k86p, __pyx_k86, sizeof(__pyx_k86)},\n {&__pyx_k87p, __pyx_k87, sizeof(__pyx_k87)},\n {&__pyx_k88p, __pyx_k88, sizeof(__pyx_k88)},\n {&__pyx_k89p, __pyx_k89, sizeof(__pyx_k89)},\n {&__pyx_k90p, __pyx_k90, sizeof(__pyx_k90)},\n {&__pyx_k91p, __pyx_k91, sizeof(__pyx_k91)},\n {&__pyx_k92p, __pyx_k92, sizeof(__pyx_k92)},\n {&__pyx_k93p, __pyx_k93, sizeof(__pyx_k93)},\n {&__pyx_k94p, __pyx_k94, sizeof(__pyx_k94)},\n {&__pyx_k95p, __pyx_k95, sizeof(__pyx_k95)},\n {&__pyx_k96p, __pyx_k96, sizeof(__pyx_k96)},\n {&__pyx_k97p, __pyx_k97, sizeof(__pyx_k97)},\n {&__pyx_k98p, __pyx_k98, sizeof(__pyx_k98)},\n {&__pyx_k99p, __pyx_k99, sizeof(__pyx_k99)},\n {&__pyx_k100p, __pyx_k100, sizeof(__pyx_k100)},\n {&__pyx_k101p, __pyx_k101, sizeof(__pyx_k101)},\n {&__pyx_k102p, __pyx_k102, sizeof(__pyx_k102)},\n {&__pyx_k103p, __pyx_k103, sizeof(__pyx_k103)},\n {&__pyx_k104p, __pyx_k104, sizeof(__pyx_k104)},\n {&__pyx_k105p, __pyx_k105, sizeof(__pyx_k105)},\n {&__pyx_k106p, __pyx_k106, sizeof(__pyx_k106)},\n {&__pyx_k107p, __pyx_k107, sizeof(__pyx_k107)},\n {&__pyx_k108p, __pyx_k108, sizeof(__pyx_k108)},\n {&__pyx_k109p, __pyx_k109, sizeof(__pyx_k109)},\n {&__pyx_k110p, __pyx_k110, sizeof(__pyx_k110)},\n {&__pyx_k111p, __pyx_k111, sizeof(__pyx_k111)},\n {&__pyx_k112p, __pyx_k112, sizeof(__pyx_k112)},\n {&__pyx_k113p, __pyx_k113, sizeof(__pyx_k113)},\n {&__pyx_k114p, __pyx_k114, sizeof(__pyx_k114)},\n {0, 0, 0}\n};\n\nstatic PyObject *__pyx_tp_new_6mtrand_RandomState(PyTypeObject *t, PyObject *a, PyObject *k) {\n PyObject *o = (*t->tp_alloc)(t, 0);\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return o;\n}\n\nstatic void __pyx_tp_dealloc_6mtrand_RandomState(PyObject *o) {\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n {\n PyObject *etype, *eval, *etb;\n PyErr_Fetch(&etype, &eval, &etb);\n ++o->ob_refcnt;\n __pyx_f_6mtrand_11RandomState___dealloc__(o);\n if (PyErr_Occurred()) PyErr_WriteUnraisable(o);\n --o->ob_refcnt;\n PyErr_Restore(etype, eval, etb);\n }\n (*o->ob_type->tp_free)(o);\n}\n\nstatic int __pyx_tp_traverse_6mtrand_RandomState(PyObject *o, visitproc v, void *a) {\n int e;\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return 0;\n}\n\nstatic int __pyx_tp_clear_6mtrand_RandomState(PyObject *o) {\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return 0;\n}\n\nstatic struct PyMethodDef __pyx_methods_6mtrand_RandomState[] = {\n {\"seed\", (PyCFunction)__pyx_f_6mtrand_11RandomState_seed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_seed},\n {\"get_state\", (PyCFunction)__pyx_f_6mtrand_11RandomState_get_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_get_state},\n {\"set_state\", (PyCFunction)__pyx_f_6mtrand_11RandomState_set_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_set_state},\n {\"__getstate__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___getstate__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"__setstate__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___setstate__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"__reduce__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___reduce__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"random_sample\", (PyCFunction)__pyx_f_6mtrand_11RandomState_random_sample, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_random_sample},\n {\"tomaxint\", (PyCFunction)__pyx_f_6mtrand_11RandomState_tomaxint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_tomaxint},\n {\"randint\", (PyCFunction)__pyx_f_6mtrand_11RandomState_randint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_randint},\n {\"bytes\", (PyCFunction)__pyx_f_6mtrand_11RandomState_bytes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_bytes},\n {\"uniform\", (PyCFunction)__pyx_f_6mtrand_11RandomState_uniform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_uniform},\n {\"rand\", (PyCFunction)__pyx_f_6mtrand_11RandomState_rand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_rand},\n {\"randn\", (PyCFunction)__pyx_f_6mtrand_11RandomState_randn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_randn},\n {\"random_integers\", (PyCFunction)__pyx_f_6mtrand_11RandomState_random_integers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_random_integers},\n {\"standard_normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_normal},\n {\"normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_normal},\n {\"beta\", (PyCFunction)__pyx_f_6mtrand_11RandomState_beta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_beta},\n {\"exponential\", (PyCFunction)__pyx_f_6mtrand_11RandomState_exponential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_exponential},\n {\"standard_exponential\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_exponential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_exponential},\n {\"standard_gamma\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_gamma},\n {\"gamma\", (PyCFunction)__pyx_f_6mtrand_11RandomState_gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_gamma},\n {\"f\", (PyCFunction)__pyx_f_6mtrand_11RandomState_f, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_f},\n {\"noncentral_f\", (PyCFunction)__pyx_f_6mtrand_11RandomState_noncentral_f, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_noncentral_f},\n {\"chisquare\", (PyCFunction)__pyx_f_6mtrand_11RandomState_chisquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_chisquare},\n {\"noncentral_chisquare\", (PyCFunction)__pyx_f_6mtrand_11RandomState_noncentral_chisquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_noncentral_chisquare},\n {\"standard_cauchy\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_cauchy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_cauchy},\n {\"standard_t\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_t, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_t},\n {\"vonmises\", (PyCFunction)__pyx_f_6mtrand_11RandomState_vonmises, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_vonmises},\n {\"pareto\", (PyCFunction)__pyx_f_6mtrand_11RandomState_pareto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_pareto},\n {\"weibull\", (PyCFunction)__pyx_f_6mtrand_11RandomState_weibull, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_weibull},\n {\"power\", (PyCFunction)__pyx_f_6mtrand_11RandomState_power, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_power},\n {\"laplace\", (PyCFunction)__pyx_f_6mtrand_11RandomState_laplace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_laplace},\n {\"gumbel\", (PyCFunction)__pyx_f_6mtrand_11RandomState_gumbel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_gumbel},\n {\"logistic\", (PyCFunction)__pyx_f_6mtrand_11RandomState_logistic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logistic},\n {\"lognormal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_lognormal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_lognormal},\n {\"rayleigh\", (PyCFunction)__pyx_f_6mtrand_11RandomState_rayleigh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_rayleigh},\n {\"wald\", (PyCFunction)__pyx_f_6mtrand_11RandomState_wald, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_wald},\n {\"triangular\", (PyCFunction)__pyx_f_6mtrand_11RandomState_triangular, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_triangular},\n {\"binomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_binomial},\n {\"negative_binomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_negative_binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_negative_binomial},\n {\"poisson\", (PyCFunction)__pyx_f_6mtrand_11RandomState_poisson, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_poisson},\n {\"zipf\", (PyCFunction)__pyx_f_6mtrand_11RandomState_zipf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_zipf},\n {\"geometric\", (PyCFunction)__pyx_f_6mtrand_11RandomState_geometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_geometric},\n {\"hypergeometric\", (PyCFunction)__pyx_f_6mtrand_11RandomState_hypergeometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_hypergeometric},\n {\"logseries\", (PyCFunction)__pyx_f_6mtrand_11RandomState_logseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logseries},\n {\"multivariate_normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_multivariate_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multivariate_normal},\n {\"multinomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_multinomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multinomial},\n {\"shuffle\", (PyCFunction)__pyx_f_6mtrand_11RandomState_shuffle, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_shuffle},\n {\"permutation\", (PyCFunction)__pyx_f_6mtrand_11RandomState_permutation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_permutation},\n {0, 0, 0, 0}\n};\n\nstatic PyNumberMethods __pyx_tp_as_number_RandomState = {\n 0, /*nb_add*/\n 0, /*nb_subtract*/\n 0, /*nb_multiply*/\n 0, /*nb_divide*/\n 0, /*nb_remainder*/\n 0, /*nb_divmod*/\n 0, /*nb_power*/\n 0, /*nb_negative*/\n 0, /*nb_positive*/\n 0, /*nb_absolute*/\n 0, /*nb_nonzero*/\n 0, /*nb_invert*/\n 0, /*nb_lshift*/\n 0, /*nb_rshift*/\n 0, /*nb_and*/\n 0, /*nb_xor*/\n 0, /*nb_or*/\n 0, /*nb_coerce*/\n 0, /*nb_int*/\n 0, /*nb_long*/\n 0, /*nb_float*/\n 0, /*nb_oct*/\n 0, /*nb_hex*/\n 0, /*nb_inplace_add*/\n 0, /*nb_inplace_subtract*/\n 0, /*nb_inplace_multiply*/\n 0, /*nb_inplace_divide*/\n 0, /*nb_inplace_remainder*/\n 0, /*nb_inplace_power*/\n 0, /*nb_inplace_lshift*/\n 0, /*nb_inplace_rshift*/\n 0, /*nb_inplace_and*/\n 0, /*nb_inplace_xor*/\n 0, /*nb_inplace_or*/\n 0, /*nb_floor_divide*/\n 0, /*nb_true_divide*/\n 0, /*nb_inplace_floor_divide*/\n 0, /*nb_inplace_true_divide*/\n};\n\nstatic PySequenceMethods __pyx_tp_as_sequence_RandomState = {\n 0, /*sq_length*/\n 0, /*sq_concat*/\n 0, /*sq_repeat*/\n 0, /*sq_item*/\n 0, /*sq_slice*/\n 0, /*sq_ass_item*/\n 0, /*sq_ass_slice*/\n 0, /*sq_contains*/\n 0, /*sq_inplace_concat*/\n 0, /*sq_inplace_repeat*/\n};\n\nstatic PyMappingMethods __pyx_tp_as_mapping_RandomState = {\n 0, /*mp_length*/\n 0, /*mp_subscript*/\n 0, /*mp_ass_subscript*/\n};\n\nstatic PyBufferProcs __pyx_tp_as_buffer_RandomState = {\n 0, /*bf_getreadbuffer*/\n 0, /*bf_getwritebuffer*/\n 0, /*bf_getsegcount*/\n 0, /*bf_getcharbuffer*/\n};\n\nstatichere PyTypeObject __pyx_type_6mtrand_RandomState = {\n PyObject_HEAD_INIT(0)\n 0, /*ob_size*/\n \"mtrand.RandomState\", /*tp_name*/\n sizeof(struct __pyx_obj_6mtrand_RandomState), /*tp_basicsize*/\n 0, /*tp_itemsize*/\n __pyx_tp_dealloc_6mtrand_RandomState, /*tp_dealloc*/\n 0, /*tp_print*/\n 0, /*tp_getattr*/\n 0, /*tp_setattr*/\n 0, /*tp_compare*/\n 0, /*tp_repr*/\n &__pyx_tp_as_number_RandomState, /*tp_as_number*/\n &__pyx_tp_as_sequence_RandomState, /*tp_as_sequence*/\n &__pyx_tp_as_mapping_RandomState, /*tp_as_mapping*/\n 0, /*tp_hash*/\n 0, /*tp_call*/\n 0, /*tp_str*/\n 0, /*tp_getattro*/\n 0, /*tp_setattro*/\n &__pyx_tp_as_buffer_RandomState, /*tp_as_buffer*/\n Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/\n \"Container for the Mersenne Twister PRNG.\\n\\n Constructor\\n -----------\\n RandomState(seed=None): initializes the PRNG with the given seed. See the\\n seed() method for details.\\n\\n Distribution Methods\\n -----------------\\n RandomState exposes a number of methods for generating random numbers drawn\\n from a variety of probability distributions. In addition to the\\n distribution-specific arguments, each method takes a keyword argument\\n size=None. If size is None, then a single value is generated and returned.\\n If size is an integer, then a 1-D scipy array filled with generated values\\n is returned. If size is a tuple, then a scipy array with that shape is\\n filled and returned.\\n \", /*tp_doc*/\n __pyx_tp_traverse_6mtrand_RandomState, /*tp_traverse*/\n __pyx_tp_clear_6mtrand_RandomState, /*tp_clear*/\n 0, /*tp_richcompare*/\n 0, /*tp_weaklistoffset*/\n 0, /*tp_iter*/\n 0, /*tp_iternext*/\n __pyx_methods_6mtrand_RandomState, /*tp_methods*/\n 0, /*tp_members*/\n 0, /*tp_getset*/\n 0, /*tp_base*/\n 0, /*tp_dict*/\n 0, /*tp_descr_get*/\n 0, /*tp_descr_set*/\n 0, /*tp_dictoffset*/\n __pyx_f_6mtrand_11RandomState___init__, /*tp_init*/\n 0, /*tp_alloc*/\n __pyx_tp_new_6mtrand_RandomState, /*tp_new*/\n 0, /*tp_free*/\n 0, /*tp_is_gc*/\n 0, /*tp_bases*/\n 0, /*tp_mro*/\n 0, /*tp_cache*/\n 0, /*tp_subclasses*/\n 0, /*tp_weaklist*/\n};\n\nstatic struct PyMethodDef __pyx_methods[] = {\n {0, 0, 0, 0}\n};\n\nDL_EXPORT(void) initmtrand(void); /*proto*/\nDL_EXPORT(void) initmtrand(void) {\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n __pyx_m = Py_InitModule4(\"mtrand\", __pyx_methods, 0, 0, PYTHON_API_VERSION);\n if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n __pyx_b = PyImport_AddModule(\"__builtin__\");\n if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (PyObject_SetAttrString(__pyx_m, \"__builtins__\", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n __pyx_ptype_6mtrand_ArrayType = __Pyx_ImportType(\"scipy\", \"ArrayType\", sizeof(PyArrayObject)); if (!__pyx_ptype_6mtrand_ArrayType) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; goto __pyx_L1;}\n if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}\n if (PyObject_SetAttrString(__pyx_m, \"RandomState\", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}\n __pyx_ptype_6mtrand_RandomState = &__pyx_type_6mtrand_RandomState;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":114 */\n import_array();\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":116 */\n __pyx_1 = __Pyx_Import(__pyx_n_scipy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}\n if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":282 */\n Py_INCREF(Py_None);\n __pyx_k2 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":291 */\n Py_INCREF(Py_None);\n __pyx_k3 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":352 */\n Py_INCREF(Py_None);\n __pyx_k4 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":359 */\n Py_INCREF(Py_None);\n __pyx_k5 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":366 */\n Py_INCREF(Py_None);\n __pyx_k6 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k7 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":412 */\n __pyx_k8 = 0.0;\n __pyx_k9 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k10 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":442 */\n Py_INCREF(Py_None);\n __pyx_k11 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k12 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":455 */\n Py_INCREF(Py_None);\n __pyx_k13 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":462 */\n __pyx_k14 = 0.0;\n __pyx_k15 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k16 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":471 */\n Py_INCREF(Py_None);\n __pyx_k17 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":482 */\n __pyx_k18 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k19 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":491 */\n Py_INCREF(Py_None);\n __pyx_k20 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":498 */\n Py_INCREF(Py_None);\n __pyx_k21 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":507 */\n __pyx_k22 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k23 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":518 */\n Py_INCREF(Py_None);\n __pyx_k24 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":529 */\n Py_INCREF(Py_None);\n __pyx_k25 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":543 */\n Py_INCREF(Py_None);\n __pyx_k26 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":552 */\n Py_INCREF(Py_None);\n __pyx_k27 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":564 */\n Py_INCREF(Py_None);\n __pyx_k28 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":571 */\n Py_INCREF(Py_None);\n __pyx_k29 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":580 */\n Py_INCREF(Py_None);\n __pyx_k30 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":590 */\n Py_INCREF(Py_None);\n __pyx_k31 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":599 */\n Py_INCREF(Py_None);\n __pyx_k32 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":608 */\n Py_INCREF(Py_None);\n __pyx_k33 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":617 */\n __pyx_k34 = 0.0;\n __pyx_k35 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k36 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":626 */\n __pyx_k37 = 0.0;\n __pyx_k38 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k39 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":635 */\n __pyx_k40 = 0.0;\n __pyx_k41 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k42 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":644 */\n __pyx_k43 = 0.0;\n __pyx_k44 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k45 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":658 */\n Py_INCREF(Py_None);\n __pyx_k46 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":667 */\n Py_INCREF(Py_None);\n __pyx_k47 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":678 */\n Py_INCREF(Py_None);\n __pyx_k48 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":694 */\n Py_INCREF(Py_None);\n __pyx_k49 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":707 */\n Py_INCREF(Py_None);\n __pyx_k50 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":721 */\n __pyx_k51 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k52 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":730 */\n Py_INCREF(Py_None);\n __pyx_k53 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":739 */\n Py_INCREF(Py_None);\n __pyx_k54 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":751 */\n Py_INCREF(Py_None);\n __pyx_k55 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":772 */\n Py_INCREF(Py_None);\n __pyx_k56 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":784 */\n Py_INCREF(Py_None);\n __pyx_k57 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":841 */\n Py_INCREF(Py_None);\n __pyx_k58 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":919 */\n __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":920 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_get_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":921 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_set_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":922 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":923 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":924 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_bytes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":925 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_uniform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":926 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rand); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":927 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randn); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":928 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_integers); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":929 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":930 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":931 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_beta); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":932 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":933 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":934 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":935 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":936 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":937 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":938 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":939 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":940 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_cauchy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":941 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":942 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_vonmises); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":943 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_pareto); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":944 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_weibull); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":945 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_power); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":946 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_laplace); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":947 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gumbel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":948 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logistic); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":949 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lognormal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":950 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rayleigh); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":951 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_wald); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":952 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_triangular); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":954 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":955 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_negative_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":956 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_poisson); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":957 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zipf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":958 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_geometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":959 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_hypergeometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":960 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logseries); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_logseries, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":962 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multivariate_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":963 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multinomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":965 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":966 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_permutation); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n return;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n __Pyx_AddTraceback(\"mtrand\");\n}\n\nstatic char *__pyx_filenames[] = {\n \"mtrand.pyx\",\n \"scipy.pxi\",\n};\nstatichere char **__pyx_f = __pyx_filenames;\n\n/* Runtime support code */\n\nstatic int __Pyx_GetStarArgs(\n PyObject **args, \n PyObject **kwds,\n char *kwd_list[], \n int nargs,\n PyObject **args2, \n PyObject **kwds2)\n{\n PyObject *x = 0, *args1 = 0, *kwds1 = 0;\n \n if (args2)\n *args2 = 0;\n if (kwds2)\n *kwds2 = 0;\n \n if (args2) {\n args1 = PyTuple_GetSlice(*args, 0, nargs);\n if (!args1)\n goto bad;\n *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_Size(*args));\n if (!*args2)\n goto bad;\n }\n else {\n args1 = *args;\n Py_INCREF(args1);\n }\n \n if (kwds2) {\n if (*kwds) {\n char **p;\n kwds1 = PyDict_New();\n if (!kwds)\n goto bad;\n *kwds2 = PyDict_Copy(*kwds);\n if (!*kwds2)\n goto bad;\n for (p = kwd_list; *p; p++) {\n x = PyDict_GetItemString(*kwds, *p);\n if (x) {\n if (PyDict_SetItemString(kwds1, *p, x) < 0)\n goto bad;\n if (PyDict_DelItemString(*kwds2, *p) < 0)\n goto bad;\n }\n }\n }\n else {\n *kwds2 = PyDict_New();\n if (!*kwds2)\n goto bad;\n }\n }\n else {\n kwds1 = *kwds;\n Py_XINCREF(kwds1);\n }\n \n *args = args1;\n *kwds = kwds1;\n return 0;\nbad:\n Py_XDECREF(args1);\n Py_XDECREF(kwds1);\n if (*args2)\n Py_XDECREF(*args2);\n if (*kwds2)\n Py_XDECREF(*kwds2);\n return -1;\n}\n\nstatic PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {\n PyObject *__import__ = 0;\n PyObject *empty_list = 0;\n PyObject *module = 0;\n PyObject *global_dict = 0;\n PyObject *empty_dict = 0;\n PyObject *list;\n __import__ = PyObject_GetAttrString(__pyx_b, \"__import__\");\n if (!__import__)\n goto bad;\n if (from_list)\n list = from_list;\n else {\n empty_list = PyList_New(0);\n if (!empty_list)\n goto bad;\n list = empty_list;\n }\n global_dict = PyModule_GetDict(__pyx_m);\n if (!global_dict)\n goto bad;\n empty_dict = PyDict_New();\n if (!empty_dict)\n goto bad;\n module = PyObject_CallFunction(__import__, \"OOOO\",\n name, global_dict, empty_dict, list);\nbad:\n Py_XDECREF(empty_list);\n Py_XDECREF(__import__);\n Py_XDECREF(empty_dict);\n return module;\n}\n\nstatic PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {\n PyObject *result;\n result = PyObject_GetAttr(dict, name);\n if (!result)\n PyErr_SetObject(PyExc_NameError, name);\n return result;\n}\n\nstatic void __Pyx_WriteUnraisable(char *name) {\n PyObject *old_exc, *old_val, *old_tb;\n PyObject *ctx;\n PyErr_Fetch(&old_exc, &old_val, &old_tb);\n ctx = PyString_FromString(name);\n PyErr_Restore(old_exc, old_val, old_tb);\n if (!ctx)\n ctx = Py_None;\n PyErr_WriteUnraisable(ctx);\n}\n\nstatic void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {\n Py_XINCREF(type);\n Py_XINCREF(value);\n Py_XINCREF(tb);\n /* First, check the traceback argument, replacing None with NULL. */\n if (tb == Py_None) {\n Py_DECREF(tb);\n tb = 0;\n }\n else if (tb != NULL && !PyTraceBack_Check(tb)) {\n PyErr_SetString(PyExc_TypeError,\n \"raise: arg 3 must be a traceback or None\");\n goto raise_error;\n }\n /* Next, replace a missing value with None */\n if (value == NULL) {\n value = Py_None;\n Py_INCREF(value);\n }\n /* Next, repeatedly, replace a tuple exception with its first item */\n while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {\n PyObject *tmp = type;\n type = PyTuple_GET_ITEM(type, 0);\n Py_INCREF(type);\n Py_DECREF(tmp);\n }\n if (PyString_Check(type))\n ;\n else if (PyClass_Check(type))\n ; /*PyErr_NormalizeException(&type, &value, &tb);*/\n else if (PyInstance_Check(type)) {\n /* Raising an instance. The value should be a dummy. */\n if (value != Py_None) {\n PyErr_SetString(PyExc_TypeError,\n \"instance exception may not have a separate value\");\n goto raise_error;\n }\n else {\n /* Normalize to raise , */\n Py_DECREF(value);\n value = type;\n type = (PyObject*) ((PyInstanceObject*)type)->in_class;\n Py_INCREF(type);\n }\n }\n else {\n /* Not something you can raise. You get an exception\n anyway, just not what you specified :-) */\n PyErr_Format(PyExc_TypeError,\n \"exceptions must be strings, classes, or \"\n \"instances, not %s\", type->ob_type->tp_name);\n goto raise_error;\n }\n PyErr_Restore(type, value, tb);\n return;\nraise_error:\n Py_XDECREF(value);\n Py_XDECREF(type);\n Py_XDECREF(tb);\n return;\n}\n\nstatic void __Pyx_UnpackError(void) {\n PyErr_SetString(PyExc_ValueError, \"unpack sequence of wrong size\");\n}\n\nstatic PyObject *__Pyx_UnpackItem(PyObject *seq, int i) {\n PyObject *item;\n if (!(item = PySequence_GetItem(seq, i))) {\n if (PyErr_ExceptionMatches(PyExc_IndexError))\n \t__Pyx_UnpackError();\n }\n return item;\n}\n\nstatic int __Pyx_EndUnpack(PyObject *seq, int i) {\n PyObject *item;\n if (item = PySequence_GetItem(seq, i)) {\n Py_DECREF(item);\n __Pyx_UnpackError();\n return -1;\n }\n PyErr_Clear();\n return 0;\n}\n\nstatic int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {\n while (t->p) {\n *t->p = PyString_InternFromString(t->s);\n if (!*t->p)\n return -1;\n ++t;\n }\n return 0;\n}\n\nstatic int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {\n while (t->p) {\n *t->p = PyString_FromStringAndSize(t->s, t->n - 1);\n if (!*t->p)\n return -1;\n ++t;\n }\n return 0;\n}\n\nstatic PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, \n long size) \n{\n PyObject *py_module_name = 0;\n PyObject *py_class_name = 0;\n PyObject *py_name_list = 0;\n PyObject *py_module = 0;\n PyObject *result = 0;\n \n py_module_name = PyString_FromString(module_name);\n if (!py_module_name)\n goto bad;\n py_class_name = PyString_FromString(class_name);\n if (!py_class_name)\n goto bad;\n py_name_list = PyList_New(1);\n if (!py_name_list)\n goto bad;\n Py_INCREF(py_class_name);\n if (PyList_SetItem(py_name_list, 0, py_class_name) < 0)\n goto bad;\n py_module = __Pyx_Import(py_module_name, py_name_list);\n if (!py_module)\n goto bad;\n result = PyObject_GetAttr(py_module, py_class_name);\n if (!result)\n goto bad;\n if (!PyType_Check(result)) {\n PyErr_Format(PyExc_TypeError, \n \"%s.%s is not a type object\",\n module_name, class_name);\n goto bad;\n }\n if (((PyTypeObject *)result)->tp_basicsize != size) {\n PyErr_Format(PyExc_ValueError, \n \"%s.%s does not appear to be the correct type object\",\n module_name, class_name);\n goto bad;\n }\n goto done;\nbad:\n Py_XDECREF(result);\n result = 0;\ndone:\n Py_XDECREF(py_module_name);\n Py_XDECREF(py_class_name);\n Py_XDECREF(py_name_list);\n return (PyTypeObject *)result;\n}\n\n#include \"compile.h\"\n#include \"frameobject.h\"\n#include \"traceback.h\"\n\nstatic void __Pyx_AddTraceback(char *funcname) {\n PyObject *py_srcfile = 0;\n PyObject *py_funcname = 0;\n PyObject *py_globals = 0;\n PyObject *empty_tuple = 0;\n PyObject *empty_string = 0;\n PyCodeObject *py_code = 0;\n PyFrameObject *py_frame = 0;\n \n py_srcfile = PyString_FromString(__pyx_filename);\n if (!py_srcfile) goto bad;\n py_funcname = PyString_FromString(funcname);\n if (!py_funcname) goto bad;\n py_globals = PyModule_GetDict(__pyx_m);\n if (!py_globals) goto bad;\n empty_tuple = PyTuple_New(0);\n if (!empty_tuple) goto bad;\n empty_string = PyString_FromString(\"\");\n if (!empty_string) goto bad;\n py_code = PyCode_New(\n 0, /*int argcount,*/\n 0, /*int nlocals,*/\n 0, /*int stacksize,*/\n 0, /*int flags,*/\n empty_string, /*PyObject *code,*/\n empty_tuple, /*PyObject *consts,*/\n empty_tuple, /*PyObject *names,*/\n empty_tuple, /*PyObject *varnames,*/\n empty_tuple, /*PyObject *freevars,*/\n empty_tuple, /*PyObject *cellvars,*/\n py_srcfile, /*PyObject *filename,*/\n py_funcname, /*PyObject *name,*/\n __pyx_lineno, /*int firstlineno,*/\n empty_string /*PyObject *lnotab*/\n );\n if (!py_code) goto bad;\n py_frame = PyFrame_New(\n PyThreadState_Get(), /*PyThreadState *tstate,*/\n py_code, /*PyCodeObject *code,*/\n py_globals, /*PyObject *globals,*/\n 0 /*PyObject *locals*/\n );\n if (!py_frame) goto bad;\n py_frame->f_lineno = __pyx_lineno;\n PyTraceBack_Here(py_frame);\nbad:\n Py_XDECREF(py_srcfile);\n Py_XDECREF(py_funcname);\n Py_XDECREF(empty_tuple);\n Py_XDECREF(empty_string);\n Py_XDECREF(py_code);\n Py_XDECREF(py_frame);\n}\n", "source_code_before": "/* Generated by Pyrex 0.9.3.1 on Thu Oct 6 21:56:32 2005 */\n\n#include \"Python.h\"\n#include \"structmember.h\"\n#ifndef PY_LONG_LONG\n #define PY_LONG_LONG LONG_LONG\n#endif\n#include \"string.h\"\n#include \"math.h\"\n#include \"scipy/arrayobject.h\"\n#include \"randomkit.h\"\n#include \"distributions.h\"\n#include \"initarray.h\"\n\n\ntypedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/\ntypedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/\nstatic PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/\nstatic int __Pyx_EndUnpack(PyObject *, int); /*proto*/\nstatic int __Pyx_PrintItem(PyObject *); /*proto*/\nstatic int __Pyx_PrintNewline(void); /*proto*/\nstatic void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/\nstatic void __Pyx_ReRaise(void); /*proto*/\nstatic PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/\nstatic PyObject *__Pyx_GetExcValue(void); /*proto*/\nstatic int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/\nstatic int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/\nstatic int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/\nstatic void __Pyx_WriteUnraisable(char *name); /*proto*/\nstatic void __Pyx_AddTraceback(char *funcname); /*proto*/\nstatic PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/\nstatic int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/\nstatic int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/\nstatic PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/\nstatic int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/\nstatic int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/\nstatic PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/\n\nstatic PyObject *__pyx_m;\nstatic PyObject *__pyx_b;\nstatic int __pyx_lineno;\nstatic char *__pyx_filename;\nstaticforward char **__pyx_f;\n\n/* Declarations from mtrand */\n\nstaticforward PyTypeObject __pyx_type_6mtrand_RandomState;\n\nstruct __pyx_obj_6mtrand_RandomState {\n PyObject_HEAD\n rk_state (*internal_state);\n};\n\nstatic PyTypeObject *__pyx_ptype_6mtrand_ArrayType = 0;\nstatic PyTypeObject *__pyx_ptype_6mtrand_RandomState = 0;\nstatic PyObject *__pyx_k2;\nstatic PyObject *__pyx_k3;\nstatic PyObject *__pyx_k4;\nstatic PyObject *__pyx_k5;\nstatic PyObject *__pyx_k6;\nstatic PyObject *__pyx_k7;\nstatic double __pyx_k8;\nstatic double __pyx_k9;\nstatic PyObject *__pyx_k10;\nstatic PyObject *__pyx_k11;\nstatic PyObject *__pyx_k12;\nstatic PyObject *__pyx_k13;\nstatic double __pyx_k14;\nstatic double __pyx_k15;\nstatic PyObject *__pyx_k16;\nstatic PyObject *__pyx_k17;\nstatic double __pyx_k18;\nstatic PyObject *__pyx_k19;\nstatic PyObject *__pyx_k20;\nstatic PyObject *__pyx_k21;\nstatic double __pyx_k22;\nstatic PyObject *__pyx_k23;\nstatic PyObject *__pyx_k24;\nstatic PyObject *__pyx_k25;\nstatic PyObject *__pyx_k26;\nstatic PyObject *__pyx_k27;\nstatic PyObject *__pyx_k28;\nstatic PyObject *__pyx_k29;\nstatic PyObject *__pyx_k30;\nstatic PyObject *__pyx_k31;\nstatic PyObject *__pyx_k32;\nstatic PyObject *__pyx_k33;\nstatic double __pyx_k34;\nstatic double __pyx_k35;\nstatic PyObject *__pyx_k36;\nstatic double __pyx_k37;\nstatic double __pyx_k38;\nstatic PyObject *__pyx_k39;\nstatic double __pyx_k40;\nstatic double __pyx_k41;\nstatic PyObject *__pyx_k42;\nstatic double __pyx_k43;\nstatic double __pyx_k44;\nstatic PyObject *__pyx_k45;\nstatic PyObject *__pyx_k46;\nstatic PyObject *__pyx_k47;\nstatic PyObject *__pyx_k48;\nstatic PyObject *__pyx_k49;\nstatic PyObject *__pyx_k50;\nstatic double __pyx_k51;\nstatic PyObject *__pyx_k52;\nstatic PyObject *__pyx_k53;\nstatic PyObject *__pyx_k54;\nstatic PyObject *__pyx_k55;\nstatic PyObject *__pyx_k56;\nstatic PyObject *__pyx_k57;\nstatic PyObject *(__pyx_f_6mtrand_cont0_array(rk_state (*),double ((*)(rk_state (*))),PyObject *)); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont1_array(rk_state (*),double ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont2_array(rk_state (*),double ((*)(rk_state (*),double ,double )),PyObject *,double ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont3_array(rk_state (*),double ((*)(rk_state (*),double ,double ,double )),PyObject *,double ,double ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_disc0_array(rk_state (*),long ((*)(rk_state (*))),PyObject *)); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discnp_array(rk_state (*),long ((*)(rk_state (*),long ,double )),PyObject *,long ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discnmN_array(rk_state (*),long ((*)(rk_state (*),long ,long ,long )),PyObject *,long ,long ,long )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discd_array(rk_state (*),long ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/\nstatic double (__pyx_f_6mtrand_kahan_sum(double (*),long )); /*proto*/\n\n/* Implementation of mtrand */\n\n\nstatic PyObject *__pyx_n__sp;\nstatic PyObject *__pyx_n__rand;\nstatic PyObject *__pyx_n_get_state;\nstatic PyObject *__pyx_n_set_state;\nstatic PyObject *__pyx_n_random_sample;\nstatic PyObject *__pyx_n_randint;\nstatic PyObject *__pyx_n_bytes;\nstatic PyObject *__pyx_n_uniform;\nstatic PyObject *__pyx_n_rand;\nstatic PyObject *__pyx_n_randn;\nstatic PyObject *__pyx_n_random_integers;\nstatic PyObject *__pyx_n_standard_normal;\nstatic PyObject *__pyx_n_normal;\nstatic PyObject *__pyx_n_beta;\nstatic PyObject *__pyx_n_exponential;\nstatic PyObject *__pyx_n_standard_exponential;\nstatic PyObject *__pyx_n_standard_gamma;\nstatic PyObject *__pyx_n_gamma;\nstatic PyObject *__pyx_n_f;\nstatic PyObject *__pyx_n_noncentral_f;\nstatic PyObject *__pyx_n_chisquare;\nstatic PyObject *__pyx_n_noncentral_chisquare;\nstatic PyObject *__pyx_n_standard_cauchy;\nstatic PyObject *__pyx_n_standard_t;\nstatic PyObject *__pyx_n_vonmises;\nstatic PyObject *__pyx_n_pareto;\nstatic PyObject *__pyx_n_weibull;\nstatic PyObject *__pyx_n_power;\nstatic PyObject *__pyx_n_laplace;\nstatic PyObject *__pyx_n_gumbel;\nstatic PyObject *__pyx_n_logistic;\nstatic PyObject *__pyx_n_lognormal;\nstatic PyObject *__pyx_n_rayleigh;\nstatic PyObject *__pyx_n_wald;\nstatic PyObject *__pyx_n_triangular;\nstatic PyObject *__pyx_n_binomial;\nstatic PyObject *__pyx_n_negative_binomial;\nstatic PyObject *__pyx_n_poisson;\nstatic PyObject *__pyx_n_zipf;\nstatic PyObject *__pyx_n_geometric;\nstatic PyObject *__pyx_n_hypergeometric;\nstatic PyObject *__pyx_n_multivariate_normal;\nstatic PyObject *__pyx_n_multinomial;\nstatic PyObject *__pyx_n_shuffle;\nstatic PyObject *__pyx_n_permutation;\nstatic PyObject *__pyx_n_scipy;\n\nstatic PyObject *__pyx_n_empty;\nstatic PyObject *__pyx_n_Float64;\n\nstatic PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":123 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":124 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":126 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":127 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":128 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":129 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":130 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":131 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont0_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":139 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":140 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":142 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":143 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":144 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":145 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":146 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":147 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont1_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":156 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":157 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":159 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":160 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":161 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":162 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":163 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":164 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont2_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b,double __pyx_v_c) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":174 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":175 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":177 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":178 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":179 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":180 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":181 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":182 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont3_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_Int;\n\nstatic PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":190 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":191 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":193 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":194 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":195 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":196 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":197 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":198 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.disc0_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,double )),PyObject *__pyx_v_size,long __pyx_v_n,double __pyx_v_p) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":206 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":207 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":209 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":210 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":211 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":212 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":213 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":214 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discnp_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,long ,long )),PyObject *__pyx_v_size,long __pyx_v_n,long __pyx_v_m,long __pyx_v_N) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":223 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":224 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":226 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":227 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":228 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":229 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":230 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":231 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discnmN_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":239 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":240 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":242 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":243 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":244 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":245 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":246 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":247 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discd_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic double __pyx_f_6mtrand_kahan_sum(double (*__pyx_v_darr),long __pyx_v_n) {\n double __pyx_v_c;\n double __pyx_v_y;\n double __pyx_v_t;\n double __pyx_v_sum;\n long __pyx_v_i;\n double __pyx_r;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":252 */\n __pyx_v_sum = (__pyx_v_darr[0]);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":253 */\n __pyx_v_c = 0.0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":254 */\n for (__pyx_v_i = 1; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":255 */\n __pyx_v_y = ((__pyx_v_darr[__pyx_v_i]) - __pyx_v_c);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":256 */\n __pyx_v_t = (__pyx_v_sum + __pyx_v_y);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":257 */\n __pyx_v_c = ((__pyx_v_t - __pyx_v_sum) - __pyx_v_y);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":258 */\n __pyx_v_sum = __pyx_v_t;\n __pyx_L2:;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":259 */\n __pyx_r = __pyx_v_sum;\n goto __pyx_L0;\n\n __pyx_r = 0;\n goto __pyx_L0;\n __pyx_L1:;\n __Pyx_WriteUnraisable(\"mtrand.kahan_sum\");\n __pyx_L0:;\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_seed;\n\nstatic int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_seed = 0;\n int __pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {\"seed\",0};\n __pyx_v_seed = __pyx_k2;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_seed)) return -1;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_seed);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":282 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state (*))PyMem_Malloc((sizeof(rk_state ))));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":284 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_seed);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n __pyx_r = 0;\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__init__\");\n __pyx_r = -1;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_seed);\n return __pyx_r;\n}\n\nstatic void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self); /*proto*/\nstatic void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {\n int __pyx_1;\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":287 */\n __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":288 */\n PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n goto __pyx_L0;\n __pyx_L1:;\n __Pyx_AddTraceback(\"mtrand.RandomState.__dealloc__\");\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n}\n\nstatic PyObject *__pyx_n_type;\nstatic PyObject *__pyx_n_int;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_seed[] = \"Seed the generator.\\n\\n seed(seed=None)\\n\\n seed can be an integer, an array (or other sequence) of integers of any\\n length, or None. If seed is None, then RandomState will try to read data\\n from /dev/urandom (or the Windows analogue) if available or seed from\\n the clock otherwise.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_seed = 0;\n rk_error __pyx_v_errcode;\n PyArrayObject *__pyx_v_obj;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n unsigned long __pyx_5;\n static char *__pyx_argnames[] = {\"seed\",0};\n __pyx_v_seed = __pyx_k3;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_seed)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_seed);\n __pyx_v_obj = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_obj);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":302 */\n __pyx_1 = __pyx_v_seed == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":303 */\n __pyx_v_errcode = rk_randomseed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_seed);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}\n __pyx_1 = __pyx_4 == __pyx_2;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":305 */\n __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":307 */\n __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_3;\n __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":308 */\n init_by_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,((unsigned long (*))__pyx_v_obj->data),(__pyx_v_obj->dimensions[0]));\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.seed\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_obj);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_seed);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_MT19937;\n\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_get_state[] = \"Return a tuple representing the internal state of the generator.\\n\\n get_state() -> (\\'MT19937\\', int key[624], int pos)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyArrayObject *__pyx_v_state;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n __pyx_v_state = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":317 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n __pyx_1 = 0;\n __pyx_4 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_INCREF(((PyObject *)__pyx_1));\n Py_DECREF(((PyObject *)__pyx_v_state));\n __pyx_v_state = ((PyObject *)__pyx_1);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":318 */\n memcpy(((void (*))__pyx_v_state->data),((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,(624 * (sizeof(long ))));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":319 */\n __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}\n Py_INCREF(__pyx_n_MT19937);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_n_MT19937);\n Py_INCREF(((PyObject *)__pyx_v_state));\n PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_state));\n PyTuple_SET_ITEM(__pyx_2, 2, __pyx_4);\n __pyx_4 = 0;\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.get_state\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_state);\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_ValueError;\n\nstatic PyObject *__pyx_k60p;\nstatic PyObject *__pyx_k61p;\n\nstatic char (__pyx_k60[]) = \"algorithm must be 'MT19937'\";\nstatic char (__pyx_k61[]) = \"state must be 624 longs\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_set_state[] = \"Set the state from a tuple.\\n \\n state = (\\'MT19937\\', int key[624], int pos)\\n \\n set_state(state)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_state = 0;\n PyArrayObject *__pyx_v_obj;\n int __pyx_v_pos;\n PyObject *__pyx_v_algorithm_name;\n PyObject *__pyx_v_key;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n int __pyx_3;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"state\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_state)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_state);\n __pyx_v_obj = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_obj);\n __pyx_v_algorithm_name = Py_None; Py_INCREF(__pyx_v_algorithm_name);\n __pyx_v_key = Py_None; Py_INCREF(__pyx_v_key);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":330 */\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; goto __pyx_L1;}\n __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_algorithm_name);\n __pyx_v_algorithm_name = __pyx_2;\n __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":331 */\n if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n __pyx_3 = __pyx_3 != 0;\n if (__pyx_3) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":332 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n Py_INCREF(__pyx_k60p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k60p);\n __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":333 */\n __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_DECREF(__pyx_v_key);\n __pyx_v_key = __pyx_2;\n __pyx_2 = 0;\n __pyx_4 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n __pyx_3 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_v_pos = __pyx_3;\n if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":334 */\n __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_4;\n __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":335 */\n __pyx_3 = ((__pyx_v_obj->dimensions[0]) != 624);\n if (__pyx_3) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":336 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}\n Py_INCREF(__pyx_k61p);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k61p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":337 */\n memcpy(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,((void (*))__pyx_v_obj->data),(624 * (sizeof(long ))));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":338 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.set_state\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_obj);\n Py_DECREF(__pyx_v_algorithm_name);\n Py_DECREF(__pyx_v_key);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_state);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":342 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__getstate__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_state = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {\"state\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_state)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":345 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}\n Py_INCREF(__pyx_v_state);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_state);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__setstate__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_state);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_stats;\nstatic PyObject *__pyx_n___RandomState_ctor;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":348 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stats); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_5);\n __pyx_1 = 0;\n __pyx_2 = 0;\n __pyx_5 = 0;\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.__reduce__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_random_sample[] = \"Return random floats in the half-open interval [0.0, 1.0).\\n\\n random_sample(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k4;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":356 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.random_sample\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_tomaxint[] = \"Returns random integers x such that 0 <= x <= sys.maxint.\\n\\n tomaxint(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k5;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":363 */\n __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.tomaxint\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k62p;\n\nstatic char (__pyx_k62[]) = \"low >= high\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_randint[] = \"Return random integers x such that low <= x < high.\\n\\n randint(low, high=None, size=None) -> random values\\n\\n If high is None, then 0 <= x < low.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_low = 0;\n PyObject *__pyx_v_high = 0;\n PyObject *__pyx_v_size = 0;\n long __pyx_v_lo;\n long __pyx_v_hi;\n long __pyx_v_diff;\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n long __pyx_2;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_high = __pyx_k6;\n __pyx_v_size = __pyx_k7;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O|OO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_low);\n Py_INCREF(__pyx_v_high);\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":378 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":379 */\n __pyx_v_lo = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":380 */\n __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":382 */\n __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; goto __pyx_L1;}\n __pyx_v_lo = __pyx_2;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":383 */\n __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":385 */\n __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":386 */\n __pyx_1 = (__pyx_v_diff < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":387 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}\n __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}\n Py_INCREF(__pyx_k62p);\n PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k62p);\n __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __Pyx_Raise(__pyx_5, 0, 0);\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":389 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":390 */\n __pyx_3 = PyLong_FromUnsignedLong(rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n goto __pyx_L4;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":392 */\n __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":393 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":394 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":395 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":396 */\n (__pyx_v_array_data[__pyx_v_i]) = (__pyx_v_lo + rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state));\n __pyx_L5:;\n }\n __pyx_L6:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":397 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L4:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.randint\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_bytes[] = \"Return random bytes.\\n\\n bytes(length) -> str\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n unsigned int __pyx_v_length;\n void (*__pyx_v_bytes);\n PyObject *__pyx_v_bytestring;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"length\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"i\", __pyx_argnames, &__pyx_v_length)) return 0;\n Py_INCREF(__pyx_v_self);\n __pyx_v_bytestring = Py_None; Py_INCREF(__pyx_v_bytestring);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":405 */\n __pyx_v_bytes = PyMem_Malloc(__pyx_v_length);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":406 */\n rk_fill(__pyx_v_bytes,__pyx_v_length,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":407 */\n __pyx_1 = PyString_FromString(((char (*))__pyx_v_bytes)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; goto __pyx_L1;}\n Py_DECREF(__pyx_v_bytestring);\n __pyx_v_bytestring = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":408 */\n PyMem_Free(__pyx_v_bytes);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":409 */\n Py_INCREF(__pyx_v_bytestring);\n __pyx_r = __pyx_v_bytestring;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.bytes\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_bytestring);\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_uniform[] = \"Uniform distribution over [low, high).\\n\\n uniform(low=0.0, high=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_low;\n double __pyx_v_high;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_low = __pyx_k8;\n __pyx_v_high = __pyx_k9;\n __pyx_v_size = __pyx_k10;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":416 */\n __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_low,(__pyx_v_high - __pyx_v_low)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.uniform\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_len;\nstatic PyObject *__pyx_n_size;\n\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_rand[] = \"Return an array of the given dimensions which is initialized to \\n random numbers from a uniform distribution in the range [0,1).\\n\\n randn(d0, d1, ..., dn) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_args = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {0};\n if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0) < 0) return 0;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) {\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n Py_XDECREF(__pyx_v_args);\n return 0;\n }\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":425 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}\n __pyx_4 = __pyx_4 == 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":426 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":428 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}\n __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}\n if (PyDict_SetItem(__pyx_1, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}\n __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_r = __pyx_5;\n __pyx_5 = 0;\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.rand\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_XDECREF(__pyx_v_args);\n Py_DECREF(__pyx_v_self);\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_randn[] = \"Returns zero-mean, unit-variance Gaussian random numbers in an \\n array of shape (d0, d1, ..., dn).\\n\\n randn(d0, d1, ..., dn) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_args = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n static char *__pyx_argnames[] = {0};\n if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0) < 0) return 0;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) {\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n Py_XDECREF(__pyx_v_args);\n return 0;\n }\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":436 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}\n __pyx_4 = __pyx_4 == 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":437 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":439 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_args);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.randn\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_XDECREF(__pyx_v_args);\n Py_DECREF(__pyx_v_self);\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_random_integers[] = \"Return random integers x such that low <= x <= high.\\n\\n random_integers(low, high=None, size=None) -> random values.\\n\\n If high is None, then 1 <= x <= low.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_low = 0;\n PyObject *__pyx_v_high = 0;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_high = __pyx_k11;\n __pyx_v_size = __pyx_k12;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O|OO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_low);\n Py_INCREF(__pyx_v_high);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":448 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":449 */\n Py_INCREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n __pyx_v_high = __pyx_v_low;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":450 */\n __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; goto __pyx_L1;}\n Py_DECREF(__pyx_v_low);\n __pyx_v_low = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":451 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n Py_INCREF(__pyx_v_low);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_low);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_size);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_4;\n __pyx_4 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.random_integers\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_normal[] = \"Standard Normal distribution (mean=0, stdev=1).\\n\\n standard_normal(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k13;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":459 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k64p;\n\nstatic char (__pyx_k64[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_normal[] = \"Normal distribution (mean=loc, stdev=scale).\\n\\n normal(loc=0.0, scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k14;\n __pyx_v_scale = __pyx_k15;\n __pyx_v_size = __pyx_k16;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":466 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":467 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}\n Py_INCREF(__pyx_k64p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k64p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":468 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k65p;\nstatic PyObject *__pyx_k66p;\n\nstatic char (__pyx_k65[]) = \"a <= 0\";\nstatic char (__pyx_k66[]) = \"b <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_beta[] = \"Beta distribution over [0, 1].\\n\\n beta(a, b, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n double __pyx_v_b;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"b\",\"size\",0};\n __pyx_v_size = __pyx_k17;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":475 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":476 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}\n Py_INCREF(__pyx_k65p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k65p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_b <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":478 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}\n Py_INCREF(__pyx_k66p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":479 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_a,__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.beta\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k67p;\n\nstatic char (__pyx_k67[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_exponential[] = \"Exponential distribution.\\n\\n exponential(scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"scale\",\"size\",0};\n __pyx_v_scale = __pyx_k18;\n __pyx_v_size = __pyx_k19;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":486 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":487 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}\n Py_INCREF(__pyx_k67p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":488 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.exponential\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_exponential[] = \"Standard exponential distribution (scale=1).\\n\\n standard_exponential(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k20;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":495 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_exponential\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k68p;\n\nstatic char (__pyx_k68[]) = \"shape <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_gamma[] = \"Standard Gamma distribution.\\n\\n standard_gamma(shape, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_shape;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"shape\",\"size\",0};\n __pyx_v_size = __pyx_k21;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_shape, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":502 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":503 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}\n Py_INCREF(__pyx_k68p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":504 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_gamma\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k69p;\nstatic PyObject *__pyx_k70p;\n\nstatic char (__pyx_k69[]) = \"shape <= 0\";\nstatic char (__pyx_k70[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_gamma[] = \"Gamma distribution.\\n\\n gamma(shape, scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_shape;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"shape\",\"scale\",\"size\",0};\n __pyx_v_scale = __pyx_k22;\n __pyx_v_size = __pyx_k23;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|dO\", __pyx_argnames, &__pyx_v_shape, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":511 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":512 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}\n Py_INCREF(__pyx_k69p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":514 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}\n Py_INCREF(__pyx_k70p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":515 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_shape,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.gamma\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k71p;\nstatic PyObject *__pyx_k72p;\n\nstatic char (__pyx_k71[]) = \"dfnum <= 0\";\nstatic char (__pyx_k72[]) = \"dfden <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_f[] = \"F distribution.\\n\\n f(dfnum, dfden, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_dfnum;\n double __pyx_v_dfden;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"dfnum\",\"dfden\",\"size\",0};\n __pyx_v_size = __pyx_k24;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":522 */\n __pyx_1 = (__pyx_v_dfnum <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":523 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}\n Py_INCREF(__pyx_k71p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":525 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}\n Py_INCREF(__pyx_k72p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":526 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.f\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k73p;\nstatic PyObject *__pyx_k74p;\nstatic PyObject *__pyx_k75p;\n\nstatic char (__pyx_k73[]) = \"dfnum <= 1\";\nstatic char (__pyx_k74[]) = \"dfden <= 0\";\nstatic char (__pyx_k75[]) = \"nonc < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_noncentral_f[] = \"Noncentral F distribution.\\n\\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_dfnum;\n double __pyx_v_dfden;\n double __pyx_v_nonc;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"dfnum\",\"dfden\",\"nonc\",\"size\",0};\n __pyx_v_size = __pyx_k25;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ddd|O\", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_nonc, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":533 */\n __pyx_1 = (__pyx_v_dfnum <= 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":534 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}\n Py_INCREF(__pyx_k73p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":536 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}\n Py_INCREF(__pyx_k74p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":538 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}\n Py_INCREF(__pyx_k75p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":539 */\n __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.noncentral_f\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k76p;\n\nstatic char (__pyx_k76[]) = \"df <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_chisquare[] = \"Chi^2 distribution.\\n\\n chisquare(df, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"size\",0};\n __pyx_v_size = __pyx_k26;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":547 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":548 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}\n Py_INCREF(__pyx_k76p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":549 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.chisquare\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k77p;\nstatic PyObject *__pyx_k78p;\n\nstatic char (__pyx_k77[]) = \"df <= 1\";\nstatic char (__pyx_k78[]) = \"nonc < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_noncentral_chisquare[] = \"Noncentral Chi^2 distribution.\\n\\n noncentral_chisquare(df, nonc, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n double __pyx_v_nonc;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"nonc\",\"size\",0};\n __pyx_v_size = __pyx_k27;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_nonc, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":556 */\n __pyx_1 = (__pyx_v_df <= 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":557 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}\n Py_INCREF(__pyx_k77p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":559 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}\n Py_INCREF(__pyx_k78p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":560 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_df,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.noncentral_chisquare\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_cauchy[] = \"Standard Cauchy with mode=0.\\n\\n standard_cauchy(size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k28;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":568 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_cauchy\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k79p;\n\nstatic char (__pyx_k79[]) = \"df <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_t[] = \"Standard Student\\'s t distribution with df degrees of freedom.\\n\\n standard_t(df, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"size\",0};\n __pyx_v_size = __pyx_k29;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":575 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":576 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}\n Py_INCREF(__pyx_k79p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":577 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_t\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k80p;\n\nstatic char (__pyx_k80[]) = \"kappa < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_vonmises[] = \"von Mises circular distribution with mode mu and dispersion parameter\\n kappa on [-pi, pi].\\n\\n vonmises(mu, kappa, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mu;\n double __pyx_v_kappa;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mu\",\"kappa\",\"size\",0};\n __pyx_v_size = __pyx_k30;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_mu, &__pyx_v_kappa, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":585 */\n __pyx_1 = (__pyx_v_kappa < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":586 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}\n Py_INCREF(__pyx_k80p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":587 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_mu,__pyx_v_kappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.vonmises\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k81p;\n\nstatic char (__pyx_k81[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_pareto[] = \"Pareto distribution.\\n\\n pareto(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k31;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":594 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":595 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}\n Py_INCREF(__pyx_k81p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":596 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.pareto\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k82p;\n\nstatic char (__pyx_k82[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_weibull[] = \"Weibull distribution.\\n\\n weibull(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k32;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":603 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":604 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}\n Py_INCREF(__pyx_k82p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":605 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.weibull\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k83p;\n\nstatic char (__pyx_k83[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_power[] = \"Power distribution.\\n\\n power(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k33;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":612 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":613 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}\n Py_INCREF(__pyx_k83p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":614 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.power\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k84p;\n\nstatic char (__pyx_k84[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_laplace[] = \"Laplace distribution.\\n \\n laplace(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k34;\n __pyx_v_scale = __pyx_k35;\n __pyx_v_size = __pyx_k36;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":621 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":622 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}\n Py_INCREF(__pyx_k84p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":623 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.laplace\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k85p;\n\nstatic char (__pyx_k85[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_gumbel[] = \"Gumbel distribution.\\n \\n gumbel(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k37;\n __pyx_v_scale = __pyx_k38;\n __pyx_v_size = __pyx_k39;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":630 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":631 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}\n Py_INCREF(__pyx_k85p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":632 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.gumbel\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k86p;\n\nstatic char (__pyx_k86[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_logistic[] = \"Logistic distribution.\\n \\n logistic(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k40;\n __pyx_v_scale = __pyx_k41;\n __pyx_v_size = __pyx_k42;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":639 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":640 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}\n Py_INCREF(__pyx_k86p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":641 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.logistic\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k87p;\n\nstatic char (__pyx_k87[]) = \"sigma <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_lognormal[] = \"Log-normal distribution.\\n \\n Note that the mean parameter is not the mean of this distribution, but \\n the underlying normal distribution.\\n \\n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\\n \\n lognormal(mean=0.0, sigma=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mean;\n double __pyx_v_sigma;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"sigma\",\"size\",0};\n __pyx_v_mean = __pyx_k43;\n __pyx_v_sigma = __pyx_k44;\n __pyx_v_size = __pyx_k45;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_sigma, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":653 */\n __pyx_1 = (__pyx_v_sigma <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":654 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}\n Py_INCREF(__pyx_k87p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":655 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_mean,__pyx_v_sigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.lognormal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k88p;\n\nstatic char (__pyx_k88[]) = \"mode <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_rayleigh[] = \"Rayleigh distribution.\\n \\n rayleigh(mode, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mode;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mode\",\"size\",0};\n __pyx_v_size = __pyx_k46;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_mode, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":662 */\n __pyx_1 = (__pyx_v_mode <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":663 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}\n Py_INCREF(__pyx_k88p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":664 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_mode); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.rayleigh\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k89p;\nstatic PyObject *__pyx_k90p;\n\nstatic char (__pyx_k89[]) = \"mean <= 0.0\";\nstatic char (__pyx_k90[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_wald[] = \"Wald (inverse Gaussian) distribution.\\n \\n wald(mean, scale, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mean;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"scale\",\"size\",0};\n __pyx_v_size = __pyx_k47;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":671 */\n __pyx_1 = (__pyx_v_mean <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":672 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}\n Py_INCREF(__pyx_k89p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":674 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}\n Py_INCREF(__pyx_k90p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":675 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_mean,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.wald\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k91p;\nstatic PyObject *__pyx_k92p;\nstatic PyObject *__pyx_k93p;\n\nstatic char (__pyx_k91[]) = \"left > mode\";\nstatic char (__pyx_k92[]) = \"mode > right\";\nstatic char (__pyx_k93[]) = \"left == right\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_triangular[] = \"Triangular distribution starting at left, peaking at mode, and \\n ending at right (left <= mode <= right).\\n \\n triangular(left, mode, right, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_left;\n double __pyx_v_mode;\n double __pyx_v_right;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"left\",\"mode\",\"right\",\"size\",0};\n __pyx_v_size = __pyx_k48;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ddd|O\", __pyx_argnames, &__pyx_v_left, &__pyx_v_mode, &__pyx_v_right, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":683 */\n __pyx_1 = (__pyx_v_left > __pyx_v_mode);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":684 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}\n Py_INCREF(__pyx_k91p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_mode > __pyx_v_right);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":686 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}\n Py_INCREF(__pyx_k92p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_left == __pyx_v_right);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":688 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}\n Py_INCREF(__pyx_k93p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":689 */\n __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_left,__pyx_v_mode,__pyx_v_right); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.triangular\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k94p;\nstatic PyObject *__pyx_k95p;\nstatic PyObject *__pyx_k96p;\n\nstatic char (__pyx_k94[]) = \"n <= 0\";\nstatic char (__pyx_k95[]) = \"p < 0\";\nstatic char (__pyx_k96[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_binomial[] = \"Binomial distribution of n trials and p probability of success.\\n\\n binomial(n, p, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"n\",\"p\",\"size\",0};\n __pyx_v_size = __pyx_k49;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ld|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":698 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":699 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}\n Py_INCREF(__pyx_k94p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":701 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}\n Py_INCREF(__pyx_k95p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":703 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}\n Py_INCREF(__pyx_k96p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":704 */\n __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.binomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k97p;\nstatic PyObject *__pyx_k98p;\nstatic PyObject *__pyx_k99p;\n\nstatic char (__pyx_k97[]) = \"n <= 0\";\nstatic char (__pyx_k98[]) = \"p < 0\";\nstatic char (__pyx_k99[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_negative_binomial[] = \"Negative Binomial distribution.\\n\\n negative_binomial(n, p, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"n\",\"p\",\"size\",0};\n __pyx_v_size = __pyx_k50;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ld|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":711 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":712 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}\n Py_INCREF(__pyx_k97p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":714 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}\n Py_INCREF(__pyx_k98p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":716 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}\n Py_INCREF(__pyx_k99p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":717 */\n __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.negative_binomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k100p;\n\nstatic char (__pyx_k100[]) = \"lam <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_poisson[] = \"Poisson distribution.\\n\\n poisson(lam=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_lam;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"lam\",\"size\",0};\n __pyx_v_lam = __pyx_k51;\n __pyx_v_size = __pyx_k52;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_lam, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":725 */\n __pyx_1 = (__pyx_v_lam <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":726 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}\n Py_INCREF(__pyx_k100p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":727 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_lam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.poisson\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k101p;\n\nstatic char (__pyx_k101[]) = \"a <= 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_zipf[] = \"Zipf distribution.\\n \\n zipf(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k53;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":734 */\n __pyx_1 = (__pyx_v_a <= 1.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":735 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}\n Py_INCREF(__pyx_k101p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":736 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.zipf\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k102p;\nstatic PyObject *__pyx_k103p;\n\nstatic char (__pyx_k102[]) = \"p < 0.0\";\nstatic char (__pyx_k103[]) = \"p > 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_geometric[] = \"Geometric distribution with p being the probability of \\\"success\\\" on\\n an individual trial.\\n \\n geometric(p, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"p\",\"size\",0};\n __pyx_v_size = __pyx_k54;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":744 */\n __pyx_1 = (__pyx_v_p < 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":745 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}\n Py_INCREF(__pyx_k102p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":747 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}\n Py_INCREF(__pyx_k103p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":748 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.geometric\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k104p;\nstatic PyObject *__pyx_k105p;\nstatic PyObject *__pyx_k106p;\nstatic PyObject *__pyx_k107p;\n\nstatic char (__pyx_k104[]) = \"ngood < 1\";\nstatic char (__pyx_k105[]) = \"nbad < 1\";\nstatic char (__pyx_k106[]) = \"ngood + nbad < nsample\";\nstatic char (__pyx_k107[]) = \"nsample < 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_hypergeometric[] = \"Hypergeometric distribution.\\n \\n Consider an urn with ngood \\\"good\\\" balls and nbad \\\"bad\\\" balls. If one \\n were to draw nsample balls from the urn without replacement, then \\n the hypergeometric distribution describes the distribution of \\\"good\\\" \\n balls in the sample.\\n \\n hypergeometric(ngood, nbad, nsample, size=None) \\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_ngood;\n long __pyx_v_nbad;\n long __pyx_v_nsample;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"ngood\",\"nbad\",\"nsample\",\"size\",0};\n __pyx_v_size = __pyx_k55;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lll|O\", __pyx_argnames, &__pyx_v_ngood, &__pyx_v_nbad, &__pyx_v_nsample, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":760 */\n __pyx_1 = (__pyx_v_ngood < 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":761 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}\n Py_INCREF(__pyx_k104p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nbad < 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":763 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}\n Py_INCREF(__pyx_k105p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = ((__pyx_v_ngood + __pyx_v_nbad) < __pyx_v_nsample);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":765 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}\n Py_INCREF(__pyx_k106p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nsample < 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":767 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}\n Py_INCREF(__pyx_k107p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":768 */\n __pyx_2 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ngood,__pyx_v_nbad,__pyx_v_nsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.hypergeometric\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_array;\nstatic PyObject *__pyx_n_shape;\nstatic PyObject *__pyx_n_ArgumentError;\nstatic PyObject *__pyx_n_isinstance;\nstatic PyObject *__pyx_n_list;\nstatic PyObject *__pyx_n_append;\nstatic PyObject *__pyx_n_multiply;\nstatic PyObject *__pyx_n_reduce;\nstatic PyObject *__pyx_n_linalg;\nstatic PyObject *__pyx_n_singular_value_decomposition;\nstatic PyObject *__pyx_n_matrixmultiply;\nstatic PyObject *__pyx_n_sqrt;\nstatic PyObject *__pyx_n_add;\nstatic PyObject *__pyx_n_tuple;\n\nstatic PyObject *__pyx_k108p;\nstatic PyObject *__pyx_k109p;\nstatic PyObject *__pyx_k110p;\n\nstatic char (__pyx_k108[]) = \"mean must be 1 dimensional\";\nstatic char (__pyx_k109[]) = \"cov must be 2 dimensional and square\";\nstatic char (__pyx_k110[]) = \"mean and cov must have same length\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_multivariate_normal[] = \"Return an array containing multivariate normally distributed random numbers\\n with specified mean and covariance.\\n\\n multivariate_normal(mean, cov) -> random values\\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\\n\\n mean must be a 1 dimensional array. cov must be a square two dimensional\\n array with the same number of rows and columns as mean has elements.\\n\\n The first form returns a single 1-D array containing a multivariate\\n normal.\\n\\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\\n normal.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_mean = 0;\n PyObject *__pyx_v_cov = 0;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_v_shape;\n PyObject *__pyx_v_final_shape;\n PyObject *__pyx_v_x;\n PyObject *__pyx_v_u;\n PyObject *__pyx_v_s;\n PyObject *__pyx_v_v;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"cov\",\"size\",0};\n __pyx_v_size = __pyx_k56;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"OO|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_cov, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_mean);\n Py_INCREF(__pyx_v_cov);\n Py_INCREF(__pyx_v_size);\n __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape);\n __pyx_v_final_shape = Py_None; Py_INCREF(__pyx_v_final_shape);\n __pyx_v_x = Py_None; Py_INCREF(__pyx_v_x);\n __pyx_v_u = Py_None; Py_INCREF(__pyx_v_u);\n __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s);\n __pyx_v_v = Py_None; Py_INCREF(__pyx_v_v);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":790 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}\n Py_INCREF(__pyx_v_mean);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_mean);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_mean);\n __pyx_v_mean = __pyx_3;\n __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":791 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}\n Py_INCREF(__pyx_v_cov);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_cov);\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_cov);\n __pyx_v_cov = __pyx_2;\n __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":792 */\n __pyx_4 = __pyx_v_size == Py_None;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":793 */\n __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; goto __pyx_L1;}\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":795 */\n Py_INCREF(__pyx_v_size);\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_v_size;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":796 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);\n __pyx_2 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":797 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}\n Py_INCREF(__pyx_k108p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k108p);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_3, 0, 0);\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":798 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n __pyx_2 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (!__pyx_4) {\n __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n }\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":799 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}\n Py_INCREF(__pyx_k109p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k109p);\n __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_1, 0, 0);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}\n goto __pyx_L4;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":800 */\n __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":801 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}\n Py_INCREF(__pyx_k110p);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k110p);\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __Pyx_Raise(__pyx_2, 0, 0);\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}\n goto __pyx_L5;\n }\n __pyx_L5:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":803 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_5, 1, __pyx_1);\n __pyx_1 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":804 */\n __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyList_SET_ITEM(__pyx_1, 0, __pyx_v_shape);\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L6;\n }\n __pyx_L6:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":805 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);\n __pyx_5 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_final_shape);\n __pyx_v_final_shape = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":806 */\n __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":810 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);\n __pyx_3 = 0;\n __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_x);\n __pyx_v_x = __pyx_5;\n __pyx_5 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":811 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_final_shape);\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);\n PyTuple_SET_ITEM(__pyx_1, 1, __pyx_5);\n __pyx_3 = 0;\n __pyx_5 = 0;\n if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":821 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_linalg); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_singular_value_decomposition); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n Py_INCREF(__pyx_v_cov);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_cov);\n __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n Py_DECREF(__pyx_v_u);\n __pyx_v_u = __pyx_3;\n __pyx_3 = 0;\n __pyx_5 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n Py_DECREF(__pyx_v_s);\n __pyx_v_s = __pyx_5;\n __pyx_5 = 0;\n __pyx_1 = __Pyx_UnpackItem(__pyx_2, 2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n Py_DECREF(__pyx_v_v);\n __pyx_v_v = __pyx_1;\n __pyx_1 = 0;\n if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":822 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_matrixmultiply); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_INCREF(__pyx_v_s);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_s);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n Py_INCREF(__pyx_v_v);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_v);\n __pyx_2 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_x);\n __pyx_v_x = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":825 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}\n Py_INCREF(__pyx_v_mean);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_mean);\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_x);\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_x);\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":826 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":827 */\n Py_INCREF(__pyx_v_x);\n __pyx_r = __pyx_v_x;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.multivariate_normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_shape);\n Py_DECREF(__pyx_v_final_shape);\n Py_DECREF(__pyx_v_x);\n Py_DECREF(__pyx_v_u);\n Py_DECREF(__pyx_v_s);\n Py_DECREF(__pyx_v_v);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_mean);\n Py_DECREF(__pyx_v_cov);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_zeros;\n\nstatic PyObject *__pyx_k111p;\n\nstatic char (__pyx_k111[]) = \"sum(pvals) > 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_multinomial[] = \"Multinomial distribution.\\n \\n multinomial(n, pvals, size=None) -> random values\\n\\n pvals is a sequence of probabilities that should sum to 1 (however, the\\n last element is always assumed to account for the remaining probability\\n as long as sum(pvals[:-1]) <= 1).\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n PyObject *__pyx_v_pvals = 0;\n PyObject *__pyx_v_size = 0;\n long __pyx_v_d;\n PyArrayObject *__pyx_v_parr;\n PyArrayObject *__pyx_v_mnarr;\n double (*__pyx_v_pix);\n long (*__pyx_v_mnix);\n long __pyx_v_i;\n long __pyx_v_j;\n long __pyx_v_dn;\n double __pyx_v_Sum;\n double __pyx_v_prob;\n PyObject *__pyx_v_shape;\n PyObject *__pyx_v_multin;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n long __pyx_4;\n int __pyx_5;\n static char *__pyx_argnames[] = {\"n\",\"pvals\",\"size\",0};\n __pyx_v_size = __pyx_k57;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lO|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_pvals, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_pvals);\n Py_INCREF(__pyx_v_size);\n __pyx_v_parr = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_parr);\n __pyx_v_mnarr = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_mnarr);\n __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape);\n __pyx_v_multin = Py_None; Py_INCREF(__pyx_v_multin);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":845 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}\n Py_INCREF(__pyx_v_pvals);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_pvals);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_v_d = __pyx_4;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":846 */\n __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_parr));\n __pyx_v_parr = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":847 */\n __pyx_v_pix = ((double (*))__pyx_v_parr->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":849 */\n __pyx_5 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix,(__pyx_v_d - 1)) > 1.0);\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":850 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}\n Py_INCREF(__pyx_k111p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k111p);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_1, 0, 0);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":852 */\n __pyx_5 = __pyx_v_size == Py_None;\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":853 */\n __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L3;\n }\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}\n __pyx_5 = __pyx_3 == __pyx_1;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":855 */\n __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);\n __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L3;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":857 */\n __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":859 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_1);\n __pyx_1 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_multin);\n __pyx_v_multin = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":860 */\n Py_INCREF(((PyObject *)__pyx_v_multin));\n Py_DECREF(((PyObject *)__pyx_v_mnarr));\n __pyx_v_mnarr = ((PyObject *)__pyx_v_multin);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":861 */\n __pyx_v_mnix = ((long (*))__pyx_v_mnarr->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":862 */\n __pyx_v_i = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":863 */\n while (1) {\n __pyx_L4:;\n __pyx_5 = (__pyx_v_i < PyArray_SIZE(__pyx_v_mnarr));\n if (!__pyx_5) break;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":864 */\n __pyx_v_Sum = 1.0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":865 */\n __pyx_v_dn = __pyx_v_n;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":866 */\n __pyx_4 = (__pyx_v_d - 1);\n for (__pyx_v_j = 0; __pyx_v_j < __pyx_4; ++__pyx_v_j) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":867 */\n (__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));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":868 */\n __pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":869 */\n __pyx_5 = (__pyx_v_dn <= 0);\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":870 */\n goto __pyx_L7;\n goto __pyx_L8;\n }\n __pyx_L8:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":871 */\n __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j]));\n __pyx_L6:;\n }\n __pyx_L7:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":872 */\n __pyx_5 = (__pyx_v_dn > 0);\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":873 */\n (__pyx_v_mnix[((__pyx_v_i + __pyx_v_d) - 1)]) = __pyx_v_dn;\n goto __pyx_L9;\n }\n __pyx_L9:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":875 */\n __pyx_v_i = (__pyx_v_i + __pyx_v_d);\n }\n __pyx_L5:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":877 */\n Py_INCREF(__pyx_v_multin);\n __pyx_r = __pyx_v_multin;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.multinomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_parr);\n Py_DECREF(__pyx_v_mnarr);\n Py_DECREF(__pyx_v_shape);\n Py_DECREF(__pyx_v_multin);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_pvals);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_shuffle[] = \"Modify a sequence in-place by shuffling its contents.\\n \\n shuffle(x)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_x = 0;\n long __pyx_v_i;\n long __pyx_v_j;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n long __pyx_4;\n int __pyx_5;\n static char *__pyx_argnames[] = {\"x\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_x)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":888 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_v_i = __pyx_4;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":889 */\n while (1) {\n __pyx_L2:;\n __pyx_5 = (__pyx_v_i > 0);\n if (!__pyx_5) break;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":890 */\n __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":891 */\n __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":892 */\n __pyx_v_i = (__pyx_v_i - 1);\n }\n __pyx_L3:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.shuffle\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_x);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_arange;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_permutation[] = \"Given an integer, return a shuffled sequence of integers >= 0 and \\n < x.\\n\\n permutation(x)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_x = 0;\n PyObject *__pyx_v_arr;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {\"x\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_x)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n __pyx_v_arr = Py_None; Py_INCREF(__pyx_v_arr);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":900 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_arange); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_arr);\n __pyx_v_arr = __pyx_3;\n __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":901 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; goto __pyx_L1;}\n Py_INCREF(__pyx_v_arr);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_arr);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":902 */\n Py_INCREF(__pyx_v_arr);\n __pyx_r = __pyx_v_arr;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.permutation\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_arr);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_x);\n return __pyx_r;\n}\n\nstatic __Pyx_InternTabEntry __pyx_intern_tab[] = {\n {&__pyx_n_ArgumentError, \"ArgumentError\"},\n {&__pyx_n_Float64, \"Float64\"},\n {&__pyx_n_Int, \"Int\"},\n {&__pyx_n_MT19937, \"MT19937\"},\n {&__pyx_n_ValueError, \"ValueError\"},\n {&__pyx_n___RandomState_ctor, \"__RandomState_ctor\"},\n {&__pyx_n__rand, \"_rand\"},\n {&__pyx_n__sp, \"_sp\"},\n {&__pyx_n_add, \"add\"},\n {&__pyx_n_append, \"append\"},\n {&__pyx_n_arange, \"arange\"},\n {&__pyx_n_array, \"array\"},\n {&__pyx_n_beta, \"beta\"},\n {&__pyx_n_binomial, \"binomial\"},\n {&__pyx_n_bytes, \"bytes\"},\n {&__pyx_n_chisquare, \"chisquare\"},\n {&__pyx_n_empty, \"empty\"},\n {&__pyx_n_exponential, \"exponential\"},\n {&__pyx_n_f, \"f\"},\n {&__pyx_n_gamma, \"gamma\"},\n {&__pyx_n_geometric, \"geometric\"},\n {&__pyx_n_get_state, \"get_state\"},\n {&__pyx_n_gumbel, \"gumbel\"},\n {&__pyx_n_hypergeometric, \"hypergeometric\"},\n {&__pyx_n_int, \"int\"},\n {&__pyx_n_isinstance, \"isinstance\"},\n {&__pyx_n_laplace, \"laplace\"},\n {&__pyx_n_len, \"len\"},\n {&__pyx_n_linalg, \"linalg\"},\n {&__pyx_n_list, \"list\"},\n {&__pyx_n_logistic, \"logistic\"},\n {&__pyx_n_lognormal, \"lognormal\"},\n {&__pyx_n_matrixmultiply, \"matrixmultiply\"},\n {&__pyx_n_multinomial, \"multinomial\"},\n {&__pyx_n_multiply, \"multiply\"},\n {&__pyx_n_multivariate_normal, \"multivariate_normal\"},\n {&__pyx_n_negative_binomial, \"negative_binomial\"},\n {&__pyx_n_noncentral_chisquare, \"noncentral_chisquare\"},\n {&__pyx_n_noncentral_f, \"noncentral_f\"},\n {&__pyx_n_normal, \"normal\"},\n {&__pyx_n_pareto, \"pareto\"},\n {&__pyx_n_permutation, \"permutation\"},\n {&__pyx_n_poisson, \"poisson\"},\n {&__pyx_n_power, \"power\"},\n {&__pyx_n_rand, \"rand\"},\n {&__pyx_n_randint, \"randint\"},\n {&__pyx_n_randn, \"randn\"},\n {&__pyx_n_random_integers, \"random_integers\"},\n {&__pyx_n_random_sample, \"random_sample\"},\n {&__pyx_n_rayleigh, \"rayleigh\"},\n {&__pyx_n_reduce, \"reduce\"},\n {&__pyx_n_scipy, \"scipy\"},\n {&__pyx_n_seed, \"seed\"},\n {&__pyx_n_set_state, \"set_state\"},\n {&__pyx_n_shape, \"shape\"},\n {&__pyx_n_shuffle, \"shuffle\"},\n {&__pyx_n_singular_value_decomposition, \"singular_value_decomposition\"},\n {&__pyx_n_size, \"size\"},\n {&__pyx_n_sqrt, \"sqrt\"},\n {&__pyx_n_standard_cauchy, \"standard_cauchy\"},\n {&__pyx_n_standard_exponential, \"standard_exponential\"},\n {&__pyx_n_standard_gamma, \"standard_gamma\"},\n {&__pyx_n_standard_normal, \"standard_normal\"},\n {&__pyx_n_standard_t, \"standard_t\"},\n {&__pyx_n_stats, \"stats\"},\n {&__pyx_n_triangular, \"triangular\"},\n {&__pyx_n_tuple, \"tuple\"},\n {&__pyx_n_type, \"type\"},\n {&__pyx_n_uniform, \"uniform\"},\n {&__pyx_n_vonmises, \"vonmises\"},\n {&__pyx_n_wald, \"wald\"},\n {&__pyx_n_weibull, \"weibull\"},\n {&__pyx_n_zeros, \"zeros\"},\n {&__pyx_n_zipf, \"zipf\"},\n {0, 0}\n};\n\nstatic __Pyx_StringTabEntry __pyx_string_tab[] = {\n {&__pyx_k60p, __pyx_k60, sizeof(__pyx_k60)},\n {&__pyx_k61p, __pyx_k61, sizeof(__pyx_k61)},\n {&__pyx_k62p, __pyx_k62, sizeof(__pyx_k62)},\n {&__pyx_k64p, __pyx_k64, sizeof(__pyx_k64)},\n {&__pyx_k65p, __pyx_k65, sizeof(__pyx_k65)},\n {&__pyx_k66p, __pyx_k66, sizeof(__pyx_k66)},\n {&__pyx_k67p, __pyx_k67, sizeof(__pyx_k67)},\n {&__pyx_k68p, __pyx_k68, sizeof(__pyx_k68)},\n {&__pyx_k69p, __pyx_k69, sizeof(__pyx_k69)},\n {&__pyx_k70p, __pyx_k70, sizeof(__pyx_k70)},\n {&__pyx_k71p, __pyx_k71, sizeof(__pyx_k71)},\n {&__pyx_k72p, __pyx_k72, sizeof(__pyx_k72)},\n {&__pyx_k73p, __pyx_k73, sizeof(__pyx_k73)},\n {&__pyx_k74p, __pyx_k74, sizeof(__pyx_k74)},\n {&__pyx_k75p, __pyx_k75, sizeof(__pyx_k75)},\n {&__pyx_k76p, __pyx_k76, sizeof(__pyx_k76)},\n {&__pyx_k77p, __pyx_k77, sizeof(__pyx_k77)},\n {&__pyx_k78p, __pyx_k78, sizeof(__pyx_k78)},\n {&__pyx_k79p, __pyx_k79, sizeof(__pyx_k79)},\n {&__pyx_k80p, __pyx_k80, sizeof(__pyx_k80)},\n {&__pyx_k81p, __pyx_k81, sizeof(__pyx_k81)},\n {&__pyx_k82p, __pyx_k82, sizeof(__pyx_k82)},\n {&__pyx_k83p, __pyx_k83, sizeof(__pyx_k83)},\n {&__pyx_k84p, __pyx_k84, sizeof(__pyx_k84)},\n {&__pyx_k85p, __pyx_k85, sizeof(__pyx_k85)},\n {&__pyx_k86p, __pyx_k86, sizeof(__pyx_k86)},\n {&__pyx_k87p, __pyx_k87, sizeof(__pyx_k87)},\n {&__pyx_k88p, __pyx_k88, sizeof(__pyx_k88)},\n {&__pyx_k89p, __pyx_k89, sizeof(__pyx_k89)},\n {&__pyx_k90p, __pyx_k90, sizeof(__pyx_k90)},\n {&__pyx_k91p, __pyx_k91, sizeof(__pyx_k91)},\n {&__pyx_k92p, __pyx_k92, sizeof(__pyx_k92)},\n {&__pyx_k93p, __pyx_k93, sizeof(__pyx_k93)},\n {&__pyx_k94p, __pyx_k94, sizeof(__pyx_k94)},\n {&__pyx_k95p, __pyx_k95, sizeof(__pyx_k95)},\n {&__pyx_k96p, __pyx_k96, sizeof(__pyx_k96)},\n {&__pyx_k97p, __pyx_k97, sizeof(__pyx_k97)},\n {&__pyx_k98p, __pyx_k98, sizeof(__pyx_k98)},\n {&__pyx_k99p, __pyx_k99, sizeof(__pyx_k99)},\n {&__pyx_k100p, __pyx_k100, sizeof(__pyx_k100)},\n {&__pyx_k101p, __pyx_k101, sizeof(__pyx_k101)},\n {&__pyx_k102p, __pyx_k102, sizeof(__pyx_k102)},\n {&__pyx_k103p, __pyx_k103, sizeof(__pyx_k103)},\n {&__pyx_k104p, __pyx_k104, sizeof(__pyx_k104)},\n {&__pyx_k105p, __pyx_k105, sizeof(__pyx_k105)},\n {&__pyx_k106p, __pyx_k106, sizeof(__pyx_k106)},\n {&__pyx_k107p, __pyx_k107, sizeof(__pyx_k107)},\n {&__pyx_k108p, __pyx_k108, sizeof(__pyx_k108)},\n {&__pyx_k109p, __pyx_k109, sizeof(__pyx_k109)},\n {&__pyx_k110p, __pyx_k110, sizeof(__pyx_k110)},\n {&__pyx_k111p, __pyx_k111, sizeof(__pyx_k111)},\n {0, 0, 0}\n};\n\nstatic PyObject *__pyx_tp_new_6mtrand_RandomState(PyTypeObject *t, PyObject *a, PyObject *k) {\n PyObject *o = (*t->tp_alloc)(t, 0);\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return o;\n}\n\nstatic void __pyx_tp_dealloc_6mtrand_RandomState(PyObject *o) {\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n {\n PyObject *etype, *eval, *etb;\n PyErr_Fetch(&etype, &eval, &etb);\n ++o->ob_refcnt;\n __pyx_f_6mtrand_11RandomState___dealloc__(o);\n if (PyErr_Occurred()) PyErr_WriteUnraisable(o);\n --o->ob_refcnt;\n PyErr_Restore(etype, eval, etb);\n }\n (*o->ob_type->tp_free)(o);\n}\n\nstatic int __pyx_tp_traverse_6mtrand_RandomState(PyObject *o, visitproc v, void *a) {\n int e;\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return 0;\n}\n\nstatic int __pyx_tp_clear_6mtrand_RandomState(PyObject *o) {\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return 0;\n}\n\nstatic struct PyMethodDef __pyx_methods_6mtrand_RandomState[] = {\n {\"seed\", (PyCFunction)__pyx_f_6mtrand_11RandomState_seed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_seed},\n {\"get_state\", (PyCFunction)__pyx_f_6mtrand_11RandomState_get_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_get_state},\n {\"set_state\", (PyCFunction)__pyx_f_6mtrand_11RandomState_set_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_set_state},\n {\"__getstate__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___getstate__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"__setstate__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___setstate__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"__reduce__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___reduce__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"random_sample\", (PyCFunction)__pyx_f_6mtrand_11RandomState_random_sample, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_random_sample},\n {\"tomaxint\", (PyCFunction)__pyx_f_6mtrand_11RandomState_tomaxint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_tomaxint},\n {\"randint\", (PyCFunction)__pyx_f_6mtrand_11RandomState_randint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_randint},\n {\"bytes\", (PyCFunction)__pyx_f_6mtrand_11RandomState_bytes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_bytes},\n {\"uniform\", (PyCFunction)__pyx_f_6mtrand_11RandomState_uniform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_uniform},\n {\"rand\", (PyCFunction)__pyx_f_6mtrand_11RandomState_rand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_rand},\n {\"randn\", (PyCFunction)__pyx_f_6mtrand_11RandomState_randn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_randn},\n {\"random_integers\", (PyCFunction)__pyx_f_6mtrand_11RandomState_random_integers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_random_integers},\n {\"standard_normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_normal},\n {\"normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_normal},\n {\"beta\", (PyCFunction)__pyx_f_6mtrand_11RandomState_beta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_beta},\n {\"exponential\", (PyCFunction)__pyx_f_6mtrand_11RandomState_exponential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_exponential},\n {\"standard_exponential\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_exponential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_exponential},\n {\"standard_gamma\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_gamma},\n {\"gamma\", (PyCFunction)__pyx_f_6mtrand_11RandomState_gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_gamma},\n {\"f\", (PyCFunction)__pyx_f_6mtrand_11RandomState_f, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_f},\n {\"noncentral_f\", (PyCFunction)__pyx_f_6mtrand_11RandomState_noncentral_f, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_noncentral_f},\n {\"chisquare\", (PyCFunction)__pyx_f_6mtrand_11RandomState_chisquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_chisquare},\n {\"noncentral_chisquare\", (PyCFunction)__pyx_f_6mtrand_11RandomState_noncentral_chisquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_noncentral_chisquare},\n {\"standard_cauchy\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_cauchy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_cauchy},\n {\"standard_t\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_t, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_t},\n {\"vonmises\", (PyCFunction)__pyx_f_6mtrand_11RandomState_vonmises, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_vonmises},\n {\"pareto\", (PyCFunction)__pyx_f_6mtrand_11RandomState_pareto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_pareto},\n {\"weibull\", (PyCFunction)__pyx_f_6mtrand_11RandomState_weibull, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_weibull},\n {\"power\", (PyCFunction)__pyx_f_6mtrand_11RandomState_power, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_power},\n {\"laplace\", (PyCFunction)__pyx_f_6mtrand_11RandomState_laplace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_laplace},\n {\"gumbel\", (PyCFunction)__pyx_f_6mtrand_11RandomState_gumbel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_gumbel},\n {\"logistic\", (PyCFunction)__pyx_f_6mtrand_11RandomState_logistic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logistic},\n {\"lognormal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_lognormal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_lognormal},\n {\"rayleigh\", (PyCFunction)__pyx_f_6mtrand_11RandomState_rayleigh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_rayleigh},\n {\"wald\", (PyCFunction)__pyx_f_6mtrand_11RandomState_wald, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_wald},\n {\"triangular\", (PyCFunction)__pyx_f_6mtrand_11RandomState_triangular, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_triangular},\n {\"binomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_binomial},\n {\"negative_binomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_negative_binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_negative_binomial},\n {\"poisson\", (PyCFunction)__pyx_f_6mtrand_11RandomState_poisson, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_poisson},\n {\"zipf\", (PyCFunction)__pyx_f_6mtrand_11RandomState_zipf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_zipf},\n {\"geometric\", (PyCFunction)__pyx_f_6mtrand_11RandomState_geometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_geometric},\n {\"hypergeometric\", (PyCFunction)__pyx_f_6mtrand_11RandomState_hypergeometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_hypergeometric},\n {\"multivariate_normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_multivariate_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multivariate_normal},\n {\"multinomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_multinomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multinomial},\n {\"shuffle\", (PyCFunction)__pyx_f_6mtrand_11RandomState_shuffle, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_shuffle},\n {\"permutation\", (PyCFunction)__pyx_f_6mtrand_11RandomState_permutation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_permutation},\n {0, 0, 0, 0}\n};\n\nstatic PyNumberMethods __pyx_tp_as_number_RandomState = {\n 0, /*nb_add*/\n 0, /*nb_subtract*/\n 0, /*nb_multiply*/\n 0, /*nb_divide*/\n 0, /*nb_remainder*/\n 0, /*nb_divmod*/\n 0, /*nb_power*/\n 0, /*nb_negative*/\n 0, /*nb_positive*/\n 0, /*nb_absolute*/\n 0, /*nb_nonzero*/\n 0, /*nb_invert*/\n 0, /*nb_lshift*/\n 0, /*nb_rshift*/\n 0, /*nb_and*/\n 0, /*nb_xor*/\n 0, /*nb_or*/\n 0, /*nb_coerce*/\n 0, /*nb_int*/\n 0, /*nb_long*/\n 0, /*nb_float*/\n 0, /*nb_oct*/\n 0, /*nb_hex*/\n 0, /*nb_inplace_add*/\n 0, /*nb_inplace_subtract*/\n 0, /*nb_inplace_multiply*/\n 0, /*nb_inplace_divide*/\n 0, /*nb_inplace_remainder*/\n 0, /*nb_inplace_power*/\n 0, /*nb_inplace_lshift*/\n 0, /*nb_inplace_rshift*/\n 0, /*nb_inplace_and*/\n 0, /*nb_inplace_xor*/\n 0, /*nb_inplace_or*/\n 0, /*nb_floor_divide*/\n 0, /*nb_true_divide*/\n 0, /*nb_inplace_floor_divide*/\n 0, /*nb_inplace_true_divide*/\n};\n\nstatic PySequenceMethods __pyx_tp_as_sequence_RandomState = {\n 0, /*sq_length*/\n 0, /*sq_concat*/\n 0, /*sq_repeat*/\n 0, /*sq_item*/\n 0, /*sq_slice*/\n 0, /*sq_ass_item*/\n 0, /*sq_ass_slice*/\n 0, /*sq_contains*/\n 0, /*sq_inplace_concat*/\n 0, /*sq_inplace_repeat*/\n};\n\nstatic PyMappingMethods __pyx_tp_as_mapping_RandomState = {\n 0, /*mp_length*/\n 0, /*mp_subscript*/\n 0, /*mp_ass_subscript*/\n};\n\nstatic PyBufferProcs __pyx_tp_as_buffer_RandomState = {\n 0, /*bf_getreadbuffer*/\n 0, /*bf_getwritebuffer*/\n 0, /*bf_getsegcount*/\n 0, /*bf_getcharbuffer*/\n};\n\nstatichere PyTypeObject __pyx_type_6mtrand_RandomState = {\n PyObject_HEAD_INIT(0)\n 0, /*ob_size*/\n \"mtrand.RandomState\", /*tp_name*/\n sizeof(struct __pyx_obj_6mtrand_RandomState), /*tp_basicsize*/\n 0, /*tp_itemsize*/\n __pyx_tp_dealloc_6mtrand_RandomState, /*tp_dealloc*/\n 0, /*tp_print*/\n 0, /*tp_getattr*/\n 0, /*tp_setattr*/\n 0, /*tp_compare*/\n 0, /*tp_repr*/\n &__pyx_tp_as_number_RandomState, /*tp_as_number*/\n &__pyx_tp_as_sequence_RandomState, /*tp_as_sequence*/\n &__pyx_tp_as_mapping_RandomState, /*tp_as_mapping*/\n 0, /*tp_hash*/\n 0, /*tp_call*/\n 0, /*tp_str*/\n 0, /*tp_getattro*/\n 0, /*tp_setattro*/\n &__pyx_tp_as_buffer_RandomState, /*tp_as_buffer*/\n Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/\n \"Container for the Mersenne Twister PRNG.\\n\\n Constructor\\n -----------\\n RandomState(seed=None): initializes the PRNG with the given seed. See the\\n seed() method for details.\\n\\n Distribution Methods\\n -----------------\\n RandomState exposes a number of methods for generating random numbers drawn\\n from a variety of probability distributions. In addition to the\\n distribution-specific arguments, each method takes a keyword argument\\n size=None. If size is None, then a single value is generated and returned.\\n If size is an integer, then a 1-D scipy array filled with generated values\\n is returned. If size is a tuple, then a scipy array with that shape is\\n filled and returned.\\n \", /*tp_doc*/\n __pyx_tp_traverse_6mtrand_RandomState, /*tp_traverse*/\n __pyx_tp_clear_6mtrand_RandomState, /*tp_clear*/\n 0, /*tp_richcompare*/\n 0, /*tp_weaklistoffset*/\n 0, /*tp_iter*/\n 0, /*tp_iternext*/\n __pyx_methods_6mtrand_RandomState, /*tp_methods*/\n 0, /*tp_members*/\n 0, /*tp_getset*/\n 0, /*tp_base*/\n 0, /*tp_dict*/\n 0, /*tp_descr_get*/\n 0, /*tp_descr_set*/\n 0, /*tp_dictoffset*/\n __pyx_f_6mtrand_11RandomState___init__, /*tp_init*/\n 0, /*tp_alloc*/\n __pyx_tp_new_6mtrand_RandomState, /*tp_new*/\n 0, /*tp_free*/\n 0, /*tp_is_gc*/\n 0, /*tp_bases*/\n 0, /*tp_mro*/\n 0, /*tp_cache*/\n 0, /*tp_subclasses*/\n 0, /*tp_weaklist*/\n};\n\nstatic struct PyMethodDef __pyx_methods[] = {\n {0, 0, 0, 0}\n};\n\nDL_EXPORT(void) initmtrand(void); /*proto*/\nDL_EXPORT(void) initmtrand(void) {\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n __pyx_m = Py_InitModule4(\"mtrand\", __pyx_methods, 0, 0, PYTHON_API_VERSION);\n if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n __pyx_b = PyImport_AddModule(\"__builtin__\");\n if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (PyObject_SetAttrString(__pyx_m, \"__builtins__\", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n __pyx_ptype_6mtrand_ArrayType = __Pyx_ImportType(\"scipy\", \"ArrayType\", sizeof(PyArrayObject)); if (!__pyx_ptype_6mtrand_ArrayType) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; goto __pyx_L1;}\n if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}\n if (PyObject_SetAttrString(__pyx_m, \"RandomState\", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}\n __pyx_ptype_6mtrand_RandomState = &__pyx_type_6mtrand_RandomState;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":113 */\n import_array();\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":115 */\n __pyx_1 = __Pyx_Import(__pyx_n_scipy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}\n if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":281 */\n Py_INCREF(Py_None);\n __pyx_k2 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":290 */\n Py_INCREF(Py_None);\n __pyx_k3 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":351 */\n Py_INCREF(Py_None);\n __pyx_k4 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":358 */\n Py_INCREF(Py_None);\n __pyx_k5 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":365 */\n Py_INCREF(Py_None);\n __pyx_k6 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k7 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":411 */\n __pyx_k8 = 0.0;\n __pyx_k9 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k10 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":441 */\n Py_INCREF(Py_None);\n __pyx_k11 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k12 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":454 */\n Py_INCREF(Py_None);\n __pyx_k13 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":461 */\n __pyx_k14 = 0.0;\n __pyx_k15 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k16 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":470 */\n Py_INCREF(Py_None);\n __pyx_k17 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":481 */\n __pyx_k18 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k19 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":490 */\n Py_INCREF(Py_None);\n __pyx_k20 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":497 */\n Py_INCREF(Py_None);\n __pyx_k21 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":506 */\n __pyx_k22 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k23 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":517 */\n Py_INCREF(Py_None);\n __pyx_k24 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":528 */\n Py_INCREF(Py_None);\n __pyx_k25 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":542 */\n Py_INCREF(Py_None);\n __pyx_k26 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":551 */\n Py_INCREF(Py_None);\n __pyx_k27 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":563 */\n Py_INCREF(Py_None);\n __pyx_k28 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":570 */\n Py_INCREF(Py_None);\n __pyx_k29 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":579 */\n Py_INCREF(Py_None);\n __pyx_k30 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":589 */\n Py_INCREF(Py_None);\n __pyx_k31 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":598 */\n Py_INCREF(Py_None);\n __pyx_k32 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":607 */\n Py_INCREF(Py_None);\n __pyx_k33 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":616 */\n __pyx_k34 = 0.0;\n __pyx_k35 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k36 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":625 */\n __pyx_k37 = 0.0;\n __pyx_k38 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k39 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":634 */\n __pyx_k40 = 0.0;\n __pyx_k41 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k42 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":643 */\n __pyx_k43 = 0.0;\n __pyx_k44 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k45 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":657 */\n Py_INCREF(Py_None);\n __pyx_k46 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":666 */\n Py_INCREF(Py_None);\n __pyx_k47 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":677 */\n Py_INCREF(Py_None);\n __pyx_k48 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":693 */\n Py_INCREF(Py_None);\n __pyx_k49 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":706 */\n Py_INCREF(Py_None);\n __pyx_k50 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":720 */\n __pyx_k51 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k52 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":729 */\n Py_INCREF(Py_None);\n __pyx_k53 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":738 */\n Py_INCREF(Py_None);\n __pyx_k54 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":750 */\n Py_INCREF(Py_None);\n __pyx_k55 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":772 */\n Py_INCREF(Py_None);\n __pyx_k56 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":829 */\n Py_INCREF(Py_None);\n __pyx_k57 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":905 */\n __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;}\n __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":906 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_get_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":907 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_set_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":908 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":909 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":910 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_bytes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":911 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_uniform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":912 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rand); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":913 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randn); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":914 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_integers); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":915 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":916 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":917 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_beta); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":918 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":919 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":920 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":921 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":922 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":923 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":924 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":925 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":926 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_cauchy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":927 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":928 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_vonmises); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":929 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_pareto); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":930 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_weibull); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":931 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_power); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":932 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_laplace); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":933 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gumbel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":934 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logistic); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":935 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lognormal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":936 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rayleigh); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":937 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_wald); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":938 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_triangular); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":940 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":941 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_negative_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":942 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_poisson); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":943 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zipf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":944 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_geometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":945 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_hypergeometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":947 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multivariate_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":948 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multinomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":950 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":951 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_permutation); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n return;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n __Pyx_AddTraceback(\"mtrand\");\n}\n\nstatic char *__pyx_filenames[] = {\n \"mtrand.pyx\",\n \"scipy.pxi\",\n};\nstatichere char **__pyx_f = __pyx_filenames;\n\n/* Runtime support code */\n\nstatic int __Pyx_GetStarArgs(\n PyObject **args, \n PyObject **kwds,\n char *kwd_list[], \n int nargs,\n PyObject **args2, \n PyObject **kwds2)\n{\n PyObject *x = 0, *args1 = 0, *kwds1 = 0;\n \n if (args2)\n *args2 = 0;\n if (kwds2)\n *kwds2 = 0;\n \n if (args2) {\n args1 = PyTuple_GetSlice(*args, 0, nargs);\n if (!args1)\n goto bad;\n *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_Size(*args));\n if (!*args2)\n goto bad;\n }\n else {\n args1 = *args;\n Py_INCREF(args1);\n }\n \n if (kwds2) {\n if (*kwds) {\n char **p;\n kwds1 = PyDict_New();\n if (!kwds)\n goto bad;\n *kwds2 = PyDict_Copy(*kwds);\n if (!*kwds2)\n goto bad;\n for (p = kwd_list; *p; p++) {\n x = PyDict_GetItemString(*kwds, *p);\n if (x) {\n if (PyDict_SetItemString(kwds1, *p, x) < 0)\n goto bad;\n if (PyDict_DelItemString(*kwds2, *p) < 0)\n goto bad;\n }\n }\n }\n else {\n *kwds2 = PyDict_New();\n if (!*kwds2)\n goto bad;\n }\n }\n else {\n kwds1 = *kwds;\n Py_XINCREF(kwds1);\n }\n \n *args = args1;\n *kwds = kwds1;\n return 0;\nbad:\n Py_XDECREF(args1);\n Py_XDECREF(kwds1);\n if (*args2)\n Py_XDECREF(*args2);\n if (*kwds2)\n Py_XDECREF(*kwds2);\n return -1;\n}\n\nstatic PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {\n PyObject *__import__ = 0;\n PyObject *empty_list = 0;\n PyObject *module = 0;\n PyObject *global_dict = 0;\n PyObject *empty_dict = 0;\n PyObject *list;\n __import__ = PyObject_GetAttrString(__pyx_b, \"__import__\");\n if (!__import__)\n goto bad;\n if (from_list)\n list = from_list;\n else {\n empty_list = PyList_New(0);\n if (!empty_list)\n goto bad;\n list = empty_list;\n }\n global_dict = PyModule_GetDict(__pyx_m);\n if (!global_dict)\n goto bad;\n empty_dict = PyDict_New();\n if (!empty_dict)\n goto bad;\n module = PyObject_CallFunction(__import__, \"OOOO\",\n name, global_dict, empty_dict, list);\nbad:\n Py_XDECREF(empty_list);\n Py_XDECREF(__import__);\n Py_XDECREF(empty_dict);\n return module;\n}\n\nstatic PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {\n PyObject *result;\n result = PyObject_GetAttr(dict, name);\n if (!result)\n PyErr_SetObject(PyExc_NameError, name);\n return result;\n}\n\nstatic void __Pyx_WriteUnraisable(char *name) {\n PyObject *old_exc, *old_val, *old_tb;\n PyObject *ctx;\n PyErr_Fetch(&old_exc, &old_val, &old_tb);\n ctx = PyString_FromString(name);\n PyErr_Restore(old_exc, old_val, old_tb);\n if (!ctx)\n ctx = Py_None;\n PyErr_WriteUnraisable(ctx);\n}\n\nstatic void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {\n Py_XINCREF(type);\n Py_XINCREF(value);\n Py_XINCREF(tb);\n /* First, check the traceback argument, replacing None with NULL. */\n if (tb == Py_None) {\n Py_DECREF(tb);\n tb = 0;\n }\n else if (tb != NULL && !PyTraceBack_Check(tb)) {\n PyErr_SetString(PyExc_TypeError,\n \"raise: arg 3 must be a traceback or None\");\n goto raise_error;\n }\n /* Next, replace a missing value with None */\n if (value == NULL) {\n value = Py_None;\n Py_INCREF(value);\n }\n /* Next, repeatedly, replace a tuple exception with its first item */\n while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {\n PyObject *tmp = type;\n type = PyTuple_GET_ITEM(type, 0);\n Py_INCREF(type);\n Py_DECREF(tmp);\n }\n if (PyString_Check(type))\n ;\n else if (PyClass_Check(type))\n ; /*PyErr_NormalizeException(&type, &value, &tb);*/\n else if (PyInstance_Check(type)) {\n /* Raising an instance. The value should be a dummy. */\n if (value != Py_None) {\n PyErr_SetString(PyExc_TypeError,\n \"instance exception may not have a separate value\");\n goto raise_error;\n }\n else {\n /* Normalize to raise , */\n Py_DECREF(value);\n value = type;\n type = (PyObject*) ((PyInstanceObject*)type)->in_class;\n Py_INCREF(type);\n }\n }\n else {\n /* Not something you can raise. You get an exception\n anyway, just not what you specified :-) */\n PyErr_Format(PyExc_TypeError,\n \"exceptions must be strings, classes, or \"\n \"instances, not %s\", type->ob_type->tp_name);\n goto raise_error;\n }\n PyErr_Restore(type, value, tb);\n return;\nraise_error:\n Py_XDECREF(value);\n Py_XDECREF(type);\n Py_XDECREF(tb);\n return;\n}\n\nstatic void __Pyx_UnpackError(void) {\n PyErr_SetString(PyExc_ValueError, \"unpack sequence of wrong size\");\n}\n\nstatic PyObject *__Pyx_UnpackItem(PyObject *seq, int i) {\n PyObject *item;\n if (!(item = PySequence_GetItem(seq, i))) {\n if (PyErr_ExceptionMatches(PyExc_IndexError))\n \t__Pyx_UnpackError();\n }\n return item;\n}\n\nstatic int __Pyx_EndUnpack(PyObject *seq, int i) {\n PyObject *item;\n if (item = PySequence_GetItem(seq, i)) {\n Py_DECREF(item);\n __Pyx_UnpackError();\n return -1;\n }\n PyErr_Clear();\n return 0;\n}\n\nstatic int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {\n while (t->p) {\n *t->p = PyString_InternFromString(t->s);\n if (!*t->p)\n return -1;\n ++t;\n }\n return 0;\n}\n\nstatic int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {\n while (t->p) {\n *t->p = PyString_FromStringAndSize(t->s, t->n - 1);\n if (!*t->p)\n return -1;\n ++t;\n }\n return 0;\n}\n\nstatic PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, \n long size) \n{\n PyObject *py_module_name = 0;\n PyObject *py_class_name = 0;\n PyObject *py_name_list = 0;\n PyObject *py_module = 0;\n PyObject *result = 0;\n \n py_module_name = PyString_FromString(module_name);\n if (!py_module_name)\n goto bad;\n py_class_name = PyString_FromString(class_name);\n if (!py_class_name)\n goto bad;\n py_name_list = PyList_New(1);\n if (!py_name_list)\n goto bad;\n Py_INCREF(py_class_name);\n if (PyList_SetItem(py_name_list, 0, py_class_name) < 0)\n goto bad;\n py_module = __Pyx_Import(py_module_name, py_name_list);\n if (!py_module)\n goto bad;\n result = PyObject_GetAttr(py_module, py_class_name);\n if (!result)\n goto bad;\n if (!PyType_Check(result)) {\n PyErr_Format(PyExc_TypeError, \n \"%s.%s is not a type object\",\n module_name, class_name);\n goto bad;\n }\n if (((PyTypeObject *)result)->tp_basicsize != size) {\n PyErr_Format(PyExc_ValueError, \n \"%s.%s does not appear to be the correct type object\",\n module_name, class_name);\n goto bad;\n }\n goto done;\nbad:\n Py_XDECREF(result);\n result = 0;\ndone:\n Py_XDECREF(py_module_name);\n Py_XDECREF(py_class_name);\n Py_XDECREF(py_name_list);\n return (PyTypeObject *)result;\n}\n\n#include \"compile.h\"\n#include \"frameobject.h\"\n#include \"traceback.h\"\n\nstatic void __Pyx_AddTraceback(char *funcname) {\n PyObject *py_srcfile = 0;\n PyObject *py_funcname = 0;\n PyObject *py_globals = 0;\n PyObject *empty_tuple = 0;\n PyObject *empty_string = 0;\n PyCodeObject *py_code = 0;\n PyFrameObject *py_frame = 0;\n \n py_srcfile = PyString_FromString(__pyx_filename);\n if (!py_srcfile) goto bad;\n py_funcname = PyString_FromString(funcname);\n if (!py_funcname) goto bad;\n py_globals = PyModule_GetDict(__pyx_m);\n if (!py_globals) goto bad;\n empty_tuple = PyTuple_New(0);\n if (!empty_tuple) goto bad;\n empty_string = PyString_FromString(\"\");\n if (!empty_string) goto bad;\n py_code = PyCode_New(\n 0, /*int argcount,*/\n 0, /*int nlocals,*/\n 0, /*int stacksize,*/\n 0, /*int flags,*/\n empty_string, /*PyObject *code,*/\n empty_tuple, /*PyObject *consts,*/\n empty_tuple, /*PyObject *names,*/\n empty_tuple, /*PyObject *varnames,*/\n empty_tuple, /*PyObject *freevars,*/\n empty_tuple, /*PyObject *cellvars,*/\n py_srcfile, /*PyObject *filename,*/\n py_funcname, /*PyObject *name,*/\n __pyx_lineno, /*int firstlineno,*/\n empty_string /*PyObject *lnotab*/\n );\n if (!py_code) goto bad;\n py_frame = PyFrame_New(\n PyThreadState_Get(), /*PyThreadState *tstate,*/\n py_code, /*PyCodeObject *code,*/\n py_globals, /*PyObject *globals,*/\n 0 /*PyObject *locals*/\n );\n if (!py_frame) goto bad;\n py_frame->f_lineno = __pyx_lineno;\n PyTraceBack_Here(py_frame);\nbad:\n Py_XDECREF(py_srcfile);\n Py_XDECREF(py_funcname);\n Py_XDECREF(empty_tuple);\n Py_XDECREF(empty_string);\n Py_XDECREF(py_code);\n Py_XDECREF(py_frame);\n}\n", "methods": [ { "name": "__pyx_f_6mtrand_cont0_array", "long_name": "__pyx_f_6mtrand_cont0_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "double", "__pyx_v_size" ], "start_line": 177, "end_line": 257, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont1_array", "long_name": "__pyx_f_6mtrand_cont1_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a" ], "start_line": 259, "end_line": 339, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont2_array", "long_name": "__pyx_f_6mtrand_cont2_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b" ], "start_line": 341, "end_line": 421, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont3_array", "long_name": "__pyx_f_6mtrand_cont3_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b , double __pyx_v_c)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b", "__pyx_v_c" ], "start_line": 423, "end_line": 503, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_disc0_array", "long_name": "__pyx_f_6mtrand_disc0_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "long", "__pyx_v_size" ], "start_line": 507, "end_line": 587, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnp_array", "long_name": "__pyx_f_6mtrand_discnp_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,double)) , PyObject * __pyx_v_size , long __pyx_v_n , double __pyx_v_p)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_p" ], "start_line": 589, "end_line": 669, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnmN_array", "long_name": "__pyx_f_6mtrand_discnmN_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,long,long)) , PyObject * __pyx_v_size , long __pyx_v_n , long __pyx_v_m , long __pyx_v_N)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_m", "__pyx_v_N" ], "start_line": 671, "end_line": 751, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discd_array", "long_name": "__pyx_f_6mtrand_discd_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_a" ], "start_line": 753, "end_line": 833, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_kahan_sum", "long_name": "__pyx_f_6mtrand_kahan_sum( double(*__pyx_v_darr) , long __pyx_v_n)", "filename": "mtrand.c", "nloc": 26, "complexity": 2, "token_count": 130, "parameters": [ "double", "__pyx_v_n" ], "start_line": 835, "end_line": 877, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___init__", "long_name": "__pyx_f_6mtrand_11RandomState___init__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 33, "complexity": 5, "token_count": 300, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 882, "end_line": 919, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___dealloc__", "long_name": "__pyx_f_6mtrand_11RandomState___dealloc__( PyObject * __pyx_v_self)", "filename": "mtrand.c", "nloc": 15, "complexity": 2, "token_count": 78, "parameters": [ "__pyx_v_self" ], "start_line": 922, "end_line": 941, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_seed", "long_name": "__pyx_f_6mtrand_11RandomState_seed( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 10, "token_count": 541, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 948, "end_line": 1017, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_get_state", "long_name": "__pyx_f_6mtrand_11RandomState_get_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 56, "complexity": 11, "token_count": 637, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1024, "end_line": 1086, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_set_state", "long_name": "__pyx_f_6mtrand_11RandomState_set_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 88, "complexity": 19, "token_count": 969, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1098, "end_line": 1204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 107, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___getstate__", "long_name": "__pyx_f_6mtrand_11RandomState___getstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 5, "token_count": 238, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1207, "end_line": 1237, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___setstate__", "long_name": "__pyx_f_6mtrand_11RandomState___setstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 5, "token_count": 271, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1240, "end_line": 1273, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___reduce__", "long_name": "__pyx_f_6mtrand_11RandomState___reduce__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 10, "token_count": 463, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1279, "end_line": 1326, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_sample", "long_name": "__pyx_f_6mtrand_11RandomState_random_sample( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1330, "end_line": 1356, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_tomaxint", "long_name": "__pyx_f_6mtrand_11RandomState_tomaxint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1360, "end_line": 1386, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randint", "long_name": "__pyx_f_6mtrand_11RandomState_randint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 111, "complexity": 19, "token_count": 1002, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1394, "end_line": 1537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 144, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_bytes", "long_name": "__pyx_f_6mtrand_11RandomState_bytes( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 3, "token_count": 223, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1541, "end_line": 1582, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_uniform", "long_name": "__pyx_f_6mtrand_11RandomState_uniform( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 3, "token_count": 208, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1586, "end_line": 1616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rand", "long_name": "__pyx_f_6mtrand_11RandomState_rand( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 70, "complexity": 17, "token_count": 715, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1624, "end_line": 1700, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randn", "long_name": "__pyx_f_6mtrand_11RandomState_randn( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 67, "complexity": 15, "token_count": 651, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1704, "end_line": 1777, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_integers", "long_name": "__pyx_f_6mtrand_11RandomState_random_integers( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 9, "token_count": 493, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1781, "end_line": 1850, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_normal", "long_name": "__pyx_f_6mtrand_11RandomState_standard_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1854, "end_line": 1880, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_normal", "long_name": "__pyx_f_6mtrand_11RandomState_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1888, "end_line": 1942, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_beta", "long_name": "__pyx_f_6mtrand_11RandomState_beta( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1952, "end_line": 2020, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2028, "end_line": 2080, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_standard_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2084, "end_line": 2110, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_standard_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2118, "end_line": 2169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 11, "token_count": 570, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2179, "end_line": 2248, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_f", "long_name": "__pyx_f_6mtrand_11RandomState_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2258, "end_line": 2326, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_f", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2338, "end_line": 2423, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2431, "end_line": 2482, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2492, "end_line": 2560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_cauchy", "long_name": "__pyx_f_6mtrand_11RandomState_standard_cauchy( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2564, "end_line": 2590, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_t", "long_name": "__pyx_f_6mtrand_11RandomState_standard_t( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2598, "end_line": 2649, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_vonmises", "long_name": "__pyx_f_6mtrand_11RandomState_vonmises( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 395, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2657, "end_line": 2709, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_pareto", "long_name": "__pyx_f_6mtrand_11RandomState_pareto( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2717, "end_line": 2768, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_weibull", "long_name": "__pyx_f_6mtrand_11RandomState_weibull( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2776, "end_line": 2827, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_power", "long_name": "__pyx_f_6mtrand_11RandomState_power( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2835, "end_line": 2886, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_laplace", "long_name": "__pyx_f_6mtrand_11RandomState_laplace( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2894, "end_line": 2948, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gumbel", "long_name": "__pyx_f_6mtrand_11RandomState_gumbel( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2956, "end_line": 3010, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logistic", "long_name": "__pyx_f_6mtrand_11RandomState_logistic( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3018, "end_line": 3072, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_lognormal", "long_name": "__pyx_f_6mtrand_11RandomState_lognormal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3080, "end_line": 3134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rayleigh", "long_name": "__pyx_f_6mtrand_11RandomState_rayleigh( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3142, "end_line": 3193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_wald", "long_name": "__pyx_f_6mtrand_11RandomState_wald( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3203, "end_line": 3271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_triangular", "long_name": "__pyx_f_6mtrand_11RandomState_triangular( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3283, "end_line": 3368, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3380, "end_line": 3464, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_negative_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_negative_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3476, "end_line": 3560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_poisson", "long_name": "__pyx_f_6mtrand_11RandomState_poisson( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3568, "end_line": 3620, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_zipf", "long_name": "__pyx_f_6mtrand_11RandomState_zipf( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3628, "end_line": 3679, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_geometric", "long_name": "__pyx_f_6mtrand_11RandomState_geometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3689, "end_line": 3756, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_hypergeometric", "long_name": "__pyx_f_6mtrand_11RandomState_hypergeometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 89, "complexity": 19, "token_count": 922, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3770, "end_line": 3871, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 102, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logseries", "long_name": "__pyx_f_6mtrand_11RandomState_logseries( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3881, "end_line": 3948, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multivariate_normal", "long_name": "__pyx_f_6mtrand_11RandomState_multivariate_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 367, "complexity": 119, "token_count": 4997, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3975, "end_line": 4386, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 412, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multinomial", "long_name": "__pyx_f_6mtrand_11RandomState_multinomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 180, "complexity": 35, "token_count": 1738, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4396, "end_line": 4628, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 233, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_shuffle", "long_name": "__pyx_f_6mtrand_11RandomState_shuffle( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 63, "complexity": 18, "token_count": 729, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4632, "end_line": 4705, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_permutation", "long_name": "__pyx_f_6mtrand_11RandomState_permutation( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 79, "complexity": 18, "token_count": 836, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4711, "end_line": 4800, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "__pyx_tp_new_6mtrand_RandomState", "long_name": "__pyx_tp_new_6mtrand_RandomState( PyTypeObject * t , PyObject * a , PyObject * k)", "filename": "mtrand.c", "nloc": 5, "complexity": 1, "token_count": 47, "parameters": [ "t", "a", "k" ], "start_line": 4938, "end_line": 4942, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "__pyx_tp_dealloc_6mtrand_RandomState", "long_name": "__pyx_tp_dealloc_6mtrand_RandomState( PyObject * o)", "filename": "mtrand.c", "nloc": 13, "complexity": 2, "token_count": 91, "parameters": [ "o" ], "start_line": 4944, "end_line": 4956, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "__pyx_tp_traverse_6mtrand_RandomState", "long_name": "__pyx_tp_traverse_6mtrand_RandomState( PyObject * o , visitproc v , * a)", "filename": "mtrand.c", "nloc": 5, "complexity": 1, "token_count": 33, "parameters": [ "o", "v", "a" ], "start_line": 4958, "end_line": 4962, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "__pyx_tp_clear_6mtrand_RandomState", "long_name": "__pyx_tp_clear_6mtrand_RandomState( PyObject * o)", "filename": "mtrand.c", "nloc": 4, "complexity": 1, "token_count": 23, "parameters": [ "o" ], "start_line": 4964, "end_line": 4967, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "initmtrand", "long_name": "initmtrand()", "filename": "mtrand.c", "nloc": 348, "complexity": 146, "token_count": 5614, "parameters": [], "start_line": 5143, "end_line": 5664, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 522, "top_nesting_level": 0 }, { "name": "__Pyx_GetStarArgs", "long_name": "__Pyx_GetStarArgs( PyObject ** args , PyObject ** kwds , char * kwd_list [ ] , int nargs , PyObject ** args2 , PyObject ** kwds2)", "filename": "mtrand.c", "nloc": 66, "complexity": 17, "token_count": 324, "parameters": [ "args", "kwds", "nargs", "args2", "kwds2" ], "start_line": 5674, "end_line": 5743, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__Pyx_Import", "long_name": "__Pyx_Import( PyObject * name , PyObject * from_list)", "filename": "mtrand.c", "nloc": 32, "complexity": 6, "token_count": 159, "parameters": [ "name", "from_list" ], "start_line": 5745, "end_line": 5776, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "__Pyx_GetName", "long_name": "__Pyx_GetName( PyObject * dict , PyObject * name)", "filename": "mtrand.c", "nloc": 7, "complexity": 2, "token_count": 40, "parameters": [ "dict", "name" ], "start_line": 5778, "end_line": 5784, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "__Pyx_WriteUnraisable", "long_name": "__Pyx_WriteUnraisable( char * name)", "filename": "mtrand.c", "nloc": 10, "complexity": 2, "token_count": 64, "parameters": [ "name" ], "start_line": 5786, "end_line": 5795, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "__Pyx_Raise", "long_name": "__Pyx_Raise( PyObject * type , PyObject * value , PyObject * tb)", "filename": "mtrand.c", "nloc": 54, "complexity": 11, "token_count": 259, "parameters": [ "type", "value", "tb" ], "start_line": 5797, "end_line": 5857, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "__Pyx_UnpackError", "long_name": "__Pyx_UnpackError()", "filename": "mtrand.c", "nloc": 3, "complexity": 1, "token_count": 13, "parameters": [], "start_line": 5859, "end_line": 5861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 0 }, { "name": "__Pyx_UnpackItem", "long_name": "__Pyx_UnpackItem( PyObject * seq , int i)", "filename": "mtrand.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "seq", "i" ], "start_line": 5863, "end_line": 5870, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "__Pyx_EndUnpack", "long_name": "__Pyx_EndUnpack( PyObject * seq , int i)", "filename": "mtrand.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "seq", "i" ], "start_line": 5872, "end_line": 5881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "__Pyx_InternStrings", "long_name": "__Pyx_InternStrings( __Pyx_InternTabEntry * t)", "filename": "mtrand.c", "nloc": 9, "complexity": 3, "token_count": 46, "parameters": [ "t" ], "start_line": 5883, "end_line": 5891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "__Pyx_InitStrings", "long_name": "__Pyx_InitStrings( __Pyx_StringTabEntry * t)", "filename": "mtrand.c", "nloc": 9, "complexity": 3, "token_count": 52, "parameters": [ "t" ], "start_line": 5893, "end_line": 5901, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "__Pyx_ImportType", "long_name": "__Pyx_ImportType( char * module_name , char * class_name , long size)", "filename": "mtrand.c", "nloc": 48, "complexity": 9, "token_count": 237, "parameters": [ "module_name", "class_name", "size" ], "start_line": 5903, "end_line": 5951, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "__Pyx_AddTraceback", "long_name": "__Pyx_AddTraceback( char * funcname)", "filename": "mtrand.c", "nloc": 52, "complexity": 8, "token_count": 232, "parameters": [ "funcname" ], "start_line": 5957, "end_line": 6009, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 } ], "methods_before": [ { "name": "__pyx_f_6mtrand_cont0_array", "long_name": "__pyx_f_6mtrand_cont0_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "double", "__pyx_v_size" ], "start_line": 175, "end_line": 255, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont1_array", "long_name": "__pyx_f_6mtrand_cont1_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a" ], "start_line": 257, "end_line": 337, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont2_array", "long_name": "__pyx_f_6mtrand_cont2_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b" ], "start_line": 339, "end_line": 419, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont3_array", "long_name": "__pyx_f_6mtrand_cont3_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b , double __pyx_v_c)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b", "__pyx_v_c" ], "start_line": 421, "end_line": 501, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_disc0_array", "long_name": "__pyx_f_6mtrand_disc0_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "long", "__pyx_v_size" ], "start_line": 505, "end_line": 585, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnp_array", "long_name": "__pyx_f_6mtrand_discnp_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,double)) , PyObject * __pyx_v_size , long __pyx_v_n , double __pyx_v_p)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_p" ], "start_line": 587, "end_line": 667, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnmN_array", "long_name": "__pyx_f_6mtrand_discnmN_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,long,long)) , PyObject * __pyx_v_size , long __pyx_v_n , long __pyx_v_m , long __pyx_v_N)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_m", "__pyx_v_N" ], "start_line": 669, "end_line": 749, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discd_array", "long_name": "__pyx_f_6mtrand_discd_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_a" ], "start_line": 751, "end_line": 831, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_kahan_sum", "long_name": "__pyx_f_6mtrand_kahan_sum( double(*__pyx_v_darr) , long __pyx_v_n)", "filename": "mtrand.c", "nloc": 26, "complexity": 2, "token_count": 130, "parameters": [ "double", "__pyx_v_n" ], "start_line": 833, "end_line": 875, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___init__", "long_name": "__pyx_f_6mtrand_11RandomState___init__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 33, "complexity": 5, "token_count": 300, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 880, "end_line": 917, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___dealloc__", "long_name": "__pyx_f_6mtrand_11RandomState___dealloc__( PyObject * __pyx_v_self)", "filename": "mtrand.c", "nloc": 15, "complexity": 2, "token_count": 78, "parameters": [ "__pyx_v_self" ], "start_line": 920, "end_line": 939, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_seed", "long_name": "__pyx_f_6mtrand_11RandomState_seed( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 10, "token_count": 541, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 946, "end_line": 1015, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_get_state", "long_name": "__pyx_f_6mtrand_11RandomState_get_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 56, "complexity": 11, "token_count": 637, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1022, "end_line": 1084, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_set_state", "long_name": "__pyx_f_6mtrand_11RandomState_set_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 88, "complexity": 19, "token_count": 969, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1096, "end_line": 1202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 107, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___getstate__", "long_name": "__pyx_f_6mtrand_11RandomState___getstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 5, "token_count": 238, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1205, "end_line": 1235, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___setstate__", "long_name": "__pyx_f_6mtrand_11RandomState___setstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 5, "token_count": 271, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1238, "end_line": 1271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___reduce__", "long_name": "__pyx_f_6mtrand_11RandomState___reduce__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 10, "token_count": 463, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1277, "end_line": 1324, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_sample", "long_name": "__pyx_f_6mtrand_11RandomState_random_sample( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1328, "end_line": 1354, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_tomaxint", "long_name": "__pyx_f_6mtrand_11RandomState_tomaxint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1358, "end_line": 1384, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randint", "long_name": "__pyx_f_6mtrand_11RandomState_randint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 111, "complexity": 19, "token_count": 1002, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1392, "end_line": 1535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 144, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_bytes", "long_name": "__pyx_f_6mtrand_11RandomState_bytes( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 3, "token_count": 223, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1539, "end_line": 1580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_uniform", "long_name": "__pyx_f_6mtrand_11RandomState_uniform( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 3, "token_count": 208, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1584, "end_line": 1614, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rand", "long_name": "__pyx_f_6mtrand_11RandomState_rand( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 70, "complexity": 17, "token_count": 715, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1622, "end_line": 1698, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randn", "long_name": "__pyx_f_6mtrand_11RandomState_randn( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 67, "complexity": 15, "token_count": 651, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1702, "end_line": 1775, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_integers", "long_name": "__pyx_f_6mtrand_11RandomState_random_integers( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 9, "token_count": 493, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1779, "end_line": 1848, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_normal", "long_name": "__pyx_f_6mtrand_11RandomState_standard_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1852, "end_line": 1878, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_normal", "long_name": "__pyx_f_6mtrand_11RandomState_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1886, "end_line": 1940, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_beta", "long_name": "__pyx_f_6mtrand_11RandomState_beta( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1950, "end_line": 2018, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2026, "end_line": 2078, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_standard_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2082, "end_line": 2108, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_standard_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2116, "end_line": 2167, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 11, "token_count": 570, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2177, "end_line": 2246, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_f", "long_name": "__pyx_f_6mtrand_11RandomState_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2256, "end_line": 2324, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_f", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2336, "end_line": 2421, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2429, "end_line": 2480, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2490, "end_line": 2558, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_cauchy", "long_name": "__pyx_f_6mtrand_11RandomState_standard_cauchy( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2562, "end_line": 2588, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_t", "long_name": "__pyx_f_6mtrand_11RandomState_standard_t( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2596, "end_line": 2647, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_vonmises", "long_name": "__pyx_f_6mtrand_11RandomState_vonmises( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 395, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2655, "end_line": 2707, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_pareto", "long_name": "__pyx_f_6mtrand_11RandomState_pareto( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2715, "end_line": 2766, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_weibull", "long_name": "__pyx_f_6mtrand_11RandomState_weibull( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2774, "end_line": 2825, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_power", "long_name": "__pyx_f_6mtrand_11RandomState_power( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2833, "end_line": 2884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_laplace", "long_name": "__pyx_f_6mtrand_11RandomState_laplace( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2892, "end_line": 2946, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gumbel", "long_name": "__pyx_f_6mtrand_11RandomState_gumbel( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2954, "end_line": 3008, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logistic", "long_name": "__pyx_f_6mtrand_11RandomState_logistic( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3016, "end_line": 3070, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_lognormal", "long_name": "__pyx_f_6mtrand_11RandomState_lognormal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3078, "end_line": 3132, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rayleigh", "long_name": "__pyx_f_6mtrand_11RandomState_rayleigh( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3140, "end_line": 3191, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_wald", "long_name": "__pyx_f_6mtrand_11RandomState_wald( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3201, "end_line": 3269, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_triangular", "long_name": "__pyx_f_6mtrand_11RandomState_triangular( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3281, "end_line": 3366, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3378, "end_line": 3462, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_negative_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_negative_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3474, "end_line": 3558, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_poisson", "long_name": "__pyx_f_6mtrand_11RandomState_poisson( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3566, "end_line": 3618, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_zipf", "long_name": "__pyx_f_6mtrand_11RandomState_zipf( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3626, "end_line": 3677, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_geometric", "long_name": "__pyx_f_6mtrand_11RandomState_geometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3687, "end_line": 3754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_hypergeometric", "long_name": "__pyx_f_6mtrand_11RandomState_hypergeometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 89, "complexity": 19, "token_count": 922, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3768, "end_line": 3869, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 102, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multivariate_normal", "long_name": "__pyx_f_6mtrand_11RandomState_multivariate_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 367, "complexity": 119, "token_count": 4997, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3896, "end_line": 4307, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 412, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multinomial", "long_name": "__pyx_f_6mtrand_11RandomState_multinomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 180, "complexity": 35, "token_count": 1738, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4317, "end_line": 4549, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 233, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_shuffle", "long_name": "__pyx_f_6mtrand_11RandomState_shuffle( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 63, "complexity": 18, "token_count": 729, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4553, "end_line": 4626, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_permutation", "long_name": "__pyx_f_6mtrand_11RandomState_permutation( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 49, "complexity": 9, "token_count": 473, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4632, "end_line": 4687, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "__pyx_tp_new_6mtrand_RandomState", "long_name": "__pyx_tp_new_6mtrand_RandomState( PyTypeObject * t , PyObject * a , PyObject * k)", "filename": "mtrand.c", "nloc": 5, "complexity": 1, "token_count": 47, "parameters": [ "t", "a", "k" ], "start_line": 4822, "end_line": 4826, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "__pyx_tp_dealloc_6mtrand_RandomState", "long_name": "__pyx_tp_dealloc_6mtrand_RandomState( PyObject * o)", "filename": "mtrand.c", "nloc": 13, "complexity": 2, "token_count": 91, "parameters": [ "o" ], "start_line": 4828, "end_line": 4840, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "__pyx_tp_traverse_6mtrand_RandomState", "long_name": "__pyx_tp_traverse_6mtrand_RandomState( PyObject * o , visitproc v , * a)", "filename": "mtrand.c", "nloc": 5, "complexity": 1, "token_count": 33, "parameters": [ "o", "v", "a" ], "start_line": 4842, "end_line": 4846, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "__pyx_tp_clear_6mtrand_RandomState", "long_name": "__pyx_tp_clear_6mtrand_RandomState( PyObject * o)", "filename": "mtrand.c", "nloc": 4, "complexity": 1, "token_count": 23, "parameters": [ "o" ], "start_line": 4848, "end_line": 4851, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "initmtrand", "long_name": "initmtrand()", "filename": "mtrand.c", "nloc": 341, "complexity": 143, "token_count": 5498, "parameters": [], "start_line": 5026, "end_line": 5536, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 511, "top_nesting_level": 0 }, { "name": "__Pyx_GetStarArgs", "long_name": "__Pyx_GetStarArgs( PyObject ** args , PyObject ** kwds , char * kwd_list [ ] , int nargs , PyObject ** args2 , PyObject ** kwds2)", "filename": "mtrand.c", "nloc": 66, "complexity": 17, "token_count": 324, "parameters": [ "args", "kwds", "nargs", "args2", "kwds2" ], "start_line": 5546, "end_line": 5615, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__Pyx_Import", "long_name": "__Pyx_Import( PyObject * name , PyObject * from_list)", "filename": "mtrand.c", "nloc": 32, "complexity": 6, "token_count": 159, "parameters": [ "name", "from_list" ], "start_line": 5617, "end_line": 5648, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "__Pyx_GetName", "long_name": "__Pyx_GetName( PyObject * dict , PyObject * name)", "filename": "mtrand.c", "nloc": 7, "complexity": 2, "token_count": 40, "parameters": [ "dict", "name" ], "start_line": 5650, "end_line": 5656, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "__Pyx_WriteUnraisable", "long_name": "__Pyx_WriteUnraisable( char * name)", "filename": "mtrand.c", "nloc": 10, "complexity": 2, "token_count": 64, "parameters": [ "name" ], "start_line": 5658, "end_line": 5667, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "__Pyx_Raise", "long_name": "__Pyx_Raise( PyObject * type , PyObject * value , PyObject * tb)", "filename": "mtrand.c", "nloc": 54, "complexity": 11, "token_count": 259, "parameters": [ "type", "value", "tb" ], "start_line": 5669, "end_line": 5729, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "__Pyx_UnpackError", "long_name": "__Pyx_UnpackError()", "filename": "mtrand.c", "nloc": 3, "complexity": 1, "token_count": 13, "parameters": [], "start_line": 5731, "end_line": 5733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 0 }, { "name": "__Pyx_UnpackItem", "long_name": "__Pyx_UnpackItem( PyObject * seq , int i)", "filename": "mtrand.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "seq", "i" ], "start_line": 5735, "end_line": 5742, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "__Pyx_EndUnpack", "long_name": "__Pyx_EndUnpack( PyObject * seq , int i)", "filename": "mtrand.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "seq", "i" ], "start_line": 5744, "end_line": 5753, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "__Pyx_InternStrings", "long_name": "__Pyx_InternStrings( __Pyx_InternTabEntry * t)", "filename": "mtrand.c", "nloc": 9, "complexity": 3, "token_count": 46, "parameters": [ "t" ], "start_line": 5755, "end_line": 5763, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "__Pyx_InitStrings", "long_name": "__Pyx_InitStrings( __Pyx_StringTabEntry * t)", "filename": "mtrand.c", "nloc": 9, "complexity": 3, "token_count": 52, "parameters": [ "t" ], "start_line": 5765, "end_line": 5773, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "__Pyx_ImportType", "long_name": "__Pyx_ImportType( char * module_name , char * class_name , long size)", "filename": "mtrand.c", "nloc": 48, "complexity": 9, "token_count": 237, "parameters": [ "module_name", "class_name", "size" ], "start_line": 5775, "end_line": 5823, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "__Pyx_AddTraceback", "long_name": "__Pyx_AddTraceback( char * funcname)", "filename": "mtrand.c", "nloc": 52, "complexity": 8, "token_count": 232, "parameters": [ "funcname" ], "start_line": 5829, "end_line": 5881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "__pyx_f_6mtrand_11RandomState_lognormal", "long_name": "__pyx_f_6mtrand_11RandomState_lognormal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3080, "end_line": 3134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_tomaxint", "long_name": "__pyx_f_6mtrand_11RandomState_tomaxint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1360, "end_line": 1386, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont2_array", "long_name": "__pyx_f_6mtrand_cont2_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b" ], "start_line": 341, "end_line": 421, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_laplace", "long_name": "__pyx_f_6mtrand_11RandomState_laplace( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2894, "end_line": 2948, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_permutation", "long_name": "__pyx_f_6mtrand_11RandomState_permutation( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 79, "complexity": 18, "token_count": 836, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4711, "end_line": 4800, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_standard_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2084, "end_line": 2110, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_triangular", "long_name": "__pyx_f_6mtrand_11RandomState_triangular( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3283, "end_line": 3368, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_geometric", "long_name": "__pyx_f_6mtrand_11RandomState_geometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3689, "end_line": 3756, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discd_array", "long_name": "__pyx_f_6mtrand_discd_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_a" ], "start_line": 753, "end_line": 833, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_sample", "long_name": "__pyx_f_6mtrand_11RandomState_random_sample( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1330, "end_line": 1356, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___reduce__", "long_name": "__pyx_f_6mtrand_11RandomState___reduce__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 10, "token_count": 463, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1279, "end_line": 1326, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_weibull", "long_name": "__pyx_f_6mtrand_11RandomState_weibull( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2776, "end_line": 2827, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_normal", "long_name": "__pyx_f_6mtrand_11RandomState_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1888, "end_line": 1942, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rand", "long_name": "__pyx_f_6mtrand_11RandomState_rand( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 70, "complexity": 17, "token_count": 715, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1624, "end_line": 1700, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logseries", "long_name": "__pyx_f_6mtrand_11RandomState_logseries( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3881, "end_line": 3948, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_set_state", "long_name": "__pyx_f_6mtrand_11RandomState_set_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 88, "complexity": 19, "token_count": 969, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1098, "end_line": 1204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 107, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___dealloc__", "long_name": "__pyx_f_6mtrand_11RandomState___dealloc__( PyObject * __pyx_v_self)", "filename": "mtrand.c", "nloc": 15, "complexity": 2, "token_count": 78, "parameters": [ "__pyx_v_self" ], "start_line": 922, "end_line": 941, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_standard_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2118, "end_line": 2169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont1_array", "long_name": "__pyx_f_6mtrand_cont1_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a" ], "start_line": 259, "end_line": 339, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_poisson", "long_name": "__pyx_f_6mtrand_11RandomState_poisson( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3568, "end_line": 3620, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___getstate__", "long_name": "__pyx_f_6mtrand_11RandomState___getstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 5, "token_count": 238, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1207, "end_line": 1237, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_kahan_sum", "long_name": "__pyx_f_6mtrand_kahan_sum( double(*__pyx_v_darr) , long __pyx_v_n)", "filename": "mtrand.c", "nloc": 26, "complexity": 2, "token_count": 130, "parameters": [ "double", "__pyx_v_n" ], "start_line": 835, "end_line": 877, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2431, "end_line": 2482, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_negative_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_negative_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3476, "end_line": 3560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logistic", "long_name": "__pyx_f_6mtrand_11RandomState_logistic( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3018, "end_line": 3072, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_t", "long_name": "__pyx_f_6mtrand_11RandomState_standard_t( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2598, "end_line": 2649, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multivariate_normal", "long_name": "__pyx_f_6mtrand_11RandomState_multivariate_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 367, "complexity": 119, "token_count": 4997, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3975, "end_line": 4386, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 412, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randn", "long_name": "__pyx_f_6mtrand_11RandomState_randn( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 67, "complexity": 15, "token_count": 651, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1704, "end_line": 1777, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randint", "long_name": "__pyx_f_6mtrand_11RandomState_randint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 111, "complexity": 19, "token_count": 1002, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1394, "end_line": 1537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 144, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_uniform", "long_name": "__pyx_f_6mtrand_11RandomState_uniform( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 3, "token_count": 208, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1586, "end_line": 1616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_integers", "long_name": "__pyx_f_6mtrand_11RandomState_random_integers( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 9, "token_count": 493, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1781, "end_line": 1850, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnmN_array", "long_name": "__pyx_f_6mtrand_discnmN_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,long,long)) , PyObject * __pyx_v_size , long __pyx_v_n , long __pyx_v_m , long __pyx_v_N)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_m", "__pyx_v_N" ], "start_line": 671, "end_line": 751, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_normal", "long_name": "__pyx_f_6mtrand_11RandomState_standard_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1854, "end_line": 1880, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_wald", "long_name": "__pyx_f_6mtrand_11RandomState_wald( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3203, "end_line": 3271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "initmtrand", "long_name": "initmtrand()", "filename": "mtrand.c", "nloc": 348, "complexity": 146, "token_count": 5614, "parameters": [], "start_line": 5143, "end_line": 5664, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 522, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_disc0_array", "long_name": "__pyx_f_6mtrand_disc0_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "long", "__pyx_v_size" ], "start_line": 507, "end_line": 587, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_vonmises", "long_name": "__pyx_f_6mtrand_11RandomState_vonmises( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 395, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2657, "end_line": 2709, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnp_array", "long_name": "__pyx_f_6mtrand_discnp_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,double)) , PyObject * __pyx_v_size , long __pyx_v_n , double __pyx_v_p)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_p" ], "start_line": 589, "end_line": 669, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_f", "long_name": "__pyx_f_6mtrand_11RandomState_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2258, "end_line": 2326, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_shuffle", "long_name": "__pyx_f_6mtrand_11RandomState_shuffle( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 63, "complexity": 18, "token_count": 729, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4632, "end_line": 4705, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___setstate__", "long_name": "__pyx_f_6mtrand_11RandomState___setstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 5, "token_count": 271, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1240, "end_line": 1273, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 11, "token_count": 570, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2179, "end_line": 2248, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_cauchy", "long_name": "__pyx_f_6mtrand_11RandomState_standard_cauchy( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2564, "end_line": 2590, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multinomial", "long_name": "__pyx_f_6mtrand_11RandomState_multinomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 180, "complexity": 35, "token_count": 1738, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4396, "end_line": 4628, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 233, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_power", "long_name": "__pyx_f_6mtrand_11RandomState_power( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2835, "end_line": 2886, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_seed", "long_name": "__pyx_f_6mtrand_11RandomState_seed( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 10, "token_count": 541, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 948, "end_line": 1017, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3380, "end_line": 3464, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_zipf", "long_name": "__pyx_f_6mtrand_11RandomState_zipf( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3628, "end_line": 3679, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___init__", "long_name": "__pyx_f_6mtrand_11RandomState___init__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 33, "complexity": 5, "token_count": 300, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 882, "end_line": 919, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_beta", "long_name": "__pyx_f_6mtrand_11RandomState_beta( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1952, "end_line": 2020, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rayleigh", "long_name": "__pyx_f_6mtrand_11RandomState_rayleigh( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3142, "end_line": 3193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2028, "end_line": 2080, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_f", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2338, "end_line": 2423, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gumbel", "long_name": "__pyx_f_6mtrand_11RandomState_gumbel( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2956, "end_line": 3010, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2492, "end_line": 2560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_bytes", "long_name": "__pyx_f_6mtrand_11RandomState_bytes( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 3, "token_count": 223, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1541, "end_line": 1582, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_hypergeometric", "long_name": "__pyx_f_6mtrand_11RandomState_hypergeometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 89, "complexity": 19, "token_count": 922, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3770, "end_line": 3871, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 102, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont0_array", "long_name": "__pyx_f_6mtrand_cont0_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "double", "__pyx_v_size" ], "start_line": 177, "end_line": 257, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_get_state", "long_name": "__pyx_f_6mtrand_11RandomState_get_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 56, "complexity": 11, "token_count": 637, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1024, "end_line": 1086, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont3_array", "long_name": "__pyx_f_6mtrand_cont3_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b , double __pyx_v_c)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b", "__pyx_v_c" ], "start_line": 423, "end_line": 503, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_pareto", "long_name": "__pyx_f_6mtrand_11RandomState_pareto( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2717, "end_line": 2768, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 } ], "nloc": 4992, "complexity": 906, "token_count": 48023, "diff_parsed": { "added": [ "/* Generated by Pyrex 0.9.3.1 on Fri Oct 7 02:05:13 2005 */", "static PyObject *__pyx_k58;", "static PyObject *__pyx_n_logseries;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":124 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":125 */", " __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":127 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":128 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":129 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":130 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":131 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":132 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":140 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":141 */", " __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":143 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":144 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":145 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":146 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":147 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":148 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":157 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":158 */", " __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":160 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":161 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":162 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":163 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":164 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":165 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":175 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":176 */", " __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":178 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":179 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":180 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":181 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":182 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":183 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":191 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":192 */", " __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":194 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":195 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":196 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":197 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":198 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":199 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":207 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":208 */", " __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":210 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":211 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":212 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":213 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":214 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":215 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":224 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":225 */", " __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":227 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":228 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":229 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":230 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":231 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":232 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":240 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":241 */", " __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":243 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":244 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":245 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":246 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":247 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":248 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":253 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":254 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":255 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":256 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":257 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":258 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":259 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":260 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":283 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":285 */", " __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":288 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":289 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":303 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":304 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":306 */", " __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":308 */", " __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":309 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":318 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}", " __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":319 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":320 */", " __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}", "static PyObject *__pyx_k62p;", "static char (__pyx_k61[]) = \"algorithm must be 'MT19937'\";", "static char (__pyx_k62[]) = \"state must be 624 longs\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":331 */", " __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}", " __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":332 */", " if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":333 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}", " Py_INCREF(__pyx_k61p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k61p);", " __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":334 */", " __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}", " __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}", " __pyx_4 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}", " __pyx_3 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}", " if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":335 */", " __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":336 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":337 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}", " Py_INCREF(__pyx_k62p);", " PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k62p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":338 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":339 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":343 */", " __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":346 */", " __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}", "static PyObject *__pyx_n_random;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":349 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}", " __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}", " __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":357 */", " __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":364 */", " __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}", "static PyObject *__pyx_k63p;", "static char (__pyx_k63[]) = \"low >= high\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":379 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":380 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":381 */", " __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":383 */", " __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":384 */", " __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":386 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":387 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":388 */", " __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}", " __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}", " Py_INCREF(__pyx_k63p);", " PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k63p);", " __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":390 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":391 */", " __pyx_3 = PyLong_FromUnsignedLong(rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":393 */", " __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}", " __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":394 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":395 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":396 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":397 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":398 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":406 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":407 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":408 */", " __pyx_1 = PyString_FromString(((char (*))__pyx_v_bytes)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":409 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":410 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":417 */", " __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_low,(__pyx_v_high - __pyx_v_low)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":426 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}", " __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":427 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":429 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}", " __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}", " if (PyDict_SetItem(__pyx_1, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}", " __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":437 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}", " __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":438 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":440 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":449 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":450 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":451 */", " __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":452 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}", " __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}", " __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":460 */", " __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; goto __pyx_L1;}", "static PyObject *__pyx_k65p;", "static char (__pyx_k65[]) = \"scale <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":467 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":468 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}", " Py_INCREF(__pyx_k65p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k65p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":469 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; goto __pyx_L1;}", "static PyObject *__pyx_k67p;", "static char (__pyx_k66[]) = \"a <= 0\";", "static char (__pyx_k67[]) = \"b <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":476 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":477 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}", " Py_INCREF(__pyx_k66p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":479 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}", " Py_INCREF(__pyx_k67p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":480 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_a,__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; goto __pyx_L1;}", "static PyObject *__pyx_k68p;", "static char (__pyx_k68[]) = \"scale <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":487 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":488 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}", " Py_INCREF(__pyx_k68p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":489 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":496 */", " __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;}", "static PyObject *__pyx_k69p;", "static char (__pyx_k69[]) = \"shape <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":503 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":504 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}", " Py_INCREF(__pyx_k69p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":505 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; goto __pyx_L1;}", "static PyObject *__pyx_k71p;", "static char (__pyx_k70[]) = \"shape <= 0\";", "static char (__pyx_k71[]) = \"scale <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":512 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":513 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}", " Py_INCREF(__pyx_k70p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":515 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}", " Py_INCREF(__pyx_k71p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":516 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_shape,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; goto __pyx_L1;}", "static PyObject *__pyx_k73p;", "static char (__pyx_k72[]) = \"dfnum <= 0\";", "static char (__pyx_k73[]) = \"dfden <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":523 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":524 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}", " Py_INCREF(__pyx_k72p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":526 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}", " Py_INCREF(__pyx_k73p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":527 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}", "static PyObject *__pyx_k76p;", "static char (__pyx_k74[]) = \"dfnum <= 1\";", "static char (__pyx_k75[]) = \"dfden <= 0\";", "static char (__pyx_k76[]) = \"nonc < 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":534 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":535 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}", " Py_INCREF(__pyx_k74p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":537 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}", " Py_INCREF(__pyx_k75p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":539 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}", " Py_INCREF(__pyx_k76p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":540 */", " __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; goto __pyx_L1;}", "static PyObject *__pyx_k77p;", "static char (__pyx_k77[]) = \"df <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":548 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":549 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}", " Py_INCREF(__pyx_k77p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":550 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}", "static PyObject *__pyx_k79p;", "static char (__pyx_k78[]) = \"df <= 1\";", "static char (__pyx_k79[]) = \"nonc < 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":557 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":558 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}", " Py_INCREF(__pyx_k78p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":560 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}", " Py_INCREF(__pyx_k79p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":561 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_df,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":569 */", " __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; goto __pyx_L1;}", "static PyObject *__pyx_k80p;", "static char (__pyx_k80[]) = \"df <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":576 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":577 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}", " Py_INCREF(__pyx_k80p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":578 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}", "static PyObject *__pyx_k81p;", "static char (__pyx_k81[]) = \"kappa < 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":586 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":587 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}", " Py_INCREF(__pyx_k81p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":588 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_mu,__pyx_v_kappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}", "static PyObject *__pyx_k82p;", "static char (__pyx_k82[]) = \"a <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":595 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":596 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}", " Py_INCREF(__pyx_k82p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":597 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; goto __pyx_L1;}", "static PyObject *__pyx_k83p;", "static char (__pyx_k83[]) = \"a <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":604 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":605 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}", " Py_INCREF(__pyx_k83p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":606 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; goto __pyx_L1;}", "static PyObject *__pyx_k84p;", "static char (__pyx_k84[]) = \"a <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":613 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":614 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}", " Py_INCREF(__pyx_k84p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":615 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}", "static PyObject *__pyx_k85p;", "static char (__pyx_k85[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":622 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":623 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}", " Py_INCREF(__pyx_k85p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":624 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; goto __pyx_L1;}", "static PyObject *__pyx_k86p;", "static char (__pyx_k86[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":631 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":632 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}", " Py_INCREF(__pyx_k86p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":633 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; goto __pyx_L1;}", "static PyObject *__pyx_k87p;", "static char (__pyx_k87[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":640 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":641 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}", " Py_INCREF(__pyx_k87p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":642 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; goto __pyx_L1;}", "static PyObject *__pyx_k88p;", "static char (__pyx_k88[]) = \"sigma <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":654 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":655 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}", " Py_INCREF(__pyx_k88p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":656 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_mean,__pyx_v_sigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; goto __pyx_L1;}", "static PyObject *__pyx_k89p;", "static char (__pyx_k89[]) = \"mode <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":663 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":664 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}", " Py_INCREF(__pyx_k89p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":665 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_mode); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}", "static PyObject *__pyx_k91p;", "static char (__pyx_k90[]) = \"mean <= 0.0\";", "static char (__pyx_k91[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":672 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":673 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}", " Py_INCREF(__pyx_k90p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":675 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}", " Py_INCREF(__pyx_k91p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":676 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_mean,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; goto __pyx_L1;}", "static PyObject *__pyx_k94p;", "static char (__pyx_k92[]) = \"left > mode\";", "static char (__pyx_k93[]) = \"mode > right\";", "static char (__pyx_k94[]) = \"left == right\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":684 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":685 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}", " Py_INCREF(__pyx_k92p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":687 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}", " Py_INCREF(__pyx_k93p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":689 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}", " Py_INCREF(__pyx_k94p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":690 */", " __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_left,__pyx_v_mode,__pyx_v_right); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; goto __pyx_L1;}", "static PyObject *__pyx_k97p;", "static char (__pyx_k95[]) = \"n <= 0\";", "static char (__pyx_k96[]) = \"p < 0\";", "static char (__pyx_k97[]) = \"p > 1\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":699 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":700 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}", " Py_INCREF(__pyx_k95p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":702 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}", " Py_INCREF(__pyx_k96p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":704 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}", " Py_INCREF(__pyx_k97p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":705 */", " __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; goto __pyx_L1;}", "static PyObject *__pyx_k100p;", "static char (__pyx_k98[]) = \"n <= 0\";", "static char (__pyx_k99[]) = \"p < 0\";", "static char (__pyx_k100[]) = \"p > 1\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":712 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":713 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}", " Py_INCREF(__pyx_k98p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":715 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}", " Py_INCREF(__pyx_k99p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":717 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}", " Py_INCREF(__pyx_k100p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":718 */", " __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; goto __pyx_L1;}", "static PyObject *__pyx_k101p;", "static char (__pyx_k101[]) = \"lam <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":726 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":727 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}", " Py_INCREF(__pyx_k101p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":728 */", " __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_lam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}", "static PyObject *__pyx_k102p;", "static char (__pyx_k102[]) = \"a <= 1.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":735 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":736 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}", " Py_INCREF(__pyx_k102p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":737 */", " __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}", "static PyObject *__pyx_k104p;", "static char (__pyx_k103[]) = \"p < 0.0\";", "static char (__pyx_k104[]) = \"p > 1.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":745 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":746 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}", " Py_INCREF(__pyx_k103p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":748 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}", " Py_INCREF(__pyx_k104p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":749 */", " __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; goto __pyx_L1;}", "static PyObject *__pyx_k108p;", "static char (__pyx_k105[]) = \"ngood < 1\";", "static char (__pyx_k106[]) = \"nbad < 1\";", "static char (__pyx_k107[]) = \"ngood + nbad < nsample\";", "static char (__pyx_k108[]) = \"nsample < 1\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":761 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":762 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}", " Py_INCREF(__pyx_k105p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":764 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}", " Py_INCREF(__pyx_k106p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":766 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}", " Py_INCREF(__pyx_k107p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":768 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}", " Py_INCREF(__pyx_k108p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k108p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":769 */", " __pyx_2 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ngood,__pyx_v_nbad,__pyx_v_nsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; goto __pyx_L1;}", "static PyObject *__pyx_k109p;", "static PyObject *__pyx_k110p;", "", "static char (__pyx_k109[]) = \"p < 0\";", "static char (__pyx_k110[]) = \"p > 1\";", "", "static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/", "static char __pyx_doc_6mtrand_11RandomState_logseries[] = \"Logarithmic series distribution.\\n \\n logseries(p, size=None)\\n \";", "static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {", " double __pyx_v_p;", " PyObject *__pyx_v_size = 0;", " PyObject *__pyx_r;", " int __pyx_1;", " PyObject *__pyx_2 = 0;", " PyObject *__pyx_3 = 0;", " PyObject *__pyx_4 = 0;", " static char *__pyx_argnames[] = {\"p\",\"size\",0};", " __pyx_v_size = __pyx_k56;", " if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;", " Py_INCREF(__pyx_v_self);", " Py_INCREF(__pyx_v_size);", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":777 */", " __pyx_1 = (__pyx_v_p < 0);", " if (__pyx_1) {", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":778 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}", " Py_INCREF(__pyx_k109p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", " Py_DECREF(__pyx_3); __pyx_3 = 0;", " __Pyx_Raise(__pyx_4, 0, 0);", " Py_DECREF(__pyx_4); __pyx_4 = 0;", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}", " goto __pyx_L2;", " }", " __pyx_1 = (__pyx_v_p > 1);", " if (__pyx_1) {", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":780 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}", " Py_INCREF(__pyx_k110p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k110p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", " Py_DECREF(__pyx_3); __pyx_3 = 0;", " __Pyx_Raise(__pyx_4, 0, 0);", " Py_DECREF(__pyx_4); __pyx_4 = 0;", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}", " goto __pyx_L2;", " }", " __pyx_L2:;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":781 */", " __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; goto __pyx_L1;}", " __pyx_r = __pyx_2;", " __pyx_2 = 0;", " goto __pyx_L0;", "", " __pyx_r = Py_None; Py_INCREF(__pyx_r);", " goto __pyx_L0;", " __pyx_L1:;", " Py_XDECREF(__pyx_2);", " Py_XDECREF(__pyx_3);", " Py_XDECREF(__pyx_4);", " __Pyx_AddTraceback(\"mtrand.RandomState.logseries\");", " __pyx_r = 0;", " __pyx_L0:;", " Py_DECREF(__pyx_v_self);", " Py_DECREF(__pyx_v_size);", " return __pyx_r;", "}", "", "static PyObject *__pyx_k111p;", "static PyObject *__pyx_k112p;", "static PyObject *__pyx_k113p;", "static char (__pyx_k111[]) = \"mean must be 1 dimensional\";", "static char (__pyx_k112[]) = \"cov must be 2 dimensional and square\";", "static char (__pyx_k113[]) = \"mean and cov must have same length\";", " __pyx_v_size = __pyx_k57;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":802 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":803 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":804 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":805 */", " __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":807 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":808 */", " __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}", " __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":809 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}", " Py_INCREF(__pyx_k111p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k111p);", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":810 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":811 */", " __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " Py_INCREF(__pyx_k112p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);", " __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":812 */", " __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}", " __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}", " __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}", " __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}", " __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":813 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}", " __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}", " Py_INCREF(__pyx_k113p);", " PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k113p);", " __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":815 */", " __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}", " __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}", " __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":816 */", " __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":817 */", " __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}", " __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":818 */", " __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}", " __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":822 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":823 */", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}", " __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":833 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_linalg); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}", " __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_singular_value_decomposition); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}", " __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}", " __pyx_5 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}", " __pyx_1 = __Pyx_UnpackItem(__pyx_2, 2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}", " if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":834 */", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}", " __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_matrixmultiply); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}", " __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":837 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}", " __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":838 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}", " __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":839 */", "static PyObject *__pyx_k114p;", "static char (__pyx_k114[]) = \"sum(pvals) > 1.0\";", " __pyx_v_size = __pyx_k58;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":857 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}", " __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":858 */", " __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":859 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":861 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":862 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}", " Py_INCREF(__pyx_k114p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k114p);", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":864 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":865 */", " __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":867 */", " __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":869 */", " __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}", " __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":871 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":872 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":873 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":874 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":875 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":876 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":877 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":878 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":879 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":880 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":881 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":882 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":883 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":884 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":885 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":887 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":889 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":900 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}", " __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}", " __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}", " __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":901 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":902 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":903 */", " __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}", " __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}", " __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}", " if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}", " if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":904 */", "static char __pyx_doc_6mtrand_11RandomState_permutation[] = \"Given an integer, return a shuffled sequence of integers >= 0 and \\n < x; given a sequence, return a shuffled array copy.\\n\\n permutation(x)\\n \";", " int __pyx_4;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":912 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}", " __pyx_4 = __pyx_3 == __pyx_1;", " Py_DECREF(__pyx_3); __pyx_3 = 0;", " if (__pyx_4) {", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":913 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_arange); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}", " Py_INCREF(__pyx_v_x);", " PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x);", " __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}", " Py_DECREF(__pyx_3); __pyx_3 = 0;", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " Py_DECREF(__pyx_v_arr);", " __pyx_v_arr = __pyx_2;", " __pyx_2 = 0;", " goto __pyx_L2;", " }", " /*else*/ {", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":915 */", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}", " Py_DECREF(__pyx_3); __pyx_3 = 0;", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}", " Py_INCREF(__pyx_v_x);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " Py_DECREF(__pyx_2); __pyx_2 = 0;", " Py_DECREF(__pyx_v_arr);", " __pyx_v_arr = __pyx_3;", " __pyx_3 = 0;", " }", " __pyx_L2:;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":916 */", " __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_arr);", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":917 */", " {&__pyx_n_logseries, \"logseries\"},", " {&__pyx_n_random, \"random\"},", " {&__pyx_k63p, __pyx_k63, sizeof(__pyx_k63)},", " {&__pyx_k112p, __pyx_k112, sizeof(__pyx_k112)},", " {&__pyx_k113p, __pyx_k113, sizeof(__pyx_k113)},", " {&__pyx_k114p, __pyx_k114, sizeof(__pyx_k114)},", " {\"logseries\", (PyCFunction)__pyx_f_6mtrand_11RandomState_logseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logseries},", " if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}", " if (PyObject_SetAttrString(__pyx_m, \"RandomState\", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":114 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":116 */", " __pyx_1 = __Pyx_Import(__pyx_n_scipy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":282 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":291 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":352 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":359 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":366 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":412 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":442 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":455 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":462 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":471 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":482 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":491 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":498 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":507 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":518 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":529 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":543 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":552 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":564 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":571 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":580 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":590 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":599 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":608 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":617 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":626 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":635 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":644 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":658 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":667 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":678 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":694 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":707 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":721 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":730 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":739 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":751 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":784 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":841 */", " Py_INCREF(Py_None);", " __pyx_k58 = Py_None;", " __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_get_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_set_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_bytes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_uniform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rand); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randn); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_integers); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_beta); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":939 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_cauchy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_vonmises); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_pareto); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_weibull); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_power); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":946 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_laplace); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gumbel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logistic); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":949 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lognormal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rayleigh); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_wald); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":952 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_triangular); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":954 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":955 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_negative_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":956 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_poisson); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":957 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zipf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":958 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_geometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":959 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_hypergeometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":960 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logseries); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_logseries, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":962 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multivariate_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":963 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multinomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":965 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":966 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_permutation); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}" ], "deleted": [ "/* Generated by Pyrex 0.9.3.1 on Thu Oct 6 21:56:32 2005 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":123 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":124 */", " __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":126 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":127 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":128 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":129 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":130 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":131 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":139 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":140 */", " __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":142 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":143 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":144 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":145 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":146 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":147 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":156 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":157 */", " __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":159 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":160 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":161 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":162 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":163 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":164 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":174 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":175 */", " __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":177 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":178 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":179 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":180 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":181 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":182 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":190 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":191 */", " __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":193 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":194 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":195 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":196 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":197 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":198 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":206 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":207 */", " __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":209 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":210 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":211 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":212 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":213 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":214 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":223 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":224 */", " __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":226 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":227 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":228 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":229 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":230 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":231 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":239 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":240 */", " __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":242 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":243 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":244 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":245 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":246 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":247 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":252 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":253 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":254 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":255 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":256 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":257 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":258 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":259 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":282 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":284 */", " __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":287 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":288 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":302 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":303 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":305 */", " __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":307 */", " __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":308 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":317 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}", " __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":318 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":319 */", " __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}", "static PyObject *__pyx_k60p;", "static char (__pyx_k60[]) = \"algorithm must be 'MT19937'\";", "static char (__pyx_k61[]) = \"state must be 624 longs\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":330 */", " __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; goto __pyx_L1;}", " __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":331 */", " if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":332 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}", " Py_INCREF(__pyx_k60p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k60p);", " __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":333 */", " __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}", " __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}", " __pyx_4 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}", " __pyx_3 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}", " if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":334 */", " __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":335 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":336 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}", " Py_INCREF(__pyx_k61p);", " PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k61p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":337 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":338 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":342 */", " __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":345 */", " __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}", "static PyObject *__pyx_n_stats;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":348 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stats); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}", " __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}", " __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":356 */", " __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":363 */", " __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; goto __pyx_L1;}", "static PyObject *__pyx_k62p;", "static char (__pyx_k62[]) = \"low >= high\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":378 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":379 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":380 */", " __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":382 */", " __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":383 */", " __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":385 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":386 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":387 */", " __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}", " __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}", " Py_INCREF(__pyx_k62p);", " PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k62p);", " __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":389 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":390 */", " __pyx_3 = PyLong_FromUnsignedLong(rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":392 */", " __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}", " __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}", " __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":393 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":394 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":395 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":396 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":397 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":405 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":406 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":407 */", " __pyx_1 = PyString_FromString(((char (*))__pyx_v_bytes)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":408 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":409 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":416 */", " __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_low,(__pyx_v_high - __pyx_v_low)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":425 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}", " __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":426 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":428 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}", " __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}", " if (PyDict_SetItem(__pyx_1, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}", " __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":436 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}", " __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":437 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":439 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":448 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":449 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":450 */", " __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":451 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}", " __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}", " __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":459 */", " __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; goto __pyx_L1;}", "static PyObject *__pyx_k64p;", "static char (__pyx_k64[]) = \"scale <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":466 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":467 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}", " Py_INCREF(__pyx_k64p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k64p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":468 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}", "static PyObject *__pyx_k65p;", "static char (__pyx_k65[]) = \"a <= 0\";", "static char (__pyx_k66[]) = \"b <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":475 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":476 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}", " Py_INCREF(__pyx_k65p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k65p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":478 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}", " Py_INCREF(__pyx_k66p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":479 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_a,__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}", "static PyObject *__pyx_k67p;", "static char (__pyx_k67[]) = \"scale <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":486 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":487 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}", " Py_INCREF(__pyx_k67p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":488 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":495 */", " __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; goto __pyx_L1;}", "static PyObject *__pyx_k68p;", "static char (__pyx_k68[]) = \"shape <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":502 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":503 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}", " Py_INCREF(__pyx_k68p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":504 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}", "static PyObject *__pyx_k69p;", "static char (__pyx_k69[]) = \"shape <= 0\";", "static char (__pyx_k70[]) = \"scale <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":511 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":512 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}", " Py_INCREF(__pyx_k69p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":514 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}", " Py_INCREF(__pyx_k70p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":515 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_shape,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}", "static PyObject *__pyx_k71p;", "static char (__pyx_k71[]) = \"dfnum <= 0\";", "static char (__pyx_k72[]) = \"dfden <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":522 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":523 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}", " Py_INCREF(__pyx_k71p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":525 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}", " Py_INCREF(__pyx_k72p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":526 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}", "static PyObject *__pyx_k73p;", "static char (__pyx_k73[]) = \"dfnum <= 1\";", "static char (__pyx_k74[]) = \"dfden <= 0\";", "static char (__pyx_k75[]) = \"nonc < 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":533 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":534 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}", " Py_INCREF(__pyx_k73p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":536 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}", " Py_INCREF(__pyx_k74p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":538 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}", " Py_INCREF(__pyx_k75p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":539 */", " __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}", "static PyObject *__pyx_k76p;", "static char (__pyx_k76[]) = \"df <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":547 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":548 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}", " Py_INCREF(__pyx_k76p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":549 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}", "static PyObject *__pyx_k77p;", "static char (__pyx_k77[]) = \"df <= 1\";", "static char (__pyx_k78[]) = \"nonc < 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":556 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":557 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}", " Py_INCREF(__pyx_k77p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":559 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}", " Py_INCREF(__pyx_k78p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":560 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_df,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":568 */", " __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; goto __pyx_L1;}", "static PyObject *__pyx_k79p;", "static char (__pyx_k79[]) = \"df <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":575 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":576 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}", " Py_INCREF(__pyx_k79p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":577 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}", "static PyObject *__pyx_k80p;", "static char (__pyx_k80[]) = \"kappa < 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":585 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":586 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}", " Py_INCREF(__pyx_k80p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":587 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_mu,__pyx_v_kappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}", "static PyObject *__pyx_k81p;", "static char (__pyx_k81[]) = \"a <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":594 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":595 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}", " Py_INCREF(__pyx_k81p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":596 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}", "static PyObject *__pyx_k82p;", "static char (__pyx_k82[]) = \"a <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":603 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":604 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}", " Py_INCREF(__pyx_k82p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":605 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}", "static PyObject *__pyx_k83p;", "static char (__pyx_k83[]) = \"a <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":612 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":613 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}", " Py_INCREF(__pyx_k83p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":614 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}", "static PyObject *__pyx_k84p;", "static char (__pyx_k84[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":621 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":622 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}", " Py_INCREF(__pyx_k84p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":623 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}", "static PyObject *__pyx_k85p;", "static char (__pyx_k85[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":630 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":631 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}", " Py_INCREF(__pyx_k85p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":632 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}", "static PyObject *__pyx_k86p;", "static char (__pyx_k86[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":639 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":640 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}", " Py_INCREF(__pyx_k86p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":641 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}", "static PyObject *__pyx_k87p;", "static char (__pyx_k87[]) = \"sigma <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":653 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":654 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}", " Py_INCREF(__pyx_k87p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":655 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_mean,__pyx_v_sigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}", "static PyObject *__pyx_k88p;", "static char (__pyx_k88[]) = \"mode <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":662 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":663 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}", " Py_INCREF(__pyx_k88p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":664 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_mode); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}", "static PyObject *__pyx_k89p;", "static char (__pyx_k89[]) = \"mean <= 0.0\";", "static char (__pyx_k90[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":671 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":672 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}", " Py_INCREF(__pyx_k89p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":674 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}", " Py_INCREF(__pyx_k90p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":675 */", " __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_mean,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}", "static PyObject *__pyx_k91p;", "static char (__pyx_k91[]) = \"left > mode\";", "static char (__pyx_k92[]) = \"mode > right\";", "static char (__pyx_k93[]) = \"left == right\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":683 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":684 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}", " Py_INCREF(__pyx_k91p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":686 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}", " Py_INCREF(__pyx_k92p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":688 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}", " Py_INCREF(__pyx_k93p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":689 */", " __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_left,__pyx_v_mode,__pyx_v_right); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}", "static PyObject *__pyx_k94p;", "static char (__pyx_k94[]) = \"n <= 0\";", "static char (__pyx_k95[]) = \"p < 0\";", "static char (__pyx_k96[]) = \"p > 1\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":698 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":699 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}", " Py_INCREF(__pyx_k94p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":701 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}", " Py_INCREF(__pyx_k95p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":703 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}", " Py_INCREF(__pyx_k96p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":704 */", " __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}", "static PyObject *__pyx_k97p;", "static char (__pyx_k97[]) = \"n <= 0\";", "static char (__pyx_k98[]) = \"p < 0\";", "static char (__pyx_k99[]) = \"p > 1\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":711 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":712 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}", " Py_INCREF(__pyx_k97p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":714 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}", " Py_INCREF(__pyx_k98p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":716 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}", " Py_INCREF(__pyx_k99p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":717 */", " __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}", "static PyObject *__pyx_k100p;", "static char (__pyx_k100[]) = \"lam <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":725 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":726 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}", " Py_INCREF(__pyx_k100p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":727 */", " __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_lam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}", "static PyObject *__pyx_k101p;", "static char (__pyx_k101[]) = \"a <= 1.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":734 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":735 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}", " Py_INCREF(__pyx_k101p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":736 */", " __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}", "static PyObject *__pyx_k102p;", "static char (__pyx_k102[]) = \"p < 0.0\";", "static char (__pyx_k103[]) = \"p > 1.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":744 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":745 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}", " Py_INCREF(__pyx_k102p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":747 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}", " Py_INCREF(__pyx_k103p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":748 */", " __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}", "static PyObject *__pyx_k104p;", "static char (__pyx_k104[]) = \"ngood < 1\";", "static char (__pyx_k105[]) = \"nbad < 1\";", "static char (__pyx_k106[]) = \"ngood + nbad < nsample\";", "static char (__pyx_k107[]) = \"nsample < 1\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":760 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":761 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}", " Py_INCREF(__pyx_k104p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":763 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}", " Py_INCREF(__pyx_k105p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":765 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}", " Py_INCREF(__pyx_k106p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":767 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}", " Py_INCREF(__pyx_k107p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);", " __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":768 */", " __pyx_2 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ngood,__pyx_v_nbad,__pyx_v_nsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}", "static PyObject *__pyx_k108p;", "static PyObject *__pyx_k109p;", "static PyObject *__pyx_k110p;", "static char (__pyx_k108[]) = \"mean must be 1 dimensional\";", "static char (__pyx_k109[]) = \"cov must be 2 dimensional and square\";", "static char (__pyx_k110[]) = \"mean and cov must have same length\";", " __pyx_v_size = __pyx_k56;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":790 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":791 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":792 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":793 */", " __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":795 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":796 */", " __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}", " __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":797 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}", " Py_INCREF(__pyx_k108p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k108p);", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":798 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":799 */", " __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}", " Py_INCREF(__pyx_k109p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k109p);", " __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":800 */", " __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}", " __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}", " __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}", " __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}", " __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}", " if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":801 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}", " __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}", " Py_INCREF(__pyx_k110p);", " PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k110p);", " __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":803 */", " __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}", " __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}", " __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":804 */", " __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":805 */", " __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}", " __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":806 */", " __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}", " __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":810 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":811 */", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}", " __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":821 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}", " __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_linalg); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}", " __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_singular_value_decomposition); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}", " __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}", " __pyx_5 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}", " __pyx_1 = __Pyx_UnpackItem(__pyx_2, 2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}", " if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":822 */", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_matrixmultiply); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":825 */", " __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}", " __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":826 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}", " __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":827 */", "static PyObject *__pyx_k111p;", "static char (__pyx_k111[]) = \"sum(pvals) > 1.0\";", " __pyx_v_size = __pyx_k57;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":845 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}", " __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":846 */", " __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":847 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":849 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":850 */", " __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}", " Py_INCREF(__pyx_k111p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k111p);", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}", " {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":852 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":853 */", " __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; goto __pyx_L1;}", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":855 */", " __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":857 */", " __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}", " __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":859 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}", " __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}", " __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}", " __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}", " __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":860 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":861 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":862 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":863 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":864 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":865 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":866 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":867 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":868 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":869 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":870 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":871 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":872 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":873 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":875 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":877 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":888 */", " __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}", " __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}", " __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}", " __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}", " __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}", " __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":889 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":890 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":891 */", " __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}", " __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}", " __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}", " if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}", " __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}", " if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":892 */", "static char __pyx_doc_6mtrand_11RandomState_permutation[] = \"Given an integer, return a shuffled sequence of integers >= 0 and \\n < x.\\n\\n permutation(x)\\n \";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":900 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_arange); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}", " PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x);", " __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}", " Py_DECREF(__pyx_v_arr);", " __pyx_v_arr = __pyx_3;", " __pyx_3 = 0;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":901 */", " __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; goto __pyx_L1;}", " __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; goto __pyx_L1;}", " PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_arr);", " __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":902 */", " {&__pyx_n_stats, \"stats\"},", " {&__pyx_k60p, __pyx_k60, sizeof(__pyx_k60)},", " {&__pyx_k64p, __pyx_k64, sizeof(__pyx_k64)},", " if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}", " if (PyObject_SetAttrString(__pyx_m, \"RandomState\", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":113 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":115 */", " __pyx_1 = __Pyx_Import(__pyx_n_scipy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":281 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":290 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":351 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":358 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":365 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":411 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":441 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":454 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":461 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":470 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":481 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":490 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":497 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":506 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":517 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":528 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":542 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":551 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":563 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":570 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":579 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":589 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":598 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":607 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":616 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":625 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":634 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":643 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":657 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":666 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":677 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":693 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":706 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":720 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":729 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":738 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":750 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":829 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":905 */", " __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;}", " __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":906 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_get_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":907 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_set_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":908 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":909 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":910 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_bytes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":911 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_uniform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":912 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rand); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":913 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randn); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":914 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_integers); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":915 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":916 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":917 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_beta); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":918 */", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}", " Py_DECREF(__pyx_1); __pyx_1 = 0;", " if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}", " Py_DECREF(__pyx_2); __pyx_2 = 0;", " __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_cauchy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_vonmises); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_pareto); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_weibull); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_power); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_laplace); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gumbel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logistic); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lognormal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rayleigh); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_wald); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_triangular); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_negative_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_poisson); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zipf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_geometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_hypergeometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multivariate_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multinomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}", " __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_permutation); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}", " if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}" ] } }, { "old_path": "scipy/corelib/mtrand/mtrand.pyx", "new_path": "scipy/corelib/mtrand/mtrand.pyx", "filename": "mtrand.pyx", "extension": "pyx", "change_type": "MODIFY", "diff": "@@ -93,6 +93,7 @@\n long rk_zipf(rk_state *state, double a)\n long rk_geometric(rk_state *state, double p)\n long rk_hypergeometric(rk_state *state, long good, long bad, long sample)\n+ long rk_logseries(rk_state *state, double p)\n \n ctypedef double (* rk_cont0)(rk_state *state)\n ctypedef double (* rk_cont1)(rk_state *state, double a)\n@@ -170,7 +171,7 @@\n cdef ArrayType array\n cdef long length\n cdef long i\n-\n+ \n if size is None:\n return func(state, a, b, c)\n else:\n@@ -345,7 +346,7 @@ def __setstate__(self, state):\n self.set_state(state)\n \n def __reduce__(self):\n- return (_sp.stats.__RandomState_ctor, (), self.get_state())\n+ return (_sp.random.__RandomState_ctor, (), self.get_state())\n \n # Basic distributions:\n def random_sample(self, size=None):\n@@ -768,6 +769,17 @@ def hypergeometric(self, long ngood, long nbad, long nsample, size=None):\n return discnmN_array(self.internal_state, rk_hypergeometric, size,\n ngood, nbad, nsample)\n \n+ def logseries(self, double p, size=None):\n+ \"\"\"Logarithmic series distribution.\n+ \n+ logseries(p, size=None)\n+ \"\"\"\n+ if p < 0:\n+ raise ValueError(\"p < 0\")\n+ elif p > 1:\n+ raise ValueError(\"p > 1\")\n+ return discd_array(self.internal_state, rk_logseries, size, p)\n+\n # Multivariate distributions:\n def multivariate_normal(self, mean, cov, size=None):\n \"\"\"Return an array containing multivariate normally distributed random numbers\n@@ -893,14 +905,16 @@ def shuffle(self, object x):\n \n def permutation(self, object x):\n \"\"\"Given an integer, return a shuffled sequence of integers >= 0 and \n- < x.\n+ < x; given a sequence, return a shuffled array copy.\n \n permutation(x)\n \"\"\"\n- arr = _sp.arange(x)\n+ if type(x) is int:\n+ arr = _sp.arange(x)\n+ else:\n+ arr = _sp.array(x)\n self.shuffle(arr)\n- return arr\n-\n+ return arr \n \n _rand = RandomState()\n get_state = _rand.get_state\n@@ -943,6 +957,7 @@ def permutation(self, object x):\n zipf = _rand.zipf\n geometric = _rand.geometric\n hypergeometric = _rand.hypergeometric\n+logseries = _rand.logseries\n \n multivariate_normal = _rand.multivariate_normal\n multinomial = _rand.multinomial\n", "added_lines": 21, "deleted_lines": 6, "source_code": "# mtrand.pyx -- A Pyrex wrapper of Jean-Sebastien Roy's RandomKit\n#\n# Copyright 2005 Robert Kern (robert.kern@gmail.com)\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n# \n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n# \n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\ninclude \"Python.pxi\"\ninclude \"scipy.pxi\"\n\ncdef extern from \"math.h\":\n double exp(double x)\n double log(double x)\n double floor(double x)\n double sin(double x)\n double cos(double x)\n\ncdef extern from \"randomkit.h\":\n\n ctypedef struct rk_state:\n unsigned long key[624]\n int pos\n\n ctypedef enum rk_error:\n RK_NOERR = 0\n RK_ENODEV = 1\n RK_ERR_MAX = 2\n\n char *rk_strerror[2]\n \n # 0xFFFFFFFFUL\n unsigned long RK_MAX\n\n void rk_seed(unsigned long seed, rk_state *state)\n rk_error rk_randomseed(rk_state *state)\n unsigned long rk_random(rk_state *state)\n long rk_long(rk_state *state)\n unsigned long rk_ulong(rk_state *state)\n unsigned long rk_interval(unsigned long max, rk_state *state)\n double rk_double(rk_state *state)\n void rk_fill(void *buffer, size_t size, rk_state *state)\n rk_error rk_devfill(void *buffer, size_t size, int strong)\n rk_error rk_altfill(void *buffer, size_t size, int strong,\n rk_state *state)\n double rk_gauss(rk_state *state)\n\ncdef extern from \"distributions.h\":\n \n double rk_normal(rk_state *state, double loc, double scale)\n double rk_standard_exponential(rk_state *state)\n double rk_exponential(rk_state *state, double scale)\n double rk_uniform(rk_state *state, double loc, double scale)\n double rk_standard_gamma(rk_state *state, double shape)\n double rk_gamma(rk_state *state, double shape, double scale)\n double rk_beta(rk_state *state, double a, double b)\n double rk_chisquare(rk_state *state, double df)\n double rk_noncentral_chisquare(rk_state *state, double df, double nonc)\n double rk_f(rk_state *state, double dfnum, double dfden)\n double rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc)\n double rk_standard_cauchy(rk_state *state)\n double rk_standard_t(rk_state *state, double df)\n double rk_vonmises(rk_state *state, double mu, double kappa)\n double rk_pareto(rk_state *state, double a)\n double rk_weibull(rk_state *state, double a)\n double rk_power(rk_state *state, double a)\n double rk_laplace(rk_state *state, double loc, double scale)\n double rk_gumbel(rk_state *state, double loc, double scale)\n double rk_logistic(rk_state *state, double loc, double scale)\n double rk_lognormal(rk_state *state, double mode, double sigma)\n double rk_rayleigh(rk_state *state, double mode)\n double rk_wald(rk_state *state, double mean, double scale)\n double rk_triangular(rk_state *state, double left, double mode, double right)\n \n long rk_binomial(rk_state *state, long n, double p)\n long rk_negative_binomial(rk_state *state, long n, double p)\n long rk_poisson(rk_state *state, double lam)\n long rk_zipf(rk_state *state, double a)\n long rk_geometric(rk_state *state, double p)\n long rk_hypergeometric(rk_state *state, long good, long bad, long sample)\n long rk_logseries(rk_state *state, double p)\n \nctypedef double (* rk_cont0)(rk_state *state)\nctypedef double (* rk_cont1)(rk_state *state, double a)\nctypedef double (* rk_cont2)(rk_state *state, double a, double b)\nctypedef double (* rk_cont3)(rk_state *state, double a, double b, double c)\n\nctypedef long (* rk_disc0)(rk_state *state)\nctypedef long (* rk_discnp)(rk_state *state, long n, double p)\nctypedef long (* rk_discnmN)(rk_state *state, long n, long m, long N)\nctypedef long (* rk_discd)(rk_state *state, double a)\n\n\ncdef extern from \"initarray.h\":\n void init_by_array(rk_state *self, unsigned long *init_key, \n unsigned long key_length)\n\n# Initialize scipy\nimport_array()\n\nimport scipy as _sp\n\ncdef object cont0_array(rk_state *state, rk_cont0 func, object size):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state)\n return array\n\ncdef object cont1_array(rk_state *state, rk_cont1 func, object size, double a):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a)\n return array\n\ncdef object cont2_array(rk_state *state, rk_cont2 func, object size, double a, \n double b):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a, b)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a, b)\n return array\n\ncdef object cont3_array(rk_state *state, rk_cont3 func, object size, double a, \n double b, double c):\n\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n \n if size is None:\n return func(state, a, b, c)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a, b, c)\n return array\n\ncdef object disc0_array(rk_state *state, rk_disc0 func, object size):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state)\n return array\n\ncdef object discnp_array(rk_state *state, rk_discnp func, object size, long n, double p):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, n, p)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, n, p)\n return array\n\ncdef object discnmN_array(rk_state *state, rk_discnmN func, object size, \n long n, long m, long N):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, n, m, N)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, n, m, N)\n return array\n\ncdef object discd_array(rk_state *state, rk_discd func, object size, double a):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a)\n return array\n\ncdef double kahan_sum(double *darr, long n):\n cdef double c, y, t, sum\n cdef long i\n sum = darr[0]\n c = 0.0\n for i from 1 <= i < n:\n y = darr[i] - c\n t = sum + y\n c = (t-sum) - y\n sum = t\n return sum\n\ncdef class RandomState:\n \"\"\"Container for the Mersenne Twister PRNG.\n\n Constructor\n -----------\n RandomState(seed=None): initializes the PRNG with the given seed. See the\n seed() method for details.\n\n Distribution Methods\n -----------------\n RandomState exposes a number of methods for generating random numbers drawn\n from a variety of probability distributions. In addition to the\n distribution-specific arguments, each method takes a keyword argument\n size=None. If size is None, then a single value is generated and returned.\n If size is an integer, then a 1-D scipy array filled with generated values\n is returned. If size is a tuple, then a scipy array with that shape is\n filled and returned.\n \"\"\"\n cdef rk_state *internal_state\n\n def __init__(self, seed=None):\n self.internal_state = PyMem_Malloc(sizeof(rk_state))\n\n self.seed(seed)\n\n def __dealloc__(self):\n if self.internal_state != NULL:\n PyMem_Free(self.internal_state)\n\n def seed(self, seed=None):\n \"\"\"Seed the generator.\n\n seed(seed=None)\n\n seed can be an integer, an array (or other sequence) of integers of any\n length, or None. If seed is None, then RandomState will try to read data\n from /dev/urandom (or the Windows analogue) if available or seed from\n the clock otherwise.\n \"\"\"\n cdef rk_error errcode\n cdef ArrayType obj\n if seed is None:\n errcode = rk_randomseed(self.internal_state)\n elif type(seed) is int:\n rk_seed(seed, self.internal_state)\n else:\n obj = PyArray_ContiguousFromObject(seed, PyArray_LONG, 1, 1)\n init_by_array(self.internal_state, (obj.data),\n obj.dimensions[0])\n\n def get_state(self):\n \"\"\"Return a tuple representing the internal state of the generator.\n\n get_state() -> ('MT19937', int key[624], int pos)\n \"\"\"\n cdef ArrayType state\n state = _sp.empty(624, _sp.Int)\n memcpy((state.data), self.internal_state.key, 624*sizeof(long))\n return ('MT19937', state, self.internal_state.pos)\n \n def set_state(self, state):\n \"\"\"Set the state from a tuple.\n \n state = ('MT19937', int key[624], int pos)\n \n set_state(state)\n \"\"\"\n cdef ArrayType obj\n cdef int pos\n algorithm_name = state[0]\n if algorithm_name != 'MT19937':\n raise ValueError(\"algorithm must be 'MT19937'\")\n key, pos = state[1:]\n obj = PyArray_ContiguousFromObject(key, PyArray_LONG, 1, 1)\n if obj.dimensions[0] != 624:\n raise ValueError(\"state must be 624 longs\")\n memcpy(self.internal_state.key, (obj.data), 624*sizeof(long))\n self.internal_state.pos = pos\n \n # Pickling support:\n def __getstate__(self):\n return self.get_state()\n\n def __setstate__(self, state):\n self.set_state(state)\n\n def __reduce__(self):\n return (_sp.random.__RandomState_ctor, (), self.get_state())\n\n # Basic distributions:\n def random_sample(self, size=None):\n \"\"\"Return random floats in the half-open interval [0.0, 1.0).\n\n random_sample(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_double, size)\n\n def tomaxint(self, size=None):\n \"\"\"Returns random integers x such that 0 <= x <= sys.maxint.\n\n tomaxint(size=None) -> random values\n \"\"\"\n return disc0_array(self.internal_state, rk_long, size)\n\n def randint(self, low, high=None, size=None):\n \"\"\"Return random integers x such that low <= x < high.\n\n randint(low, high=None, size=None) -> random values\n\n If high is None, then 0 <= x < low.\n \"\"\"\n cdef long lo, hi, diff\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if high is None:\n lo = 0\n hi = low\n else:\n lo = low\n hi = high\n\n diff = hi - lo - 1\n if diff < 0:\n raise ValueError(\"low >= high\")\n \n if size is None:\n return rk_interval(diff, self.internal_state)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = lo + rk_interval(diff, self.internal_state)\n return array\n\n def bytes(self, unsigned int length):\n \"\"\"Return random bytes.\n\n bytes(length) -> str\n \"\"\"\n cdef void *bytes\n bytes = PyMem_Malloc(length)\n rk_fill(bytes, length, self.internal_state)\n bytestring = PyString_FromString(bytes)\n PyMem_Free(bytes)\n return bytestring\n\n def uniform(self, double low=0.0, double high=1.0, size=None):\n \"\"\"Uniform distribution over [low, high).\n\n uniform(low=0.0, high=1.0, size=None) -> random values\n \"\"\"\n return cont2_array(self.internal_state, rk_uniform, size, low, \n high-low)\n\n def rand(self, *args):\n \"\"\"Return an array of the given dimensions which is initialized to \n random numbers from a uniform distribution in the range [0,1).\n\n randn(d0, d1, ..., dn) -> random values\n \"\"\"\n if len(args) == 0:\n return self.random_sample()\n else:\n return self.random_sample(size=args)\n\n def randn(self, *args):\n \"\"\"Returns zero-mean, unit-variance Gaussian random numbers in an \n array of shape (d0, d1, ..., dn).\n\n randn(d0, d1, ..., dn) -> random values\n \"\"\"\n if len(args) == 0:\n return self.standard_normal()\n else:\n return self.standard_normal(args)\n\n def random_integers(self, low, high=None, size=None):\n \"\"\"Return random integers x such that low <= x <= high.\n\n random_integers(low, high=None, size=None) -> random values.\n\n If high is None, then 1 <= x <= low.\n \"\"\"\n if high is None:\n high = low\n low = 1\n return self.randint(low, high+1, size)\n\n # Complicated, continuous distributions:\n def standard_normal(self, size=None):\n \"\"\"Standard Normal distribution (mean=0, stdev=1).\n\n standard_normal(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_gauss, size)\n\n def normal(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Normal distribution (mean=loc, stdev=scale).\n\n normal(loc=0.0, scale=1.0, size=None) -> random values\n \"\"\"\n if scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont2_array(self.internal_state, rk_normal, size, loc, scale)\n\n def beta(self, double a, double b, size=None):\n \"\"\"Beta distribution over [0, 1].\n\n beta(a, b, size=None) -> random values\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n elif b <= 0:\n raise ValueError(\"b <= 0\")\n return cont2_array(self.internal_state, rk_beta, size, a, b)\n\n def exponential(self, double scale=1.0, size=None):\n \"\"\"Exponential distribution.\n\n exponential(scale=1.0, size=None) -> random values\n \"\"\"\n if scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont1_array(self.internal_state, rk_exponential, size, scale)\n\n def standard_exponential(self, size=None):\n \"\"\"Standard exponential distribution (scale=1).\n\n standard_exponential(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_standard_exponential, size)\n\n def standard_gamma(self, double shape, size=None):\n \"\"\"Standard Gamma distribution.\n\n standard_gamma(shape, size=None) -> random values\n \"\"\"\n if shape <= 0:\n raise ValueError(\"shape <= 0\")\n return cont1_array(self.internal_state, rk_standard_gamma, size, shape)\n\n def gamma(self, double shape, double scale=1.0, size=None):\n \"\"\"Gamma distribution.\n\n gamma(shape, scale=1.0, size=None) -> random values\n \"\"\"\n if shape <= 0:\n raise ValueError(\"shape <= 0\")\n elif scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont2_array(self.internal_state, rk_gamma, size, shape, scale)\n\n def f(self, double dfnum, double dfden, size=None):\n \"\"\"F distribution.\n\n f(dfnum, dfden, size=None) -> random values\n \"\"\"\n if dfnum <= 0:\n raise ValueError(\"dfnum <= 0\")\n elif dfden <= 0:\n raise ValueError(\"dfden <= 0\")\n return cont2_array(self.internal_state, rk_f, size, dfnum, dfden)\n\n def noncentral_f(self, double dfnum, double dfden, double nonc, size=None):\n \"\"\"Noncentral F distribution.\n\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\n \"\"\"\n if dfnum <= 1:\n raise ValueError(\"dfnum <= 1\")\n elif dfden <= 0:\n raise ValueError(\"dfden <= 0\")\n elif nonc < 0:\n raise ValueError(\"nonc < 0\")\n return cont3_array(self.internal_state, rk_noncentral_f, size, dfnum,\n dfden, nonc)\n\n def chisquare(self, double df, size=None):\n \"\"\"Chi^2 distribution.\n\n chisquare(df, size=None) -> random values\n \"\"\"\n if df <= 0:\n raise ValueError(\"df <= 0\")\n return cont1_array(self.internal_state, rk_chisquare, size, df)\n\n def noncentral_chisquare(self, double df, double nonc, size=None):\n \"\"\"Noncentral Chi^2 distribution.\n\n noncentral_chisquare(df, nonc, size=None) -> random values\n \"\"\"\n if df <= 1:\n raise ValueError(\"df <= 1\")\n elif nonc < 0:\n raise ValueError(\"nonc < 0\")\n return cont2_array(self.internal_state, rk_noncentral_chisquare, size,\n df, nonc)\n \n def standard_cauchy(self, size=None):\n \"\"\"Standard Cauchy with mode=0.\n\n standard_cauchy(size=None)\n \"\"\"\n return cont0_array(self.internal_state, rk_standard_cauchy, size)\n\n def standard_t(self, double df, size=None):\n \"\"\"Standard Student's t distribution with df degrees of freedom.\n\n standard_t(df, size=None)\n \"\"\"\n if df <= 0:\n raise ValueError(\"df <= 0\")\n return cont1_array(self.internal_state, rk_standard_t, size, df)\n\n def vonmises(self, double mu, double kappa, size=None):\n \"\"\"von Mises circular distribution with mode mu and dispersion parameter\n kappa on [-pi, pi].\n\n vonmises(mu, kappa, size=None)\n \"\"\"\n if kappa < 0:\n raise ValueError(\"kappa < 0\")\n return cont2_array(self.internal_state, rk_vonmises, size, mu, kappa)\n\n def pareto(self, double a, size=None):\n \"\"\"Pareto distribution.\n\n pareto(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_pareto, size, a)\n\n def weibull(self, double a, size=None):\n \"\"\"Weibull distribution.\n\n weibull(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_weibull, size, a)\n\n def power(self, double a, size=None):\n \"\"\"Power distribution.\n\n power(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_power, size, a)\n\n def laplace(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Laplace distribution.\n \n laplace(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_laplace, size, loc, scale)\n \n def gumbel(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Gumbel distribution.\n \n gumbel(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_gumbel, size, loc, scale)\n \n def logistic(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Logistic distribution.\n \n logistic(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_logistic, size, loc, scale)\n\n def lognormal(self, double mean=0.0, double sigma=1.0, size=None):\n \"\"\"Log-normal distribution.\n \n Note that the mean parameter is not the mean of this distribution, but \n the underlying normal distribution.\n \n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\n \n lognormal(mean=0.0, sigma=1.0, size=None)\n \"\"\"\n if sigma <= 0.0:\n raise ValueError(\"sigma <= 0.0\")\n return cont2_array(self.internal_state, rk_lognormal, size, mean, sigma)\n \n def rayleigh(self, double mode, size=None):\n \"\"\"Rayleigh distribution.\n \n rayleigh(mode, size=None)\n \"\"\"\n if mode <= 0.0:\n raise ValueError(\"mode <= 0.0\")\n return cont1_array(self.internal_state, rk_rayleigh, size, mode)\n \n def wald(self, double mean, double scale, size=None):\n \"\"\"Wald (inverse Gaussian) distribution.\n \n wald(mean, scale, size=None)\n \"\"\"\n if mean <= 0.0:\n raise ValueError(\"mean <= 0.0\")\n elif scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_wald, size, mean, scale)\n\n def triangular(self, double left, double mode, double right, size=None):\n \"\"\"Triangular distribution starting at left, peaking at mode, and \n ending at right (left <= mode <= right).\n \n triangular(left, mode, right, size=None)\n \"\"\"\n if left > mode:\n raise ValueError(\"left > mode\")\n elif mode > right:\n raise ValueError(\"mode > right\")\n elif left == right:\n raise ValueError(\"left == right\")\n return cont3_array(self.internal_state, rk_triangular, size, left, \n mode, right)\n\n # Complicated, discrete distributions:\n def binomial(self, long n, double p, size=None):\n \"\"\"Binomial distribution of n trials and p probability of success.\n\n binomial(n, p, size=None) -> random values\n \"\"\"\n if n <= 0:\n raise ValueError(\"n <= 0\")\n elif p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discnp_array(self.internal_state, rk_binomial, size, n, p)\n\n def negative_binomial(self, long n, double p, size=None):\n \"\"\"Negative Binomial distribution.\n\n negative_binomial(n, p, size=None) -> random values\n \"\"\"\n if n <= 0:\n raise ValueError(\"n <= 0\")\n elif p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discnp_array(self.internal_state, rk_negative_binomial, size, n,\n p)\n\n def poisson(self, double lam=1.0, size=None):\n \"\"\"Poisson distribution.\n\n poisson(lam=1.0, size=None) -> random values\n \"\"\"\n if lam <= 0:\n raise ValueError(\"lam <= 0\")\n return discd_array(self.internal_state, rk_poisson, size, lam)\n\n def zipf(self, double a, size=None):\n \"\"\"Zipf distribution.\n \n zipf(a, size=None)\n \"\"\"\n if a <= 1.0:\n raise ValueError(\"a <= 1.0\")\n return discd_array(self.internal_state, rk_zipf, size, a)\n \n def geometric(self, double p, size=None):\n \"\"\"Geometric distribution with p being the probability of \"success\" on\n an individual trial.\n \n geometric(p, size=None)\n \"\"\"\n if p < 0.0:\n raise ValueError(\"p < 0.0\")\n elif p > 1.0:\n raise ValueError(\"p > 1.0\")\n return discd_array(self.internal_state, rk_geometric, size, p)\n \n def hypergeometric(self, long ngood, long nbad, long nsample, size=None):\n \"\"\"Hypergeometric distribution.\n \n Consider an urn with ngood \"good\" balls and nbad \"bad\" balls. If one \n were to draw nsample balls from the urn without replacement, then \n the hypergeometric distribution describes the distribution of \"good\" \n balls in the sample.\n \n hypergeometric(ngood, nbad, nsample, size=None) \n \"\"\"\n if ngood < 1:\n raise ValueError(\"ngood < 1\")\n elif nbad < 1:\n raise ValueError(\"nbad < 1\")\n elif ngood + nbad < nsample:\n raise ValueError(\"ngood + nbad < nsample\")\n elif nsample < 1:\n raise ValueError(\"nsample < 1\")\n return discnmN_array(self.internal_state, rk_hypergeometric, size,\n ngood, nbad, nsample)\n\n def logseries(self, double p, size=None):\n \"\"\"Logarithmic series distribution.\n \n logseries(p, size=None)\n \"\"\"\n if p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discd_array(self.internal_state, rk_logseries, size, p)\n\n # Multivariate distributions:\n def multivariate_normal(self, mean, cov, size=None):\n \"\"\"Return an array containing multivariate normally distributed random numbers\n with specified mean and covariance.\n\n multivariate_normal(mean, cov) -> random values\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\n\n mean must be a 1 dimensional array. cov must be a square two dimensional\n array with the same number of rows and columns as mean has elements.\n\n The first form returns a single 1-D array containing a multivariate\n normal.\n\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\n normal.\n \"\"\"\n # Check preconditions on arguments\n mean = _sp.array(mean)\n cov = _sp.array(cov)\n if size is None:\n shape = []\n else:\n shape = size\n if len(mean.shape) != 1:\n raise ArgumentError(\"mean must be 1 dimensional\")\n if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]):\n raise ArgumentError(\"cov must be 2 dimensional and square\")\n if mean.shape[0] != cov.shape[0]:\n raise ArgumentError(\"mean and cov must have same length\")\n # Compute shape of output\n if isinstance(shape, int):\n shape = [shape]\n final_shape = list(shape[:])\n final_shape.append(mean.shape[0])\n # Create a matrix of independent standard normally distributed random\n # numbers. The matrix has rows with the same length as mean and as\n # many rows are necessary to form a matrix of shape final_shape.\n x = standard_normal(_sp.multiply.reduce(final_shape))\n x.shape = (_sp.multiply.reduce(final_shape[0:len(final_shape)-1]),\n mean.shape[0])\n # Transform matrix of standard normals into matrix where each row\n # contains multivariate normals with the desired covariance.\n # Compute A such that matrixmultiply(transpose(A),A) == cov.\n # Then the matrix products of the rows of x and A has the desired\n # covariance. Note that sqrt(s)*v where (u,s,v) is the singular value\n # decomposition of cov is such an A.\n \n # XXX: we really should be doing this by Cholesky decomposition\n (u,s,v) = _sp.linalg.singular_value_decomposition(cov)\n x = _sp.matrixmultiply(x*_sp.sqrt(s),v)\n # The rows of x now have the correct covariance but mean 0. Add\n # mean to each row. Then each row will have mean mean.\n _sp.add(mean,x,x)\n x.shape = tuple(final_shape)\n return x\n\n def multinomial(self, long n, object pvals, size=None):\n \"\"\"Multinomial distribution.\n \n multinomial(n, pvals, size=None) -> random values\n\n pvals is a sequence of probabilities that should sum to 1 (however, the\n last element is always assumed to account for the remaining probability\n as long as sum(pvals[:-1]) <= 1).\n \"\"\"\n cdef long d\n cdef ArrayType parr, mnarr\n cdef double *pix\n cdef long *mnix\n cdef long i, j, dn\n cdef double Sum, prob\n\n d = len(pvals)\n parr = PyArray_ContiguousFromObject(pvals, PyArray_DOUBLE, 1, 1)\n pix = parr.data\n\n if kahan_sum(pix, d-1) > 1.0:\n raise ValueError(\"sum(pvals) > 1.0\")\n\n if size is None:\n shape = (d,)\n elif type(size) is int:\n shape = (size, d)\n else:\n shape = size + (d,)\n\n multin = _sp.zeros(shape, _sp.Int)\n mnarr = multin\n mnix = mnarr.data\n i = 0\n while i < PyArray_SIZE(mnarr):\n Sum = 1.0\n dn = n\n for j from 0 <= j < d-1:\n mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum)\n dn = dn - mnix[i+j]\n if dn <= 0:\n break\n Sum = Sum - pix[j]\n if dn > 0:\n mnix[i+d-1] = dn\n\n i = i + d\n\n return multin\n\n # Shuffling and permutations:\n def shuffle(self, object x):\n \"\"\"Modify a sequence in-place by shuffling its contents.\n \n shuffle(x)\n \"\"\"\n cdef long i, j\n\n # adaptation of random.shuffle()\n i = len(x) - 1\n while i > 0:\n j = rk_interval(i, self.internal_state)\n x[i], x[j] = x[j], x[i]\n i = i - 1\n \n def permutation(self, object x):\n \"\"\"Given an integer, return a shuffled sequence of integers >= 0 and \n < x; given a sequence, return a shuffled array copy.\n\n permutation(x)\n \"\"\"\n if type(x) is int:\n arr = _sp.arange(x)\n else:\n arr = _sp.array(x)\n self.shuffle(arr)\n return arr \n\n_rand = RandomState()\nget_state = _rand.get_state\nset_state = _rand.set_state\nrandom_sample = _rand.random_sample\nrandint = _rand.randint\nbytes = _rand.bytes\nuniform = _rand.uniform\nrand = _rand.rand\nrandn = _rand.randn\nrandom_integers = _rand.random_integers\nstandard_normal = _rand.standard_normal\nnormal = _rand.normal\nbeta = _rand.beta\nexponential = _rand.exponential\nstandard_exponential = _rand.standard_exponential\nstandard_gamma = _rand.standard_gamma\ngamma = _rand.gamma\nf = _rand.f\nnoncentral_f = _rand.noncentral_f\nchisquare = _rand.chisquare\nnoncentral_chisquare = _rand.noncentral_chisquare\nstandard_cauchy = _rand.standard_cauchy\nstandard_t = _rand.standard_t\nvonmises = _rand.vonmises\npareto = _rand.pareto\nweibull = _rand.weibull\npower = _rand.power\nlaplace = _rand.laplace\ngumbel = _rand.gumbel\nlogistic = _rand.logistic\nlognormal = _rand.lognormal\nrayleigh = _rand.rayleigh\nwald = _rand.wald\ntriangular = _rand.triangular\n\nbinomial = _rand.binomial\nnegative_binomial = _rand.negative_binomial\npoisson = _rand.poisson\nzipf = _rand.zipf\ngeometric = _rand.geometric\nhypergeometric = _rand.hypergeometric\nlogseries = _rand.logseries\n\nmultivariate_normal = _rand.multivariate_normal\nmultinomial = _rand.multinomial\n\nshuffle = _rand.shuffle\npermutation = _rand.permutation\n", "source_code_before": "# mtrand.pyx -- A Pyrex wrapper of Jean-Sebastien Roy's RandomKit\n#\n# Copyright 2005 Robert Kern (robert.kern@gmail.com)\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n# \n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n# \n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\ninclude \"Python.pxi\"\ninclude \"scipy.pxi\"\n\ncdef extern from \"math.h\":\n double exp(double x)\n double log(double x)\n double floor(double x)\n double sin(double x)\n double cos(double x)\n\ncdef extern from \"randomkit.h\":\n\n ctypedef struct rk_state:\n unsigned long key[624]\n int pos\n\n ctypedef enum rk_error:\n RK_NOERR = 0\n RK_ENODEV = 1\n RK_ERR_MAX = 2\n\n char *rk_strerror[2]\n \n # 0xFFFFFFFFUL\n unsigned long RK_MAX\n\n void rk_seed(unsigned long seed, rk_state *state)\n rk_error rk_randomseed(rk_state *state)\n unsigned long rk_random(rk_state *state)\n long rk_long(rk_state *state)\n unsigned long rk_ulong(rk_state *state)\n unsigned long rk_interval(unsigned long max, rk_state *state)\n double rk_double(rk_state *state)\n void rk_fill(void *buffer, size_t size, rk_state *state)\n rk_error rk_devfill(void *buffer, size_t size, int strong)\n rk_error rk_altfill(void *buffer, size_t size, int strong,\n rk_state *state)\n double rk_gauss(rk_state *state)\n\ncdef extern from \"distributions.h\":\n \n double rk_normal(rk_state *state, double loc, double scale)\n double rk_standard_exponential(rk_state *state)\n double rk_exponential(rk_state *state, double scale)\n double rk_uniform(rk_state *state, double loc, double scale)\n double rk_standard_gamma(rk_state *state, double shape)\n double rk_gamma(rk_state *state, double shape, double scale)\n double rk_beta(rk_state *state, double a, double b)\n double rk_chisquare(rk_state *state, double df)\n double rk_noncentral_chisquare(rk_state *state, double df, double nonc)\n double rk_f(rk_state *state, double dfnum, double dfden)\n double rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc)\n double rk_standard_cauchy(rk_state *state)\n double rk_standard_t(rk_state *state, double df)\n double rk_vonmises(rk_state *state, double mu, double kappa)\n double rk_pareto(rk_state *state, double a)\n double rk_weibull(rk_state *state, double a)\n double rk_power(rk_state *state, double a)\n double rk_laplace(rk_state *state, double loc, double scale)\n double rk_gumbel(rk_state *state, double loc, double scale)\n double rk_logistic(rk_state *state, double loc, double scale)\n double rk_lognormal(rk_state *state, double mode, double sigma)\n double rk_rayleigh(rk_state *state, double mode)\n double rk_wald(rk_state *state, double mean, double scale)\n double rk_triangular(rk_state *state, double left, double mode, double right)\n \n long rk_binomial(rk_state *state, long n, double p)\n long rk_negative_binomial(rk_state *state, long n, double p)\n long rk_poisson(rk_state *state, double lam)\n long rk_zipf(rk_state *state, double a)\n long rk_geometric(rk_state *state, double p)\n long rk_hypergeometric(rk_state *state, long good, long bad, long sample)\n \nctypedef double (* rk_cont0)(rk_state *state)\nctypedef double (* rk_cont1)(rk_state *state, double a)\nctypedef double (* rk_cont2)(rk_state *state, double a, double b)\nctypedef double (* rk_cont3)(rk_state *state, double a, double b, double c)\n\nctypedef long (* rk_disc0)(rk_state *state)\nctypedef long (* rk_discnp)(rk_state *state, long n, double p)\nctypedef long (* rk_discnmN)(rk_state *state, long n, long m, long N)\nctypedef long (* rk_discd)(rk_state *state, double a)\n\n\ncdef extern from \"initarray.h\":\n void init_by_array(rk_state *self, unsigned long *init_key, \n unsigned long key_length)\n\n# Initialize scipy\nimport_array()\n\nimport scipy as _sp\n\ncdef object cont0_array(rk_state *state, rk_cont0 func, object size):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state)\n return array\n\ncdef object cont1_array(rk_state *state, rk_cont1 func, object size, double a):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a)\n return array\n\ncdef object cont2_array(rk_state *state, rk_cont2 func, object size, double a, \n double b):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a, b)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a, b)\n return array\n\ncdef object cont3_array(rk_state *state, rk_cont3 func, object size, double a, \n double b, double c):\n\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a, b, c)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a, b, c)\n return array\n\ncdef object disc0_array(rk_state *state, rk_disc0 func, object size):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state)\n return array\n\ncdef object discnp_array(rk_state *state, rk_discnp func, object size, long n, double p):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, n, p)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, n, p)\n return array\n\ncdef object discnmN_array(rk_state *state, rk_discnmN func, object size, \n long n, long m, long N):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, n, m, N)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, n, m, N)\n return array\n\ncdef object discd_array(rk_state *state, rk_discd func, object size, double a):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a)\n return array\n\ncdef double kahan_sum(double *darr, long n):\n cdef double c, y, t, sum\n cdef long i\n sum = darr[0]\n c = 0.0\n for i from 1 <= i < n:\n y = darr[i] - c\n t = sum + y\n c = (t-sum) - y\n sum = t\n return sum\n\ncdef class RandomState:\n \"\"\"Container for the Mersenne Twister PRNG.\n\n Constructor\n -----------\n RandomState(seed=None): initializes the PRNG with the given seed. See the\n seed() method for details.\n\n Distribution Methods\n -----------------\n RandomState exposes a number of methods for generating random numbers drawn\n from a variety of probability distributions. In addition to the\n distribution-specific arguments, each method takes a keyword argument\n size=None. If size is None, then a single value is generated and returned.\n If size is an integer, then a 1-D scipy array filled with generated values\n is returned. If size is a tuple, then a scipy array with that shape is\n filled and returned.\n \"\"\"\n cdef rk_state *internal_state\n\n def __init__(self, seed=None):\n self.internal_state = PyMem_Malloc(sizeof(rk_state))\n\n self.seed(seed)\n\n def __dealloc__(self):\n if self.internal_state != NULL:\n PyMem_Free(self.internal_state)\n\n def seed(self, seed=None):\n \"\"\"Seed the generator.\n\n seed(seed=None)\n\n seed can be an integer, an array (or other sequence) of integers of any\n length, or None. If seed is None, then RandomState will try to read data\n from /dev/urandom (or the Windows analogue) if available or seed from\n the clock otherwise.\n \"\"\"\n cdef rk_error errcode\n cdef ArrayType obj\n if seed is None:\n errcode = rk_randomseed(self.internal_state)\n elif type(seed) is int:\n rk_seed(seed, self.internal_state)\n else:\n obj = PyArray_ContiguousFromObject(seed, PyArray_LONG, 1, 1)\n init_by_array(self.internal_state, (obj.data),\n obj.dimensions[0])\n\n def get_state(self):\n \"\"\"Return a tuple representing the internal state of the generator.\n\n get_state() -> ('MT19937', int key[624], int pos)\n \"\"\"\n cdef ArrayType state\n state = _sp.empty(624, _sp.Int)\n memcpy((state.data), self.internal_state.key, 624*sizeof(long))\n return ('MT19937', state, self.internal_state.pos)\n \n def set_state(self, state):\n \"\"\"Set the state from a tuple.\n \n state = ('MT19937', int key[624], int pos)\n \n set_state(state)\n \"\"\"\n cdef ArrayType obj\n cdef int pos\n algorithm_name = state[0]\n if algorithm_name != 'MT19937':\n raise ValueError(\"algorithm must be 'MT19937'\")\n key, pos = state[1:]\n obj = PyArray_ContiguousFromObject(key, PyArray_LONG, 1, 1)\n if obj.dimensions[0] != 624:\n raise ValueError(\"state must be 624 longs\")\n memcpy(self.internal_state.key, (obj.data), 624*sizeof(long))\n self.internal_state.pos = pos\n \n # Pickling support:\n def __getstate__(self):\n return self.get_state()\n\n def __setstate__(self, state):\n self.set_state(state)\n\n def __reduce__(self):\n return (_sp.stats.__RandomState_ctor, (), self.get_state())\n\n # Basic distributions:\n def random_sample(self, size=None):\n \"\"\"Return random floats in the half-open interval [0.0, 1.0).\n\n random_sample(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_double, size)\n\n def tomaxint(self, size=None):\n \"\"\"Returns random integers x such that 0 <= x <= sys.maxint.\n\n tomaxint(size=None) -> random values\n \"\"\"\n return disc0_array(self.internal_state, rk_long, size)\n\n def randint(self, low, high=None, size=None):\n \"\"\"Return random integers x such that low <= x < high.\n\n randint(low, high=None, size=None) -> random values\n\n If high is None, then 0 <= x < low.\n \"\"\"\n cdef long lo, hi, diff\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if high is None:\n lo = 0\n hi = low\n else:\n lo = low\n hi = high\n\n diff = hi - lo - 1\n if diff < 0:\n raise ValueError(\"low >= high\")\n \n if size is None:\n return rk_interval(diff, self.internal_state)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = lo + rk_interval(diff, self.internal_state)\n return array\n\n def bytes(self, unsigned int length):\n \"\"\"Return random bytes.\n\n bytes(length) -> str\n \"\"\"\n cdef void *bytes\n bytes = PyMem_Malloc(length)\n rk_fill(bytes, length, self.internal_state)\n bytestring = PyString_FromString(bytes)\n PyMem_Free(bytes)\n return bytestring\n\n def uniform(self, double low=0.0, double high=1.0, size=None):\n \"\"\"Uniform distribution over [low, high).\n\n uniform(low=0.0, high=1.0, size=None) -> random values\n \"\"\"\n return cont2_array(self.internal_state, rk_uniform, size, low, \n high-low)\n\n def rand(self, *args):\n \"\"\"Return an array of the given dimensions which is initialized to \n random numbers from a uniform distribution in the range [0,1).\n\n randn(d0, d1, ..., dn) -> random values\n \"\"\"\n if len(args) == 0:\n return self.random_sample()\n else:\n return self.random_sample(size=args)\n\n def randn(self, *args):\n \"\"\"Returns zero-mean, unit-variance Gaussian random numbers in an \n array of shape (d0, d1, ..., dn).\n\n randn(d0, d1, ..., dn) -> random values\n \"\"\"\n if len(args) == 0:\n return self.standard_normal()\n else:\n return self.standard_normal(args)\n\n def random_integers(self, low, high=None, size=None):\n \"\"\"Return random integers x such that low <= x <= high.\n\n random_integers(low, high=None, size=None) -> random values.\n\n If high is None, then 1 <= x <= low.\n \"\"\"\n if high is None:\n high = low\n low = 1\n return self.randint(low, high+1, size)\n\n # Complicated, continuous distributions:\n def standard_normal(self, size=None):\n \"\"\"Standard Normal distribution (mean=0, stdev=1).\n\n standard_normal(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_gauss, size)\n\n def normal(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Normal distribution (mean=loc, stdev=scale).\n\n normal(loc=0.0, scale=1.0, size=None) -> random values\n \"\"\"\n if scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont2_array(self.internal_state, rk_normal, size, loc, scale)\n\n def beta(self, double a, double b, size=None):\n \"\"\"Beta distribution over [0, 1].\n\n beta(a, b, size=None) -> random values\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n elif b <= 0:\n raise ValueError(\"b <= 0\")\n return cont2_array(self.internal_state, rk_beta, size, a, b)\n\n def exponential(self, double scale=1.0, size=None):\n \"\"\"Exponential distribution.\n\n exponential(scale=1.0, size=None) -> random values\n \"\"\"\n if scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont1_array(self.internal_state, rk_exponential, size, scale)\n\n def standard_exponential(self, size=None):\n \"\"\"Standard exponential distribution (scale=1).\n\n standard_exponential(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_standard_exponential, size)\n\n def standard_gamma(self, double shape, size=None):\n \"\"\"Standard Gamma distribution.\n\n standard_gamma(shape, size=None) -> random values\n \"\"\"\n if shape <= 0:\n raise ValueError(\"shape <= 0\")\n return cont1_array(self.internal_state, rk_standard_gamma, size, shape)\n\n def gamma(self, double shape, double scale=1.0, size=None):\n \"\"\"Gamma distribution.\n\n gamma(shape, scale=1.0, size=None) -> random values\n \"\"\"\n if shape <= 0:\n raise ValueError(\"shape <= 0\")\n elif scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont2_array(self.internal_state, rk_gamma, size, shape, scale)\n\n def f(self, double dfnum, double dfden, size=None):\n \"\"\"F distribution.\n\n f(dfnum, dfden, size=None) -> random values\n \"\"\"\n if dfnum <= 0:\n raise ValueError(\"dfnum <= 0\")\n elif dfden <= 0:\n raise ValueError(\"dfden <= 0\")\n return cont2_array(self.internal_state, rk_f, size, dfnum, dfden)\n\n def noncentral_f(self, double dfnum, double dfden, double nonc, size=None):\n \"\"\"Noncentral F distribution.\n\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\n \"\"\"\n if dfnum <= 1:\n raise ValueError(\"dfnum <= 1\")\n elif dfden <= 0:\n raise ValueError(\"dfden <= 0\")\n elif nonc < 0:\n raise ValueError(\"nonc < 0\")\n return cont3_array(self.internal_state, rk_noncentral_f, size, dfnum,\n dfden, nonc)\n\n def chisquare(self, double df, size=None):\n \"\"\"Chi^2 distribution.\n\n chisquare(df, size=None) -> random values\n \"\"\"\n if df <= 0:\n raise ValueError(\"df <= 0\")\n return cont1_array(self.internal_state, rk_chisquare, size, df)\n\n def noncentral_chisquare(self, double df, double nonc, size=None):\n \"\"\"Noncentral Chi^2 distribution.\n\n noncentral_chisquare(df, nonc, size=None) -> random values\n \"\"\"\n if df <= 1:\n raise ValueError(\"df <= 1\")\n elif nonc < 0:\n raise ValueError(\"nonc < 0\")\n return cont2_array(self.internal_state, rk_noncentral_chisquare, size,\n df, nonc)\n \n def standard_cauchy(self, size=None):\n \"\"\"Standard Cauchy with mode=0.\n\n standard_cauchy(size=None)\n \"\"\"\n return cont0_array(self.internal_state, rk_standard_cauchy, size)\n\n def standard_t(self, double df, size=None):\n \"\"\"Standard Student's t distribution with df degrees of freedom.\n\n standard_t(df, size=None)\n \"\"\"\n if df <= 0:\n raise ValueError(\"df <= 0\")\n return cont1_array(self.internal_state, rk_standard_t, size, df)\n\n def vonmises(self, double mu, double kappa, size=None):\n \"\"\"von Mises circular distribution with mode mu and dispersion parameter\n kappa on [-pi, pi].\n\n vonmises(mu, kappa, size=None)\n \"\"\"\n if kappa < 0:\n raise ValueError(\"kappa < 0\")\n return cont2_array(self.internal_state, rk_vonmises, size, mu, kappa)\n\n def pareto(self, double a, size=None):\n \"\"\"Pareto distribution.\n\n pareto(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_pareto, size, a)\n\n def weibull(self, double a, size=None):\n \"\"\"Weibull distribution.\n\n weibull(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_weibull, size, a)\n\n def power(self, double a, size=None):\n \"\"\"Power distribution.\n\n power(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_power, size, a)\n\n def laplace(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Laplace distribution.\n \n laplace(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_laplace, size, loc, scale)\n \n def gumbel(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Gumbel distribution.\n \n gumbel(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_gumbel, size, loc, scale)\n \n def logistic(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Logistic distribution.\n \n logistic(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_logistic, size, loc, scale)\n\n def lognormal(self, double mean=0.0, double sigma=1.0, size=None):\n \"\"\"Log-normal distribution.\n \n Note that the mean parameter is not the mean of this distribution, but \n the underlying normal distribution.\n \n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\n \n lognormal(mean=0.0, sigma=1.0, size=None)\n \"\"\"\n if sigma <= 0.0:\n raise ValueError(\"sigma <= 0.0\")\n return cont2_array(self.internal_state, rk_lognormal, size, mean, sigma)\n \n def rayleigh(self, double mode, size=None):\n \"\"\"Rayleigh distribution.\n \n rayleigh(mode, size=None)\n \"\"\"\n if mode <= 0.0:\n raise ValueError(\"mode <= 0.0\")\n return cont1_array(self.internal_state, rk_rayleigh, size, mode)\n \n def wald(self, double mean, double scale, size=None):\n \"\"\"Wald (inverse Gaussian) distribution.\n \n wald(mean, scale, size=None)\n \"\"\"\n if mean <= 0.0:\n raise ValueError(\"mean <= 0.0\")\n elif scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_wald, size, mean, scale)\n\n def triangular(self, double left, double mode, double right, size=None):\n \"\"\"Triangular distribution starting at left, peaking at mode, and \n ending at right (left <= mode <= right).\n \n triangular(left, mode, right, size=None)\n \"\"\"\n if left > mode:\n raise ValueError(\"left > mode\")\n elif mode > right:\n raise ValueError(\"mode > right\")\n elif left == right:\n raise ValueError(\"left == right\")\n return cont3_array(self.internal_state, rk_triangular, size, left, \n mode, right)\n\n # Complicated, discrete distributions:\n def binomial(self, long n, double p, size=None):\n \"\"\"Binomial distribution of n trials and p probability of success.\n\n binomial(n, p, size=None) -> random values\n \"\"\"\n if n <= 0:\n raise ValueError(\"n <= 0\")\n elif p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discnp_array(self.internal_state, rk_binomial, size, n, p)\n\n def negative_binomial(self, long n, double p, size=None):\n \"\"\"Negative Binomial distribution.\n\n negative_binomial(n, p, size=None) -> random values\n \"\"\"\n if n <= 0:\n raise ValueError(\"n <= 0\")\n elif p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discnp_array(self.internal_state, rk_negative_binomial, size, n,\n p)\n\n def poisson(self, double lam=1.0, size=None):\n \"\"\"Poisson distribution.\n\n poisson(lam=1.0, size=None) -> random values\n \"\"\"\n if lam <= 0:\n raise ValueError(\"lam <= 0\")\n return discd_array(self.internal_state, rk_poisson, size, lam)\n\n def zipf(self, double a, size=None):\n \"\"\"Zipf distribution.\n \n zipf(a, size=None)\n \"\"\"\n if a <= 1.0:\n raise ValueError(\"a <= 1.0\")\n return discd_array(self.internal_state, rk_zipf, size, a)\n \n def geometric(self, double p, size=None):\n \"\"\"Geometric distribution with p being the probability of \"success\" on\n an individual trial.\n \n geometric(p, size=None)\n \"\"\"\n if p < 0.0:\n raise ValueError(\"p < 0.0\")\n elif p > 1.0:\n raise ValueError(\"p > 1.0\")\n return discd_array(self.internal_state, rk_geometric, size, p)\n \n def hypergeometric(self, long ngood, long nbad, long nsample, size=None):\n \"\"\"Hypergeometric distribution.\n \n Consider an urn with ngood \"good\" balls and nbad \"bad\" balls. If one \n were to draw nsample balls from the urn without replacement, then \n the hypergeometric distribution describes the distribution of \"good\" \n balls in the sample.\n \n hypergeometric(ngood, nbad, nsample, size=None) \n \"\"\"\n if ngood < 1:\n raise ValueError(\"ngood < 1\")\n elif nbad < 1:\n raise ValueError(\"nbad < 1\")\n elif ngood + nbad < nsample:\n raise ValueError(\"ngood + nbad < nsample\")\n elif nsample < 1:\n raise ValueError(\"nsample < 1\")\n return discnmN_array(self.internal_state, rk_hypergeometric, size,\n ngood, nbad, nsample)\n\n # Multivariate distributions:\n def multivariate_normal(self, mean, cov, size=None):\n \"\"\"Return an array containing multivariate normally distributed random numbers\n with specified mean and covariance.\n\n multivariate_normal(mean, cov) -> random values\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\n\n mean must be a 1 dimensional array. cov must be a square two dimensional\n array with the same number of rows and columns as mean has elements.\n\n The first form returns a single 1-D array containing a multivariate\n normal.\n\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\n normal.\n \"\"\"\n # Check preconditions on arguments\n mean = _sp.array(mean)\n cov = _sp.array(cov)\n if size is None:\n shape = []\n else:\n shape = size\n if len(mean.shape) != 1:\n raise ArgumentError(\"mean must be 1 dimensional\")\n if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]):\n raise ArgumentError(\"cov must be 2 dimensional and square\")\n if mean.shape[0] != cov.shape[0]:\n raise ArgumentError(\"mean and cov must have same length\")\n # Compute shape of output\n if isinstance(shape, int):\n shape = [shape]\n final_shape = list(shape[:])\n final_shape.append(mean.shape[0])\n # Create a matrix of independent standard normally distributed random\n # numbers. The matrix has rows with the same length as mean and as\n # many rows are necessary to form a matrix of shape final_shape.\n x = standard_normal(_sp.multiply.reduce(final_shape))\n x.shape = (_sp.multiply.reduce(final_shape[0:len(final_shape)-1]),\n mean.shape[0])\n # Transform matrix of standard normals into matrix where each row\n # contains multivariate normals with the desired covariance.\n # Compute A such that matrixmultiply(transpose(A),A) == cov.\n # Then the matrix products of the rows of x and A has the desired\n # covariance. Note that sqrt(s)*v where (u,s,v) is the singular value\n # decomposition of cov is such an A.\n \n # XXX: we really should be doing this by Cholesky decomposition\n (u,s,v) = _sp.linalg.singular_value_decomposition(cov)\n x = _sp.matrixmultiply(x*_sp.sqrt(s),v)\n # The rows of x now have the correct covariance but mean 0. Add\n # mean to each row. Then each row will have mean mean.\n _sp.add(mean,x,x)\n x.shape = tuple(final_shape)\n return x\n\n def multinomial(self, long n, object pvals, size=None):\n \"\"\"Multinomial distribution.\n \n multinomial(n, pvals, size=None) -> random values\n\n pvals is a sequence of probabilities that should sum to 1 (however, the\n last element is always assumed to account for the remaining probability\n as long as sum(pvals[:-1]) <= 1).\n \"\"\"\n cdef long d\n cdef ArrayType parr, mnarr\n cdef double *pix\n cdef long *mnix\n cdef long i, j, dn\n cdef double Sum, prob\n\n d = len(pvals)\n parr = PyArray_ContiguousFromObject(pvals, PyArray_DOUBLE, 1, 1)\n pix = parr.data\n\n if kahan_sum(pix, d-1) > 1.0:\n raise ValueError(\"sum(pvals) > 1.0\")\n\n if size is None:\n shape = (d,)\n elif type(size) is int:\n shape = (size, d)\n else:\n shape = size + (d,)\n\n multin = _sp.zeros(shape, _sp.Int)\n mnarr = multin\n mnix = mnarr.data\n i = 0\n while i < PyArray_SIZE(mnarr):\n Sum = 1.0\n dn = n\n for j from 0 <= j < d-1:\n mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum)\n dn = dn - mnix[i+j]\n if dn <= 0:\n break\n Sum = Sum - pix[j]\n if dn > 0:\n mnix[i+d-1] = dn\n\n i = i + d\n\n return multin\n\n # Shuffling and permutations:\n def shuffle(self, object x):\n \"\"\"Modify a sequence in-place by shuffling its contents.\n \n shuffle(x)\n \"\"\"\n cdef long i, j\n\n # adaptation of random.shuffle()\n i = len(x) - 1\n while i > 0:\n j = rk_interval(i, self.internal_state)\n x[i], x[j] = x[j], x[i]\n i = i - 1\n \n def permutation(self, object x):\n \"\"\"Given an integer, return a shuffled sequence of integers >= 0 and \n < x.\n\n permutation(x)\n \"\"\"\n arr = _sp.arange(x)\n self.shuffle(arr)\n return arr\n\n\n_rand = RandomState()\nget_state = _rand.get_state\nset_state = _rand.set_state\nrandom_sample = _rand.random_sample\nrandint = _rand.randint\nbytes = _rand.bytes\nuniform = _rand.uniform\nrand = _rand.rand\nrandn = _rand.randn\nrandom_integers = _rand.random_integers\nstandard_normal = _rand.standard_normal\nnormal = _rand.normal\nbeta = _rand.beta\nexponential = _rand.exponential\nstandard_exponential = _rand.standard_exponential\nstandard_gamma = _rand.standard_gamma\ngamma = _rand.gamma\nf = _rand.f\nnoncentral_f = _rand.noncentral_f\nchisquare = _rand.chisquare\nnoncentral_chisquare = _rand.noncentral_chisquare\nstandard_cauchy = _rand.standard_cauchy\nstandard_t = _rand.standard_t\nvonmises = _rand.vonmises\npareto = _rand.pareto\nweibull = _rand.weibull\npower = _rand.power\nlaplace = _rand.laplace\ngumbel = _rand.gumbel\nlogistic = _rand.logistic\nlognormal = _rand.lognormal\nrayleigh = _rand.rayleigh\nwald = _rand.wald\ntriangular = _rand.triangular\n\nbinomial = _rand.binomial\nnegative_binomial = _rand.negative_binomial\npoisson = _rand.poisson\nzipf = _rand.zipf\ngeometric = _rand.geometric\nhypergeometric = _rand.hypergeometric\n\nmultivariate_normal = _rand.multivariate_normal\nmultinomial = _rand.multinomial\n\nshuffle = _rand.shuffle\npermutation = _rand.permutation\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ " long rk_logseries(rk_state *state, double p)", "", " return (_sp.random.__RandomState_ctor, (), self.get_state())", " def logseries(self, double p, size=None):", " \"\"\"Logarithmic series distribution.", "", " logseries(p, size=None)", " \"\"\"", " if p < 0:", " raise ValueError(\"p < 0\")", " elif p > 1:", " raise ValueError(\"p > 1\")", " return discd_array(self.internal_state, rk_logseries, size, p)", "", " < x; given a sequence, return a shuffled array copy.", " if type(x) is int:", " arr = _sp.arange(x)", " else:", " arr = _sp.array(x)", " return arr", "logseries = _rand.logseries" ], "deleted": [ "", " return (_sp.stats.__RandomState_ctor, (), self.get_state())", " < x.", " arr = _sp.arange(x)", " return arr", "" ] } }, { "old_path": null, "new_path": "scipy/random.py", "filename": "random.py", "extension": "py", "change_type": "ADD", "diff": "@@ -0,0 +1,13 @@\n+from scipy.lib.mtrand import *\n+\n+# Some aliases:\n+ranf = random_sample\n+random = random_sample\n+sample = random_sample\n+\n+def __RandomState_ctor():\n+ \"\"\"Return a RandomState instance.\n+ \n+ This function exists solely to assist (un)pickling.\n+ \"\"\"\n+ return RandomState()\n", "added_lines": 13, "deleted_lines": 0, "source_code": "from scipy.lib.mtrand import *\n\n# Some aliases:\nranf = random_sample\nrandom = random_sample\nsample = random_sample\n\ndef __RandomState_ctor():\n \"\"\"Return a RandomState instance.\n \n This function exists solely to assist (un)pickling.\n \"\"\"\n return RandomState()\n", "source_code_before": null, "methods": [ { "name": "__RandomState_ctor", "long_name": "__RandomState_ctor( )", "filename": "random.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [], "start_line": 8, "end_line": 13, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 } ], "methods_before": [], "changed_methods": [ { "name": "__RandomState_ctor", "long_name": "__RandomState_ctor( )", "filename": "random.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [], "start_line": 8, "end_line": 13, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 } ], "nloc": 6, "complexity": 1, "token_count": 27, "diff_parsed": { "added": [ "from scipy.lib.mtrand import *", "", "# Some aliases:", "ranf = random_sample", "random = random_sample", "sample = random_sample", "", "def __RandomState_ctor():", " \"\"\"Return a RandomState instance.", "", " This function exists solely to assist (un)pickling.", " \"\"\"", " return RandomState()" ], "deleted": [] } } ] }, { "hash": "1f5d0b48db1e7c5ac9b06e9b122c134897edeba2", "msg": "More checks for SIZEOF_LONGLONG==SIZEOF_LONG", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T09:40:25+00:00", "author_timezone": 0, "committer_date": "2005-10-07T09:40:25+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "d2b5deb37fbb1aa3619837c96b3865a5d79a7be0" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 9, "insertions": 23, "lines": 32, "files": 2, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.0, "dmm_unit_interfacing": 1.0, "modified_files": [ { "old_path": "scipy/base/src/multiarraymodule.c", "new_path": "scipy/base/src/multiarraymodule.c", "filename": "multiarraymodule.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -3825,7 +3825,11 @@ setup_scalartypes(PyObject *dict)\n SINGLE_INHERIT(Int, SignedInteger);\n #endif\n DUAL_INHERIT(Long, Int, SignedInteger);\n+#if SIZEOF_LONGLONG == SIZEOF_LONG\n+ DUAL_INHERIT(LongLong, Int, SignedInteger);\n+#else\n SINGLE_INHERIT(LongLong, SignedInteger);\n+#endif\n \n SINGLE_INHERIT(UByte, UnsignedInteger);\n SINGLE_INHERIT(UShort, UnsignedInteger);\n", "added_lines": 4, "deleted_lines": 0, "source_code": "\n/*\n Python Multiarray Module -- A useful collection of functions for creating and\n using ndarrays\n\n Original file \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n Modified for scipy_core in 2005 \n\n Travis E. Oliphant\n Assistant Professor at\n Brigham Young University\n \n*/\n\n/* $Id: multiarraymodule.c,v 1.36 2005/09/14 00:14:00 teoliphant Exp $ */\n\n#include \"Python.h\"\n#include \"structmember.h\"\n/*#include \n#include \n*/\n\n#define _MULTIARRAYMODULE\n#include \"scipy/arrayobject.h\"\n\n#define PyAO PyArrayObject\n\nstatic PyObject *typeDict=NULL; /* Must be explicitly loaded */\n\n/* Including this file is the only way I know how to declare functions\n static in each file, and store the pointers from functions in both\n arrayobject.c and multiarraymodule.c for the C-API \n\n Declarying an external pointer-containing variable in arrayobject.c\n and trying to copy it to PyArray_API, did not work.\n\n Think about two modules with a common api that import each other...\n\n This file would just be the module calls. \n*/\n\n#include \"arrayobject.c\"\n\n\n/* An Error object -- rarely used? */\nstatic PyObject *MultiArrayError;\n\nstatic intp \nPyArray_MultiplyList(intp *l1, int n) \n{\n\tregister intp s=1;\n\tregister int i=0;\n while (i++ < n) s *= (*l1++);\n return s;\n}\n\n\nstatic int \nPyArray_AxisConverter(PyObject *obj, int *axis)\n{\n\tif (obj == Py_None) {\n\t\t*axis = MAX_DIMS;\n\t}\n\telse {\n\t\t*axis = (int) PyInt_AsLong(obj);\n\t\tif (PyErr_Occurred()) {\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n\treturn PY_SUCCEED;\n}\n\nstatic int \nPyArray_CompareLists(intp *l1, intp *l2, int n) \n{\n int i;\n for(i=0;itype_num;\n\t}\n\n\tnew = PyArray_New(self->ob_type,\n\t\t\t self->nd, self->dimensions,\n\t\t\t self->descr->type_num,\n\t\t\t self->strides,\n\t\t\t self->data,\n\t\t\t self->itemsize,\n\t\t\t self->flags, self);\n\n\tif (new==NULL) return NULL;\n\t\n Py_INCREF(self);\n PyArray_BASE(new) = (PyObject *)self;\n if ((type_num != PyArray_NOTYPE) && \\\n (type_num != self->descr->type_num)) {\n if (!PyTypeNum_ISFLEXIBLE(type_num)) {\n v = PyArray_TypeObjectFromType(type_num);\n }\n else {\n PyArray_Descr *descr;\n int itemsize = type->itemsize;\n descr = PyArray_DescrFromType(type_num);\n if (type_num == PyArray_UNICODE) \n itemsize /= sizeof(Py_UNICODE);\n /* construct a string representation */\n v = PyString_FromFormat(\"%c%d\", descr->type, \n itemsize);\n }\n if (v == NULL) goto fail;\n /* set attribute new.dtype = newtype */\n if (PyObject_SetAttrString(new, \"dtype\", v) < 0) goto fail;\n Py_DECREF(v);\n }\n\treturn new;\t\n\n fail:\n Py_XDECREF(v);\n Py_XDECREF(new);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Ravel(PyArrayObject *a, int fortran)\n{\n\tPyArray_Dims newdim = {NULL,1};\n\tintp val[1] = {-1};\n\n if (a->nd == 1) {\n Py_INCREF(a);\n return (PyObject *)a;\n }\n\tnewdim.ptr = val;\n\tif (!fortran && PyArray_ISCONTIGUOUS(a)) \n\t\treturn PyArray_Newshape(a, &newdim);\n\telse\n\t return PyArray_Flatten(a, fortran);\n}\n\nstatic PyObject *\nPyArray_Flatten(PyArrayObject *a, int fortran)\n{\n\tPyObject *ret, *new;\n\tintp size;\n\n\tsize = PyArray_SIZE(a);\n\tret = PyArray_New(a->ob_type,\n\t\t\t 1, &size,\n\t\t\t a->descr->type_num,\n\t\t\t NULL,\n NULL,\n\t\t\t a->itemsize,\n\t\t\t 0, a);\n\n\tif (ret== NULL) return NULL;\n\tif (fortran) {\n\t\tnew = PyArray_Transpose(a, NULL);\n\t\tif (new == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\telse {\n\t\tPy_INCREF(a);\n\t\tnew = (PyObject *)a;\n\t}\n\tif (PyArray_CopyInto((PyArrayObject *)ret, (PyArrayObject *)new) < 0) {\n\t\tPy_DECREF(ret);\n\t\tPy_DECREF(new);\n\t\treturn NULL;\n\t}\n\tPy_DECREF(new);\n\treturn ret;\n}\n\n\n/* For back-ward compatability *\n\n/ * Not recommended */\n\nstatic PyObject *\nPyArray_Reshape(PyArrayObject *self, PyObject *shape) \n{\n PyObject *ret;\n PyArray_Dims newdims;\n\n if (!PyArray_IntpConverter(shape, &newdims)) return NULL;\n ret = PyArray_Newshape(self, &newdims);\n PyDimMem_FREE(newdims.ptr);\n return ret;\n}\n\n/* Returns a new array \n with the a new shape from the data\n in the old array\n*/\n\nstatic PyObject * \nPyArray_Newshape(PyArrayObject *self, PyArray_Dims *newdims)\n{\n intp i, s_original, i_unknown, s_known;\n intp *dimensions = newdims->ptr;\n PyArrayObject *ret;\n\tchar msg[] = \"total size of new array must be unchanged\";\n\tint n = newdims->len;\n Bool same;\n\n /* Quick check to make sure anything needs to be done */\n if (n == self->nd) {\n same = TRUE;\n i=0;\n while(same && i= 0) {\n if ((s_known == 0) || (s_original % s_known != 0)) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n dimensions[i_unknown] = s_original/s_known;\n } else {\n if (s_original != s_known) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n }\n \n\tret = (PyAO *)PyArray_New(self->ob_type,\n\t\t\t\t n, dimensions,\n\t\t\t\t self->descr->type_num,\n\t\t\t\t NULL,\n\t\t\t\t self->data,\n\t\t\t\t self->itemsize,\n\t\t\t\t self->flags, self);\n\n\tif (ret== NULL)\n goto fail;\n\t\n Py_INCREF(self);\n ret->base = (PyObject *)self;\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n return (PyObject *)ret;\n\t\n fail:\n return NULL;\n}\n\n/* return a new view of the array object with all of its unit-length \n dimensions squeezed out if needed, otherwise\n return the same array.\n */\n\nstatic PyObject *\nPyArray_Squeeze(PyArrayObject *self)\n{\n\tint nd = self->nd;\n\tint newnd = nd;\n\tintp dimensions[MAX_DIMS];\n\tintp strides[MAX_DIMS];\n\tint i,j;\n\tPyObject *ret;\n\n\tif (nd == 0) {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n\tfor (j=0, i=0; idimensions[i] == 1) {\n\t\t\tnewnd -= 1;\n\t\t}\n\t\telse {\n\t\t\tdimensions[j] = self->dimensions[i];\n\t\t\tstrides[j++] = self->strides[i];\n\t\t}\n\t}\n\t\n\tret = PyArray_New(self->ob_type, newnd, dimensions, \n\t\t\t self->descr->type_num, strides,\n\t\t\t self->data, self->itemsize, self->flags,\n\t\t\t self);\n\tself->flags &= ~OWN_DATA;\n\tself->base = (PyObject *)self;\n\tPy_INCREF(self);\n\treturn (PyObject *)ret;\n}\n\n\nstatic PyObject *\nPyArray_Mean(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL;\n\tPyObject *new, *ret;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\n\tobj1 = PyArray_GenericReduceFunction((PyAO *)new, n_ops.add, axis,\n\t\t\t\t\t rtype);\n\tobj2 = PyFloat_FromDouble((double) PyArray_DIM(new,axis));\n Py_DECREF(new);\n\tif (obj1 == NULL || obj2 == NULL) {\n\t\tPy_XDECREF(obj1);\n\t\tPy_XDECREF(obj2);\n\t\treturn NULL;\n\t}\n\n\tret = PyNumber_Divide(obj1, obj2);\n\tPy_DECREF(obj1);\n\tPy_DECREF(obj2);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Std(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL, *new=NULL;\n\tPyObject *ret=NULL, *newshape=NULL;\n\tint i, n;\n\tintp val;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\t\n\t/* Compute and reshape mean */\n\tobj1 = PyArray_EnsureArray(PyArray_Mean((PyAO *)new, axis, rtype));\n\tif (obj1 == NULL) {Py_DECREF(new); return NULL;} \n\tn = PyArray_NDIM(new);\n\tnewshape = PyTuple_New(n);\n\tif (newshape == NULL) {Py_DECREF(obj1); Py_DECREF(new); return NULL;}\n\tfor (i=0; ind != 1) {\n Py_DECREF(cond);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Condition must be 1-d array.\");\n return NULL;\n }\n\n res = PyArray_Nonzero(cond);\n Py_DECREF(cond);\n\tret = PyArray_Take(self, res, axis);\n\tPy_DECREF(res);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Nonzero(PyArrayObject *self)\n{\n int n=self->nd, j;\n\tintp count=0, i, size;\n\tPyArrayIterObject *it=NULL;\n\tPyObject *ret=NULL, *item;\n\tintp *dptr[MAX_DIMS];\n\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (it==NULL) return NULL;\n\n\tsize = it->size;\n\tfor (i=0; idescr->nonzero(it->dataptr, self)) count++;\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\n\tPyArray_ITER_RESET(it);\n\tif (n==1) {\n\t\tret = PyArray_New(self->ob_type, 1, &count, PyArray_INTP, \n\t\t\t\t NULL, NULL, 0, 0, self);\n\t\tif (ret == NULL) goto fail;\n\t\tdptr[0] = (intp *)PyArray_DATA(ret);\n\t\t\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\t*(dptr[0])++ = i;\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t}\n\telse {\n\t\tret = PyTuple_New(n);\n\t\tfor (j=0; job_type, 1, &count, \n\t\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0,\n\t\t\t\t\t self);\n\t\t\tPyTuple_SET_ITEM(ret, j, item);\n\t\t\tif (item == NULL) goto fail;\n\t\t\tdptr[j] = (intp *)PyArray_DATA(item);\n\t\t}\n\t\t\n\t\t/* reset contiguous so that coordinates gets updated */\n\t\tit->contiguous = 0;\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\tfor (j=0; jcoordinates[j];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\n\t}\n\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ret);\n\tPy_XDECREF(it);\n\treturn NULL;\n \n}\n\nstatic PyObject *\nPyArray_Clip(PyArrayObject *self, PyObject *min, PyObject *max)\n{\n\tPyObject *selector=NULL, *newtup=NULL, *ret=NULL;\n\tPyObject *res1=NULL, *res2=NULL, *res3=NULL;\n\tPyObject *two;\n\n\ttwo = PyInt_FromLong((long)2);\n\tres1 = PyArray_GenericBinaryFunction(self, max, n_ops.greater);\n\tres2 = PyArray_GenericBinaryFunction(self, min, n_ops.less);\n\tif ((res1 == NULL) || (res2 == NULL)) goto fail;\n\tres3 = PyNumber_Multiply(two, res1);\n\tPy_DECREF(two);\n\tPy_DECREF(res1);\n\tif (res3 == NULL) return NULL;\n\n\tselector = PyArray_EnsureArray(PyNumber_Add(res2, res3));\n\tPy_DECREF(res2);\n\tPy_DECREF(res3);\n\tif (selector == NULL) return NULL;\n\n\tnewtup = Py_BuildValue(\"(OOO)\", (PyObject *)self, min, max);\n\tif (newtup == NULL) goto fail;\n\tret = PyArray_Choose((PyAO *)selector, newtup);\n\tPy_DECREF(selector);\n\tPy_DECREF(newtup);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(res1);\n\tPy_XDECREF(res2);\n\tPy_XDECREF(two);\n\tPy_XDECREF(selector);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Conjugate(PyArrayObject *self)\n{\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyObject *new;\n\t\tintp size, i;\n\t\t/* Make a copy */\n\t\tnew = PyArray_Copy(self);\n\t\tif (new==NULL) return NULL;\n\t\tsize = PyArray_SIZE(new);\n\t\tif (self->descr->type_num == PyArray_CFLOAT) {\n\t\t\tcfloat *dptr = (cfloat *) PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CDOUBLE) {\n\t\t\tcdouble *dptr = (cdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CLONGDOUBLE) {\n\t\t\tclongdouble *dptr = (clongdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\t\t\t\n\t\t}\t\t\n\t\treturn new;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *) self;\n\t}\n}\n\nstatic PyObject *\nPyArray_Trace(PyArrayObject *self, int offset, int axis1, int axis2, \nint rtype)\n{\n\tPyObject *diag=NULL, *ret=NULL;\n\n\tdiag = PyArray_Diagonal(self, offset, axis1, axis2);\n\tif (diag == NULL) return NULL;\n\tret = PyArray_GenericReduceFunction((PyAO *)diag, n_ops.add, -1, rtype);\n\tPy_DECREF(diag);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Diagonal(PyArrayObject *self, int offset, int axis1, int axis2)\n{\n\tint n = self->nd;\n\tPyObject *new;\n\tPyObject *newaxes;\n\tint i, pos;\t\n\n\tif (n < 2) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"array.ndim must be >= 2\");\n\t\treturn NULL;\n\t}\n\tif (axis1 < 0) axis1 += n;\n\tif (axis2 < 0) axis2 += n;\n\tif ((axis1 == axis2) || (axis1 < 0) || (axis1 >= n) ||\t\\\n\t (axis2 < 0) || (axis2 >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \"axis1(=%d) and axis2(=%d) \"\\\n\t\t\t \"must be different and within range (nd=%d)\",\n\t\t\t axis1, axis2, n);\n\t\treturn NULL;\n\t}\n \n\tnewaxes = PyTuple_New(n);\n\tif (newaxes==NULL) return NULL;\n\t/* insert at the end */\n\tPyTuple_SET_ITEM(newaxes, n-2, PyInt_FromLong((long)axis1));\n\tPyTuple_SET_ITEM(newaxes, n-1, PyInt_FromLong((long)axis2));\n\tpos = 0;\n\tfor (i=0; idimensions[0];\n\t\tn2 = self->dimensions[1];\n\t\tstep = n2+1;\n\t\tif (offset < 0) {\n\t\t\tstart = -n2 * offset;\n\t\t\tstop = MIN(n2, n1+offset)*(n2+1) - n2*offset;\n\t\t}\n\t\telse {\n\t\t\tstart = offset;\n\t\t\tstop = MIN(n1, n2-offset)*(n2+1) + offset;\n\t\t}\n\t\t\n\t\t/* count = ceil((stop-start)/step) */\n\t\tcount = ((stop-start) / step) + (((stop-start) % step) != 0);\n\t\t\t\n\t\tindices = PyArray_New(&PyArray_Type, 1, &count, \n\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0, NULL);\n\t\tif (indices == NULL) {\n\t\t\tPy_DECREF(self); return NULL;\n\t\t}\n\t\tdptr = (intp *)PyArray_DATA(indices);\n\t\tfor (n1=start; n1descr->type_num,\n\t\t\t\t\t self->itemsize, 0};\n\t\t\n\t\tmydiagonal = PyList_New(0);\n\t\tif (mydiagonal == NULL) {Py_DECREF(self); return NULL;}\n\t\tn1 = self->dimensions[0];\n\t\tfor (i=0; i 3)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"Only Carrays of 1-3 dimensions available.\");\n\t\treturn -1;\n\t}\n\tif ((ap = (PyArrayObject*)PyArray_FromAny(*op, &typecode, nd, nd,\n\t\t\t\t\t\t CARRAY_FLAGS)) == NULL)\n\t\treturn -1;\n\tswitch(nd) {\n\tcase 1:\n\t\t*((char **)ptr) = ap->data;\n\t\tbreak;\n\tcase 2:\n\t\tn = ap->dimensions[0];\n\t\tptr2 = (char **)malloc(n * sizeof(char *));\n\t\tif (!ptr2) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0];\n\t\t}\n\t\t*((char ***)ptr) = ptr2;\n\t\tbreak;\t\t\n\tcase 3:\n\t\tn = ap->dimensions[0];\n\t\tm = ap->dimensions[1];\n\t\tptr3 = (char ***)malloc(n*(m+1) * sizeof(char *));\n\t\tif (!ptr3) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0] + \\\n\t\t\t\t\tj*ap->strides[1];\n\t\t\t}\n\t\t}\n\t\t*((char ****)ptr) = ptr3;\n\t}\n\tmemcpy(dims, ap->dimensions, nd*sizeof(intp));\n\t*op = (PyObject *)ap;\n\treturn 0;\n\n fail:\n\tPyErr_SetString(PyExc_MemoryError, \"No memory.\");\n\treturn -1;\n}\n\n/* Deprecated --- Use PyArray_AsCArray instead */\n\nstatic int \nPyArray_As1D(PyObject **op, char **ptr, int *d1, int typecode) \n{\n\tintp newd1;\n\t\n\tif (PyArray_AsCArray(op, (void *)ptr, &newd1, 1, typecode) == -1)\n\t\treturn -1;\t\n\t*d1 = (int) newd1;\n\treturn 0;\n}\n\n\nstatic int \nPyArray_As2D(PyObject **op, char ***ptr, int *d1, int *d2, int typecode) \n{\n\tintp newdims[2];\n\n\tif (PyArray_AsCArray(op, (void *)ptr, newdims, 2, typecode) == -1)\n\t\treturn -1;\n\n\t*d1 = (int ) newdims[0];\n\t*d2 = (int ) newdims[1];\n return 0;\n}\n\n/* End Deprecated */\n\nstatic int \nPyArray_Free(PyObject *op, void *ptr) \n{\n PyArrayObject *ap = (PyArrayObject *)op;\n\t\n if ((ap->nd < 1) || (ap->nd > 3)) \n\t\treturn -1;\n if (ap->nd >= 2) {\n\t\tfree(ptr);\n }\n Py_DECREF(ap);\n return 0;\n}\n\n\nstatic PyObject *\n_swap_and_concat(PyObject *op, int axis, int n)\n{\n\tPyObject *newtup=NULL;\n\tPyObject *otmp, *arr;\n\tint i;\n\n\tnewtup = PyTuple_New(n);\n\tif (newtup==NULL) return NULL;\n\tfor (i=0; i= MAX_DIMS) {\n\t\t\totmp = PyArray_Ravel(mps[i],0);\n\t\t\tPy_DECREF(mps[i]);\n\t\t\tmps[i] = (PyArrayObject *)otmp;\n\t\t}\n\t\tprior2 = PyArray_GetPriority((PyObject *)(mps[i]), 0.0);\n\t\tif (prior2 > prior1) {\n\t\t\tprior1 = prior2;\n\t\t\tsubtype = mps[i]->ob_type;\n\t\t\tret = mps[i];\n\t\t}\n\t}\n\t\n\tnew_dim = 0;\n\tfor(i=0; ind;\n\t\telse {\n\t\t\tif (nd != mps[i]->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"arrays must have same \"\\\n\t\t\t\t\t\t\"number of dimensions\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tif (!PyArray_CompareLists(mps[0]->dimensions+1, \n\t\t\t\t\t\t mps[i]->dimensions+1, \n\t\t\t\t\t\t nd-1)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"array dimensions must \"\\\n\t\t\t\t\t\t\"agree except for d_0\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t}\n\t\tif (nd == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"0d arrays can't be concatenated\");\n\t\t\tgoto fail;\n\t\t}\n\t\tnew_dim += mps[i]->dimensions[0];\n\t}\n\t\n\ttmp = mps[0]->dimensions[0];\n\tmps[0]->dimensions[0] = new_dim;\n\tret = (PyArrayObject *)PyArray_New(subtype, nd,\n\t\t\t\t\t mps[0]->dimensions, \n\t\t\t\t\t type_num, NULL, NULL, 0, 0, ret);\n\tmps[0]->dimensions[0] = tmp;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tdata = ret->data;\n\tfor(i=0; idata, numbytes);\n\t\tdata += numbytes;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; ind;\n\tif (n <= 1) {\n\t\tPy_INCREF(ap);\n\t\treturn (PyObject *)ap;\n\t}\n\n\tif (a1 < 0) a1 += n;\n\tif (a2 < 0) a2 += n;\n\tif ((a1 < 0) || (a1 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis1 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tif ((a2 < 0) || (a2 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis2 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tnew_axes = PyTuple_New(n);\n\tfor (i=0; ind;\n\t\tpermutation = (intp *)malloc(n*sizeof(int));\n\t\tfor(i=0; ind+axis;\n\t\t\tif (axis < 0 || axis >= ap->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"invalid axis for this array\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tpermutation[i] = axis;\n\t\t}\n\t}\n\t\n\t/* this allocates memory for dimensions and strides (but fills them\n\t incorrectly), sets up descr, and points data at ap->data. */\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, n, permutation, \n\t\t\t\t\t ap->descr->type_num, NULL,\n\t\t\t\t\t ap->data, ap->itemsize, ap->flags,\n\t\t\t\t\t ap);\n\tif (ret == NULL) goto fail;\n\t\n\t/* point at true owner of memory: */\n\tret->base = (PyObject *)ap;\n\tPy_INCREF(ap);\n\t\n\tfor(i=0; idimensions[i] = ap->dimensions[permutation[i]];\n\t\tret->strides[i] = ap->strides[permutation[i]];\n\t}\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n\tif (op && (op != Py_None))\n\t\tPyArray_Free(op, (char *)axes);\n\tfree(permutation);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ret);\n\tif (permutation != NULL) free(permutation);\n\tif (op != Py_None)\n\t\tPyArray_Free(op, (char *)axes);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Repeat(PyArrayObject *aop, PyObject *op, int axis) {\n\tintp *counts;\n\tintp n, n_outer, i, j, k, chunk, total;\n\tintp tmp;\n\tint nd;\n\tPyArrayObject *repeats=NULL;\n\tPyObject *ap=NULL;\n\tPyArrayObject *ret=NULL;\n\tchar *new_data, *old_data;\n\n\trepeats = (PyAO *)PyArray_ContiguousFromObject(op, PyArray_INTP, 0, 1);\n\tif (repeats == NULL) return NULL;\n\tnd = repeats->nd;\n\tcounts = (intp *)repeats->data;\n\n\tif ((ap=_check_axis(aop, &axis, CARRAY_FLAGS))==NULL) {\n\t\tPy_DECREF(repeats);\n\t\treturn NULL;\n\t}\n\n\taop = (PyAO *)ap;\n\n\tif (nd == 1)\n\t\tn = repeats->dimensions[0];\n\telse /* nd == 0 */\n\t\tn = aop->dimensions[axis];\n\n\tif (aop->dimensions[axis] != n) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"a.shape[axis] != len(repeats)\");\n\t\tgoto fail;\n\t}\n\n\t\n\tif (nd == 0) \n\t\ttotal = counts[0]*n;\n\telse {\n\t\t\n\t\ttotal = 0;\n\t\tfor(j=0; jdimensions[axis] = total;\n\tret = (PyArrayObject *)PyArray_New(aop->ob_type, aop->nd,\n\t\t\t\t\t aop->dimensions, \n\t\t\t\t\t aop->descr->type_num,\n\t\t\t\t\t NULL, NULL, aop->itemsize, 0,\n\t\t\t\t\t aop);\n\taop->dimensions[axis] = n;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tnew_data = ret->data;\n\told_data = aop->data;\n\t\n\tchunk = aop->itemsize;\n\tfor(i=axis+1; ind; i++) {\n\t\tchunk *= aop->dimensions[i];\n\t}\n\t\n\tn_outer = 1;\n\tfor(i=0; idimensions[i];\n\n\tfor(i=0; ind < mps[i]->nd) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"too many dimensions\");\n\t\t\tgoto fail;\n\t\t}\n\t\tif (!PyArray_CompareLists(ap->dimensions+(ap->nd-mps[i]->nd),\n\t\t\t\t mps[i]->dimensions, mps[i]->nd)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"array dimensions must agree\");\n\t\t\tgoto fail;\n\t\t}\n\t\tsizes[i] = PyArray_NBYTES(mps[i]);\n\t}\n\t\n\t/* why not ??? \n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tPyErr_SetString(PyExc_NotImplementedError, \n\t\t\t\t\"Not implemented for flexible sizes\");\n\t\treturn NULL;\n\t}\n\t*/\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, ap);\n\tif (ret == NULL) goto fail;\n\t\n\telsize = ret->itemsize;\n\tm = PyArray_SIZE(ret);\n\tself_data = (intp *)ap->data;\n\tret_data = ret->data;\n\t\n\tfor (i=0; i= n) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"invalid entry in choice array\");\n\t\t\tgoto fail;\n\t\t}\n\t\toffset = i*elsize;\n\t\tif (offset >= sizes[mi]) {offset = offset % sizes[mi]; }\n\t\tmemmove(ret_data, mps[mi]->data+offset, elsize);\n\t\tret_data += elsize; self_data++;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; idescr->compare(a,b,global_obj);\n}\n\n#define SWAPAXES(op, ap) {\t\t\t\t\t\t\\\n\t\torign = (ap)->nd-1;\t\t\t\t\t\\\n\t\tif (axis != orign) {\t\t\t\t\t\\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\n#define SWAPBACK(op, ap) { \\\n\t\tif (axis != orign) { \\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\nstatic PyObject *\nPyArray_Sort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap=NULL, *store_arr=NULL;\n\tchar *ip;\n\tint i, n, m, elsize, orign;\n\n\tif ((ap = (PyAO*) _check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_CopyFromObject((PyObject *)op, \n\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tPy_DECREF(ap);\n\t\treturn NULL;\n\t}\n\t\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\n\t/* Store global -- allows re-entry -- restore before leaving*/\n\tstore_arr = global_obj; \n\tglobal_obj = ap;\n\t\n\tfor (ip=ap->data, i=0; iitemsize;\n\tconst intp *ipa = ip1;\n\tconst intp *ipb = ip2;\t\n\treturn global_obj->descr->compare(global_data + (isize * *ipa),\n global_data + (isize * *ipb), \n\t\t\t\t\t global_obj);\n}\n\nstatic PyObject *\nPyArray_ArgSort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap, *ret, *store;\n\tintp *ip;\n\tintp i, j, n, m, orign;\n\tint argsort_elsize;\n\tchar *store_ptr;\n\n\tif ((ap = (PyAO *)_check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op, \n\t\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, ap);\n\tif (ret == NULL) goto fail;\n\t\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tip = (intp *)ret->data;\n\targsort_elsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\tstore_ptr = global_data;\n\tglobal_data = ap->data;\n\tstore = global_obj;\n\tglobal_obj = ap;\n\tfor (i=0; idescr->compare;\n\tintp min_i, max_i, i, j;\n\tint location, elsize = ap1->itemsize;\n\tintp elements = ap1->dimensions[ap1->nd-1];\n\tintp n = PyArray_Size((PyObject *)ap2);\n\tintp *rp = (intp *)ret->data;\n\tchar *ip = ap2->data;\n\tchar *vp = ap1->data;\n\n\tfor (j=0; j 0) {\n\t\t\t\t\tif (compare(ip, vp+elsize*(--i), ap2) \\\n\t\t\t\t\t != 0) {\n\t\t\t\t\t\ti = i+1; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmin_i = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (location < 0) {\n\t\t\t\tmax_i = i;\n\t\t\t} else {\n\t\t\t\tmin_i = i+1;\n\t\t\t}\n\t\t}\n\t\t*rp = min_i;\n\t}\n}\n\nstatic PyObject *\nPyArray_SearchSorted(PyArrayObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tint typenum = 0;\n\n\t/* \n PyObject *args;\n args = Py_BuildValue(\"O\",op2);\n\tPy_DELEGATE_ARGS(((PyObject *)op1), searchsorted, args);\n Py_XDECREF(args);\n\t*/\n\n\ttypenum = PyArray_ObjectType((PyObject *)op1, 0);\n\ttypenum = PyArray_ObjectType(op2, typenum);\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op1, \n\t\t\t\t\t\t\t typenum, \n\t\t\t\t\t\t\t 1, 1);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap2->ob_type, ap2->nd, \n\t\t\t\t\t ap2->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, ap2);\n\tif (ret == NULL) goto fail;\n\n\tif (ap2->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tlocal_where(ap1, ap2, ret); \n\t\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ret);\n\treturn NULL;\n}\n\n\n\n/* Could perhaps be redone to not make contiguous arrays \n */\n\nstatic PyObject *\nPyArray_InnerProduct(PyObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tintp i, j, l, i1, i2, n1, n2;\n\tint typenum;\n\tintp is1, is2, os;\n\tchar *ip1, *ip2, *op;\n\tintp dimensions[MAX_DIMS], nd;\n\tPyArray_DotFunc *dot;\n\tPyTypeObject *subtype;\n double prior1, prior2;\n\t\n\ttypenum = PyArray_ObjectType(op1, 0); \n\ttypenum = PyArray_ObjectType(op2, typenum);\n\t\t\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject(op1, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tif (ap1->nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\t\n\tif (ap2->dimensions[ap2->nd-1] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"matrices are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\n\n\t/* Need to choose an output array that can hold a sum \n\t -- use priority to determine which subtype.\n\t */\n prior2 = PyArray_GetPriority((PyObject *)ap2, 0.0);\n prior1 = PyArray_GetPriority((PyObject *)ap1, 0.0);\n subtype = (prior2 > prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = (ret->descr->dotfunc);\n\t\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\n\t\n\tis1 = ap1->strides[ap1->nd-1]; \n\tis2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\tif (ap2->nd > 1) {\n\t\tmatchDim = ap2->nd - 2;\n\t\totherDim = ap2->nd - 1;\n\t}\n\telse {\n\t\tmatchDim = 0;\n\t\totherDim = 0;\n\t}\n\n\tif (ap2->dimensions[matchDim] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"objects are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-2; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\tif(ap2->nd > 1) {\n\t\tdimensions[j++] = ap2->dimensions[ap2->nd-1];\n\t}\n\t/*\n\tfprintf(stderr, \"nd=%d dimensions=\", nd);\n\t for(i=0; i prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\t\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[matchDim];\n\tif(ap1->nd > 1)\n\t\tis1r = ap1->strides[ap1->nd-2];\n\telse\n\t\tis1r = ap1->strides[ap1->nd-1];\n\tis2r = ap2->strides[otherDim];\n\n\top = ret->data; os = ret->itemsize;\n\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2ob_type, 2, dims, PyArray_TYPE(arr),\n\t\t\t NULL, NULL, elsize, 0, (PyArrayObject *)arr);\n\n\tif (ret == NULL) {\n\t\tPy_DECREF(arr);\n\t\treturn NULL;\n\t}\n\t/* do 2-d loop */\n\toptr = PyArray_DATA(ret);\n\tstr2 = elsize*dims[0];\n\tfor (i=0; idimensions[ap1->nd-1];\n\tn2 = ap2->dimensions[ap2->nd-1];\n\n\tif (n1 < n2) { \n\t\tret = ap1; ap1 = ap2; ap2 = ret; \n\t\tret = NULL; i = n1;n1=n2;n2=i;\n\t}\n\tlength = n1;\n\tn = n2;\n\tswitch(mode) {\n\tcase 0:\t\n\t\tlength = length-n+1;\n\t\tn_left = n_right = 0;\n\t\tbreak;\n\tcase 1:\n\t\tn_left = (int)(n/2);\n\t\tn_right = n-n_left-1;\n\t\tbreak;\n\tcase 2:\n\t\tn_right = n-1;\n\t\tn_left = n-1;\n\t\tlength = length+n-1;\n\t\tbreak;\n\tdefault:\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"mode must be 0,1, or 2\");\n\t\tgoto fail;\n\t}\n\t\n\tret = (PyArrayObject *)PyArray_New(ap1->ob_type, 1,\n\t\t\t\t\t &length, typenum, \n\t\t\t\t\t NULL, NULL, 0, 0, ap1);\n\tif (ret == NULL) goto fail;\n\n\t\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"function not available for this type\");\n\t\tgoto fail;\n\t}\n\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data; ip2 = ap2->data+n_left*is2;\n\tn = n-n_left;\n\tfor(i=0; idescr->argmax;\n\tif (arg_func == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"data type not ordered\");\n\t\tgoto fail;\n\t}\n\n\trp = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd-1,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, ap);\n\tif (rp == NULL) goto fail;\n\n\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) {\n\t\tPyErr_SetString(MultiArrayError, \n\t\t\t\t\"Attempt to get argmax/argmin \"\\\n\t\t\t\t\"of an empty sequence??\");\n\t\tgoto fail;\n\t}\n\tn = PyArray_SIZE(ap)/m;\n\trptr = (intp *)rp->data;\n\tfor (ip = ap->data, i=0; ind + indices->nd - 1;\n for (i=0; i< nd; i++) {\n if (i < axis) {\n shape[i] = self->dimensions[i];\n n *= shape[i];\n } else {\n if (i < axis+indices->nd) {\n shape[i] = indices->dimensions[i-axis];\n m *= shape[i];\n } else {\n shape[i] = self->dimensions[i-indices->nd+1];\n chunk *= shape[i];\n }\n }\n }\n ret = (PyArrayObject *)PyArray_New(self->ob_type, nd, shape, \n\t\t\t\t\t self->descr->type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, self);\n\t\n if (ret == NULL) goto fail;\n\t\n max_item = self->dimensions[axis];\n chunk = chunk * ret->itemsize;\n src = self->data;\n dest = ret->data;\n\t\n for(i=0; idata))[j];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"Index out of range for \"\\\n\t\t\t\t\t\t\"array\");\n goto fail;\n }\n memmove(dest, src+tmp*chunk, chunk);\n dest += chunk;\n }\n src += chunk*max_item;\n }\n\t\n PyArray_INCREF(ret);\n\n Py_XDECREF(indices);\n Py_XDECREF(self);\n\n return (PyObject *)ret;\n\t\n\t\n fail:\n Py_XDECREF(ret);\n Py_XDECREF(indices);\n Py_XDECREF(self);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Put(PyArrayObject *self, PyObject *indices0, PyObject* values0) \n{\n PyArrayObject *indices, *values;\n int i, chunk, ni, max_item, nv, tmp; \n char *src, *dest;\n\n indices = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be contiguous\");\n return NULL;\n }\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n indices = (PyArrayObject *)PyArray_ContiguousFromObject(indices0, PyArray_INTP, 0, 0);\n if (indices == NULL) goto fail;\n ni = PyArray_SIZE(indices);\n\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, self->descr->type_num, \n\t\t\t\t\t 0, 0);\n if (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\n if (nv > 0) { /* nv == 0 for a null array */\n for(i=0; idata + chunk * (i % nv);\n tmp = ((intp *)(indices->data))[i];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \"Index out of range for array\");\n goto fail;\n }\n memmove(dest + tmp * chunk, src, chunk);\n }\n }\n\n Py_XDECREF(values);\n Py_XDECREF(indices);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(indices);\n Py_XDECREF(values);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_PutMask(PyArrayObject *self, PyObject *mask0, PyObject* values0) \n{\n PyArrayObject *mask, *values;\n int i, chunk, ni, max_item, nv, tmp, thistype;\n char *src, *dest;\n\n mask = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must \"\\\n\t\t\t\t\"be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must be contiguous\");\n return NULL;\n }\n\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n mask = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(mask0, PyArray_BOOL, 0, 0);\n if (mask == NULL) goto fail;\n ni = PyArray_SIZE(mask);\n if (ni != max_item) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: mask and data must be \"\\\n\t\t\t\t\"the same size.\");\n goto fail;\n }\n\n\tthistype = self->descr->type_num;\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, thistype, 0, 0);\n\tif (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\t /* zero if null array */\n if (nv > 0) {\n\t\tfor(i=0; idata + chunk * (i % nv);\n\t\t\ttmp = ((Bool *)(mask->data))[i];\n\t\t\tif (tmp) {\n\t\t\t\tmemmove(dest + i * chunk, src, chunk);\n\t\t\t\tif (thistype == PyArray_OBJECT)\n\t\t\t\t\tPy_INCREF(*((PyObject **)src));\n\t\t\t}\n\t\t}\n }\n\n Py_XDECREF(values);\n Py_XDECREF(mask);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(mask);\n Py_XDECREF(values);\n return NULL;\n}\n\n\n/* This conversion function can be used with the \"O&\" argument for\n PyArg_ParseTuple. It will immediately return an object of array type\n or will convert to a CARRAY any other object. \n\n If you use PyArray_Converter, you must DECREF the array when finished\n as you get a new reference to it.\n*/\n \nstatic int \nPyArray_Converter(PyObject *object, PyObject **address) \n{\n if (PyArray_Check(object)) {\n *address = object;\n\t\tPy_INCREF(object);\n return PY_SUCCEED;\n }\n else {\n\t\t*address = PyArray_FromAny(object, NULL, 0, 0, CARRAY_FLAGS);\n\t\tif (*address == NULL) return PY_FAIL;\n\t\treturn PY_SUCCEED;\n }\n}\n\nstatic int\nPyArray_BoolConverter(PyObject *object, Bool *val)\n{\n\tif (PyObject_IsTrue(object)) *val=TRUE;\n\telse *val=FALSE;\n\tif (PyErr_Occurred()) return PY_FAIL;\n\treturn PY_SUCCEED;\n}\n\n\nstatic int\nPyArray_TypestrConvert(int itemsize, int gentype)\n{\n\tregister int newtype = gentype;\n\t\n\tif (gentype == PyArray_SIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_INT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_INT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_INT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_INT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_INT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\n\t}\n\n\telse if (gentype == PyArray_UNSIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_UINT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_UINT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_UINT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_UINT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_UINT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t\tbreak;\n\t\t}\n\t}\n\telse if (gentype == PyArray_FLOATINGLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 4:\n\t\t\tnewtype = PyArray_FLOAT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_FLOAT64;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 10:\n\t\t\tnewtype = PyArray_FLOAT80;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 12:\n\t\t\tnewtype = PyArray_FLOAT96;\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_FLOAT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\t\n\telse if (gentype == PyArray_COMPLEXLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 8:\n\t\t\tnewtype = PyArray_COMPLEX64;\n\t\t\tbreak;\n\t\tcase 16:\n\t\t\tnewtype = PyArray_COMPLEX128;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 20:\n\t\t\tnewtype = PyArray_COMPLEX160;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 24:\n\t\t\tnewtype = PyArray_COMPLEX192;\t\t\t\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 32:\n\t\t\tnewtype = PyArray_COMPLEX256;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\n\treturn newtype;\n}\n\n\n/* this function takes a Python object which exposes the (single-segment)\n buffer interface and returns a pointer to the data segment\n \n You should increment the reference count by one of buf->base\n if you will hang on to a reference\n\n You only get a borrowed reference to the object. Do not free the\n memory...\n*/\n\n\nstatic int\nPyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf)\n{\n int buflen;\n\n buf->ptr = NULL;\n buf->flags = WRITEABLE;\n buf->base = NULL;\n\n\tif (obj == Py_None)\n\t\treturn PY_SUCCEED;\n\n if (PyObject_AsWriteBuffer(obj, &(buf->ptr), &buflen) < 0) {\n PyErr_Clear();\n buf->flags &= ~WRITEABLE;\n if (PyObject_AsReadBuffer(obj, (const void **)&(buf->ptr), \n &buflen) < 0)\n return PY_FAIL;\n }\n buf->len = (intp) buflen;\n \n /* Point to the base of the buffer object if present */\n if (PyBuffer_Check(obj)) buf->base = ((PyArray_Chunk *)obj)->base;\n if (buf->base == NULL) buf->base = obj;\n \n return PY_SUCCEED; \n}\n\n\n\n/* This function takes a Python sequence object and allocates and\n fills in an intp array with the converted values.\n\n **Remember to free the pointer seq.ptr when done using\n PyDimMem_FREE(seq.ptr)**\n*/\n\nstatic int\nPyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq)\n{\n int len;\n int nd;\n\n seq->ptr = NULL;\n if (obj == Py_None) return PY_SUCCEED;\n len = PySequence_Size(obj);\n if (len == -1) { /* Check to see if it is a number */\n if (PyNumber_Check(obj)) len = 1;\n }\n if (len < 0) {\n PyErr_SetString(PyExc_TypeError, \n \"Expected sequence object with len >= 0\");\n return PY_FAIL;\n }\n if (len > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError, \"Sequence too large, \" \\\n \"must be smaller than %d\", MAX_DIMS);\n return PY_FAIL;\n }\n\tif (len > 0) {\n\t\tseq->ptr = PyDimMem_NEW(len);\n\t\tif (seq->ptr == NULL) {\n\t\t\tPyErr_NoMemory();\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n seq->len = len;\n nd = PyArray_IntpFromSequence(obj, (intp *)seq->ptr, len);\n if (nd == -1 || nd != len) goto fail;\n return PY_SUCCEED;\n\n fail:\n\tPyDimMem_FREE(seq->ptr);\n\treturn PY_FAIL;\n}\n\n/* This function takes a Python object representing a type and converts it \n to a C type_num and an itemsize (elements of PyArray_Typecode structure)\n \n Many objects can be used to represent a type.\n */\n\nstatic int\nPyArray_TypecodeConverter(PyObject *obj, PyArray_Typecode *at)\n{\n char *type;\n PyArray_Descr *descr;\n int check_num=PyArray_NOTYPE+10;\n\tint len;\n\tPyObject *item, *attr=NULL;\n\n\tat->itemsize = 0;\n if (obj == Py_None) {\n at->type_num = PyArray_NOTYPE;\n return PY_SUCCEED;\n }\n\n if (PyType_Check(obj) && PyType_IsSubtype((PyTypeObject *)obj, \n &PyGenericArrType_Type)) {\n PyArray_TypecodeFromTypeObject(obj, at);\n return PY_SUCCEED;\n }\n\n\n\t/* type object could be an array */\n\tif (PyArray_Check(obj)) {\n\t\tat->type_num = PyArray_TYPE(obj);\n\t\tat->itemsize = PyArray_ITEMSIZE(obj);\n\t\treturn PY_SUCCEED;\n\t}\n\n\t/* or an array scalar */\n if (PyArray_IsScalar(obj, Generic)) {\n PyArray_TypecodeFromScalar(obj, at);\n return PY_SUCCEED;\n }\n\n\t/* or a typecode string */\n\n\tif (PyString_Check(obj)) {\n\t\t/* Check for a string typecode. */\n\t\ttype = PyString_AS_STRING(obj);\n\t\tlen = PyString_GET_SIZE(obj);\t\t\n\t\tif (len > 0) {\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tif (len > 1) {\n\t\t\tat->itemsize = atoi(type+1);\n\t\t\t/* When specifying length of UNICODE\n\t\t\t the number of characters is given to match \n\t\t\t the STRING interface. Each character can be\n\t\t\t more than one byte and itemsize must be\n\t\t\t the number of bytes.\n\t\t\t*/\n\t\t\tif (check_num == PyArray_UNICODELTR ||\t\\\n\t\t\t check_num == PyArray_UNICODE) \n\t\t\t at->itemsize *= sizeof(Py_UNICODE);\n\n\t\t\t/* Support for generic processing */\n\t\t\telse if ((check_num != PyArray_STRINGLTR) &&\n\t\t\t\t (check_num != PyArray_VOIDLTR) &&\n\t\t\t\t (check_num != PyArray_STRING) &&\n\t\t\t\t (check_num != PyArray_VOID)) {\n\t\t\t\tcheck_num = \\\n\t\t\t\t\tPyArray_TypestrConvert(at->itemsize, \n\t\t\t\t\t\t\t check_num);\n\t\t\t at->itemsize = 0;\n\t\t\t\tif (check_num == PyArray_NOTYPE) goto fail;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Arbitray object with dtypenum and itemsize attributes. */\n\telse if (PyObject_HasAttrString(obj, \"dtypenum\") && \n\t PyObject_HasAttrString(obj, \"itemsize\")) {\n\t\tattr = PyObject_GetAttrString(obj, \"dtypenum\");\n\t\tcheck_num = PyInt_AsLong(attr);\n\t\tif (PyErr_Occurred()) { /* not an integer, try character */\n\t\t\tPyErr_Clear();\n\t\t\ttype = PyString_AsString(attr);\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tPy_XDECREF(attr);\n\t\tif (!PyErr_Occurred()) {\n\t\t\tattr = PyObject_GetAttrString(obj, \"itemsize\");\n\t\t\tat->itemsize = PyInt_AsLong(attr);\n\t\t\tPy_XDECREF(attr);\n\t\t}\t\t\t\n\t}\t\t\n\telse if (PyType_Check(obj)) {\n\t\tcheck_num = PyArray_OBJECT;\n\t\tif (obj == (PyObject *)(&PyInt_Type)) \n\t\t\tcheck_num = PyArray_LONG;\n\t\telse if (obj == (PyObject *)(&PyBool_Type))\n\t\t\tcheck_num = PyArray_BOOL;\n\t\telse if (obj == (PyObject *)(&PyFloat_Type)) \n\t\t\tcheck_num = PyArray_DOUBLE;\n\t\telse if (obj == (PyObject *)(&PyComplex_Type)) \n\t\t\tcheck_num = PyArray_CDOUBLE;\n else if (obj == (PyObject *)(&PyString_Type))\n check_num = PyArray_STRING;\n else if (obj == (PyObject *)(&PyUnicode_Type))\n check_num = PyArray_UNICODE;\n\t}\t\n else { /* Default -- try integer conversion */\n check_num = PyInt_AsLong(obj);\n\t}\n\n\tif (PyErr_Occurred()) goto fail;\n\n\t/*\n\tif (check_num == PyArray_NOTYPE) return PY_FAIL;\n\t*/\n\tif (check_num == PyArray_NOTYPE) {\n\t\tat->type_num = PyArray_NOTYPE;\n\t\tat->itemsize = 0;\n\t\treturn PY_SUCCEED;\n\t}\n\n if ((descr = PyArray_DescrFromType(check_num))==NULL) {\n\t\t/* Now check to see if the object is registered\n\t\t in typeDict */\n\t\tif (typeDict != NULL) {\n\t\t\titem = PyDict_GetItem(typeDict, obj);\n\t\t\tif (item) {\n\t\t\t\tPyArray_TypecodeFromTypeObject(obj, at);\n\t\t\t\tPyErr_Clear();\n\t\t\t\treturn PY_SUCCEED;\n\t\t\t}\n\t\t}\n return PY_FAIL;\n\t}\n\t\n at->type_num = descr->type_num;\n\tif (at->itemsize == 0) at->itemsize = descr->elsize;\n\t\n return PY_SUCCEED;\n fail:\n\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\"data type not understood\");\n\treturn PY_FAIL;\n}\t\n\n\n/* This function returns true if the two typecodes are \n equivalent (same basic kind and same itemsize).\n*/\n\nstatic Bool\nPyArray_EquivalentTypes(PyArray_Typecode *typ1, PyArray_Typecode *typ2)\n{\n\tregister int typenum1=typ1->type_num;\n\tregister int typenum2=typ2->type_num;\n\tregister int size1=typ1->itemsize;\n\tregister int size2=typ2->itemsize;\n\n\tif (size1 != size2) return FALSE;\n\tif (typenum1==typenum2) return TRUE;\n\n\t/* If we are here then size1 == size2 */\n\tif (typenum1 < PyArray_FLOAT) {\n\t\tif (PyTypeNum_ISBOOL(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISBOOL(typenum2));\n\t\telse if (PyTypeNum_ISUNSIGNED(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISUNSIGNED(typenum2));\n\t\telse \n\t\t\treturn (Bool)(PyTypeNum_ISSIGNED(typenum2));\n\t}\n\telse {\n\t\tif (PyTypeNum_ISFLOAT(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISFLOAT(typenum2));\n\t\telse if (PyTypeNum_ISCOMPLEX(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISCOMPLEX(typenum2));\n\t}\n\t/* Default size1 != size2 and typenum1 != typenum2 */\n\treturn FALSE;\t\n}\n\nstatic Bool \nPyArray_EquivArrTypes(PyArrayObject *a1, PyArrayObject *a2)\n{\n PyArray_Typecode type1={PyArray_TYPE(a1), PyArray_ITEMSIZE(a1), 0};\n PyArray_Typecode type2={PyArray_TYPE(a2), PyArray_ITEMSIZE(a2), 0};\n \n return PyArray_EquivalentTypes(&type1, &type2);\n}\n\n\n/*** END C-API FUNCTIONS **/\n\n\n#define _ARET(x) PyArray_Return((PyArrayObject *)(x))\n\nstatic char doc_fromobject[] = \"array(object, dtype=None, copy=1, fortran=0) will return a new array formed from the given object type given. Object can anything with an __array__ method, or any (nested) sequence. If no type is given, then the type will be determined as the minimum type required to hold the objects in the sequence. If copy is zero and sequence is already an array with the right type, a reference will be returned. If the sequence is an array, type can be used only to upcast the array. For downcasting use .astype(t) method.\";\n\nstatic PyObject *\n_array_fromobject(PyObject *ignored, PyObject *args, PyObject *kws)\n{\n\tPyObject *op, *ret=NULL;\n\tstatic char *kwd[]= {\"object\", \"dtype\", \"copy\", \"fortran\", NULL};\n\tBool copy=TRUE;\n\tPyArray_Typecode type = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode oldtype = {PyArray_NOTYPE, 0, 0};\n\tint type_num;\n\tBool fortran=FALSE;\n\tint flags=0;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|O&O&O&\", kwd, &op, \n\t\t\t\t\tPyArray_TypecodeConverter,\n &type, \n\t\t\t\t\tPyArray_BoolConverter, ©, \n\t\t\t\t\tPyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\ttype_num = type.type_num;\n\n\t/* fast exit if simple call */\n\tif (PyArray_Check(op) && (copy==0) &&\t\t\t\\\n\t (fortran == PyArray_CHKFLAGS(op, FORTRAN))) {\n\t\tif (type_num == PyArray_NOTYPE) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t\t/* One more chance */\n\t\toldtype.type_num = PyArray_TYPE(op);\n\t\toldtype.itemsize = PyArray_ITEMSIZE(op);\n\t\tif (PyArray_EquivalentTypes(&oldtype, &type)) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t}\n\n\ttype.fortran = fortran; \n\tif (copy) {\n\t\tflags = ENSURECOPY;\n\t}\n\n\tif ((ret = PyArray_FromAny(op, &type, 0, 0, flags)) == NULL) \n\t\treturn NULL;\n\n\treturn _ARET(ret);\n}\n\nstatic PyObject *\nPyArray_Empty(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n \n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n PyArray_FillObjectArray(ret, Py_None);\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic char doc_empty[] = \"empty((d1,...,dn),dtype=intp,fortran=0) will return a new array\\n of shape (d1,...,dn) and given type with all its entries uninitialized. This can be faster than zeros.\";\n\nstatic PyObject *\narray_empty(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Empty(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_scalar[] = \"scalar(dtypestr,obj) will return a new scalar array of the given type initialized with obj. Mainly for pickle support. typestr must be a valid data typestr (complete with < > or |). If dtypestr is object, then obj can be any object, otherwise obj must be a string. If obj is not given it will be interpreted as None for object type and zeros for all other types.\";\n\nstatic PyObject *\narray_scalar(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"dtypestr\",\"obj\", NULL};\n\tPyArray_Typecode typecode;\n\tPyObject *obj=NULL;\n\tchar *typestr;\n\tint typestrlen;\n\tint swap, alloc=0;\n\tvoid *dptr;\n\tPyObject *ret;\n\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"z#|O\",\n\t\t\t\t\t kwlist, &typestr, &typestrlen,\n\t\t\t\t\t &obj)) \n\t\treturn NULL;\n\t\n\tif (_array_typecode_fromstr(typestr, &swap, &typecode) < 0) \n\t\treturn NULL;\n\t\n\tif (typecode.itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\t\t\\\n\t\t\t\t\"itemsize cannot be zero\");\n\t\treturn NULL;\n\t}\n\n\tif (typecode.type_num == PyArray_OBJECT) {\n\t\tif (obj == NULL) obj = Py_None;\n\t\tdptr = &obj;\n\t\tswap = 0;\n\t}\n\telse {\n\t\tif (obj == NULL) {\n\t\t\tdptr = malloc(typecode.itemsize);\n\t\t\tif (dptr == NULL) {\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tmemset(dptr, '\\0', typecode.itemsize);\n\t\t\talloc = 1;\n\t\t}\n\t\telse {\n\t\t\tif (!PyString_Check(obj)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"initializing object must \"\\\n\t\t\t\t\t\t\"be a string.\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (PyString_GET_SIZE(obj) < typecode.itemsize) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"initialization string is too\"\\\n\t\t\t\t\t\t\" small\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = PyString_AS_STRING(obj);\n\t\t}\n\t}\n\n\tret = PyArray_Scalar(dptr, typecode.type_num,\n\t\t\t typecode.itemsize, swap); \n\n\t/* free dptr which contains zeros */\n\tif (alloc) free(dptr);\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_Zeros(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n\t\tPyObject *zero = PyInt_FromLong(0);\n PyArray_FillObjectArray(ret, zero);\n Py_DECREF(zero);\n\t}\n\telse {\t\t\n\t\tmemset(ret->data, 0, n*(ret->itemsize));\n\t}\n\treturn (PyObject *)ret;\n\n}\n\nstatic char doc_zeros[] = \"zeros((d1,...,dn),dtype=intp,fortran=0) will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero.\";\n\n\nstatic PyObject *\narray_zeros(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Zeros(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_set_typeDict[] = \"set_typeDict(dict) set the internal \"\\\n\t\"dictionary that can look up an array type using a registered \"\\\n\t\"code\";\n\nstatic PyObject *\narray_set_typeDict(PyObject *ignored, PyObject *args)\n{\n\tPyObject *dict;\n\tif (!PyArg_ParseTuple(args, \"O\", &dict)) return NULL;\n\tPy_XDECREF(typeDict); /* Decrement old reference (if any)*/\n\ttypeDict = dict;\n\tPy_INCREF(dict); /* Create an internal reference to it */\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char doc_fromString[] = \"fromstring(string, dtype=intp, count=-1, swap=False) returns a new 1d array initialized from the raw binary data in string. If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.\";\n\nstatic PyObject *\narray_fromString(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyArrayObject *ret; \n\tchar *data;\n\tlonglong nin=-1;\n\tintp s, n;\n\tstatic char *kwlist[] = {\"string\", \"dtype\", \"count\", \"swap\",NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint itemsize;\n\tint swapped=FALSE;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"s#|O&LO&\", kwlist, \n\t\t\t\t\t &data, &s, \n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &swapped)) {\n\t\treturn NULL;\n\t}\n\t\n\tn = (intp) nin;\n\n\titemsize = type.itemsize;\n\tif (itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \"zero-valued itemsize.\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype.type_num, NULL, \n\t\t\t\t\t\tNULL, itemsize, 0,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\t\n\tmemcpy(ret->data, data, n*ret->itemsize);\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPyArray_INCREF(ret);\n\treturn (PyObject *)ret;\n}\n\n\n/* This needs an open file object and reads it in directly. \n memory-mapped files handled differently through buffer interface.\n\nfile pointer number in resulting 1d array \n(can easily reshape later, -1 for to end of file)\ntype of array\nsep is a separator string for character-based data (or NULL for binary)\n \" \" means whitespace\n*/\n\nstatic char doc_fromfile[] = \"\";\n\nstatic int\n_fill_in_itemsize(PyArray_Typecode *typecode)\n{\n\tPyArray_Descr *descr;\n\tdescr = PyArray_DescrFromType(typecode->type_num);\n\tif (descr==NULL) return -1;\n\ttypecode->itemsize = descr->elsize;\n\treturn 0;\n}\n\n\nstatic PyObject *\nPyArray_FromFile(FILE *fp, PyArray_Typecode *typecode, intp num, char *sep)\n{\n\tPyArrayObject *r;\n\tsize_t nread = 0;\n\tPyArray_ScanFunc *scan;\n\n\tif (typecode->itemsize == 0) {\n\t\tif (_fill_in_itemsize(typecode) < 0) \n\t\t\treturn NULL;\n\t}\n\n\tif (num == -1 && sep == NULL) { /* Get size for binary file*/\n\t\tintp start, numbytes;\n\t\tstart = (intp )ftell(fp);\n\t\tfseek(fp, 0, SEEK_END);\n\t\tnumbytes = (intp )ftell(fp) - start;\n\t\tfseek(fp, (long) start, SEEK_SET);\n\t\tif (numbytes == -1) {\n\t\t\tPyErr_SetString(PyExc_IOError, \"Could not seek in file.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tif (typecode->itemsize == 0) {\n\t\t\ttypecode->itemsize = numbytes;\n\t\t\tnum = 1;\n\t\t}\n\t\telse {\n\t\t\tnum = numbytes / typecode->itemsize;\n\t\t}\n\t}\n\t\n\tif (sep==NULL) { /* binary data */\n\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &num, \n\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t typecode->itemsize, 0, NULL);\n\t\tif (r==NULL) return NULL;\n\t\tnread = fread(r->data, typecode->itemsize, num, fp);\n\t}\n\telse { /* character reading */\n\t\tintp i;\n\t\tchar *dptr;\n\n\t\tif (num != -1) { /* number to read is known */\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &num, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = r->data;\n\t\t\tfor (i=0; i < num-1; i++) {\n\t\t\t\tif (scan(fp, dptr, r->itemsize, sep, NULL))\n\t\t\t\t\tbreak;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (!(scan(fp, dptr, r->itemsize, NULL, NULL)))\n\t\t\t\tnread += 1;\n\t\t}\n\t\telse { /* we have to watch for the end of the file and \n\t\t\t reallocate at the end */\n#define _FILEBUFNUM 4096\n\t\t\tintp thisbuf=0;\n\t\t\tintp size = _FILEBUFNUM;\n\t\t\tintp bytes;\n\t\t\tintp totalbytes;\n\t\t\tint done=0;\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &size, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\ttotalbytes = bytes = size * typecode->itemsize;\n\t\t\tdptr = r->data;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\twhile (!done) {\n\t\t\t\tdone = scan(fp, dptr, r->itemsize, sep, NULL);\n\t\t\t\t/* end of file reached trying to \n\t\t\t\t scan value \n\t\t\t\t*/\n\t\t\t\tif (done == 1 || done < 0) break;\n\t\t\t\n\t\t\t\tthisbuf += 1;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t\tif (!done && thisbuf == size) {\n\t\t\t\t\ttotalbytes += bytes;\n\t\t\t\t\tr->data = PyDataMem_RENEW(r->data, \n\t\t\t\t\t\t\t\t totalbytes);\n\t\t\t\t\tdptr = r->data + (totalbytes - bytes);\n\t\t\t\t\tthisbuf = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr->data = PyDataMem_RENEW(r->data, nread*r->itemsize);\n\t\t\tPyArray_DIM(r,0) = nread;\n\t\t\tnum = nread;\n#undef _FILEBUFNUM\n\t\t}\n\t}\n\tif (nread < num) {\n\t\tchar msg[80];\n\t\tsnprintf(msg, 80, \n\t\t\t \"%ld items requested only %ld read\", (long) num, \n (long) nread);\n\t\tif (PyErr_Warn(PyExc_RuntimeWarning, msg) < 0) {\n\t\t\tPy_DECREF(r);\n\t\t\treturn NULL;\n\t\t}\n\t\tr->data = PyDataMem_RENEW(r->data, nread * r->itemsize);\n\t\tPyArray_DIM(r,0) = nread;\n\t}\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_fromfile(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *file=NULL, *ret;\n\tFILE *fp;\n\tchar *sep=\"\";\n\tchar *mode=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"file\", \"dtype\", \"count\", \"sep\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Ls\", kwlist, \n\t\t\t\t\t &file,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &sep)) {\n\t\treturn NULL;\n\t}\n\n\tif (PyString_Check(file)) {\n\t\tif (sep == \"\") mode=\"rb\";\n\t\telse mode=\"r\";\n\t\tfile = PyFile_FromString(PyString_AS_STRING(file), mode);\n\t\tif (file==NULL) return NULL;\n\t}\n\telse {\n\t\tPy_INCREF(file);\n\t}\n\tfp = PyFile_AsFile(file);\n\tif (fp == NULL) {\n\t\tPyErr_SetString(PyExc_IOError, \"First argument must be an open file\");\n\t\tPy_DECREF(file);\n\t\treturn NULL;\n\t}\n\tret = PyArray_FromFile(fp, &type, (intp) nin, sep);\n\tPy_DECREF(file);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_FromBuffer(PyObject *buf, PyArray_Typecode *type, \n\t\t intp count, int swapped) \n{\n\tPyArrayObject *ret;\n\tchar *data;\n\tint ts;\n\tintp s, n;\n\tint itemsize;\n\tint write=1;\n\n\tif (type->type_num == PyArray_OBJECT) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Cannot create an OBJECT array from memory\"\\\n\t\t\t\t\" buffer.\");\n\t\treturn NULL;\n\t}\n\tif (type->itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Itemsize cannot be zero in type\");\n\t\treturn NULL;\n\t}\n\n\tif (PyObject_AsWriteBuffer(buf, (void *)&data, &ts)==-1) {\n\t\twrite = 0;\n\t\tPyErr_Clear();\n\t\tif (PyObject_AsReadBuffer(buf, (void *)&data, &ts)==-1) {\n\t\t\treturn NULL;\n\t\t}\n\t}\n\ts = (intp)ts;\t\n\tn = (intp)count;\n\titemsize = type->itemsize;\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype->type_num, NULL, \n\t\t\t\t\t\tdata, itemsize, DEFAULT_FLAGS,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\n\tif (!write) ret->flags &= ~WRITEABLE;\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPy_INCREF(buf);\n\t/* Store a reference for decref on deallocation */\n\tret->base = buf;\n\tPyArray_UpdateFlags(ret, ALIGNED);\n\treturn (PyObject *)ret; \t\n}\n\nstatic char doc_frombuffer[] = \"\";\n\nstatic PyObject *\narray_frombuffer(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *obj=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"buffer\", \"dtype\", \"count\", \n\t\t\t\t \"swap\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint swapped=0;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Li\", kwlist, \n\t\t\t\t\t &obj,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &swapped)) {\n\t\treturn NULL;\n\t}\n\n\treturn PyArray_FromBuffer(obj, &type, (intp)nin, swapped);\n}\n\n\n\nstatic char doc_concatenate[] = \"concatenate((a1,a2,...),axis=None).\";\n\nstatic PyObject *\narray_concatenate(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *a0;\n\tint axis=0;\n\tstatic char *kwlist[] = {\"seq\", \"axis\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist,\n\t\t\t\t\t &a0,\n\t\t\t\t\t PyArray_AxisConverter, &axis))\n\t\treturn NULL;\n\treturn PyArray_Concatenate(a0, axis);\n}\n\nstatic char doc_innerproduct[] = \\\n\t\"inner(a,b) returns the dot product of two arrays, which has\\n\"\\\n\t\"shape a.shape[:-1] + b.shape[:-1] with elements computed by\\n\" \\\n\t\"the product of the elements from the last dimensions of a and b.\";\n\nstatic PyObject *array_innerproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *b0, *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a0, &b0)) return NULL;\n\t\n\treturn _ARET(PyArray_InnerProduct(a0, b0));\n}\n\nstatic char doc_matrixproduct[] = \\\n\t\"dot(a,v) returns matrix-multiplication between a and b. \\n\"\\\n\t\"The product-sum is over the last dimension of a and the \\n\"\\\n\t\"second-to-last dimension of b.\";\n\nstatic PyObject *array_matrixproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *v, *a;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a, &v)) return NULL;\n\t\n\treturn _ARET(PyArray_MatrixProduct(a, v));\n}\n\nstatic char doc_fastCopyAndTranspose[] = \"_fastCopyAndTranspose(a)\";\n\nstatic PyObject *array_fastCopyAndTranspose(PyObject *dummy, PyObject *args) {\n\tPyObject *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &a0)) return NULL;\n\t\n\treturn _ARET(PyArray_CopyAndTranspose(a0));\n}\n\nstatic char doc_correlate[] = \"cross_correlate(a,v, mode=0)\";\n\nstatic PyObject *array_correlate(PyObject *dummy, PyObject *args, PyObject *kwds) {\n\tPyObject *shape, *a0;\n\tint mode=0;\n\tstatic char *kwlist[] = {\"a\", \"v\", \"mode\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|i\", kwlist, \n\t\t\t\t\t &a0, &shape, &mode)) return NULL;\n\t\n\treturn PyArray_Correlate(a0, shape, mode);\n}\n\n\nstatic PyObject *\nPyArray_Arange(double start, double stop, double step, int type_num)\n{\n\tintp length, i;\n\tPyObject *range;\n\tchar *rptr;\n\tint elsize, type;\n\tdouble value;\n\tPyArray_Descr *dbl_descr;\n\n\tlength = (intp ) ceil((stop - start)/step);\n \n\tif (length <= 0) {\n\t\tlength = 0;\n\t\treturn PyArray_New(&PyArray_Type, 1, &length, type_num,\n\t\t\t\t NULL, NULL, 0, 0, NULL);\n\t}\n\n\trange = PyArray_New(&PyArray_Type, 1, &length, type_num, \n\t\t\t NULL, NULL, 0, 0, NULL);\n\tif (range == NULL) return NULL;\n\tdbl_descr = PyArray_DescrFromType(PyArray_DOUBLE);\n \n\trptr = ((PyArrayObject *)range)->data;\n\telsize = ((PyArrayObject *)range)->itemsize;\n\ttype = ((PyArrayObject *)range)->descr->type_num;\n\tfor (i=0; i < length; i++) {\n\t\tvalue = start + i*step;\n\t\tdbl_descr->cast[type]((char*)&value, rptr, 1, NULL, \n\t\t\t\t (PyArrayObject *)range);\n\t\trptr += elsize;\n\t}\n \n\treturn range;\n}\n\n\nstatic char doc_arange[] = \"arange(start, stop=None, step=1, dtype=intp)\\n\\n Just like range() except it returns an array whose type can be\\n specified by the keyword argument typecode.\";\n\nstatic PyObject *\narray_arange(PyObject *ignored, PyObject *args, PyObject *kws) {\n\tPyObject *o_start=NULL, *o_stop=Py_None, *o_step=NULL;\n\tstatic char *kwd[]= {\"start\", \"stop\", \"step\", \"dtype\", NULL};\n\tdouble start, stop, step;\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0};\n\tint type_num;\n\tint deftype = PyArray_INTP;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|OOO&\", kwd, &o_start,\n\t\t\t\t\t&o_stop, &o_step, \n\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t&typecode)) \n\t\treturn NULL;\n\n\tdeftype = PyArray_ObjectType(o_start, deftype);\n\tif (o_stop != Py_None) {\n\t\tdeftype = PyArray_ObjectType(o_stop, deftype);\n\t}\n\tif (o_step != NULL) {\n\t\tdeftype = PyArray_ObjectType(o_step, deftype);\n\t}\n\n\ttype_num = typecode.type_num;\n\tif (type_num == PyArray_NOTYPE) {\n\t\ttype_num = deftype;\n\t}\n\n\tstart = PyFloat_AsDouble(o_start);\n\tif error_converting(start) return NULL;\n\n\tif (o_step == NULL) {\n\t\tstep = 1;\n\t}\n\telse {\n\t\tstep = PyFloat_AsDouble(o_step);\n\t\tif error_converting(step) return NULL;\n\t}\n\n\tif (o_stop == Py_None) {\n\t\tstop = start;\n\t\tstart = 0;\n\t}\n\telse {\n\t\tstop = PyFloat_AsDouble(o_stop);\n\t\tif error_converting(stop) return NULL;\n\t}\n\n\treturn PyArray_Arange(start, stop, step, type_num);\n}\n\n#undef _ARET\n\n/*****\n static char doc_arrayMap[] = \"arrayMap(func, [a1,...,an])\";\n\n static PyObject *array_arrayMap(PyObject *dummy, PyObject *args) {\n PyObject *shape, *a0;\n \n if (PyArg_ParseTuple(args, \"OO\", &a0, &shape) == NULL) return NULL;\n\t\n return PyArray_Map(a0, shape);\n }\n*****/\n\nstatic char \ndoc_set_string_function[] = \"set_string_function(f, repr=1) sets the python function f to be the function used to obtain a pretty printable string version of a array whenever a array is printed. f(M) should expect a array argument M, and should return a string consisting of the desired representation of M for printing.\";\n\nstatic PyObject *\narray_set_string_function(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *op;\n\tint repr=1;\n\tstatic char *kwlist[] = {\"f\", \"repr\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|i\", kwlist, \n\t\t\t\t\t&op, &repr)) return NULL; \n\tPyArray_SetStringFunction(op, repr);\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char \ndoc_set_ops_function[] = \"set_numeric_ops(op=func, ...) sets some or all of the number methods for all array objects. Don't forget **dict can be used as the argument list. Returns the functions that were replaced -- can be stored and set later.\";\n\nstatic PyObject *\narray_set_ops_function(PyObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *oldops=NULL;\n\t\n\tif ((oldops = PyArray_GetNumericOps())==NULL) return NULL;\n\n\t/* Should probably ensure that objects are at least callable */\n\t/* Leave this to the caller for now --- error will be raised\n\t later when use is attempted \n\t*/\n\tif (PyArray_SetNumericOps(kwds) == -1) {\n\t\tPy_DECREF(oldops);\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"One or more objects is not callable.\");\n\t\treturn NULL;\n\t}\n\treturn oldops;\n}\n\n\nstatic PyObject *\nPyArray_Where(PyObject *condition, PyObject *x, PyObject *y)\n{\n\tPyArrayObject *arr;\n\tPyObject *tup=NULL, *obj=NULL;\n\tPyObject *ret=NULL, *zero=NULL;\n\n\tif ((x==NULL) || (y==NULL)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"either both or neither\"\n\t\t\t\t\"of x and y should be given.\");\n\t\treturn NULL;\n\t}\n\n\tarr = (PyArrayObject *)PyArray_FromAny(condition, NULL, 0, 0, 0);\n\tif (arr == NULL) return NULL;\n\n\tif ((x==NULL) && (y==NULL)) {\n\t\tret = PyArray_Nonzero(arr);\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\n\n\tzero = PyInt_FromLong((long) 0);\n\n\tobj = PyArray_EnsureArray(PyArray_GenericBinaryFunction(arr, zero, n_ops.not_equal));\n\tPy_DECREF(zero);\n\tPy_DECREF(arr);\n\tif (obj == NULL) return NULL;\n\n\ttup = Py_BuildValue(\"(OO)\", y, x);\n\tif (tup == NULL) {Py_DECREF(obj); return NULL;}\n\n\tret = PyArray_Choose((PyAO *)obj, tup);\n\n\tPy_DECREF(obj);\n\tPy_DECREF(tup);\n\treturn ret;\n}\n\nstatic char doc_where[] = \"where(condition, | x, y) is shaped like condition\"\\\n\t\" and has elements of x and y where condition is respectively true or\"\\\n\t\" false. If x or y are not given, then it is equivalent to\"\\\n\t\" nonzero(condition).\";\n\nstatic PyObject *\narray_where(PyObject *ignored, PyObject *args)\n{\n\tPyObject *obj=NULL, *x=NULL, *y=NULL;\n\t\n\tif (!PyArg_ParseTuple(args, \"O|OO\", &obj, &x, &y)) return NULL;\n\n\treturn PyArray_Where(obj, x, y);\n\n}\n\nstatic char doc_register_dtype[] = \\\n\t\"register_dtype(a) registers a new type object -- gives it a typenum\";\n\nstatic PyObject *\narray_register_dtype(PyObject *dummy, PyObject *args)\n{\n\tPyObject *dtype;\n\tint ret;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &dtype)) return NULL;\n\t\n\tret = PyArray_RegisterDataType((PyTypeObject *)dtype);\n\tif (ret < 0)\n\t\treturn NULL;\n\treturn PyInt_FromLong((long) ret);\n}\n\nstatic char doc_can_cast_safely[] = \\\n\t\"can_cast_safely(from=d1, to=d2) returns True if data type d1 \"\\\n\t\"can be cast to data type d2 without losing precision.\";\n\nstatic PyObject *\narray_can_cast_safely(PyObject *dummy, PyObject *args, PyObject *kwds)\n{\n\tPyArray_Typecode d1={PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode d2={PyArray_NOTYPE, 0, 0};\n\tBool ret;\n\tPyObject *retobj;\n\tstatic char *kwlist[] = {\"from\", \"to\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O&O&\", kwlist, \n\t\t\t\t\tPyArray_TypecodeConverter, &d1,\n\t\t\t\t\tPyArray_TypecodeConverter, &d2))\n\t\treturn NULL;\n\tif (d1.type_num == PyArray_NOTYPE || \\\n\t d2.type_num == PyArray_NOTYPE) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"did not understand one of the types. \"\\\n\t\t\t\t\"'None' not accepted.\");\n\t\treturn NULL;\n\t}\n\t\t\n\tret = PyArray_CanCastTo(&d1, &d2);\n\tretobj = (ret ? Py_True : Py_False);\n\tPy_INCREF(retobj);\n\treturn retobj;\n}\n\n\nstatic struct PyMethodDef array_module_methods[] = {\n\t{\"set_string_function\", (PyCFunction)array_set_string_function, \n\t METH_VARARGS|METH_KEYWORDS, doc_set_string_function},\n\t{\"set_numeric_ops\", (PyCFunction)array_set_ops_function,\n\t METH_VARARGS|METH_KEYWORDS, doc_set_ops_function},\n\t{\"set_typeDict\", (PyCFunction)array_set_typeDict,\n\t METH_VARARGS, doc_set_typeDict},\n\n\t{\"array\",\t(PyCFunction)_array_fromobject, \n\t METH_VARARGS|METH_KEYWORDS, doc_fromobject},\n\t{\"arange\", (PyCFunction)array_arange, \n\t METH_VARARGS|METH_KEYWORDS, doc_arange},\n\t{\"zeros\",\t(PyCFunction)array_zeros, \n\t METH_VARARGS|METH_KEYWORDS, doc_zeros},\n\t{\"empty\",\t(PyCFunction)array_empty, \n\t METH_VARARGS|METH_KEYWORDS, doc_empty},\n\t{\"scalar\", (PyCFunction)array_scalar,\n\t METH_VARARGS|METH_KEYWORDS, doc_scalar},\n\t{\"where\", (PyCFunction)array_where,\n\t METH_VARARGS, doc_where},\n\t{\"fromstring\",(PyCFunction)array_fromString,\n\t METH_VARARGS|METH_KEYWORDS, doc_fromString},\n\t{\"concatenate\", (PyCFunction)array_concatenate, \n\t METH_VARARGS|METH_KEYWORDS, doc_concatenate},\n\t{\"inner\", (PyCFunction)array_innerproduct, \n\t METH_VARARGS, doc_innerproduct}, \n\t{\"dot\", (PyCFunction)array_matrixproduct, \n\t METH_VARARGS, doc_matrixproduct}, \n\t{\"_fastCopyAndTranspose\", (PyCFunction)array_fastCopyAndTranspose, \n\t METH_VARARGS, doc_fastCopyAndTranspose},\n\t{\"correlate\", (PyCFunction)array_correlate, \n\t METH_VARARGS | METH_KEYWORDS, doc_correlate},\n\t{\"frombuffer\", (PyCFunction)array_frombuffer,\n\t METH_VARARGS | METH_KEYWORDS, doc_frombuffer},\n\t{\"fromfile\", (PyCFunction)array_fromfile,\n\t METH_VARARGS | METH_KEYWORDS, doc_fromfile},\n\t{\"register_dtype\", (PyCFunction)array_register_dtype,\n\t METH_VARARGS, doc_register_dtype},\n\t{\"can_cast\", (PyCFunction)array_can_cast_safely,\n\t METH_VARARGS | METH_KEYWORDS, doc_can_cast_safely},\t\t\n\t/* {\"arrayMap\",\t(PyCFunction)array_arrayMap, \n\t METH_VARARGS, doc_arrayMap},*/\n\t\n\t{NULL,\t\tNULL, 0}\t\t/* sentinel */\n};\n\n#include \"__multiarray_api.c\"\n\n/* Establish scalar-type hierarchy */\n\n/* For dual inheritance we need to make sure that the objects being\n inherited from have the tp->mro object initialized. This is\n not necessarily true for the basic type objects of Python (it is \n checked for single inheritance but not dual in PyType_Ready).\n\n Thus, we call PyType_Ready on the standard Python Types, here.\n*/ \nstatic int\nsetup_scalartypes(PyObject *dict)\n{\n\n\tinitialize_numeric_types();\n\n if (PyType_Ready(&PyBool_Type) < 0) return -1;\n if (PyType_Ready(&PyInt_Type) < 0) return -1;\n if (PyType_Ready(&PyFloat_Type) < 0) return -1;\n if (PyType_Ready(&PyComplex_Type) < 0) return -1;\n if (PyType_Ready(&PyString_Type) < 0) return -1;\n if (PyType_Ready(&PyUnicode_Type) < 0) return -1;\n\n#define SINGLE_INHERIT(child, parent) \\\n Py##child##ArrType_Type.tp_base = &Py##parent##ArrType_Type;\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) {\t\t\\\n PyErr_Print(); \\\n PyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Tyupe\", \\\n #child); \\\n return -1;\t\t\t\t\t\t\\\n }\n \n if (PyType_Ready(&PyGenericArrType_Type) < 0)\n return -1;\n\n SINGLE_INHERIT(Numeric, Generic);\n SINGLE_INHERIT(Integer, Numeric);\n SINGLE_INHERIT(Inexact, Numeric);\n SINGLE_INHERIT(SignedInteger, Integer);\n SINGLE_INHERIT(UnsignedInteger, Integer);\n SINGLE_INHERIT(Floating, Inexact);\n SINGLE_INHERIT(ComplexFloating, Inexact);\n SINGLE_INHERIT(Flexible, Generic);\n SINGLE_INHERIT(Character, Flexible);\n\t\n#define DUAL_INHERIT(child, parent1, parent2) \\\n Py##child##ArrType_Type.tp_base = &Py##parent2##ArrType_Type;\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent2##ArrType_Type,\t\\\n\t\t\t &Py##parent1##_Type);\t\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n#define DUAL_INHERIT2(child, parent1, parent2)\t\t\t\t\\\n Py##child##ArrType_Type.tp_base = &Py##parent1##_Type;\t\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent1##_Type,\t\t\\\n\t\t\t &Py##parent2##ArrType_Type);\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n SINGLE_INHERIT(Bool, Generic);\n SINGLE_INHERIT(Byte, SignedInteger);\n SINGLE_INHERIT(Short, SignedInteger);\n#if SIZEOF_INT == SIZEOF_LONG\n DUAL_INHERIT(Int, Int, SignedInteger);\n#else\n SINGLE_INHERIT(Int, SignedInteger);\n#endif\n DUAL_INHERIT(Long, Int, SignedInteger);\n#if SIZEOF_LONGLONG == SIZEOF_LONG\n DUAL_INHERIT(LongLong, Int, SignedInteger);\n#else\n SINGLE_INHERIT(LongLong, SignedInteger);\n#endif\n\n SINGLE_INHERIT(UByte, UnsignedInteger);\n SINGLE_INHERIT(UShort, UnsignedInteger);\n SINGLE_INHERIT(UInt, UnsignedInteger);\n SINGLE_INHERIT(ULong, UnsignedInteger);\n SINGLE_INHERIT(ULongLong, UnsignedInteger);\n\n SINGLE_INHERIT(Float, Floating);\n DUAL_INHERIT(Double, Float, Floating);\n SINGLE_INHERIT(LongDouble, Floating);\n\n SINGLE_INHERIT(CFloat, ComplexFloating);\n DUAL_INHERIT(CDouble, Complex, ComplexFloating);\n SINGLE_INHERIT(CLongDouble, ComplexFloating);\n\n DUAL_INHERIT2(String, String, Character);\n DUAL_INHERIT2(Unicode, Unicode, Character);\n\t\n SINGLE_INHERIT(Void, Flexible);\n \n SINGLE_INHERIT(Object, Generic);\n\n return 0;\n\n#undef SINGLE_INHERIT\n#undef DUAL_INHERIT\n\n\t/* Clean up string and unicode array types so they act more like\n\t strings -- get their tables from the standard types.\n\t \n\t \n\t*/\n}\n\n/* place a flag dictionary in d */\n\nstatic void\nset_flaginfo(PyObject *d)\n{\n PyObject *s;\n PyObject *newd;\n \n newd = PyDict_New();\n\n PyDict_SetItemString(newd, \"OWNDATA\", s=PyInt_FromLong(OWNDATA));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"FORTRAN\", s=PyInt_FromLong(FORTRAN));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"CONTIGUOUS\", s=PyInt_FromLong(CONTIGUOUS));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"ALIGNED\", s=PyInt_FromLong(ALIGNED));\n Py_DECREF(s);\n\n PyDict_SetItemString(newd, \"NOTSWAPPED\", s=PyInt_FromLong(NOTSWAPPED));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"UPDATEIFCOPY\", s=PyInt_FromLong(UPDATEIFCOPY));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"WRITEABLE\", s=PyInt_FromLong(WRITEABLE));\n Py_DECREF(s);\n \n PyDict_SetItemString(d, \"_flagdict\", newd);\n Py_DECREF(newd);\n return;\n}\n\n\n/* Initialization function for the module */\n\nDL_EXPORT(void) initmultiarray(void) {\n\tPyObject *m, *d, *s;\n\tPyObject *c_api;\n\t\n\t/* Create the module and add the functions */\n\tm = Py_InitModule(\"multiarray\", array_module_methods);\n\tif (!m) goto err;\n\n\t/* Add some symbolic constants to the module */\n\td = PyModule_GetDict(m);\n\tif (!d) goto err; \n\n\t/* Create the module and add the functions */\n\tif (PyType_Ready(&PyBigArray_Type) < 0) \n\t\treturn;\n\n PyArray_Type.tp_base = &PyBigArray_Type;\n\n PyArray_Type.tp_as_mapping = &array_as_mapping;\n\t/* Even though, this would be inherited, it needs to be set now\n\t so that the __getitem__ will map to the as_mapping descriptor\n\t*/\n PyArray_Type.tp_as_number = &array_as_number; \n\t/* For good measure */\n\tPyArray_Type.tp_as_sequence = &array_as_sequence;\n\tPyArray_Type.tp_as_buffer = &array_as_buffer;\t\n PyArray_Type.tp_flags = (Py_TPFLAGS_DEFAULT \n\t\t\t\t | Py_TPFLAGS_BASETYPE\n\t\t\t\t | Py_TPFLAGS_CHECKTYPES);\n PyArray_Type.tp_doc = Arraytype__doc__;\n\n\tif (PyType_Ready(&PyArray_Type) < 0)\n return;\n\n if (setup_scalartypes(d) < 0) goto err;\n\n\tif (PyType_Ready(&PyArrayIter_Type) < 0)\n\t\treturn; \n \n\tif (PyType_Ready(&PyArrayMapIter_Type) < 0)\n return; \n\n\tc_api = PyCObject_FromVoidPtr((void *)PyArray_API, NULL);\n\tif (PyErr_Occurred()) goto err;\n\tPyDict_SetItemString(d, \"_ARRAY_API\", c_api);\n\tPy_DECREF(c_api);\n\tif (PyErr_Occurred()) goto err;\n\n\tMultiArrayError = PyString_FromString (\"multiarray.error\");\n\tPyDict_SetItemString (d, \"error\", MultiArrayError);\n\t\n\ts = PyString_FromString(\"3.0\");\n\tPyDict_SetItemString(d, \"__version__\", s);\n\tPy_DECREF(s);\n Py_INCREF(&PyBigArray_Type);\n\tPyDict_SetItemString(d, \"bigndarray\", (PyObject *)&PyBigArray_Type);\n Py_INCREF(&PyArray_Type);\n\tPyDict_SetItemString(d, \"ndarray\", (PyObject *)&PyArray_Type);\n Py_INCREF(&PyArrayIter_Type);\n\tPyDict_SetItemString(d, \"flatiter\", (PyObject *)&PyArrayIter_Type);\n Py_INCREF(&PyArrayMapIter_Type);\n\tPyDict_SetItemString(d, \"mapiter\", (PyObject *)&PyArrayMapIter_Type);\n\n set_flaginfo(d);\n\n\tif (set_typeinfo(d) == 0) \n return; /* otherwise there is an error */\n\n\n err:\t\n\t/* Check for errors */\n\tif (PyErr_Occurred())\n PyErr_Print();\n\t\tPy_FatalError(\"can't initialize module multiarray\");\n\n\treturn;\n}\n\n", "source_code_before": "\n/*\n Python Multiarray Module -- A useful collection of functions for creating and\n using ndarrays\n\n Original file \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n Modified for scipy_core in 2005 \n\n Travis E. Oliphant\n Assistant Professor at\n Brigham Young University\n \n*/\n\n/* $Id: multiarraymodule.c,v 1.36 2005/09/14 00:14:00 teoliphant Exp $ */\n\n#include \"Python.h\"\n#include \"structmember.h\"\n/*#include \n#include \n*/\n\n#define _MULTIARRAYMODULE\n#include \"scipy/arrayobject.h\"\n\n#define PyAO PyArrayObject\n\nstatic PyObject *typeDict=NULL; /* Must be explicitly loaded */\n\n/* Including this file is the only way I know how to declare functions\n static in each file, and store the pointers from functions in both\n arrayobject.c and multiarraymodule.c for the C-API \n\n Declarying an external pointer-containing variable in arrayobject.c\n and trying to copy it to PyArray_API, did not work.\n\n Think about two modules with a common api that import each other...\n\n This file would just be the module calls. \n*/\n\n#include \"arrayobject.c\"\n\n\n/* An Error object -- rarely used? */\nstatic PyObject *MultiArrayError;\n\nstatic intp \nPyArray_MultiplyList(intp *l1, int n) \n{\n\tregister intp s=1;\n\tregister int i=0;\n while (i++ < n) s *= (*l1++);\n return s;\n}\n\n\nstatic int \nPyArray_AxisConverter(PyObject *obj, int *axis)\n{\n\tif (obj == Py_None) {\n\t\t*axis = MAX_DIMS;\n\t}\n\telse {\n\t\t*axis = (int) PyInt_AsLong(obj);\n\t\tif (PyErr_Occurred()) {\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n\treturn PY_SUCCEED;\n}\n\nstatic int \nPyArray_CompareLists(intp *l1, intp *l2, int n) \n{\n int i;\n for(i=0;itype_num;\n\t}\n\n\tnew = PyArray_New(self->ob_type,\n\t\t\t self->nd, self->dimensions,\n\t\t\t self->descr->type_num,\n\t\t\t self->strides,\n\t\t\t self->data,\n\t\t\t self->itemsize,\n\t\t\t self->flags, self);\n\n\tif (new==NULL) return NULL;\n\t\n Py_INCREF(self);\n PyArray_BASE(new) = (PyObject *)self;\n if ((type_num != PyArray_NOTYPE) && \\\n (type_num != self->descr->type_num)) {\n if (!PyTypeNum_ISFLEXIBLE(type_num)) {\n v = PyArray_TypeObjectFromType(type_num);\n }\n else {\n PyArray_Descr *descr;\n int itemsize = type->itemsize;\n descr = PyArray_DescrFromType(type_num);\n if (type_num == PyArray_UNICODE) \n itemsize /= sizeof(Py_UNICODE);\n /* construct a string representation */\n v = PyString_FromFormat(\"%c%d\", descr->type, \n itemsize);\n }\n if (v == NULL) goto fail;\n /* set attribute new.dtype = newtype */\n if (PyObject_SetAttrString(new, \"dtype\", v) < 0) goto fail;\n Py_DECREF(v);\n }\n\treturn new;\t\n\n fail:\n Py_XDECREF(v);\n Py_XDECREF(new);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Ravel(PyArrayObject *a, int fortran)\n{\n\tPyArray_Dims newdim = {NULL,1};\n\tintp val[1] = {-1};\n\n if (a->nd == 1) {\n Py_INCREF(a);\n return (PyObject *)a;\n }\n\tnewdim.ptr = val;\n\tif (!fortran && PyArray_ISCONTIGUOUS(a)) \n\t\treturn PyArray_Newshape(a, &newdim);\n\telse\n\t return PyArray_Flatten(a, fortran);\n}\n\nstatic PyObject *\nPyArray_Flatten(PyArrayObject *a, int fortran)\n{\n\tPyObject *ret, *new;\n\tintp size;\n\n\tsize = PyArray_SIZE(a);\n\tret = PyArray_New(a->ob_type,\n\t\t\t 1, &size,\n\t\t\t a->descr->type_num,\n\t\t\t NULL,\n NULL,\n\t\t\t a->itemsize,\n\t\t\t 0, a);\n\n\tif (ret== NULL) return NULL;\n\tif (fortran) {\n\t\tnew = PyArray_Transpose(a, NULL);\n\t\tif (new == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\telse {\n\t\tPy_INCREF(a);\n\t\tnew = (PyObject *)a;\n\t}\n\tif (PyArray_CopyInto((PyArrayObject *)ret, (PyArrayObject *)new) < 0) {\n\t\tPy_DECREF(ret);\n\t\tPy_DECREF(new);\n\t\treturn NULL;\n\t}\n\tPy_DECREF(new);\n\treturn ret;\n}\n\n\n/* For back-ward compatability *\n\n/ * Not recommended */\n\nstatic PyObject *\nPyArray_Reshape(PyArrayObject *self, PyObject *shape) \n{\n PyObject *ret;\n PyArray_Dims newdims;\n\n if (!PyArray_IntpConverter(shape, &newdims)) return NULL;\n ret = PyArray_Newshape(self, &newdims);\n PyDimMem_FREE(newdims.ptr);\n return ret;\n}\n\n/* Returns a new array \n with the a new shape from the data\n in the old array\n*/\n\nstatic PyObject * \nPyArray_Newshape(PyArrayObject *self, PyArray_Dims *newdims)\n{\n intp i, s_original, i_unknown, s_known;\n intp *dimensions = newdims->ptr;\n PyArrayObject *ret;\n\tchar msg[] = \"total size of new array must be unchanged\";\n\tint n = newdims->len;\n Bool same;\n\n /* Quick check to make sure anything needs to be done */\n if (n == self->nd) {\n same = TRUE;\n i=0;\n while(same && i= 0) {\n if ((s_known == 0) || (s_original % s_known != 0)) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n dimensions[i_unknown] = s_original/s_known;\n } else {\n if (s_original != s_known) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n }\n \n\tret = (PyAO *)PyArray_New(self->ob_type,\n\t\t\t\t n, dimensions,\n\t\t\t\t self->descr->type_num,\n\t\t\t\t NULL,\n\t\t\t\t self->data,\n\t\t\t\t self->itemsize,\n\t\t\t\t self->flags, self);\n\n\tif (ret== NULL)\n goto fail;\n\t\n Py_INCREF(self);\n ret->base = (PyObject *)self;\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n return (PyObject *)ret;\n\t\n fail:\n return NULL;\n}\n\n/* return a new view of the array object with all of its unit-length \n dimensions squeezed out if needed, otherwise\n return the same array.\n */\n\nstatic PyObject *\nPyArray_Squeeze(PyArrayObject *self)\n{\n\tint nd = self->nd;\n\tint newnd = nd;\n\tintp dimensions[MAX_DIMS];\n\tintp strides[MAX_DIMS];\n\tint i,j;\n\tPyObject *ret;\n\n\tif (nd == 0) {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n\tfor (j=0, i=0; idimensions[i] == 1) {\n\t\t\tnewnd -= 1;\n\t\t}\n\t\telse {\n\t\t\tdimensions[j] = self->dimensions[i];\n\t\t\tstrides[j++] = self->strides[i];\n\t\t}\n\t}\n\t\n\tret = PyArray_New(self->ob_type, newnd, dimensions, \n\t\t\t self->descr->type_num, strides,\n\t\t\t self->data, self->itemsize, self->flags,\n\t\t\t self);\n\tself->flags &= ~OWN_DATA;\n\tself->base = (PyObject *)self;\n\tPy_INCREF(self);\n\treturn (PyObject *)ret;\n}\n\n\nstatic PyObject *\nPyArray_Mean(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL;\n\tPyObject *new, *ret;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\n\tobj1 = PyArray_GenericReduceFunction((PyAO *)new, n_ops.add, axis,\n\t\t\t\t\t rtype);\n\tobj2 = PyFloat_FromDouble((double) PyArray_DIM(new,axis));\n Py_DECREF(new);\n\tif (obj1 == NULL || obj2 == NULL) {\n\t\tPy_XDECREF(obj1);\n\t\tPy_XDECREF(obj2);\n\t\treturn NULL;\n\t}\n\n\tret = PyNumber_Divide(obj1, obj2);\n\tPy_DECREF(obj1);\n\tPy_DECREF(obj2);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Std(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL, *new=NULL;\n\tPyObject *ret=NULL, *newshape=NULL;\n\tint i, n;\n\tintp val;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\t\n\t/* Compute and reshape mean */\n\tobj1 = PyArray_EnsureArray(PyArray_Mean((PyAO *)new, axis, rtype));\n\tif (obj1 == NULL) {Py_DECREF(new); return NULL;} \n\tn = PyArray_NDIM(new);\n\tnewshape = PyTuple_New(n);\n\tif (newshape == NULL) {Py_DECREF(obj1); Py_DECREF(new); return NULL;}\n\tfor (i=0; ind != 1) {\n Py_DECREF(cond);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Condition must be 1-d array.\");\n return NULL;\n }\n\n res = PyArray_Nonzero(cond);\n Py_DECREF(cond);\n\tret = PyArray_Take(self, res, axis);\n\tPy_DECREF(res);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Nonzero(PyArrayObject *self)\n{\n int n=self->nd, j;\n\tintp count=0, i, size;\n\tPyArrayIterObject *it=NULL;\n\tPyObject *ret=NULL, *item;\n\tintp *dptr[MAX_DIMS];\n\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (it==NULL) return NULL;\n\n\tsize = it->size;\n\tfor (i=0; idescr->nonzero(it->dataptr, self)) count++;\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\n\tPyArray_ITER_RESET(it);\n\tif (n==1) {\n\t\tret = PyArray_New(self->ob_type, 1, &count, PyArray_INTP, \n\t\t\t\t NULL, NULL, 0, 0, self);\n\t\tif (ret == NULL) goto fail;\n\t\tdptr[0] = (intp *)PyArray_DATA(ret);\n\t\t\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\t*(dptr[0])++ = i;\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t}\n\telse {\n\t\tret = PyTuple_New(n);\n\t\tfor (j=0; job_type, 1, &count, \n\t\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0,\n\t\t\t\t\t self);\n\t\t\tPyTuple_SET_ITEM(ret, j, item);\n\t\t\tif (item == NULL) goto fail;\n\t\t\tdptr[j] = (intp *)PyArray_DATA(item);\n\t\t}\n\t\t\n\t\t/* reset contiguous so that coordinates gets updated */\n\t\tit->contiguous = 0;\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\tfor (j=0; jcoordinates[j];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\n\t}\n\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ret);\n\tPy_XDECREF(it);\n\treturn NULL;\n \n}\n\nstatic PyObject *\nPyArray_Clip(PyArrayObject *self, PyObject *min, PyObject *max)\n{\n\tPyObject *selector=NULL, *newtup=NULL, *ret=NULL;\n\tPyObject *res1=NULL, *res2=NULL, *res3=NULL;\n\tPyObject *two;\n\n\ttwo = PyInt_FromLong((long)2);\n\tres1 = PyArray_GenericBinaryFunction(self, max, n_ops.greater);\n\tres2 = PyArray_GenericBinaryFunction(self, min, n_ops.less);\n\tif ((res1 == NULL) || (res2 == NULL)) goto fail;\n\tres3 = PyNumber_Multiply(two, res1);\n\tPy_DECREF(two);\n\tPy_DECREF(res1);\n\tif (res3 == NULL) return NULL;\n\n\tselector = PyArray_EnsureArray(PyNumber_Add(res2, res3));\n\tPy_DECREF(res2);\n\tPy_DECREF(res3);\n\tif (selector == NULL) return NULL;\n\n\tnewtup = Py_BuildValue(\"(OOO)\", (PyObject *)self, min, max);\n\tif (newtup == NULL) goto fail;\n\tret = PyArray_Choose((PyAO *)selector, newtup);\n\tPy_DECREF(selector);\n\tPy_DECREF(newtup);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(res1);\n\tPy_XDECREF(res2);\n\tPy_XDECREF(two);\n\tPy_XDECREF(selector);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Conjugate(PyArrayObject *self)\n{\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyObject *new;\n\t\tintp size, i;\n\t\t/* Make a copy */\n\t\tnew = PyArray_Copy(self);\n\t\tif (new==NULL) return NULL;\n\t\tsize = PyArray_SIZE(new);\n\t\tif (self->descr->type_num == PyArray_CFLOAT) {\n\t\t\tcfloat *dptr = (cfloat *) PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CDOUBLE) {\n\t\t\tcdouble *dptr = (cdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CLONGDOUBLE) {\n\t\t\tclongdouble *dptr = (clongdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\t\t\t\n\t\t}\t\t\n\t\treturn new;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *) self;\n\t}\n}\n\nstatic PyObject *\nPyArray_Trace(PyArrayObject *self, int offset, int axis1, int axis2, \nint rtype)\n{\n\tPyObject *diag=NULL, *ret=NULL;\n\n\tdiag = PyArray_Diagonal(self, offset, axis1, axis2);\n\tif (diag == NULL) return NULL;\n\tret = PyArray_GenericReduceFunction((PyAO *)diag, n_ops.add, -1, rtype);\n\tPy_DECREF(diag);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Diagonal(PyArrayObject *self, int offset, int axis1, int axis2)\n{\n\tint n = self->nd;\n\tPyObject *new;\n\tPyObject *newaxes;\n\tint i, pos;\t\n\n\tif (n < 2) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"array.ndim must be >= 2\");\n\t\treturn NULL;\n\t}\n\tif (axis1 < 0) axis1 += n;\n\tif (axis2 < 0) axis2 += n;\n\tif ((axis1 == axis2) || (axis1 < 0) || (axis1 >= n) ||\t\\\n\t (axis2 < 0) || (axis2 >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \"axis1(=%d) and axis2(=%d) \"\\\n\t\t\t \"must be different and within range (nd=%d)\",\n\t\t\t axis1, axis2, n);\n\t\treturn NULL;\n\t}\n \n\tnewaxes = PyTuple_New(n);\n\tif (newaxes==NULL) return NULL;\n\t/* insert at the end */\n\tPyTuple_SET_ITEM(newaxes, n-2, PyInt_FromLong((long)axis1));\n\tPyTuple_SET_ITEM(newaxes, n-1, PyInt_FromLong((long)axis2));\n\tpos = 0;\n\tfor (i=0; idimensions[0];\n\t\tn2 = self->dimensions[1];\n\t\tstep = n2+1;\n\t\tif (offset < 0) {\n\t\t\tstart = -n2 * offset;\n\t\t\tstop = MIN(n2, n1+offset)*(n2+1) - n2*offset;\n\t\t}\n\t\telse {\n\t\t\tstart = offset;\n\t\t\tstop = MIN(n1, n2-offset)*(n2+1) + offset;\n\t\t}\n\t\t\n\t\t/* count = ceil((stop-start)/step) */\n\t\tcount = ((stop-start) / step) + (((stop-start) % step) != 0);\n\t\t\t\n\t\tindices = PyArray_New(&PyArray_Type, 1, &count, \n\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0, NULL);\n\t\tif (indices == NULL) {\n\t\t\tPy_DECREF(self); return NULL;\n\t\t}\n\t\tdptr = (intp *)PyArray_DATA(indices);\n\t\tfor (n1=start; n1descr->type_num,\n\t\t\t\t\t self->itemsize, 0};\n\t\t\n\t\tmydiagonal = PyList_New(0);\n\t\tif (mydiagonal == NULL) {Py_DECREF(self); return NULL;}\n\t\tn1 = self->dimensions[0];\n\t\tfor (i=0; i 3)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"Only Carrays of 1-3 dimensions available.\");\n\t\treturn -1;\n\t}\n\tif ((ap = (PyArrayObject*)PyArray_FromAny(*op, &typecode, nd, nd,\n\t\t\t\t\t\t CARRAY_FLAGS)) == NULL)\n\t\treturn -1;\n\tswitch(nd) {\n\tcase 1:\n\t\t*((char **)ptr) = ap->data;\n\t\tbreak;\n\tcase 2:\n\t\tn = ap->dimensions[0];\n\t\tptr2 = (char **)malloc(n * sizeof(char *));\n\t\tif (!ptr2) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0];\n\t\t}\n\t\t*((char ***)ptr) = ptr2;\n\t\tbreak;\t\t\n\tcase 3:\n\t\tn = ap->dimensions[0];\n\t\tm = ap->dimensions[1];\n\t\tptr3 = (char ***)malloc(n*(m+1) * sizeof(char *));\n\t\tif (!ptr3) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0] + \\\n\t\t\t\t\tj*ap->strides[1];\n\t\t\t}\n\t\t}\n\t\t*((char ****)ptr) = ptr3;\n\t}\n\tmemcpy(dims, ap->dimensions, nd*sizeof(intp));\n\t*op = (PyObject *)ap;\n\treturn 0;\n\n fail:\n\tPyErr_SetString(PyExc_MemoryError, \"No memory.\");\n\treturn -1;\n}\n\n/* Deprecated --- Use PyArray_AsCArray instead */\n\nstatic int \nPyArray_As1D(PyObject **op, char **ptr, int *d1, int typecode) \n{\n\tintp newd1;\n\t\n\tif (PyArray_AsCArray(op, (void *)ptr, &newd1, 1, typecode) == -1)\n\t\treturn -1;\t\n\t*d1 = (int) newd1;\n\treturn 0;\n}\n\n\nstatic int \nPyArray_As2D(PyObject **op, char ***ptr, int *d1, int *d2, int typecode) \n{\n\tintp newdims[2];\n\n\tif (PyArray_AsCArray(op, (void *)ptr, newdims, 2, typecode) == -1)\n\t\treturn -1;\n\n\t*d1 = (int ) newdims[0];\n\t*d2 = (int ) newdims[1];\n return 0;\n}\n\n/* End Deprecated */\n\nstatic int \nPyArray_Free(PyObject *op, void *ptr) \n{\n PyArrayObject *ap = (PyArrayObject *)op;\n\t\n if ((ap->nd < 1) || (ap->nd > 3)) \n\t\treturn -1;\n if (ap->nd >= 2) {\n\t\tfree(ptr);\n }\n Py_DECREF(ap);\n return 0;\n}\n\n\nstatic PyObject *\n_swap_and_concat(PyObject *op, int axis, int n)\n{\n\tPyObject *newtup=NULL;\n\tPyObject *otmp, *arr;\n\tint i;\n\n\tnewtup = PyTuple_New(n);\n\tif (newtup==NULL) return NULL;\n\tfor (i=0; i= MAX_DIMS) {\n\t\t\totmp = PyArray_Ravel(mps[i],0);\n\t\t\tPy_DECREF(mps[i]);\n\t\t\tmps[i] = (PyArrayObject *)otmp;\n\t\t}\n\t\tprior2 = PyArray_GetPriority((PyObject *)(mps[i]), 0.0);\n\t\tif (prior2 > prior1) {\n\t\t\tprior1 = prior2;\n\t\t\tsubtype = mps[i]->ob_type;\n\t\t\tret = mps[i];\n\t\t}\n\t}\n\t\n\tnew_dim = 0;\n\tfor(i=0; ind;\n\t\telse {\n\t\t\tif (nd != mps[i]->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"arrays must have same \"\\\n\t\t\t\t\t\t\"number of dimensions\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tif (!PyArray_CompareLists(mps[0]->dimensions+1, \n\t\t\t\t\t\t mps[i]->dimensions+1, \n\t\t\t\t\t\t nd-1)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"array dimensions must \"\\\n\t\t\t\t\t\t\"agree except for d_0\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t}\n\t\tif (nd == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"0d arrays can't be concatenated\");\n\t\t\tgoto fail;\n\t\t}\n\t\tnew_dim += mps[i]->dimensions[0];\n\t}\n\t\n\ttmp = mps[0]->dimensions[0];\n\tmps[0]->dimensions[0] = new_dim;\n\tret = (PyArrayObject *)PyArray_New(subtype, nd,\n\t\t\t\t\t mps[0]->dimensions, \n\t\t\t\t\t type_num, NULL, NULL, 0, 0, ret);\n\tmps[0]->dimensions[0] = tmp;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tdata = ret->data;\n\tfor(i=0; idata, numbytes);\n\t\tdata += numbytes;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; ind;\n\tif (n <= 1) {\n\t\tPy_INCREF(ap);\n\t\treturn (PyObject *)ap;\n\t}\n\n\tif (a1 < 0) a1 += n;\n\tif (a2 < 0) a2 += n;\n\tif ((a1 < 0) || (a1 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis1 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tif ((a2 < 0) || (a2 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis2 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tnew_axes = PyTuple_New(n);\n\tfor (i=0; ind;\n\t\tpermutation = (intp *)malloc(n*sizeof(int));\n\t\tfor(i=0; ind+axis;\n\t\t\tif (axis < 0 || axis >= ap->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"invalid axis for this array\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tpermutation[i] = axis;\n\t\t}\n\t}\n\t\n\t/* this allocates memory for dimensions and strides (but fills them\n\t incorrectly), sets up descr, and points data at ap->data. */\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, n, permutation, \n\t\t\t\t\t ap->descr->type_num, NULL,\n\t\t\t\t\t ap->data, ap->itemsize, ap->flags,\n\t\t\t\t\t ap);\n\tif (ret == NULL) goto fail;\n\t\n\t/* point at true owner of memory: */\n\tret->base = (PyObject *)ap;\n\tPy_INCREF(ap);\n\t\n\tfor(i=0; idimensions[i] = ap->dimensions[permutation[i]];\n\t\tret->strides[i] = ap->strides[permutation[i]];\n\t}\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n\tif (op && (op != Py_None))\n\t\tPyArray_Free(op, (char *)axes);\n\tfree(permutation);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ret);\n\tif (permutation != NULL) free(permutation);\n\tif (op != Py_None)\n\t\tPyArray_Free(op, (char *)axes);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Repeat(PyArrayObject *aop, PyObject *op, int axis) {\n\tintp *counts;\n\tintp n, n_outer, i, j, k, chunk, total;\n\tintp tmp;\n\tint nd;\n\tPyArrayObject *repeats=NULL;\n\tPyObject *ap=NULL;\n\tPyArrayObject *ret=NULL;\n\tchar *new_data, *old_data;\n\n\trepeats = (PyAO *)PyArray_ContiguousFromObject(op, PyArray_INTP, 0, 1);\n\tif (repeats == NULL) return NULL;\n\tnd = repeats->nd;\n\tcounts = (intp *)repeats->data;\n\n\tif ((ap=_check_axis(aop, &axis, CARRAY_FLAGS))==NULL) {\n\t\tPy_DECREF(repeats);\n\t\treturn NULL;\n\t}\n\n\taop = (PyAO *)ap;\n\n\tif (nd == 1)\n\t\tn = repeats->dimensions[0];\n\telse /* nd == 0 */\n\t\tn = aop->dimensions[axis];\n\n\tif (aop->dimensions[axis] != n) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"a.shape[axis] != len(repeats)\");\n\t\tgoto fail;\n\t}\n\n\t\n\tif (nd == 0) \n\t\ttotal = counts[0]*n;\n\telse {\n\t\t\n\t\ttotal = 0;\n\t\tfor(j=0; jdimensions[axis] = total;\n\tret = (PyArrayObject *)PyArray_New(aop->ob_type, aop->nd,\n\t\t\t\t\t aop->dimensions, \n\t\t\t\t\t aop->descr->type_num,\n\t\t\t\t\t NULL, NULL, aop->itemsize, 0,\n\t\t\t\t\t aop);\n\taop->dimensions[axis] = n;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tnew_data = ret->data;\n\told_data = aop->data;\n\t\n\tchunk = aop->itemsize;\n\tfor(i=axis+1; ind; i++) {\n\t\tchunk *= aop->dimensions[i];\n\t}\n\t\n\tn_outer = 1;\n\tfor(i=0; idimensions[i];\n\n\tfor(i=0; ind < mps[i]->nd) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"too many dimensions\");\n\t\t\tgoto fail;\n\t\t}\n\t\tif (!PyArray_CompareLists(ap->dimensions+(ap->nd-mps[i]->nd),\n\t\t\t\t mps[i]->dimensions, mps[i]->nd)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"array dimensions must agree\");\n\t\t\tgoto fail;\n\t\t}\n\t\tsizes[i] = PyArray_NBYTES(mps[i]);\n\t}\n\t\n\t/* why not ??? \n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tPyErr_SetString(PyExc_NotImplementedError, \n\t\t\t\t\"Not implemented for flexible sizes\");\n\t\treturn NULL;\n\t}\n\t*/\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, ap);\n\tif (ret == NULL) goto fail;\n\t\n\telsize = ret->itemsize;\n\tm = PyArray_SIZE(ret);\n\tself_data = (intp *)ap->data;\n\tret_data = ret->data;\n\t\n\tfor (i=0; i= n) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"invalid entry in choice array\");\n\t\t\tgoto fail;\n\t\t}\n\t\toffset = i*elsize;\n\t\tif (offset >= sizes[mi]) {offset = offset % sizes[mi]; }\n\t\tmemmove(ret_data, mps[mi]->data+offset, elsize);\n\t\tret_data += elsize; self_data++;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; idescr->compare(a,b,global_obj);\n}\n\n#define SWAPAXES(op, ap) {\t\t\t\t\t\t\\\n\t\torign = (ap)->nd-1;\t\t\t\t\t\\\n\t\tif (axis != orign) {\t\t\t\t\t\\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\n#define SWAPBACK(op, ap) { \\\n\t\tif (axis != orign) { \\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\nstatic PyObject *\nPyArray_Sort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap=NULL, *store_arr=NULL;\n\tchar *ip;\n\tint i, n, m, elsize, orign;\n\n\tif ((ap = (PyAO*) _check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_CopyFromObject((PyObject *)op, \n\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tPy_DECREF(ap);\n\t\treturn NULL;\n\t}\n\t\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\n\t/* Store global -- allows re-entry -- restore before leaving*/\n\tstore_arr = global_obj; \n\tglobal_obj = ap;\n\t\n\tfor (ip=ap->data, i=0; iitemsize;\n\tconst intp *ipa = ip1;\n\tconst intp *ipb = ip2;\t\n\treturn global_obj->descr->compare(global_data + (isize * *ipa),\n global_data + (isize * *ipb), \n\t\t\t\t\t global_obj);\n}\n\nstatic PyObject *\nPyArray_ArgSort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap, *ret, *store;\n\tintp *ip;\n\tintp i, j, n, m, orign;\n\tint argsort_elsize;\n\tchar *store_ptr;\n\n\tif ((ap = (PyAO *)_check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op, \n\t\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, ap);\n\tif (ret == NULL) goto fail;\n\t\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tip = (intp *)ret->data;\n\targsort_elsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\tstore_ptr = global_data;\n\tglobal_data = ap->data;\n\tstore = global_obj;\n\tglobal_obj = ap;\n\tfor (i=0; idescr->compare;\n\tintp min_i, max_i, i, j;\n\tint location, elsize = ap1->itemsize;\n\tintp elements = ap1->dimensions[ap1->nd-1];\n\tintp n = PyArray_Size((PyObject *)ap2);\n\tintp *rp = (intp *)ret->data;\n\tchar *ip = ap2->data;\n\tchar *vp = ap1->data;\n\n\tfor (j=0; j 0) {\n\t\t\t\t\tif (compare(ip, vp+elsize*(--i), ap2) \\\n\t\t\t\t\t != 0) {\n\t\t\t\t\t\ti = i+1; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmin_i = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (location < 0) {\n\t\t\t\tmax_i = i;\n\t\t\t} else {\n\t\t\t\tmin_i = i+1;\n\t\t\t}\n\t\t}\n\t\t*rp = min_i;\n\t}\n}\n\nstatic PyObject *\nPyArray_SearchSorted(PyArrayObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tint typenum = 0;\n\n\t/* \n PyObject *args;\n args = Py_BuildValue(\"O\",op2);\n\tPy_DELEGATE_ARGS(((PyObject *)op1), searchsorted, args);\n Py_XDECREF(args);\n\t*/\n\n\ttypenum = PyArray_ObjectType((PyObject *)op1, 0);\n\ttypenum = PyArray_ObjectType(op2, typenum);\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op1, \n\t\t\t\t\t\t\t typenum, \n\t\t\t\t\t\t\t 1, 1);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap2->ob_type, ap2->nd, \n\t\t\t\t\t ap2->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, ap2);\n\tif (ret == NULL) goto fail;\n\n\tif (ap2->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tlocal_where(ap1, ap2, ret); \n\t\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ret);\n\treturn NULL;\n}\n\n\n\n/* Could perhaps be redone to not make contiguous arrays \n */\n\nstatic PyObject *\nPyArray_InnerProduct(PyObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tintp i, j, l, i1, i2, n1, n2;\n\tint typenum;\n\tintp is1, is2, os;\n\tchar *ip1, *ip2, *op;\n\tintp dimensions[MAX_DIMS], nd;\n\tPyArray_DotFunc *dot;\n\tPyTypeObject *subtype;\n double prior1, prior2;\n\t\n\ttypenum = PyArray_ObjectType(op1, 0); \n\ttypenum = PyArray_ObjectType(op2, typenum);\n\t\t\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject(op1, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tif (ap1->nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\t\n\tif (ap2->dimensions[ap2->nd-1] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"matrices are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\n\n\t/* Need to choose an output array that can hold a sum \n\t -- use priority to determine which subtype.\n\t */\n prior2 = PyArray_GetPriority((PyObject *)ap2, 0.0);\n prior1 = PyArray_GetPriority((PyObject *)ap1, 0.0);\n subtype = (prior2 > prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = (ret->descr->dotfunc);\n\t\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\n\t\n\tis1 = ap1->strides[ap1->nd-1]; \n\tis2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\tif (ap2->nd > 1) {\n\t\tmatchDim = ap2->nd - 2;\n\t\totherDim = ap2->nd - 1;\n\t}\n\telse {\n\t\tmatchDim = 0;\n\t\totherDim = 0;\n\t}\n\n\tif (ap2->dimensions[matchDim] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"objects are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-2; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\tif(ap2->nd > 1) {\n\t\tdimensions[j++] = ap2->dimensions[ap2->nd-1];\n\t}\n\t/*\n\tfprintf(stderr, \"nd=%d dimensions=\", nd);\n\t for(i=0; i prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\t\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[matchDim];\n\tif(ap1->nd > 1)\n\t\tis1r = ap1->strides[ap1->nd-2];\n\telse\n\t\tis1r = ap1->strides[ap1->nd-1];\n\tis2r = ap2->strides[otherDim];\n\n\top = ret->data; os = ret->itemsize;\n\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2ob_type, 2, dims, PyArray_TYPE(arr),\n\t\t\t NULL, NULL, elsize, 0, (PyArrayObject *)arr);\n\n\tif (ret == NULL) {\n\t\tPy_DECREF(arr);\n\t\treturn NULL;\n\t}\n\t/* do 2-d loop */\n\toptr = PyArray_DATA(ret);\n\tstr2 = elsize*dims[0];\n\tfor (i=0; idimensions[ap1->nd-1];\n\tn2 = ap2->dimensions[ap2->nd-1];\n\n\tif (n1 < n2) { \n\t\tret = ap1; ap1 = ap2; ap2 = ret; \n\t\tret = NULL; i = n1;n1=n2;n2=i;\n\t}\n\tlength = n1;\n\tn = n2;\n\tswitch(mode) {\n\tcase 0:\t\n\t\tlength = length-n+1;\n\t\tn_left = n_right = 0;\n\t\tbreak;\n\tcase 1:\n\t\tn_left = (int)(n/2);\n\t\tn_right = n-n_left-1;\n\t\tbreak;\n\tcase 2:\n\t\tn_right = n-1;\n\t\tn_left = n-1;\n\t\tlength = length+n-1;\n\t\tbreak;\n\tdefault:\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"mode must be 0,1, or 2\");\n\t\tgoto fail;\n\t}\n\t\n\tret = (PyArrayObject *)PyArray_New(ap1->ob_type, 1,\n\t\t\t\t\t &length, typenum, \n\t\t\t\t\t NULL, NULL, 0, 0, ap1);\n\tif (ret == NULL) goto fail;\n\n\t\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"function not available for this type\");\n\t\tgoto fail;\n\t}\n\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data; ip2 = ap2->data+n_left*is2;\n\tn = n-n_left;\n\tfor(i=0; idescr->argmax;\n\tif (arg_func == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"data type not ordered\");\n\t\tgoto fail;\n\t}\n\n\trp = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd-1,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, ap);\n\tif (rp == NULL) goto fail;\n\n\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) {\n\t\tPyErr_SetString(MultiArrayError, \n\t\t\t\t\"Attempt to get argmax/argmin \"\\\n\t\t\t\t\"of an empty sequence??\");\n\t\tgoto fail;\n\t}\n\tn = PyArray_SIZE(ap)/m;\n\trptr = (intp *)rp->data;\n\tfor (ip = ap->data, i=0; ind + indices->nd - 1;\n for (i=0; i< nd; i++) {\n if (i < axis) {\n shape[i] = self->dimensions[i];\n n *= shape[i];\n } else {\n if (i < axis+indices->nd) {\n shape[i] = indices->dimensions[i-axis];\n m *= shape[i];\n } else {\n shape[i] = self->dimensions[i-indices->nd+1];\n chunk *= shape[i];\n }\n }\n }\n ret = (PyArrayObject *)PyArray_New(self->ob_type, nd, shape, \n\t\t\t\t\t self->descr->type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, self);\n\t\n if (ret == NULL) goto fail;\n\t\n max_item = self->dimensions[axis];\n chunk = chunk * ret->itemsize;\n src = self->data;\n dest = ret->data;\n\t\n for(i=0; idata))[j];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"Index out of range for \"\\\n\t\t\t\t\t\t\"array\");\n goto fail;\n }\n memmove(dest, src+tmp*chunk, chunk);\n dest += chunk;\n }\n src += chunk*max_item;\n }\n\t\n PyArray_INCREF(ret);\n\n Py_XDECREF(indices);\n Py_XDECREF(self);\n\n return (PyObject *)ret;\n\t\n\t\n fail:\n Py_XDECREF(ret);\n Py_XDECREF(indices);\n Py_XDECREF(self);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Put(PyArrayObject *self, PyObject *indices0, PyObject* values0) \n{\n PyArrayObject *indices, *values;\n int i, chunk, ni, max_item, nv, tmp; \n char *src, *dest;\n\n indices = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be contiguous\");\n return NULL;\n }\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n indices = (PyArrayObject *)PyArray_ContiguousFromObject(indices0, PyArray_INTP, 0, 0);\n if (indices == NULL) goto fail;\n ni = PyArray_SIZE(indices);\n\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, self->descr->type_num, \n\t\t\t\t\t 0, 0);\n if (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\n if (nv > 0) { /* nv == 0 for a null array */\n for(i=0; idata + chunk * (i % nv);\n tmp = ((intp *)(indices->data))[i];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \"Index out of range for array\");\n goto fail;\n }\n memmove(dest + tmp * chunk, src, chunk);\n }\n }\n\n Py_XDECREF(values);\n Py_XDECREF(indices);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(indices);\n Py_XDECREF(values);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_PutMask(PyArrayObject *self, PyObject *mask0, PyObject* values0) \n{\n PyArrayObject *mask, *values;\n int i, chunk, ni, max_item, nv, tmp, thistype;\n char *src, *dest;\n\n mask = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must \"\\\n\t\t\t\t\"be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must be contiguous\");\n return NULL;\n }\n\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n mask = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(mask0, PyArray_BOOL, 0, 0);\n if (mask == NULL) goto fail;\n ni = PyArray_SIZE(mask);\n if (ni != max_item) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: mask and data must be \"\\\n\t\t\t\t\"the same size.\");\n goto fail;\n }\n\n\tthistype = self->descr->type_num;\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, thistype, 0, 0);\n\tif (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\t /* zero if null array */\n if (nv > 0) {\n\t\tfor(i=0; idata + chunk * (i % nv);\n\t\t\ttmp = ((Bool *)(mask->data))[i];\n\t\t\tif (tmp) {\n\t\t\t\tmemmove(dest + i * chunk, src, chunk);\n\t\t\t\tif (thistype == PyArray_OBJECT)\n\t\t\t\t\tPy_INCREF(*((PyObject **)src));\n\t\t\t}\n\t\t}\n }\n\n Py_XDECREF(values);\n Py_XDECREF(mask);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(mask);\n Py_XDECREF(values);\n return NULL;\n}\n\n\n/* This conversion function can be used with the \"O&\" argument for\n PyArg_ParseTuple. It will immediately return an object of array type\n or will convert to a CARRAY any other object. \n\n If you use PyArray_Converter, you must DECREF the array when finished\n as you get a new reference to it.\n*/\n \nstatic int \nPyArray_Converter(PyObject *object, PyObject **address) \n{\n if (PyArray_Check(object)) {\n *address = object;\n\t\tPy_INCREF(object);\n return PY_SUCCEED;\n }\n else {\n\t\t*address = PyArray_FromAny(object, NULL, 0, 0, CARRAY_FLAGS);\n\t\tif (*address == NULL) return PY_FAIL;\n\t\treturn PY_SUCCEED;\n }\n}\n\nstatic int\nPyArray_BoolConverter(PyObject *object, Bool *val)\n{\n\tif (PyObject_IsTrue(object)) *val=TRUE;\n\telse *val=FALSE;\n\tif (PyErr_Occurred()) return PY_FAIL;\n\treturn PY_SUCCEED;\n}\n\n\nstatic int\nPyArray_TypestrConvert(int itemsize, int gentype)\n{\n\tregister int newtype = gentype;\n\t\n\tif (gentype == PyArray_SIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_INT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_INT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_INT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_INT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_INT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\n\t}\n\n\telse if (gentype == PyArray_UNSIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_UINT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_UINT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_UINT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_UINT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_UINT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t\tbreak;\n\t\t}\n\t}\n\telse if (gentype == PyArray_FLOATINGLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 4:\n\t\t\tnewtype = PyArray_FLOAT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_FLOAT64;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 10:\n\t\t\tnewtype = PyArray_FLOAT80;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 12:\n\t\t\tnewtype = PyArray_FLOAT96;\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_FLOAT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\t\n\telse if (gentype == PyArray_COMPLEXLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 8:\n\t\t\tnewtype = PyArray_COMPLEX64;\n\t\t\tbreak;\n\t\tcase 16:\n\t\t\tnewtype = PyArray_COMPLEX128;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 20:\n\t\t\tnewtype = PyArray_COMPLEX160;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 24:\n\t\t\tnewtype = PyArray_COMPLEX192;\t\t\t\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 32:\n\t\t\tnewtype = PyArray_COMPLEX256;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\n\treturn newtype;\n}\n\n\n/* this function takes a Python object which exposes the (single-segment)\n buffer interface and returns a pointer to the data segment\n \n You should increment the reference count by one of buf->base\n if you will hang on to a reference\n\n You only get a borrowed reference to the object. Do not free the\n memory...\n*/\n\n\nstatic int\nPyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf)\n{\n int buflen;\n\n buf->ptr = NULL;\n buf->flags = WRITEABLE;\n buf->base = NULL;\n\n\tif (obj == Py_None)\n\t\treturn PY_SUCCEED;\n\n if (PyObject_AsWriteBuffer(obj, &(buf->ptr), &buflen) < 0) {\n PyErr_Clear();\n buf->flags &= ~WRITEABLE;\n if (PyObject_AsReadBuffer(obj, (const void **)&(buf->ptr), \n &buflen) < 0)\n return PY_FAIL;\n }\n buf->len = (intp) buflen;\n \n /* Point to the base of the buffer object if present */\n if (PyBuffer_Check(obj)) buf->base = ((PyArray_Chunk *)obj)->base;\n if (buf->base == NULL) buf->base = obj;\n \n return PY_SUCCEED; \n}\n\n\n\n/* This function takes a Python sequence object and allocates and\n fills in an intp array with the converted values.\n\n **Remember to free the pointer seq.ptr when done using\n PyDimMem_FREE(seq.ptr)**\n*/\n\nstatic int\nPyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq)\n{\n int len;\n int nd;\n\n seq->ptr = NULL;\n if (obj == Py_None) return PY_SUCCEED;\n len = PySequence_Size(obj);\n if (len == -1) { /* Check to see if it is a number */\n if (PyNumber_Check(obj)) len = 1;\n }\n if (len < 0) {\n PyErr_SetString(PyExc_TypeError, \n \"Expected sequence object with len >= 0\");\n return PY_FAIL;\n }\n if (len > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError, \"Sequence too large, \" \\\n \"must be smaller than %d\", MAX_DIMS);\n return PY_FAIL;\n }\n\tif (len > 0) {\n\t\tseq->ptr = PyDimMem_NEW(len);\n\t\tif (seq->ptr == NULL) {\n\t\t\tPyErr_NoMemory();\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n seq->len = len;\n nd = PyArray_IntpFromSequence(obj, (intp *)seq->ptr, len);\n if (nd == -1 || nd != len) goto fail;\n return PY_SUCCEED;\n\n fail:\n\tPyDimMem_FREE(seq->ptr);\n\treturn PY_FAIL;\n}\n\n/* This function takes a Python object representing a type and converts it \n to a C type_num and an itemsize (elements of PyArray_Typecode structure)\n \n Many objects can be used to represent a type.\n */\n\nstatic int\nPyArray_TypecodeConverter(PyObject *obj, PyArray_Typecode *at)\n{\n char *type;\n PyArray_Descr *descr;\n int check_num=PyArray_NOTYPE+10;\n\tint len;\n\tPyObject *item, *attr=NULL;\n\n\tat->itemsize = 0;\n if (obj == Py_None) {\n at->type_num = PyArray_NOTYPE;\n return PY_SUCCEED;\n }\n\n if (PyType_Check(obj) && PyType_IsSubtype((PyTypeObject *)obj, \n &PyGenericArrType_Type)) {\n PyArray_TypecodeFromTypeObject(obj, at);\n return PY_SUCCEED;\n }\n\n\n\t/* type object could be an array */\n\tif (PyArray_Check(obj)) {\n\t\tat->type_num = PyArray_TYPE(obj);\n\t\tat->itemsize = PyArray_ITEMSIZE(obj);\n\t\treturn PY_SUCCEED;\n\t}\n\n\t/* or an array scalar */\n if (PyArray_IsScalar(obj, Generic)) {\n PyArray_TypecodeFromScalar(obj, at);\n return PY_SUCCEED;\n }\n\n\t/* or a typecode string */\n\n\tif (PyString_Check(obj)) {\n\t\t/* Check for a string typecode. */\n\t\ttype = PyString_AS_STRING(obj);\n\t\tlen = PyString_GET_SIZE(obj);\t\t\n\t\tif (len > 0) {\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tif (len > 1) {\n\t\t\tat->itemsize = atoi(type+1);\n\t\t\t/* When specifying length of UNICODE\n\t\t\t the number of characters is given to match \n\t\t\t the STRING interface. Each character can be\n\t\t\t more than one byte and itemsize must be\n\t\t\t the number of bytes.\n\t\t\t*/\n\t\t\tif (check_num == PyArray_UNICODELTR ||\t\\\n\t\t\t check_num == PyArray_UNICODE) \n\t\t\t at->itemsize *= sizeof(Py_UNICODE);\n\n\t\t\t/* Support for generic processing */\n\t\t\telse if ((check_num != PyArray_STRINGLTR) &&\n\t\t\t\t (check_num != PyArray_VOIDLTR) &&\n\t\t\t\t (check_num != PyArray_STRING) &&\n\t\t\t\t (check_num != PyArray_VOID)) {\n\t\t\t\tcheck_num = \\\n\t\t\t\t\tPyArray_TypestrConvert(at->itemsize, \n\t\t\t\t\t\t\t check_num);\n\t\t\t at->itemsize = 0;\n\t\t\t\tif (check_num == PyArray_NOTYPE) goto fail;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Arbitray object with dtypenum and itemsize attributes. */\n\telse if (PyObject_HasAttrString(obj, \"dtypenum\") && \n\t PyObject_HasAttrString(obj, \"itemsize\")) {\n\t\tattr = PyObject_GetAttrString(obj, \"dtypenum\");\n\t\tcheck_num = PyInt_AsLong(attr);\n\t\tif (PyErr_Occurred()) { /* not an integer, try character */\n\t\t\tPyErr_Clear();\n\t\t\ttype = PyString_AsString(attr);\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tPy_XDECREF(attr);\n\t\tif (!PyErr_Occurred()) {\n\t\t\tattr = PyObject_GetAttrString(obj, \"itemsize\");\n\t\t\tat->itemsize = PyInt_AsLong(attr);\n\t\t\tPy_XDECREF(attr);\n\t\t}\t\t\t\n\t}\t\t\n\telse if (PyType_Check(obj)) {\n\t\tcheck_num = PyArray_OBJECT;\n\t\tif (obj == (PyObject *)(&PyInt_Type)) \n\t\t\tcheck_num = PyArray_LONG;\n\t\telse if (obj == (PyObject *)(&PyBool_Type))\n\t\t\tcheck_num = PyArray_BOOL;\n\t\telse if (obj == (PyObject *)(&PyFloat_Type)) \n\t\t\tcheck_num = PyArray_DOUBLE;\n\t\telse if (obj == (PyObject *)(&PyComplex_Type)) \n\t\t\tcheck_num = PyArray_CDOUBLE;\n else if (obj == (PyObject *)(&PyString_Type))\n check_num = PyArray_STRING;\n else if (obj == (PyObject *)(&PyUnicode_Type))\n check_num = PyArray_UNICODE;\n\t}\t\n else { /* Default -- try integer conversion */\n check_num = PyInt_AsLong(obj);\n\t}\n\n\tif (PyErr_Occurred()) goto fail;\n\n\t/*\n\tif (check_num == PyArray_NOTYPE) return PY_FAIL;\n\t*/\n\tif (check_num == PyArray_NOTYPE) {\n\t\tat->type_num = PyArray_NOTYPE;\n\t\tat->itemsize = 0;\n\t\treturn PY_SUCCEED;\n\t}\n\n if ((descr = PyArray_DescrFromType(check_num))==NULL) {\n\t\t/* Now check to see if the object is registered\n\t\t in typeDict */\n\t\tif (typeDict != NULL) {\n\t\t\titem = PyDict_GetItem(typeDict, obj);\n\t\t\tif (item) {\n\t\t\t\tPyArray_TypecodeFromTypeObject(obj, at);\n\t\t\t\tPyErr_Clear();\n\t\t\t\treturn PY_SUCCEED;\n\t\t\t}\n\t\t}\n return PY_FAIL;\n\t}\n\t\n at->type_num = descr->type_num;\n\tif (at->itemsize == 0) at->itemsize = descr->elsize;\n\t\n return PY_SUCCEED;\n fail:\n\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\"data type not understood\");\n\treturn PY_FAIL;\n}\t\n\n\n/* This function returns true if the two typecodes are \n equivalent (same basic kind and same itemsize).\n*/\n\nstatic Bool\nPyArray_EquivalentTypes(PyArray_Typecode *typ1, PyArray_Typecode *typ2)\n{\n\tregister int typenum1=typ1->type_num;\n\tregister int typenum2=typ2->type_num;\n\tregister int size1=typ1->itemsize;\n\tregister int size2=typ2->itemsize;\n\n\tif (size1 != size2) return FALSE;\n\tif (typenum1==typenum2) return TRUE;\n\n\t/* If we are here then size1 == size2 */\n\tif (typenum1 < PyArray_FLOAT) {\n\t\tif (PyTypeNum_ISBOOL(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISBOOL(typenum2));\n\t\telse if (PyTypeNum_ISUNSIGNED(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISUNSIGNED(typenum2));\n\t\telse \n\t\t\treturn (Bool)(PyTypeNum_ISSIGNED(typenum2));\n\t}\n\telse {\n\t\tif (PyTypeNum_ISFLOAT(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISFLOAT(typenum2));\n\t\telse if (PyTypeNum_ISCOMPLEX(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISCOMPLEX(typenum2));\n\t}\n\t/* Default size1 != size2 and typenum1 != typenum2 */\n\treturn FALSE;\t\n}\n\nstatic Bool \nPyArray_EquivArrTypes(PyArrayObject *a1, PyArrayObject *a2)\n{\n PyArray_Typecode type1={PyArray_TYPE(a1), PyArray_ITEMSIZE(a1), 0};\n PyArray_Typecode type2={PyArray_TYPE(a2), PyArray_ITEMSIZE(a2), 0};\n \n return PyArray_EquivalentTypes(&type1, &type2);\n}\n\n\n/*** END C-API FUNCTIONS **/\n\n\n#define _ARET(x) PyArray_Return((PyArrayObject *)(x))\n\nstatic char doc_fromobject[] = \"array(object, dtype=None, copy=1, fortran=0) will return a new array formed from the given object type given. Object can anything with an __array__ method, or any (nested) sequence. If no type is given, then the type will be determined as the minimum type required to hold the objects in the sequence. If copy is zero and sequence is already an array with the right type, a reference will be returned. If the sequence is an array, type can be used only to upcast the array. For downcasting use .astype(t) method.\";\n\nstatic PyObject *\n_array_fromobject(PyObject *ignored, PyObject *args, PyObject *kws)\n{\n\tPyObject *op, *ret=NULL;\n\tstatic char *kwd[]= {\"object\", \"dtype\", \"copy\", \"fortran\", NULL};\n\tBool copy=TRUE;\n\tPyArray_Typecode type = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode oldtype = {PyArray_NOTYPE, 0, 0};\n\tint type_num;\n\tBool fortran=FALSE;\n\tint flags=0;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|O&O&O&\", kwd, &op, \n\t\t\t\t\tPyArray_TypecodeConverter,\n &type, \n\t\t\t\t\tPyArray_BoolConverter, ©, \n\t\t\t\t\tPyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\ttype_num = type.type_num;\n\n\t/* fast exit if simple call */\n\tif (PyArray_Check(op) && (copy==0) &&\t\t\t\\\n\t (fortran == PyArray_CHKFLAGS(op, FORTRAN))) {\n\t\tif (type_num == PyArray_NOTYPE) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t\t/* One more chance */\n\t\toldtype.type_num = PyArray_TYPE(op);\n\t\toldtype.itemsize = PyArray_ITEMSIZE(op);\n\t\tif (PyArray_EquivalentTypes(&oldtype, &type)) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t}\n\n\ttype.fortran = fortran; \n\tif (copy) {\n\t\tflags = ENSURECOPY;\n\t}\n\n\tif ((ret = PyArray_FromAny(op, &type, 0, 0, flags)) == NULL) \n\t\treturn NULL;\n\n\treturn _ARET(ret);\n}\n\nstatic PyObject *\nPyArray_Empty(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n \n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n PyArray_FillObjectArray(ret, Py_None);\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic char doc_empty[] = \"empty((d1,...,dn),dtype=intp,fortran=0) will return a new array\\n of shape (d1,...,dn) and given type with all its entries uninitialized. This can be faster than zeros.\";\n\nstatic PyObject *\narray_empty(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Empty(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_scalar[] = \"scalar(dtypestr,obj) will return a new scalar array of the given type initialized with obj. Mainly for pickle support. typestr must be a valid data typestr (complete with < > or |). If dtypestr is object, then obj can be any object, otherwise obj must be a string. If obj is not given it will be interpreted as None for object type and zeros for all other types.\";\n\nstatic PyObject *\narray_scalar(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"dtypestr\",\"obj\", NULL};\n\tPyArray_Typecode typecode;\n\tPyObject *obj=NULL;\n\tchar *typestr;\n\tint typestrlen;\n\tint swap, alloc=0;\n\tvoid *dptr;\n\tPyObject *ret;\n\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"z#|O\",\n\t\t\t\t\t kwlist, &typestr, &typestrlen,\n\t\t\t\t\t &obj)) \n\t\treturn NULL;\n\t\n\tif (_array_typecode_fromstr(typestr, &swap, &typecode) < 0) \n\t\treturn NULL;\n\t\n\tif (typecode.itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\t\t\\\n\t\t\t\t\"itemsize cannot be zero\");\n\t\treturn NULL;\n\t}\n\n\tif (typecode.type_num == PyArray_OBJECT) {\n\t\tif (obj == NULL) obj = Py_None;\n\t\tdptr = &obj;\n\t\tswap = 0;\n\t}\n\telse {\n\t\tif (obj == NULL) {\n\t\t\tdptr = malloc(typecode.itemsize);\n\t\t\tif (dptr == NULL) {\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tmemset(dptr, '\\0', typecode.itemsize);\n\t\t\talloc = 1;\n\t\t}\n\t\telse {\n\t\t\tif (!PyString_Check(obj)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"initializing object must \"\\\n\t\t\t\t\t\t\"be a string.\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (PyString_GET_SIZE(obj) < typecode.itemsize) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"initialization string is too\"\\\n\t\t\t\t\t\t\" small\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = PyString_AS_STRING(obj);\n\t\t}\n\t}\n\n\tret = PyArray_Scalar(dptr, typecode.type_num,\n\t\t\t typecode.itemsize, swap); \n\n\t/* free dptr which contains zeros */\n\tif (alloc) free(dptr);\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_Zeros(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n\t\tPyObject *zero = PyInt_FromLong(0);\n PyArray_FillObjectArray(ret, zero);\n Py_DECREF(zero);\n\t}\n\telse {\t\t\n\t\tmemset(ret->data, 0, n*(ret->itemsize));\n\t}\n\treturn (PyObject *)ret;\n\n}\n\nstatic char doc_zeros[] = \"zeros((d1,...,dn),dtype=intp,fortran=0) will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero.\";\n\n\nstatic PyObject *\narray_zeros(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Zeros(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_set_typeDict[] = \"set_typeDict(dict) set the internal \"\\\n\t\"dictionary that can look up an array type using a registered \"\\\n\t\"code\";\n\nstatic PyObject *\narray_set_typeDict(PyObject *ignored, PyObject *args)\n{\n\tPyObject *dict;\n\tif (!PyArg_ParseTuple(args, \"O\", &dict)) return NULL;\n\tPy_XDECREF(typeDict); /* Decrement old reference (if any)*/\n\ttypeDict = dict;\n\tPy_INCREF(dict); /* Create an internal reference to it */\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char doc_fromString[] = \"fromstring(string, dtype=intp, count=-1, swap=False) returns a new 1d array initialized from the raw binary data in string. If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.\";\n\nstatic PyObject *\narray_fromString(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyArrayObject *ret; \n\tchar *data;\n\tlonglong nin=-1;\n\tintp s, n;\n\tstatic char *kwlist[] = {\"string\", \"dtype\", \"count\", \"swap\",NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint itemsize;\n\tint swapped=FALSE;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"s#|O&LO&\", kwlist, \n\t\t\t\t\t &data, &s, \n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &swapped)) {\n\t\treturn NULL;\n\t}\n\t\n\tn = (intp) nin;\n\n\titemsize = type.itemsize;\n\tif (itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \"zero-valued itemsize.\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype.type_num, NULL, \n\t\t\t\t\t\tNULL, itemsize, 0,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\t\n\tmemcpy(ret->data, data, n*ret->itemsize);\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPyArray_INCREF(ret);\n\treturn (PyObject *)ret;\n}\n\n\n/* This needs an open file object and reads it in directly. \n memory-mapped files handled differently through buffer interface.\n\nfile pointer number in resulting 1d array \n(can easily reshape later, -1 for to end of file)\ntype of array\nsep is a separator string for character-based data (or NULL for binary)\n \" \" means whitespace\n*/\n\nstatic char doc_fromfile[] = \"\";\n\nstatic int\n_fill_in_itemsize(PyArray_Typecode *typecode)\n{\n\tPyArray_Descr *descr;\n\tdescr = PyArray_DescrFromType(typecode->type_num);\n\tif (descr==NULL) return -1;\n\ttypecode->itemsize = descr->elsize;\n\treturn 0;\n}\n\n\nstatic PyObject *\nPyArray_FromFile(FILE *fp, PyArray_Typecode *typecode, intp num, char *sep)\n{\n\tPyArrayObject *r;\n\tsize_t nread = 0;\n\tPyArray_ScanFunc *scan;\n\n\tif (typecode->itemsize == 0) {\n\t\tif (_fill_in_itemsize(typecode) < 0) \n\t\t\treturn NULL;\n\t}\n\n\tif (num == -1 && sep == NULL) { /* Get size for binary file*/\n\t\tintp start, numbytes;\n\t\tstart = (intp )ftell(fp);\n\t\tfseek(fp, 0, SEEK_END);\n\t\tnumbytes = (intp )ftell(fp) - start;\n\t\tfseek(fp, (long) start, SEEK_SET);\n\t\tif (numbytes == -1) {\n\t\t\tPyErr_SetString(PyExc_IOError, \"Could not seek in file.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tif (typecode->itemsize == 0) {\n\t\t\ttypecode->itemsize = numbytes;\n\t\t\tnum = 1;\n\t\t}\n\t\telse {\n\t\t\tnum = numbytes / typecode->itemsize;\n\t\t}\n\t}\n\t\n\tif (sep==NULL) { /* binary data */\n\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &num, \n\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t typecode->itemsize, 0, NULL);\n\t\tif (r==NULL) return NULL;\n\t\tnread = fread(r->data, typecode->itemsize, num, fp);\n\t}\n\telse { /* character reading */\n\t\tintp i;\n\t\tchar *dptr;\n\n\t\tif (num != -1) { /* number to read is known */\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &num, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = r->data;\n\t\t\tfor (i=0; i < num-1; i++) {\n\t\t\t\tif (scan(fp, dptr, r->itemsize, sep, NULL))\n\t\t\t\t\tbreak;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (!(scan(fp, dptr, r->itemsize, NULL, NULL)))\n\t\t\t\tnread += 1;\n\t\t}\n\t\telse { /* we have to watch for the end of the file and \n\t\t\t reallocate at the end */\n#define _FILEBUFNUM 4096\n\t\t\tintp thisbuf=0;\n\t\t\tintp size = _FILEBUFNUM;\n\t\t\tintp bytes;\n\t\t\tintp totalbytes;\n\t\t\tint done=0;\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &size, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\ttotalbytes = bytes = size * typecode->itemsize;\n\t\t\tdptr = r->data;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\twhile (!done) {\n\t\t\t\tdone = scan(fp, dptr, r->itemsize, sep, NULL);\n\t\t\t\t/* end of file reached trying to \n\t\t\t\t scan value \n\t\t\t\t*/\n\t\t\t\tif (done == 1 || done < 0) break;\n\t\t\t\n\t\t\t\tthisbuf += 1;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t\tif (!done && thisbuf == size) {\n\t\t\t\t\ttotalbytes += bytes;\n\t\t\t\t\tr->data = PyDataMem_RENEW(r->data, \n\t\t\t\t\t\t\t\t totalbytes);\n\t\t\t\t\tdptr = r->data + (totalbytes - bytes);\n\t\t\t\t\tthisbuf = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr->data = PyDataMem_RENEW(r->data, nread*r->itemsize);\n\t\t\tPyArray_DIM(r,0) = nread;\n\t\t\tnum = nread;\n#undef _FILEBUFNUM\n\t\t}\n\t}\n\tif (nread < num) {\n\t\tchar msg[80];\n\t\tsnprintf(msg, 80, \n\t\t\t \"%ld items requested only %ld read\", (long) num, \n (long) nread);\n\t\tif (PyErr_Warn(PyExc_RuntimeWarning, msg) < 0) {\n\t\t\tPy_DECREF(r);\n\t\t\treturn NULL;\n\t\t}\n\t\tr->data = PyDataMem_RENEW(r->data, nread * r->itemsize);\n\t\tPyArray_DIM(r,0) = nread;\n\t}\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_fromfile(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *file=NULL, *ret;\n\tFILE *fp;\n\tchar *sep=\"\";\n\tchar *mode=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"file\", \"dtype\", \"count\", \"sep\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Ls\", kwlist, \n\t\t\t\t\t &file,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &sep)) {\n\t\treturn NULL;\n\t}\n\n\tif (PyString_Check(file)) {\n\t\tif (sep == \"\") mode=\"rb\";\n\t\telse mode=\"r\";\n\t\tfile = PyFile_FromString(PyString_AS_STRING(file), mode);\n\t\tif (file==NULL) return NULL;\n\t}\n\telse {\n\t\tPy_INCREF(file);\n\t}\n\tfp = PyFile_AsFile(file);\n\tif (fp == NULL) {\n\t\tPyErr_SetString(PyExc_IOError, \"First argument must be an open file\");\n\t\tPy_DECREF(file);\n\t\treturn NULL;\n\t}\n\tret = PyArray_FromFile(fp, &type, (intp) nin, sep);\n\tPy_DECREF(file);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_FromBuffer(PyObject *buf, PyArray_Typecode *type, \n\t\t intp count, int swapped) \n{\n\tPyArrayObject *ret;\n\tchar *data;\n\tint ts;\n\tintp s, n;\n\tint itemsize;\n\tint write=1;\n\n\tif (type->type_num == PyArray_OBJECT) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Cannot create an OBJECT array from memory\"\\\n\t\t\t\t\" buffer.\");\n\t\treturn NULL;\n\t}\n\tif (type->itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Itemsize cannot be zero in type\");\n\t\treturn NULL;\n\t}\n\n\tif (PyObject_AsWriteBuffer(buf, (void *)&data, &ts)==-1) {\n\t\twrite = 0;\n\t\tPyErr_Clear();\n\t\tif (PyObject_AsReadBuffer(buf, (void *)&data, &ts)==-1) {\n\t\t\treturn NULL;\n\t\t}\n\t}\n\ts = (intp)ts;\t\n\tn = (intp)count;\n\titemsize = type->itemsize;\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype->type_num, NULL, \n\t\t\t\t\t\tdata, itemsize, DEFAULT_FLAGS,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\n\tif (!write) ret->flags &= ~WRITEABLE;\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPy_INCREF(buf);\n\t/* Store a reference for decref on deallocation */\n\tret->base = buf;\n\tPyArray_UpdateFlags(ret, ALIGNED);\n\treturn (PyObject *)ret; \t\n}\n\nstatic char doc_frombuffer[] = \"\";\n\nstatic PyObject *\narray_frombuffer(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *obj=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"buffer\", \"dtype\", \"count\", \n\t\t\t\t \"swap\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint swapped=0;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Li\", kwlist, \n\t\t\t\t\t &obj,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &swapped)) {\n\t\treturn NULL;\n\t}\n\n\treturn PyArray_FromBuffer(obj, &type, (intp)nin, swapped);\n}\n\n\n\nstatic char doc_concatenate[] = \"concatenate((a1,a2,...),axis=None).\";\n\nstatic PyObject *\narray_concatenate(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *a0;\n\tint axis=0;\n\tstatic char *kwlist[] = {\"seq\", \"axis\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist,\n\t\t\t\t\t &a0,\n\t\t\t\t\t PyArray_AxisConverter, &axis))\n\t\treturn NULL;\n\treturn PyArray_Concatenate(a0, axis);\n}\n\nstatic char doc_innerproduct[] = \\\n\t\"inner(a,b) returns the dot product of two arrays, which has\\n\"\\\n\t\"shape a.shape[:-1] + b.shape[:-1] with elements computed by\\n\" \\\n\t\"the product of the elements from the last dimensions of a and b.\";\n\nstatic PyObject *array_innerproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *b0, *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a0, &b0)) return NULL;\n\t\n\treturn _ARET(PyArray_InnerProduct(a0, b0));\n}\n\nstatic char doc_matrixproduct[] = \\\n\t\"dot(a,v) returns matrix-multiplication between a and b. \\n\"\\\n\t\"The product-sum is over the last dimension of a and the \\n\"\\\n\t\"second-to-last dimension of b.\";\n\nstatic PyObject *array_matrixproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *v, *a;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a, &v)) return NULL;\n\t\n\treturn _ARET(PyArray_MatrixProduct(a, v));\n}\n\nstatic char doc_fastCopyAndTranspose[] = \"_fastCopyAndTranspose(a)\";\n\nstatic PyObject *array_fastCopyAndTranspose(PyObject *dummy, PyObject *args) {\n\tPyObject *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &a0)) return NULL;\n\t\n\treturn _ARET(PyArray_CopyAndTranspose(a0));\n}\n\nstatic char doc_correlate[] = \"cross_correlate(a,v, mode=0)\";\n\nstatic PyObject *array_correlate(PyObject *dummy, PyObject *args, PyObject *kwds) {\n\tPyObject *shape, *a0;\n\tint mode=0;\n\tstatic char *kwlist[] = {\"a\", \"v\", \"mode\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|i\", kwlist, \n\t\t\t\t\t &a0, &shape, &mode)) return NULL;\n\t\n\treturn PyArray_Correlate(a0, shape, mode);\n}\n\n\nstatic PyObject *\nPyArray_Arange(double start, double stop, double step, int type_num)\n{\n\tintp length, i;\n\tPyObject *range;\n\tchar *rptr;\n\tint elsize, type;\n\tdouble value;\n\tPyArray_Descr *dbl_descr;\n\n\tlength = (intp ) ceil((stop - start)/step);\n \n\tif (length <= 0) {\n\t\tlength = 0;\n\t\treturn PyArray_New(&PyArray_Type, 1, &length, type_num,\n\t\t\t\t NULL, NULL, 0, 0, NULL);\n\t}\n\n\trange = PyArray_New(&PyArray_Type, 1, &length, type_num, \n\t\t\t NULL, NULL, 0, 0, NULL);\n\tif (range == NULL) return NULL;\n\tdbl_descr = PyArray_DescrFromType(PyArray_DOUBLE);\n \n\trptr = ((PyArrayObject *)range)->data;\n\telsize = ((PyArrayObject *)range)->itemsize;\n\ttype = ((PyArrayObject *)range)->descr->type_num;\n\tfor (i=0; i < length; i++) {\n\t\tvalue = start + i*step;\n\t\tdbl_descr->cast[type]((char*)&value, rptr, 1, NULL, \n\t\t\t\t (PyArrayObject *)range);\n\t\trptr += elsize;\n\t}\n \n\treturn range;\n}\n\n\nstatic char doc_arange[] = \"arange(start, stop=None, step=1, dtype=intp)\\n\\n Just like range() except it returns an array whose type can be\\n specified by the keyword argument typecode.\";\n\nstatic PyObject *\narray_arange(PyObject *ignored, PyObject *args, PyObject *kws) {\n\tPyObject *o_start=NULL, *o_stop=Py_None, *o_step=NULL;\n\tstatic char *kwd[]= {\"start\", \"stop\", \"step\", \"dtype\", NULL};\n\tdouble start, stop, step;\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0};\n\tint type_num;\n\tint deftype = PyArray_INTP;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|OOO&\", kwd, &o_start,\n\t\t\t\t\t&o_stop, &o_step, \n\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t&typecode)) \n\t\treturn NULL;\n\n\tdeftype = PyArray_ObjectType(o_start, deftype);\n\tif (o_stop != Py_None) {\n\t\tdeftype = PyArray_ObjectType(o_stop, deftype);\n\t}\n\tif (o_step != NULL) {\n\t\tdeftype = PyArray_ObjectType(o_step, deftype);\n\t}\n\n\ttype_num = typecode.type_num;\n\tif (type_num == PyArray_NOTYPE) {\n\t\ttype_num = deftype;\n\t}\n\n\tstart = PyFloat_AsDouble(o_start);\n\tif error_converting(start) return NULL;\n\n\tif (o_step == NULL) {\n\t\tstep = 1;\n\t}\n\telse {\n\t\tstep = PyFloat_AsDouble(o_step);\n\t\tif error_converting(step) return NULL;\n\t}\n\n\tif (o_stop == Py_None) {\n\t\tstop = start;\n\t\tstart = 0;\n\t}\n\telse {\n\t\tstop = PyFloat_AsDouble(o_stop);\n\t\tif error_converting(stop) return NULL;\n\t}\n\n\treturn PyArray_Arange(start, stop, step, type_num);\n}\n\n#undef _ARET\n\n/*****\n static char doc_arrayMap[] = \"arrayMap(func, [a1,...,an])\";\n\n static PyObject *array_arrayMap(PyObject *dummy, PyObject *args) {\n PyObject *shape, *a0;\n \n if (PyArg_ParseTuple(args, \"OO\", &a0, &shape) == NULL) return NULL;\n\t\n return PyArray_Map(a0, shape);\n }\n*****/\n\nstatic char \ndoc_set_string_function[] = \"set_string_function(f, repr=1) sets the python function f to be the function used to obtain a pretty printable string version of a array whenever a array is printed. f(M) should expect a array argument M, and should return a string consisting of the desired representation of M for printing.\";\n\nstatic PyObject *\narray_set_string_function(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *op;\n\tint repr=1;\n\tstatic char *kwlist[] = {\"f\", \"repr\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|i\", kwlist, \n\t\t\t\t\t&op, &repr)) return NULL; \n\tPyArray_SetStringFunction(op, repr);\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char \ndoc_set_ops_function[] = \"set_numeric_ops(op=func, ...) sets some or all of the number methods for all array objects. Don't forget **dict can be used as the argument list. Returns the functions that were replaced -- can be stored and set later.\";\n\nstatic PyObject *\narray_set_ops_function(PyObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *oldops=NULL;\n\t\n\tif ((oldops = PyArray_GetNumericOps())==NULL) return NULL;\n\n\t/* Should probably ensure that objects are at least callable */\n\t/* Leave this to the caller for now --- error will be raised\n\t later when use is attempted \n\t*/\n\tif (PyArray_SetNumericOps(kwds) == -1) {\n\t\tPy_DECREF(oldops);\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"One or more objects is not callable.\");\n\t\treturn NULL;\n\t}\n\treturn oldops;\n}\n\n\nstatic PyObject *\nPyArray_Where(PyObject *condition, PyObject *x, PyObject *y)\n{\n\tPyArrayObject *arr;\n\tPyObject *tup=NULL, *obj=NULL;\n\tPyObject *ret=NULL, *zero=NULL;\n\n\tif ((x==NULL) || (y==NULL)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"either both or neither\"\n\t\t\t\t\"of x and y should be given.\");\n\t\treturn NULL;\n\t}\n\n\tarr = (PyArrayObject *)PyArray_FromAny(condition, NULL, 0, 0, 0);\n\tif (arr == NULL) return NULL;\n\n\tif ((x==NULL) && (y==NULL)) {\n\t\tret = PyArray_Nonzero(arr);\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\n\n\tzero = PyInt_FromLong((long) 0);\n\n\tobj = PyArray_EnsureArray(PyArray_GenericBinaryFunction(arr, zero, n_ops.not_equal));\n\tPy_DECREF(zero);\n\tPy_DECREF(arr);\n\tif (obj == NULL) return NULL;\n\n\ttup = Py_BuildValue(\"(OO)\", y, x);\n\tif (tup == NULL) {Py_DECREF(obj); return NULL;}\n\n\tret = PyArray_Choose((PyAO *)obj, tup);\n\n\tPy_DECREF(obj);\n\tPy_DECREF(tup);\n\treturn ret;\n}\n\nstatic char doc_where[] = \"where(condition, | x, y) is shaped like condition\"\\\n\t\" and has elements of x and y where condition is respectively true or\"\\\n\t\" false. If x or y are not given, then it is equivalent to\"\\\n\t\" nonzero(condition).\";\n\nstatic PyObject *\narray_where(PyObject *ignored, PyObject *args)\n{\n\tPyObject *obj=NULL, *x=NULL, *y=NULL;\n\t\n\tif (!PyArg_ParseTuple(args, \"O|OO\", &obj, &x, &y)) return NULL;\n\n\treturn PyArray_Where(obj, x, y);\n\n}\n\nstatic char doc_register_dtype[] = \\\n\t\"register_dtype(a) registers a new type object -- gives it a typenum\";\n\nstatic PyObject *\narray_register_dtype(PyObject *dummy, PyObject *args)\n{\n\tPyObject *dtype;\n\tint ret;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &dtype)) return NULL;\n\t\n\tret = PyArray_RegisterDataType((PyTypeObject *)dtype);\n\tif (ret < 0)\n\t\treturn NULL;\n\treturn PyInt_FromLong((long) ret);\n}\n\nstatic char doc_can_cast_safely[] = \\\n\t\"can_cast_safely(from=d1, to=d2) returns True if data type d1 \"\\\n\t\"can be cast to data type d2 without losing precision.\";\n\nstatic PyObject *\narray_can_cast_safely(PyObject *dummy, PyObject *args, PyObject *kwds)\n{\n\tPyArray_Typecode d1={PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode d2={PyArray_NOTYPE, 0, 0};\n\tBool ret;\n\tPyObject *retobj;\n\tstatic char *kwlist[] = {\"from\", \"to\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O&O&\", kwlist, \n\t\t\t\t\tPyArray_TypecodeConverter, &d1,\n\t\t\t\t\tPyArray_TypecodeConverter, &d2))\n\t\treturn NULL;\n\tif (d1.type_num == PyArray_NOTYPE || \\\n\t d2.type_num == PyArray_NOTYPE) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"did not understand one of the types. \"\\\n\t\t\t\t\"'None' not accepted.\");\n\t\treturn NULL;\n\t}\n\t\t\n\tret = PyArray_CanCastTo(&d1, &d2);\n\tretobj = (ret ? Py_True : Py_False);\n\tPy_INCREF(retobj);\n\treturn retobj;\n}\n\n\nstatic struct PyMethodDef array_module_methods[] = {\n\t{\"set_string_function\", (PyCFunction)array_set_string_function, \n\t METH_VARARGS|METH_KEYWORDS, doc_set_string_function},\n\t{\"set_numeric_ops\", (PyCFunction)array_set_ops_function,\n\t METH_VARARGS|METH_KEYWORDS, doc_set_ops_function},\n\t{\"set_typeDict\", (PyCFunction)array_set_typeDict,\n\t METH_VARARGS, doc_set_typeDict},\n\n\t{\"array\",\t(PyCFunction)_array_fromobject, \n\t METH_VARARGS|METH_KEYWORDS, doc_fromobject},\n\t{\"arange\", (PyCFunction)array_arange, \n\t METH_VARARGS|METH_KEYWORDS, doc_arange},\n\t{\"zeros\",\t(PyCFunction)array_zeros, \n\t METH_VARARGS|METH_KEYWORDS, doc_zeros},\n\t{\"empty\",\t(PyCFunction)array_empty, \n\t METH_VARARGS|METH_KEYWORDS, doc_empty},\n\t{\"scalar\", (PyCFunction)array_scalar,\n\t METH_VARARGS|METH_KEYWORDS, doc_scalar},\n\t{\"where\", (PyCFunction)array_where,\n\t METH_VARARGS, doc_where},\n\t{\"fromstring\",(PyCFunction)array_fromString,\n\t METH_VARARGS|METH_KEYWORDS, doc_fromString},\n\t{\"concatenate\", (PyCFunction)array_concatenate, \n\t METH_VARARGS|METH_KEYWORDS, doc_concatenate},\n\t{\"inner\", (PyCFunction)array_innerproduct, \n\t METH_VARARGS, doc_innerproduct}, \n\t{\"dot\", (PyCFunction)array_matrixproduct, \n\t METH_VARARGS, doc_matrixproduct}, \n\t{\"_fastCopyAndTranspose\", (PyCFunction)array_fastCopyAndTranspose, \n\t METH_VARARGS, doc_fastCopyAndTranspose},\n\t{\"correlate\", (PyCFunction)array_correlate, \n\t METH_VARARGS | METH_KEYWORDS, doc_correlate},\n\t{\"frombuffer\", (PyCFunction)array_frombuffer,\n\t METH_VARARGS | METH_KEYWORDS, doc_frombuffer},\n\t{\"fromfile\", (PyCFunction)array_fromfile,\n\t METH_VARARGS | METH_KEYWORDS, doc_fromfile},\n\t{\"register_dtype\", (PyCFunction)array_register_dtype,\n\t METH_VARARGS, doc_register_dtype},\n\t{\"can_cast\", (PyCFunction)array_can_cast_safely,\n\t METH_VARARGS | METH_KEYWORDS, doc_can_cast_safely},\t\t\n\t/* {\"arrayMap\",\t(PyCFunction)array_arrayMap, \n\t METH_VARARGS, doc_arrayMap},*/\n\t\n\t{NULL,\t\tNULL, 0}\t\t/* sentinel */\n};\n\n#include \"__multiarray_api.c\"\n\n/* Establish scalar-type hierarchy */\n\n/* For dual inheritance we need to make sure that the objects being\n inherited from have the tp->mro object initialized. This is\n not necessarily true for the basic type objects of Python (it is \n checked for single inheritance but not dual in PyType_Ready).\n\n Thus, we call PyType_Ready on the standard Python Types, here.\n*/ \nstatic int\nsetup_scalartypes(PyObject *dict)\n{\n\n\tinitialize_numeric_types();\n\n if (PyType_Ready(&PyBool_Type) < 0) return -1;\n if (PyType_Ready(&PyInt_Type) < 0) return -1;\n if (PyType_Ready(&PyFloat_Type) < 0) return -1;\n if (PyType_Ready(&PyComplex_Type) < 0) return -1;\n if (PyType_Ready(&PyString_Type) < 0) return -1;\n if (PyType_Ready(&PyUnicode_Type) < 0) return -1;\n\n#define SINGLE_INHERIT(child, parent) \\\n Py##child##ArrType_Type.tp_base = &Py##parent##ArrType_Type;\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) {\t\t\\\n PyErr_Print(); \\\n PyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Tyupe\", \\\n #child); \\\n return -1;\t\t\t\t\t\t\\\n }\n \n if (PyType_Ready(&PyGenericArrType_Type) < 0)\n return -1;\n\n SINGLE_INHERIT(Numeric, Generic);\n SINGLE_INHERIT(Integer, Numeric);\n SINGLE_INHERIT(Inexact, Numeric);\n SINGLE_INHERIT(SignedInteger, Integer);\n SINGLE_INHERIT(UnsignedInteger, Integer);\n SINGLE_INHERIT(Floating, Inexact);\n SINGLE_INHERIT(ComplexFloating, Inexact);\n SINGLE_INHERIT(Flexible, Generic);\n SINGLE_INHERIT(Character, Flexible);\n\t\n#define DUAL_INHERIT(child, parent1, parent2) \\\n Py##child##ArrType_Type.tp_base = &Py##parent2##ArrType_Type;\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent2##ArrType_Type,\t\\\n\t\t\t &Py##parent1##_Type);\t\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n#define DUAL_INHERIT2(child, parent1, parent2)\t\t\t\t\\\n Py##child##ArrType_Type.tp_base = &Py##parent1##_Type;\t\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent1##_Type,\t\t\\\n\t\t\t &Py##parent2##ArrType_Type);\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n SINGLE_INHERIT(Bool, Generic);\n SINGLE_INHERIT(Byte, SignedInteger);\n SINGLE_INHERIT(Short, SignedInteger);\n#if SIZEOF_INT == SIZEOF_LONG\n DUAL_INHERIT(Int, Int, SignedInteger);\n#else\n SINGLE_INHERIT(Int, SignedInteger);\n#endif\n DUAL_INHERIT(Long, Int, SignedInteger);\n SINGLE_INHERIT(LongLong, SignedInteger);\n\n SINGLE_INHERIT(UByte, UnsignedInteger);\n SINGLE_INHERIT(UShort, UnsignedInteger);\n SINGLE_INHERIT(UInt, UnsignedInteger);\n SINGLE_INHERIT(ULong, UnsignedInteger);\n SINGLE_INHERIT(ULongLong, UnsignedInteger);\n\n SINGLE_INHERIT(Float, Floating);\n DUAL_INHERIT(Double, Float, Floating);\n SINGLE_INHERIT(LongDouble, Floating);\n\n SINGLE_INHERIT(CFloat, ComplexFloating);\n DUAL_INHERIT(CDouble, Complex, ComplexFloating);\n SINGLE_INHERIT(CLongDouble, ComplexFloating);\n\n DUAL_INHERIT2(String, String, Character);\n DUAL_INHERIT2(Unicode, Unicode, Character);\n\t\n SINGLE_INHERIT(Void, Flexible);\n \n SINGLE_INHERIT(Object, Generic);\n\n return 0;\n\n#undef SINGLE_INHERIT\n#undef DUAL_INHERIT\n\n\t/* Clean up string and unicode array types so they act more like\n\t strings -- get their tables from the standard types.\n\t \n\t \n\t*/\n}\n\n/* place a flag dictionary in d */\n\nstatic void\nset_flaginfo(PyObject *d)\n{\n PyObject *s;\n PyObject *newd;\n \n newd = PyDict_New();\n\n PyDict_SetItemString(newd, \"OWNDATA\", s=PyInt_FromLong(OWNDATA));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"FORTRAN\", s=PyInt_FromLong(FORTRAN));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"CONTIGUOUS\", s=PyInt_FromLong(CONTIGUOUS));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"ALIGNED\", s=PyInt_FromLong(ALIGNED));\n Py_DECREF(s);\n\n PyDict_SetItemString(newd, \"NOTSWAPPED\", s=PyInt_FromLong(NOTSWAPPED));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"UPDATEIFCOPY\", s=PyInt_FromLong(UPDATEIFCOPY));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"WRITEABLE\", s=PyInt_FromLong(WRITEABLE));\n Py_DECREF(s);\n \n PyDict_SetItemString(d, \"_flagdict\", newd);\n Py_DECREF(newd);\n return;\n}\n\n\n/* Initialization function for the module */\n\nDL_EXPORT(void) initmultiarray(void) {\n\tPyObject *m, *d, *s;\n\tPyObject *c_api;\n\t\n\t/* Create the module and add the functions */\n\tm = Py_InitModule(\"multiarray\", array_module_methods);\n\tif (!m) goto err;\n\n\t/* Add some symbolic constants to the module */\n\td = PyModule_GetDict(m);\n\tif (!d) goto err; \n\n\t/* Create the module and add the functions */\n\tif (PyType_Ready(&PyBigArray_Type) < 0) \n\t\treturn;\n\n PyArray_Type.tp_base = &PyBigArray_Type;\n\n PyArray_Type.tp_as_mapping = &array_as_mapping;\n\t/* Even though, this would be inherited, it needs to be set now\n\t so that the __getitem__ will map to the as_mapping descriptor\n\t*/\n PyArray_Type.tp_as_number = &array_as_number; \n\t/* For good measure */\n\tPyArray_Type.tp_as_sequence = &array_as_sequence;\n\tPyArray_Type.tp_as_buffer = &array_as_buffer;\t\n PyArray_Type.tp_flags = (Py_TPFLAGS_DEFAULT \n\t\t\t\t | Py_TPFLAGS_BASETYPE\n\t\t\t\t | Py_TPFLAGS_CHECKTYPES);\n PyArray_Type.tp_doc = Arraytype__doc__;\n\n\tif (PyType_Ready(&PyArray_Type) < 0)\n return;\n\n if (setup_scalartypes(d) < 0) goto err;\n\n\tif (PyType_Ready(&PyArrayIter_Type) < 0)\n\t\treturn; \n \n\tif (PyType_Ready(&PyArrayMapIter_Type) < 0)\n return; \n\n\tc_api = PyCObject_FromVoidPtr((void *)PyArray_API, NULL);\n\tif (PyErr_Occurred()) goto err;\n\tPyDict_SetItemString(d, \"_ARRAY_API\", c_api);\n\tPy_DECREF(c_api);\n\tif (PyErr_Occurred()) goto err;\n\n\tMultiArrayError = PyString_FromString (\"multiarray.error\");\n\tPyDict_SetItemString (d, \"error\", MultiArrayError);\n\t\n\ts = PyString_FromString(\"3.0\");\n\tPyDict_SetItemString(d, \"__version__\", s);\n\tPy_DECREF(s);\n Py_INCREF(&PyBigArray_Type);\n\tPyDict_SetItemString(d, \"bigndarray\", (PyObject *)&PyBigArray_Type);\n Py_INCREF(&PyArray_Type);\n\tPyDict_SetItemString(d, \"ndarray\", (PyObject *)&PyArray_Type);\n Py_INCREF(&PyArrayIter_Type);\n\tPyDict_SetItemString(d, \"flatiter\", (PyObject *)&PyArrayIter_Type);\n Py_INCREF(&PyArrayMapIter_Type);\n\tPyDict_SetItemString(d, \"mapiter\", (PyObject *)&PyArrayMapIter_Type);\n\n set_flaginfo(d);\n\n\tif (set_typeinfo(d) == 0) \n return; /* otherwise there is an error */\n\n\n err:\t\n\t/* Check for errors */\n\tif (PyErr_Occurred())\n PyErr_Print();\n\t\tPy_FatalError(\"can't initialize module multiarray\");\n\n\treturn;\n}\n\n", "methods": [ { "name": "PyArray_MultiplyList", "long_name": "PyArray_MultiplyList( intp * l1 , int n)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 2, "token_count": 42, "parameters": [ "l1", "n" ], "start_line": 51, "end_line": 57, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_AxisConverter", "long_name": "PyArray_AxisConverter( PyObject * obj , int * axis)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 53, "parameters": [ "obj", "axis" ], "start_line": 61, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_CompareLists", "long_name": "PyArray_CompareLists( intp * l1 , intp * l2 , int n)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 3, "token_count": 51, "parameters": [ "l1", "l2", "n" ], "start_line": 76, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_View", "long_name": "PyArray_View( PyArrayObject * self , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 9, "token_count": 241, "parameters": [ "self", "type" ], "start_line": 86, "end_line": 134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "PyArray_Ravel", "long_name": "PyArray_Ravel( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 14, "complexity": 4, "token_count": 87, "parameters": [ "a", "fortran" ], "start_line": 137, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "PyArray_Flatten", "long_name": "PyArray_Flatten( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 32, "complexity": 5, "token_count": 158, "parameters": [ "a", "fortran" ], "start_line": 154, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Reshape", "long_name": "PyArray_Reshape( PyArrayObject * self , PyObject * shape)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 53, "parameters": [ "self", "shape" ], "start_line": 195, "end_line": 204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Newshape", "long_name": "PyArray_Newshape( PyArrayObject * self , PyArray_Dims * newdims)", "filename": "multiarraymodule.c", "nloc": 68, "complexity": 15, "token_count": 362, "parameters": [ "self", "newdims" ], "start_line": 212, "end_line": 291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 80, "top_nesting_level": 0 }, { "name": "PyArray_Squeeze", "long_name": "PyArray_Squeeze( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 4, "token_count": 188, "parameters": [ "self" ], "start_line": 299, "end_line": 330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyArray_Mean", "long_name": "PyArray_Mean( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 19, "complexity": 4, "token_count": 139, "parameters": [ "self", "axis", "rtype" ], "start_line": 334, "end_line": 355, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_Std", "long_name": "PyArray_Std( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 43, "complexity": 12, "token_count": 433, "parameters": [ "self", "axis", "rtype" ], "start_line": 358, "end_line": 413, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_Sum", "long_name": "PyArray_Sum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 417, "end_line": 427, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Prod", "long_name": "PyArray_Prod( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 430, "end_line": 440, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumSum", "long_name": "PyArray_CumSum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 443, "end_line": 453, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumProd", "long_name": "PyArray_CumProd( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 456, "end_line": 467, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Any", "long_name": "PyArray_Any( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 470, "end_line": 481, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_All", "long_name": "PyArray_All( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 484, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Compress", "long_name": "PyArray_Compress( PyArrayObject * self , PyObject * condition , int axis)", "filename": "multiarraymodule.c", "nloc": 18, "complexity": 3, "token_count": 110, "parameters": [ "self", "condition", "axis" ], "start_line": 499, "end_line": 519, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_Nonzero", "long_name": "PyArray_Nonzero( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 13, "token_count": 395, "parameters": [ "self" ], "start_line": 522, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "PyArray_Clip", "long_name": "PyArray_Clip( PyArrayObject * self , PyObject * min , PyObject * max)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 6, "token_count": 241, "parameters": [ "self", "min", "max" ], "start_line": 583, "end_line": 616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Conjugate", "long_name": "PyArray_Conjugate( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 9, "token_count": 225, "parameters": [ "self" ], "start_line": 619, "end_line": 655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_Trace", "long_name": "PyArray_Trace( PyArrayObject * self , int offset , int axis1 , int axis2 , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 81, "parameters": [ "self", "offset", "axis1", "axis2", "rtype" ], "start_line": 658, "end_line": 668, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Diagonal", "long_name": "PyArray_Diagonal( PyArrayObject * self , int offset , int axis1 , int axis2)", "filename": "multiarraymodule.c", "nloc": 104, "complexity": 24, "token_count": 798, "parameters": [ "self", "offset", "axis1", "axis2" ], "start_line": 671, "end_line": 789, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 119, "top_nesting_level": 0 }, { "name": "PyArray_AsCArray", "long_name": "PyArray_AsCArray( PyObject ** op , * ptr , intp * dims , int nd , int type_num)", "filename": "multiarraymodule.c", "nloc": 54, "complexity": 13, "token_count": 426, "parameters": [ "op", "ptr", "dims", "nd", "type_num" ], "start_line": 806, "end_line": 861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_As1D", "long_name": "PyArray_As1D( PyObject ** op , char ** ptr , int * d1 , int typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 60, "parameters": [ "op", "ptr", "d1", "typecode" ], "start_line": 866, "end_line": 874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_As2D", "long_name": "PyArray_As2D( PyObject ** op , char ** * ptr , int * d1 , int * d2 , int typecode)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 81, "parameters": [ "op", "ptr", "d1", "d2", "typecode" ], "start_line": 878, "end_line": 888, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Free", "long_name": "PyArray_Free( PyObject * op , * ptr)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 4, "token_count": 67, "parameters": [ "op", "ptr" ], "start_line": 893, "end_line": 904, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "_swap_and_concat", "long_name": "_swap_and_concat( PyObject * op , int axis , int n)", "filename": "multiarraymodule.c", "nloc": 27, "complexity": 6, "token_count": 185, "parameters": [ "op", "axis", "n" ], "start_line": 908, "end_line": 936, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_Concatenate", "long_name": "PyArray_Concatenate( PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 112, "complexity": 24, "token_count": 761, "parameters": [ "op", "axis" ], "start_line": 945, "end_line": 1071, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 127, "top_nesting_level": 0 }, { "name": "PyArray_SwapAxes", "long_name": "PyArray_SwapAxes( PyArrayObject * ap , int a1 , int a2)", "filename": "multiarraymodule.c", "nloc": 37, "complexity": 12, "token_count": 227, "parameters": [ "ap", "a1", "a2" ], "start_line": 1074, "end_line": 1113, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_Transpose", "long_name": "PyArray_Transpose( PyArrayObject * ap , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 49, "complexity": 15, "token_count": 399, "parameters": [ "ap", "op" ], "start_line": 1117, "end_line": 1176, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "PyArray_Repeat", "long_name": "PyArray_Repeat( PyArrayObject * aop , PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 75, "complexity": 15, "token_count": 516, "parameters": [ "aop", "op", "axis" ], "start_line": 1179, "end_line": 1271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 93, "top_nesting_level": 0 }, { "name": "PyArray_Choose", "long_name": "PyArray_Choose( PyArrayObject * ip , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 89, "complexity": 18, "token_count": 646, "parameters": [ "ip", "op" ], "start_line": 1275, "end_line": 1387, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 113, "top_nesting_level": 0 }, { "name": "qsortCompare", "long_name": "qsortCompare( const * a , const * b)", "filename": "multiarraymodule.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "a", "b" ], "start_line": 1395, "end_line": 1398, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "PyArray_Sort", "long_name": "PyArray_Sort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 7, "token_count": 250, "parameters": [ "op", "axis" ], "start_line": 1420, "end_line": 1469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "argsort_static_compare", "long_name": "argsort_static_compare( const * ip1 , const * ip2)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 1, "token_count": 63, "parameters": [ "ip1", "ip2" ], "start_line": 1475, "end_line": 1483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_ArgSort", "long_name": "PyArray_ArgSort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 48, "complexity": 8, "token_count": 346, "parameters": [ "op", "axis" ], "start_line": 1486, "end_line": 1545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "local_where", "long_name": "local_where( PyArrayObject * ap1 , PyArrayObject * ap2 , PyArrayObject * ret)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 7, "token_count": 243, "parameters": [ "ap1", "ap2", "ret" ], "start_line": 1548, "end_line": 1583, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_SearchSorted", "long_name": "PyArray_SearchSorted( PyArrayObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 33, "complexity": 5, "token_count": 219, "parameters": [ "op1", "op2" ], "start_line": 1586, "end_line": 1631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "PyArray_InnerProduct", "long_name": "PyArray_InnerProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 82, "complexity": 17, "token_count": 653, "parameters": [ "op1", "op2" ], "start_line": 1639, "end_line": 1741, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 103, "top_nesting_level": 0 }, { "name": "PyArray_MatrixProduct", "long_name": "PyArray_MatrixProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 98, "complexity": 20, "token_count": 756, "parameters": [ "op1", "op2" ], "start_line": 1746, "end_line": 1867, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 122, "top_nesting_level": 0 }, { "name": "PyArray_CopyAndTranspose", "long_name": "PyArray_CopyAndTranspose( PyObject * op)", "filename": "multiarraymodule.c", "nloc": 44, "complexity": 6, "token_count": 282, "parameters": [ "op" ], "start_line": 1870, "end_line": 1921, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "PyArray_Correlate", "long_name": "PyArray_Correlate( PyObject * op1 , PyObject * op2 , int mode)", "filename": "multiarraymodule.c", "nloc": 86, "complexity": 13, "token_count": 598, "parameters": [ "op1", "op2", "mode" ], "start_line": 1924, "end_line": 2019, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "PyArray_ArgMin", "long_name": "PyArray_ArgMin( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 5, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2022, "end_line": 2047, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_Max", "long_name": "PyArray_Max( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2050, "end_line": 2061, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Min", "long_name": "PyArray_Min( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2064, "end_line": 2075, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Ptp", "long_name": "PyArray_Ptp( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 4, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2078, "end_line": 2101, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "PyArray_ArgMax", "long_name": "PyArray_ArgMax( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 46, "complexity": 7, "token_count": 318, "parameters": [ "op", "axis" ], "start_line": 2105, "end_line": 2161, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 57, "top_nesting_level": 0 }, { "name": "PyArray_Take", "long_name": "PyArray_Take( PyArrayObject * self0 , PyObject * indices0 , int axis)", "filename": "multiarraymodule.c", "nloc": 61, "complexity": 12, "token_count": 464, "parameters": [ "self0", "indices0", "axis" ], "start_line": 2165, "end_line": 2236, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_Put", "long_name": "PyArray_Put( PyArrayObject * self , PyObject * indices0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 47, "complexity": 10, "token_count": 319, "parameters": [ "self", "indices0", "values0" ], "start_line": 2239, "end_line": 2291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "PyArray_PutMask", "long_name": "PyArray_PutMask( PyArrayObject * self , PyObject * mask0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 10, "token_count": 334, "parameters": [ "self", "mask0", "values0" ], "start_line": 2294, "end_line": 2356, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_Converter", "long_name": "PyArray_Converter( PyObject * object , PyObject ** address)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 66, "parameters": [ "object", "address" ], "start_line": 2368, "end_line": 2380, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_BoolConverter", "long_name": "PyArray_BoolConverter( PyObject * object , Bool * val)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 3, "token_count": 42, "parameters": [ "object", "val" ], "start_line": 2383, "end_line": 2389, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_TypestrConvert", "long_name": "PyArray_TypestrConvert( int itemsize , int gentype)", "filename": "multiarraymodule.c", "nloc": 90, "complexity": 33, "token_count": 284, "parameters": [ "itemsize", "gentype" ], "start_line": 2393, "end_line": 2502, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "PyArray_BufferConverter", "long_name": "PyArray_BufferConverter( PyObject * obj , PyArray_Chunk * buf)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 6, "token_count": 147, "parameters": [ "obj", "buf" ], "start_line": 2517, "end_line": 2542, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_IntpConverter", "long_name": "PyArray_IntpConverter( PyObject * obj , PyArray_Dims * seq)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 10, "token_count": 186, "parameters": [ "obj", "seq" ], "start_line": 2554, "end_line": 2590, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_TypecodeConverter", "long_name": "PyArray_TypecodeConverter( PyObject * obj , PyArray_Typecode * at)", "filename": "multiarraymodule.c", "nloc": 108, "complexity": 33, "token_count": 639, "parameters": [ "obj", "at" ], "start_line": 2599, "end_line": 2737, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "PyArray_EquivalentTypes", "long_name": "PyArray_EquivalentTypes( PyArray_Typecode * typ1 , PyArray_Typecode * typ2)", "filename": "multiarraymodule.c", "nloc": 24, "complexity": 8, "token_count": 162, "parameters": [ "typ1", "typ2" ], "start_line": 2745, "end_line": 2772, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyArray_EquivArrTypes", "long_name": "PyArray_EquivArrTypes( PyArrayObject * a1 , PyArrayObject * a2)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 1, "token_count": 56, "parameters": [ "a1", "a2" ], "start_line": 2775, "end_line": 2781, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "_array_fromobject", "long_name": "_array_fromobject( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 38, "complexity": 9, "token_count": 254, "parameters": [ "ignored", "args", "kws" ], "start_line": 2792, "end_line": 2836, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_Empty", "long_name": "PyArray_Empty( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 15, "complexity": 3, "token_count": 99, "parameters": [ "nd", "dims", "type" ], "start_line": 2839, "end_line": 2855, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "array_empty", "long_name": "array_empty( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2861, "end_line": 2885, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_scalar", "long_name": "array_scalar( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 11, "token_count": 290, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2890, "end_line": 2954, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 65, "top_nesting_level": 0 }, { "name": "PyArray_Zeros", "long_name": "PyArray_Zeros( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 3, "token_count": 133, "parameters": [ "nd", "dims", "type" ], "start_line": 2958, "end_line": 2980, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_zeros", "long_name": "array_zeros( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2986, "end_line": 3010, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_set_typeDict", "long_name": "array_set_typeDict( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "ignored", "args" ], "start_line": 3017, "end_line": 3026, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_fromString", "long_name": "array_fromString( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 8, "token_count": 283, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3031, "end_line": 3086, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "_fill_in_itemsize", "long_name": "_fill_in_itemsize( PyArray_Typecode * typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 42, "parameters": [ "typecode" ], "start_line": 3102, "end_line": 3109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_FromFile", "long_name": "PyArray_FromFile( FILE * fp , PyArray_Typecode * typecode , intp num , char * sep)", "filename": "multiarraymodule.c", "nloc": 130, "complexity": 26, "token_count": 764, "parameters": [ "fp", "typecode", "num", "sep" ], "start_line": 3113, "end_line": 3253, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 141, "top_nesting_level": 0 }, { "name": "array_fromfile", "long_name": "array_fromfile( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 34, "complexity": 6, "token_count": 221, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3256, "end_line": 3291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_FromBuffer", "long_name": "PyArray_FromBuffer( PyObject * buf , PyArray_Typecode * type , intp count , int swapped)", "filename": "multiarraymodule.c", "nloc": 58, "complexity": 11, "token_count": 306, "parameters": [ "buf", "type", "count", "swapped" ], "start_line": 3294, "end_line": 3357, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "array_frombuffer", "long_name": "array_frombuffer( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 16, "complexity": 2, "token_count": 115, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3362, "end_line": 3379, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_concatenate", "long_name": "array_concatenate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 73, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3386, "end_line": 3397, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_innerproduct", "long_name": "array_innerproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3404, "end_line": 3410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_matrixproduct", "long_name": "array_matrixproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3417, "end_line": 3423, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_fastCopyAndTranspose", "long_name": "array_fastCopyAndTranspose( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 41, "parameters": [ "dummy", "args" ], "start_line": 3427, "end_line": 3433, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_correlate", "long_name": "array_correlate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 81, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3437, "end_line": 3446, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Arange", "long_name": "PyArray_Arange( double start , double stop , double step , int type_num)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 4, "token_count": 229, "parameters": [ "start", "stop", "step", "type_num" ], "start_line": 3450, "end_line": 3483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_arange", "long_name": "array_arange( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 10, "token_count": 258, "parameters": [ "ignored", "args", "kws" ], "start_line": 3489, "end_line": 3537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "array_set_string_function", "long_name": "array_set_string_function( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 78, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3557, "end_line": 3568, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_set_ops_function", "long_name": "array_set_ops_function( PyObject * self , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 12, "complexity": 3, "token_count": 67, "parameters": [ "self", "args", "kwds" ], "start_line": 3574, "end_line": 3591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Where", "long_name": "PyArray_Where( PyObject * condition , PyObject * x , PyObject * y)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 8, "token_count": 226, "parameters": [ "condition", "x", "y" ], "start_line": 3595, "end_line": 3631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "array_where", "long_name": "array_where( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 2, "token_count": 60, "parameters": [ "ignored", "args" ], "start_line": 3639, "end_line": 3647, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_register_dtype", "long_name": "array_register_dtype( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 3, "token_count": 64, "parameters": [ "dummy", "args" ], "start_line": 3653, "end_line": 3664, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_can_cast_safely", "long_name": "array_can_cast_safely( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 5, "token_count": 145, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3671, "end_line": 3695, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "setup_scalartypes", "long_name": "setup_scalartypes( PyObject * dict)", "filename": "multiarraymodule.c", "nloc": 45, "complexity": 10, "token_count": 351, "parameters": [ "dict" ], "start_line": 3756, "end_line": 3865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "set_flaginfo", "long_name": "set_flaginfo( PyObject * d)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 1, "token_count": 171, "parameters": [ "d" ], "start_line": 3870, "end_line": 3896, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "initmultiarray", "long_name": "initmultiarray()", "filename": "multiarraymodule.c", "nloc": 52, "complexity": 12, "token_count": 361, "parameters": [], "start_line": 3901, "end_line": 3977, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyArray_MultiplyList", "long_name": "PyArray_MultiplyList( intp * l1 , int n)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 2, "token_count": 42, "parameters": [ "l1", "n" ], "start_line": 51, "end_line": 57, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_AxisConverter", "long_name": "PyArray_AxisConverter( PyObject * obj , int * axis)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 53, "parameters": [ "obj", "axis" ], "start_line": 61, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_CompareLists", "long_name": "PyArray_CompareLists( intp * l1 , intp * l2 , int n)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 3, "token_count": 51, "parameters": [ "l1", "l2", "n" ], "start_line": 76, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_View", "long_name": "PyArray_View( PyArrayObject * self , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 9, "token_count": 241, "parameters": [ "self", "type" ], "start_line": 86, "end_line": 134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "PyArray_Ravel", "long_name": "PyArray_Ravel( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 14, "complexity": 4, "token_count": 87, "parameters": [ "a", "fortran" ], "start_line": 137, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "PyArray_Flatten", "long_name": "PyArray_Flatten( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 32, "complexity": 5, "token_count": 158, "parameters": [ "a", "fortran" ], "start_line": 154, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Reshape", "long_name": "PyArray_Reshape( PyArrayObject * self , PyObject * shape)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 53, "parameters": [ "self", "shape" ], "start_line": 195, "end_line": 204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Newshape", "long_name": "PyArray_Newshape( PyArrayObject * self , PyArray_Dims * newdims)", "filename": "multiarraymodule.c", "nloc": 68, "complexity": 15, "token_count": 362, "parameters": [ "self", "newdims" ], "start_line": 212, "end_line": 291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 80, "top_nesting_level": 0 }, { "name": "PyArray_Squeeze", "long_name": "PyArray_Squeeze( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 4, "token_count": 188, "parameters": [ "self" ], "start_line": 299, "end_line": 330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyArray_Mean", "long_name": "PyArray_Mean( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 19, "complexity": 4, "token_count": 139, "parameters": [ "self", "axis", "rtype" ], "start_line": 334, "end_line": 355, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_Std", "long_name": "PyArray_Std( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 43, "complexity": 12, "token_count": 433, "parameters": [ "self", "axis", "rtype" ], "start_line": 358, "end_line": 413, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_Sum", "long_name": "PyArray_Sum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 417, "end_line": 427, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Prod", "long_name": "PyArray_Prod( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 430, "end_line": 440, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumSum", "long_name": "PyArray_CumSum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 443, "end_line": 453, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumProd", "long_name": "PyArray_CumProd( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 456, "end_line": 467, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Any", "long_name": "PyArray_Any( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 470, "end_line": 481, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_All", "long_name": "PyArray_All( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 484, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Compress", "long_name": "PyArray_Compress( PyArrayObject * self , PyObject * condition , int axis)", "filename": "multiarraymodule.c", "nloc": 18, "complexity": 3, "token_count": 110, "parameters": [ "self", "condition", "axis" ], "start_line": 499, "end_line": 519, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_Nonzero", "long_name": "PyArray_Nonzero( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 13, "token_count": 395, "parameters": [ "self" ], "start_line": 522, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "PyArray_Clip", "long_name": "PyArray_Clip( PyArrayObject * self , PyObject * min , PyObject * max)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 6, "token_count": 241, "parameters": [ "self", "min", "max" ], "start_line": 583, "end_line": 616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Conjugate", "long_name": "PyArray_Conjugate( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 9, "token_count": 225, "parameters": [ "self" ], "start_line": 619, "end_line": 655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_Trace", "long_name": "PyArray_Trace( PyArrayObject * self , int offset , int axis1 , int axis2 , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 81, "parameters": [ "self", "offset", "axis1", "axis2", "rtype" ], "start_line": 658, "end_line": 668, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Diagonal", "long_name": "PyArray_Diagonal( PyArrayObject * self , int offset , int axis1 , int axis2)", "filename": "multiarraymodule.c", "nloc": 104, "complexity": 24, "token_count": 798, "parameters": [ "self", "offset", "axis1", "axis2" ], "start_line": 671, "end_line": 789, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 119, "top_nesting_level": 0 }, { "name": "PyArray_AsCArray", "long_name": "PyArray_AsCArray( PyObject ** op , * ptr , intp * dims , int nd , int type_num)", "filename": "multiarraymodule.c", "nloc": 54, "complexity": 13, "token_count": 426, "parameters": [ "op", "ptr", "dims", "nd", "type_num" ], "start_line": 806, "end_line": 861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_As1D", "long_name": "PyArray_As1D( PyObject ** op , char ** ptr , int * d1 , int typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 60, "parameters": [ "op", "ptr", "d1", "typecode" ], "start_line": 866, "end_line": 874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_As2D", "long_name": "PyArray_As2D( PyObject ** op , char ** * ptr , int * d1 , int * d2 , int typecode)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 81, "parameters": [ "op", "ptr", "d1", "d2", "typecode" ], "start_line": 878, "end_line": 888, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Free", "long_name": "PyArray_Free( PyObject * op , * ptr)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 4, "token_count": 67, "parameters": [ "op", "ptr" ], "start_line": 893, "end_line": 904, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "_swap_and_concat", "long_name": "_swap_and_concat( PyObject * op , int axis , int n)", "filename": "multiarraymodule.c", "nloc": 27, "complexity": 6, "token_count": 185, "parameters": [ "op", "axis", "n" ], "start_line": 908, "end_line": 936, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_Concatenate", "long_name": "PyArray_Concatenate( PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 112, "complexity": 24, "token_count": 761, "parameters": [ "op", "axis" ], "start_line": 945, "end_line": 1071, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 127, "top_nesting_level": 0 }, { "name": "PyArray_SwapAxes", "long_name": "PyArray_SwapAxes( PyArrayObject * ap , int a1 , int a2)", "filename": "multiarraymodule.c", "nloc": 37, "complexity": 12, "token_count": 227, "parameters": [ "ap", "a1", "a2" ], "start_line": 1074, "end_line": 1113, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_Transpose", "long_name": "PyArray_Transpose( PyArrayObject * ap , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 49, "complexity": 15, "token_count": 399, "parameters": [ "ap", "op" ], "start_line": 1117, "end_line": 1176, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "PyArray_Repeat", "long_name": "PyArray_Repeat( PyArrayObject * aop , PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 75, "complexity": 15, "token_count": 516, "parameters": [ "aop", "op", "axis" ], "start_line": 1179, "end_line": 1271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 93, "top_nesting_level": 0 }, { "name": "PyArray_Choose", "long_name": "PyArray_Choose( PyArrayObject * ip , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 89, "complexity": 18, "token_count": 646, "parameters": [ "ip", "op" ], "start_line": 1275, "end_line": 1387, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 113, "top_nesting_level": 0 }, { "name": "qsortCompare", "long_name": "qsortCompare( const * a , const * b)", "filename": "multiarraymodule.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "a", "b" ], "start_line": 1395, "end_line": 1398, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "PyArray_Sort", "long_name": "PyArray_Sort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 7, "token_count": 250, "parameters": [ "op", "axis" ], "start_line": 1420, "end_line": 1469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "argsort_static_compare", "long_name": "argsort_static_compare( const * ip1 , const * ip2)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 1, "token_count": 63, "parameters": [ "ip1", "ip2" ], "start_line": 1475, "end_line": 1483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_ArgSort", "long_name": "PyArray_ArgSort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 48, "complexity": 8, "token_count": 346, "parameters": [ "op", "axis" ], "start_line": 1486, "end_line": 1545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "local_where", "long_name": "local_where( PyArrayObject * ap1 , PyArrayObject * ap2 , PyArrayObject * ret)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 7, "token_count": 243, "parameters": [ "ap1", "ap2", "ret" ], "start_line": 1548, "end_line": 1583, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_SearchSorted", "long_name": "PyArray_SearchSorted( PyArrayObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 33, "complexity": 5, "token_count": 219, "parameters": [ "op1", "op2" ], "start_line": 1586, "end_line": 1631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "PyArray_InnerProduct", "long_name": "PyArray_InnerProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 82, "complexity": 17, "token_count": 653, "parameters": [ "op1", "op2" ], "start_line": 1639, "end_line": 1741, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 103, "top_nesting_level": 0 }, { "name": "PyArray_MatrixProduct", "long_name": "PyArray_MatrixProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 98, "complexity": 20, "token_count": 756, "parameters": [ "op1", "op2" ], "start_line": 1746, "end_line": 1867, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 122, "top_nesting_level": 0 }, { "name": "PyArray_CopyAndTranspose", "long_name": "PyArray_CopyAndTranspose( PyObject * op)", "filename": "multiarraymodule.c", "nloc": 44, "complexity": 6, "token_count": 282, "parameters": [ "op" ], "start_line": 1870, "end_line": 1921, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "PyArray_Correlate", "long_name": "PyArray_Correlate( PyObject * op1 , PyObject * op2 , int mode)", "filename": "multiarraymodule.c", "nloc": 86, "complexity": 13, "token_count": 598, "parameters": [ "op1", "op2", "mode" ], "start_line": 1924, "end_line": 2019, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "PyArray_ArgMin", "long_name": "PyArray_ArgMin( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 5, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2022, "end_line": 2047, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_Max", "long_name": "PyArray_Max( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2050, "end_line": 2061, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Min", "long_name": "PyArray_Min( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2064, "end_line": 2075, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Ptp", "long_name": "PyArray_Ptp( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 4, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2078, "end_line": 2101, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "PyArray_ArgMax", "long_name": "PyArray_ArgMax( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 46, "complexity": 7, "token_count": 318, "parameters": [ "op", "axis" ], "start_line": 2105, "end_line": 2161, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 57, "top_nesting_level": 0 }, { "name": "PyArray_Take", "long_name": "PyArray_Take( PyArrayObject * self0 , PyObject * indices0 , int axis)", "filename": "multiarraymodule.c", "nloc": 61, "complexity": 12, "token_count": 464, "parameters": [ "self0", "indices0", "axis" ], "start_line": 2165, "end_line": 2236, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_Put", "long_name": "PyArray_Put( PyArrayObject * self , PyObject * indices0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 47, "complexity": 10, "token_count": 319, "parameters": [ "self", "indices0", "values0" ], "start_line": 2239, "end_line": 2291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "PyArray_PutMask", "long_name": "PyArray_PutMask( PyArrayObject * self , PyObject * mask0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 10, "token_count": 334, "parameters": [ "self", "mask0", "values0" ], "start_line": 2294, "end_line": 2356, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_Converter", "long_name": "PyArray_Converter( PyObject * object , PyObject ** address)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 66, "parameters": [ "object", "address" ], "start_line": 2368, "end_line": 2380, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_BoolConverter", "long_name": "PyArray_BoolConverter( PyObject * object , Bool * val)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 3, "token_count": 42, "parameters": [ "object", "val" ], "start_line": 2383, "end_line": 2389, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_TypestrConvert", "long_name": "PyArray_TypestrConvert( int itemsize , int gentype)", "filename": "multiarraymodule.c", "nloc": 90, "complexity": 33, "token_count": 284, "parameters": [ "itemsize", "gentype" ], "start_line": 2393, "end_line": 2502, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "PyArray_BufferConverter", "long_name": "PyArray_BufferConverter( PyObject * obj , PyArray_Chunk * buf)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 6, "token_count": 147, "parameters": [ "obj", "buf" ], "start_line": 2517, "end_line": 2542, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_IntpConverter", "long_name": "PyArray_IntpConverter( PyObject * obj , PyArray_Dims * seq)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 10, "token_count": 186, "parameters": [ "obj", "seq" ], "start_line": 2554, "end_line": 2590, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_TypecodeConverter", "long_name": "PyArray_TypecodeConverter( PyObject * obj , PyArray_Typecode * at)", "filename": "multiarraymodule.c", "nloc": 108, "complexity": 33, "token_count": 639, "parameters": [ "obj", "at" ], "start_line": 2599, "end_line": 2737, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "PyArray_EquivalentTypes", "long_name": "PyArray_EquivalentTypes( PyArray_Typecode * typ1 , PyArray_Typecode * typ2)", "filename": "multiarraymodule.c", "nloc": 24, "complexity": 8, "token_count": 162, "parameters": [ "typ1", "typ2" ], "start_line": 2745, "end_line": 2772, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyArray_EquivArrTypes", "long_name": "PyArray_EquivArrTypes( PyArrayObject * a1 , PyArrayObject * a2)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 1, "token_count": 56, "parameters": [ "a1", "a2" ], "start_line": 2775, "end_line": 2781, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "_array_fromobject", "long_name": "_array_fromobject( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 38, "complexity": 9, "token_count": 254, "parameters": [ "ignored", "args", "kws" ], "start_line": 2792, "end_line": 2836, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_Empty", "long_name": "PyArray_Empty( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 15, "complexity": 3, "token_count": 99, "parameters": [ "nd", "dims", "type" ], "start_line": 2839, "end_line": 2855, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "array_empty", "long_name": "array_empty( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2861, "end_line": 2885, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_scalar", "long_name": "array_scalar( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 11, "token_count": 290, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2890, "end_line": 2954, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 65, "top_nesting_level": 0 }, { "name": "PyArray_Zeros", "long_name": "PyArray_Zeros( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 3, "token_count": 133, "parameters": [ "nd", "dims", "type" ], "start_line": 2958, "end_line": 2980, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_zeros", "long_name": "array_zeros( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2986, "end_line": 3010, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_set_typeDict", "long_name": "array_set_typeDict( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "ignored", "args" ], "start_line": 3017, "end_line": 3026, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_fromString", "long_name": "array_fromString( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 8, "token_count": 283, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3031, "end_line": 3086, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "_fill_in_itemsize", "long_name": "_fill_in_itemsize( PyArray_Typecode * typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 42, "parameters": [ "typecode" ], "start_line": 3102, "end_line": 3109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_FromFile", "long_name": "PyArray_FromFile( FILE * fp , PyArray_Typecode * typecode , intp num , char * sep)", "filename": "multiarraymodule.c", "nloc": 130, "complexity": 26, "token_count": 764, "parameters": [ "fp", "typecode", "num", "sep" ], "start_line": 3113, "end_line": 3253, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 141, "top_nesting_level": 0 }, { "name": "array_fromfile", "long_name": "array_fromfile( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 34, "complexity": 6, "token_count": 221, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3256, "end_line": 3291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_FromBuffer", "long_name": "PyArray_FromBuffer( PyObject * buf , PyArray_Typecode * type , intp count , int swapped)", "filename": "multiarraymodule.c", "nloc": 58, "complexity": 11, "token_count": 306, "parameters": [ "buf", "type", "count", "swapped" ], "start_line": 3294, "end_line": 3357, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "array_frombuffer", "long_name": "array_frombuffer( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 16, "complexity": 2, "token_count": 115, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3362, "end_line": 3379, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_concatenate", "long_name": "array_concatenate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 73, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3386, "end_line": 3397, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_innerproduct", "long_name": "array_innerproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3404, "end_line": 3410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_matrixproduct", "long_name": "array_matrixproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3417, "end_line": 3423, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_fastCopyAndTranspose", "long_name": "array_fastCopyAndTranspose( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 41, "parameters": [ "dummy", "args" ], "start_line": 3427, "end_line": 3433, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_correlate", "long_name": "array_correlate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 81, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3437, "end_line": 3446, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Arange", "long_name": "PyArray_Arange( double start , double stop , double step , int type_num)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 4, "token_count": 229, "parameters": [ "start", "stop", "step", "type_num" ], "start_line": 3450, "end_line": 3483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_arange", "long_name": "array_arange( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 10, "token_count": 258, "parameters": [ "ignored", "args", "kws" ], "start_line": 3489, "end_line": 3537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "array_set_string_function", "long_name": "array_set_string_function( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 78, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3557, "end_line": 3568, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_set_ops_function", "long_name": "array_set_ops_function( PyObject * self , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 12, "complexity": 3, "token_count": 67, "parameters": [ "self", "args", "kwds" ], "start_line": 3574, "end_line": 3591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Where", "long_name": "PyArray_Where( PyObject * condition , PyObject * x , PyObject * y)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 8, "token_count": 226, "parameters": [ "condition", "x", "y" ], "start_line": 3595, "end_line": 3631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "array_where", "long_name": "array_where( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 2, "token_count": 60, "parameters": [ "ignored", "args" ], "start_line": 3639, "end_line": 3647, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_register_dtype", "long_name": "array_register_dtype( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 3, "token_count": 64, "parameters": [ "dummy", "args" ], "start_line": 3653, "end_line": 3664, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_can_cast_safely", "long_name": "array_can_cast_safely( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 5, "token_count": 145, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3671, "end_line": 3695, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "setup_scalartypes", "long_name": "setup_scalartypes( PyObject * dict)", "filename": "multiarraymodule.c", "nloc": 44, "complexity": 9, "token_count": 342, "parameters": [ "dict" ], "start_line": 3756, "end_line": 3861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "set_flaginfo", "long_name": "set_flaginfo( PyObject * d)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 1, "token_count": 171, "parameters": [ "d" ], "start_line": 3866, "end_line": 3892, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "initmultiarray", "long_name": "initmultiarray()", "filename": "multiarraymodule.c", "nloc": 52, "complexity": 12, "token_count": 361, "parameters": [], "start_line": 3897, "end_line": 3973, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "setup_scalartypes", "long_name": "setup_scalartypes( PyObject * dict)", "filename": "multiarraymodule.c", "nloc": 45, "complexity": 10, "token_count": 351, "parameters": [ "dict" ], "start_line": 3756, "end_line": 3865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 } ], "nloc": 3076, "complexity": 636, "token_count": 20173, "diff_parsed": { "added": [ "#if SIZEOF_LONGLONG == SIZEOF_LONG", " DUAL_INHERIT(LongLong, Int, SignedInteger);", "#else", "#endif" ], "deleted": [] } }, { "old_path": "scipy/base/src/scalartypes.inc.src", "new_path": "scipy/base/src/scalartypes.inc.src", "filename": "scalartypes.inc.src", "extension": "src", "change_type": "MODIFY", "diff": "@@ -1355,15 +1355,8 @@ int_arrtype_hash(PyObject *obj)\n #Char=,U#\n #ext=&& (x >= LONG_MIN),#\n */\n-#if SIZEOF_LONG == SIZEOF_LONGLONG\n-static long\n-@char@longlong_arrtype_hash(PyObject *obj)\n-{\n- long x = (long)(((Py@Char@LongLongScalarObject *)obj)->obval);\n- if (x == -1) x=-2;\n- return x;\n-}\n-#else /* we assume SIZEOF_LONGLONG=2*SIZEOF_LONG */\n+#if SIZEOF_LONG != SIZEOF_LONGLONG\n+/* we assume SIZEOF_LONGLONG=2*SIZEOF_LONG */\n static long\n @char@longlong_arrtype_hash(PyObject *obj)\n {\n@@ -1388,6 +1381,18 @@ static long\n #endif\n /**end repeat**/\n \n+#if SIZEOF_LONG==SIZEOF_LONGLONG\n+static long\n+ulonglong_arrtype_hash(PyObject *obj)\n+{\n+ long x = (long)(((PyULongLongScalarObject *)obj)->obval);\n+ if (x == -1) x=-2;\n+ return x;\n+}\n+#endif\n+\n+\n+\n /* Wrong thing to do for longdouble, but....*/\n /**begin repeat\n #lname=float, longdouble#\n@@ -1508,6 +1513,11 @@ ComplexFloating, Flexible, Character#\n PyIntArrType_Type.tp_hash = int_arrtype_hash;\n #endif\n \n+#if SIZEOF_LONG != SIZEOF_LONGLONG\n+ /* We won't be inheriting from Python Int type. */\n+ PyLongLongArrType_Type.tp_hash = longlong_arrtype_hash;\n+#endif\n+\n \t/* These need to be coded specially because getitem does not\n \t return a normal Python type\n \t*/\n", "added_lines": 19, "deleted_lines": 9, "source_code": "/* -*- c -*- */\n\n/**begin repeat\n\n#name=Bool, Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, Object,#\n#type=Bool, signed char, short, int, long, longlong, unsigned char, unsigned short, unsigned int, unsigned long, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, PyObject *,char#\n*/\ntypedef struct {\n\tPyObject_HEAD;\n\t@type@ obval;\n} Py@name@ScalarObject;\n\n/**end repeat**/\n\n/* Inheritance established later when tp_bases is set (or tp_base for \n single inheritance) */\n\n/**begin repeat\n\n#name=numeric, integer, signedinteger, unsignedinteger, inexact, floating, complexfloating, flexible, \ncharacter#\n#NAME=Numeric, Integer, SignedInteger, UnsignedInteger, Inexact, Floating, ComplexFloating, Flexible, Character#\n*/\n\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@_arrtype\",\t\t /*tp_name*/\n sizeof(PyObject),\t\t /*tp_basicsize*/\n};\n/**end repeat**/\n\n\n#define PyStringScalarObject PyStringObject\n#define PyUnicodeScalarObject PyUnicodeObject\n\ntypedef struct {\n\tPyObject_VAR_HEAD;\n\tchar *obval;\n} PyVoidScalarObject;\n\n/* 0-dim array from array-scalar object */\n\nstatic PyObject *\nPyArray_FromScalar(PyObject *scalar, PyArray_Typecode *outcode)\n{\n\tPyArray_Typecode typecode;\n\tPyObject *r;\n\tchar *memptr;\n\tPyObject *ret;\n\n\t/* convert to 0-dim array of scalar typecode */\n\tPyArray_TypecodeFromScalar(scalar, &typecode);\n\tr = PyArray_New(&PyArray_Type, 0, NULL, typecode.type_num,\n\t\t\tNULL, NULL, typecode.itemsize, 0, NULL);\n\tif (r==NULL) return NULL;\n\n\tswitch(typecode.type_num) {\n\tcase PyArray_STRING:\n\t\tmemptr = PyString_AS_STRING(scalar);\n\t\tbreak;\n\tcase PyArray_UNICODE:\n\t\tmemptr = (char *)PyUnicode_AS_DATA(scalar);\n\t\tbreak;\n\tcase PyArray_VOID:\n\t\tmemptr = (((PyVoidScalarObject *)scalar)->obval);\n\t\tbreak;\n\tdefault:\n\t\tmemptr = &(((PyScalarObject *)scalar)->obval);\n\t\tbreak;\n\t}\n\n\tmemcpy(PyArray_DATA(r), memptr, PyArray_ITEMSIZE(r));\n\tif (PyArray_ISOBJECT(r)) {\n\t\tPy_INCREF(*((PyObject **)memptr));\n\t}\n\t\n\tif (outcode == NULL || \\\n\t outcode->type_num == PyArray_NOTYPE ||\t\\\n\t outcode->type_num == PyArray_TYPE(r))\n\t\treturn r;\n\n\t/* cast if necessary to desired output typecode */\n\tret = PyArray_CastToType((PyArrayObject *)r, outcode);\n\tPy_DECREF(r);\n\treturn ret;\n}\n\n\nstatic void\ngentype_dealloc(PyObject *v) \n{\n\tv->ob_type->tp_free(v);\n}\n\n\nstatic PyObject *\ngentype_power(PyObject *m1, PyObject *m2, PyObject *m3)\n{\n\tPyObject *arr, *ret, *arg2;\n\tchar *msg=\"unsupported operand type(s) for ** or pow()\";\n\t\n\tif (!PyArray_IsScalar(m1,Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_power(m1,m2, \n\t\t\t\t\t\t\t\t Py_None);\n\t\t}\n\t\telse {\n\t\t\tif (!PyArray_IsScalar(m2,Generic)) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_power(m1, arr,\n\t\t\t\t\t\t\t\t Py_None);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_power(m1,m2, \n\t\t\t\t\t\t\t\t Py_None);\n\t\t}\n\t\telse {\n\t\t\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_power(arr, m2,\n\t\t\t\t\t\t\t\t Py_None);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tarr=arg2=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\targ2 = PyArray_FromScalar(m2, NULL);\t\n\tif (arr == NULL || arg2 == NULL) {\n\t\tPy_XDECREF(arr); Py_XDECREF(arg2); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_power(arr, arg2, Py_None);\n\tPy_DECREF(arr);\n\tPy_DECREF(arg2);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_generic_method(PyObject *self, PyObject *args, PyObject *kwds, \n\t\t char *str)\n{\n\tPyObject *arr, *meth, *ret;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tmeth = PyObject_GetAttrString(arr, str);\n\tif (kwds == NULL) \n\t\tret = PyObject_CallObject(meth, args);\n\telse\n\t\tret = PyObject_Call(meth, args, kwds);\n\tPy_DECREF(meth);\n\tPy_DECREF(arr);\n\treturn PyArray_Return((PyArrayObject *)ret);\n}\n\n/**begin repeat\n\n#name=add, subtract, divide, remainder, divmod, lshift, rshift, and, xor, or, floor_divide, true_divide#\n#PYNAME=Add, Subtract, Divide, Remainder, Divmod, Lshift, Rshift, And, Xor, Or, FloorDivide, TrueDivide#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *m1, PyObject *m2)\n{\n\tPyObject *arr, *ret, *tup;\n\n\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_@name@(m1,m2);\n\t\t}\n else if ((m1->ob_type->tp_as_number == NULL) ||\n\t\t\t (m1->ob_type->tp_as_number->nb_@name@ == NULL)) {\n\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_@name@(m1, arr);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\telse {\n\t\t\t/* Convert m2 to a Python object and then try */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m2, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_@PYNAME@(m1, arr);\n\t\t\tif (ret==NULL) {\n\t\t\t\tPyObject *newarr;\n\t\t\t\tPyErr_Clear();\n\t\t\t\t/* Convert object to Array scalar and try again */\n\t\t\t\tnewarr = PyArray_FromAny(m1, NULL, 0, 0, 0);\n\t\t\t\tif (newarr!=NULL) {\n\t\t\t\t\tret = newarr->ob_type->tp_as_number->nb_@name@(m1, newarr);\n\t\t\t\t\tPy_DECREF(newarr);\n\t\t\t\t}\n\t\t\t}\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_@name@(m1,m2);\n\t\t}\n\t\telse if ((m2->ob_type->tp_as_number == NULL) ||\n\t\t\t (m2->ob_type->tp_as_number->nb_@name@ == NULL)) {\n\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_@name@(arr, m2);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\telse {\n\t\t\t/* Convert m1 to a Python object and then try */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m1, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tret = PyNumber_@PYNAME@(arr,m2);\n\t\t\tif (ret==NULL) {\n\t\t\t\tPyObject *newarr;\n\t\t\t\tPyErr_Clear();\n\t\t\t\t/* Convert object to Array and try again */\n\t\t\t\tnewarr = PyArray_FromAny(m1, NULL, 0, 0, 0);\n\t\t\t\tif (newarr!=NULL) {\n\t\t\t\t\tret = newarr->ob_type->tp_as_number->nb_@name@(newarr, m2);\n\t\t\t\t\tPy_DECREF(newarr);\n\t\t\t\t}\n\t\t\t}\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tarr=tup=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\ttup = PyArray_FromScalar(m2, NULL);\n\tif (arr == NULL || tup == NULL) {\n\t\tPy_XDECREF(tup); Py_XDECREF(arr); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_@name@(arr, tup);\n\tPy_DECREF(arr);\n\tPy_DECREF(tup);\n\treturn ret;\n}\n/**end repeat**/\n\n\nstatic PyObject *\ngentype_multiply(PyObject *m1, PyObject *m2)\n{\n\tPyObject *arr, *ret, *tup;\n\tlong repeat;\n\n\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_multiply(m1,m2);\n\t\t}\n\t\telse if ((m1->ob_type->tp_as_number == NULL) ||\n\t\t\t (m1->ob_type->tp_as_number->nb_multiply == NULL)) {\n\t\t\t/* Convert m2 to an int and assume sequence\n\t\t\t repeat */\n\t\t\trepeat = PyInt_AsLong(m2);\n\t\t\tif (repeat == -1 && PyErr_Occurred()) return NULL;\n\t\t\tret = PySequence_Repeat(m1, (int) repeat);\n\t\t\tif (ret == NULL) {\n\t\t\t\tPyErr_Clear();\n\t\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\t\tif (arr == NULL) return NULL;\n\t\t\t\tret = arr->ob_type->tp_as_number->\\\n\t\t\t\t\tnb_multiply(m1, arr);\n\t\t\t\tPy_DECREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t/* Convert m2 to a Python object */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m2, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_Multiply(m1, arr);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_multiply(m1,m2);\n\t\t}\n\t\telse if ((m2->ob_type->tp_as_number == NULL) ||\n\t\t\t (m2->ob_type->tp_as_number->nb_multiply == NULL)) {\n\t\t\t/* Convert m1 to an int and assume sequence\n\t\t\t repeat */\n\t\t\trepeat = PyInt_AsLong(m1);\n\t\t\tif (repeat == -1 && PyErr_Occurred()) return NULL;\n\t\t\tret = PySequence_Repeat(m2, (int) repeat);\n\t\t\tif (ret == NULL) {\n\t\t\t\tPyErr_Clear();\n\t\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\t\tif (arr == NULL) return NULL;\n\t\t\t\tret = arr->ob_type->tp_as_number->\t\\\n\t\t\t\t\tnb_multiply(arr, m2);\n\t\t\t\tPy_DECREF(arr);\n\t\t\t}\t\t\t\n\t\t}\n\t\telse {\n\t\t\t/* Convert m1 to a Python object */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m1, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_Multiply(arr, m2);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\t/* Both are array scalar objects */\n\tarr=tup=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\ttup = PyArray_FromScalar(m2, NULL);\n\tif (arr == NULL || tup == NULL) {\n\t\tPy_XDECREF(tup); Py_XDECREF(arr); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_multiply(arr, tup);\n\tPy_DECREF(arr);\n\tPy_DECREF(tup);\n\treturn ret;\n\n}\n\n\n\n/**begin repeat\n\n#name=negative, absolute, invert, int, long, float, oct, hex#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *m1)\n{\n\tPyObject *arr, *ret;\n\n\tarr = PyArray_FromScalar(m1, NULL);\n\tif (arr == NULL) return NULL;\n\tret = arr->ob_type->tp_as_number->nb_@name@(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n/**end repeat**/\n\nstatic int\ngentype_nonzero_number(PyObject *m1)\n{\n\tPyObject *arr;\n\tint ret;\n\n\tarr = PyArray_FromScalar(m1, NULL);\n\tif (arr == NULL) return -1;\n\tret = arr->ob_type->tp_as_number->nb_nonzero(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_str(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tif (arr==NULL) return NULL;\n\tret = PyObject_Str(arr->descr->getitem(arr->data, arr));\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_repr(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tif (arr==NULL) return NULL;\n\tret = PyObject_Repr(arr->descr->getitem(arr->data, arr));\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic void\nformat_longdouble(char *buf, size_t buflen, longdouble val, int precision)\n{\n register char *cp;\n\n PyOS_snprintf(buf, buflen, \"%.*\" LONGDOUBLE_FMT, precision, val);\n cp = buf;\n if (*cp == '-')\n cp++;\n for (; *cp != '\\0'; cp++) {\n if (!isdigit(Py_CHARMASK(*cp)))\n break;\n }\n if (*cp == '\\0') {\n *cp++ = '.';\n *cp++ = '0';\n *cp++ = '\\0';\n }\n}\n\n#if SIZEOF_LONGDOUBLE == SIZEOF_DOUBLE\n#define PREC_REPR 15\n#define PREC_STR 15\n#else\n#define PREC_REPR 21\n#define PREC_STR 21\n#endif\n\nstatic PyObject *\nlongdoubletype_repr(PyObject *self)\n{\n static char buf[100];\n format_longdouble(buf, sizeof(buf), ((PyLongDoubleScalarObject *)self)->obval, PREC_REPR);\n return PyString_FromString(buf);\n}\n\nstatic PyObject *\nclongdoubletype_repr(PyObject *self)\n{\n static char buf1[100];\n static char buf2[100];\n\tstatic char buf3[202];\n clongdouble x;\n x = ((PyCLongDoubleScalarObject *)self)->obval;\n format_longdouble(buf1, sizeof(buf1), x.real, PREC_REPR);\n format_longdouble(buf2, sizeof(buf2), x.imag, PREC_REPR);\n\n\tsnprintf(buf3, sizeof(buf3), \"(%s+%sj)\", buf1, buf2);\n\treturn PyString_FromString(buf3);\n}\n\n#define longdoubletype_str longdoubletype_repr\n#define clongdoubletype_str clongdoubletype_repr\n\n/** Could improve this with a PyLong_FromLongDouble(longdouble ldval)\n but this would need some more work...\n**/\n\n/**begin repeat\n\n#name=(int, long, hex, oct, float)*2#\n#KIND=(Long*4, Float)*2#\n#char=,,,,,c*5#\n#CHAR=,,,,,C*5#\n#POST=,,,,,.real*5#\n*/\nstatic PyObject *\n@char@longdoubletype_@name@(PyObject *self)\n{\n\tdouble dval;\n\tPyObject *obj, *ret;\n\t\n\tdval = (double)(((Py@CHAR@LongDoubleScalarObject *)self)->obval)@POST@;\n\tobj = Py@KIND@_FromDouble(dval);\n\tret = obj->ob_type->tp_as_number->nb_@name@(obj);\n\tPy_DECREF(obj);\n\treturn ret;\n}\n/**end repeat**/\n\n\nstatic PyObject *gentype_copy(PyObject *, PyObject *);\n\nstatic PyNumberMethods gentype_as_number = {\n (binaryfunc)gentype_add,\t\t /*nb_add*/\n (binaryfunc)gentype_subtract,\t\t /*nb_subtract*/\n (binaryfunc)gentype_multiply,\t\t /*nb_multiply*/\n (binaryfunc)gentype_divide,\t\t /*nb_divide*/\n (binaryfunc)gentype_remainder,\t /*nb_remainder*/\n (binaryfunc)gentype_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)gentype_power,\t\t /*nb_power*/\n (unaryfunc)gentype_negative,\t \n (unaryfunc)gentype_copy,\t\t /*nb_pos*/ \n (unaryfunc)gentype_absolute,\t\t /*(unaryfunc)gentype_abs,*/\n (inquiry)gentype_nonzero_number,\t\t /*nb_nonzero*/\n (unaryfunc)gentype_invert,\t\t /*nb_invert*/\n (binaryfunc)gentype_lshift,\t /*nb_lshift*/\n (binaryfunc)gentype_rshift,\t /*nb_rshift*/\n (binaryfunc)gentype_and,\t /*nb_and*/\n (binaryfunc)gentype_xor,\t /*nb_xor*/\n (binaryfunc)gentype_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)gentype_int,\t\t /*nb_int*/\n (unaryfunc)gentype_long,\t\t /*nb_long*/\n (unaryfunc)gentype_float,\t\t /*nb_float*/\n (unaryfunc)gentype_oct,\t\t /*nb_oct*/\n (unaryfunc)gentype_hex,\t\t /*nb_hex*/\n 0, /*inplace_add*/\n 0, /*inplace_subtract*/\n 0, /*inplace_multiply*/\n 0, /*inplace_divide*/\n 0, /*inplace_remainder*/\n 0, /*inplace_power*/\n 0, /*inplace_lshift*/\n 0, /*inplace_rshift*/\n 0, /*inplace_and*/\n 0, /*inplace_xor*/\n 0, /*inplace_or*/\n (binaryfunc)gentype_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)gentype_true_divide,\t /*nb_true_divide*/\n 0, /*nb_inplace_floor_divide*/\n 0, /*nb_inplace_true_divide*/\n\n};\n\nstatic PyObject *\ngentype_richcompare(PyObject *self, PyObject *other, int cmp_op) \n{\n\n\tPyObject *arr, *ret;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tret = arr->ob_type->tp_richcompare(arr, other, cmp_op);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_ndim_get(PyObject *self)\n{\n\treturn PyInt_FromLong(0);\n}\n\nstatic PyObject *\ngentype_flags_get(PyObject *self)\n{\n\tPyObject *dict;\n\tdict = PyDict_New();\t\n\n#define ADDFLAG(flag, val) PyDict_SetItemString(dict, #flag, Py_##val);\n\n ADDFLAG(CONTIGUOUS, True);\n ADDFLAG(OWN_DATA, True);\n ADDFLAG(FORTRAN, True);\n ADDFLAG(ALIGNED, True);\n ADDFLAG(NOTSWAPPED, True);\n ADDFLAG(WRITEABLE, False);\n ADDFLAG(UPDATEIFCOPY, False);\n\treturn dict;\n#undef ADDFLAG\n}\n\nstatic PyObject *\ngentype_shape_get(PyObject *self)\n{\n\treturn PyTuple_New(0);\n}\n\n/*\nstatic int\ngentype_shape_set(PyObject *self, PyObject *val)\n{\n\tif (!PyTuple_Check(val) || PyTuple_GET_SIZE(val) > 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \\\n\t\t\t\t\"invalid shape for scalar\");\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n*/\n\n\nstatic PyObject *\ngentype_data_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\n\treturn PyBuffer_FromObject(self, 0, typecode.itemsize);\n}\n\n\nstatic PyObject *\ngentype_itemsize_get(PyObject *self)\n{\t\n\tPyArray_Typecode typecode;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\treturn PyInt_FromLong((long) typecode.itemsize);\n}\n\nstatic PyObject *\ngentype_size_get(PyObject *self)\n{\n\treturn PyInt_FromLong(1);\n}\n\n\nstatic PyObject *\ngentype_typechar_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\tPyArray_Descr *descr;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\tdescr = PyArray_DescrFromType(typecode.type_num);\n\tif (PyArray_IsScalar(self, Flexible)) \n\t\treturn PyString_FromFormat(\"%c%d\", (int)(descr->type),\n\t\t\t\t\t typecode.itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(descr->type), 1);\n}\n\nstatic PyObject *\ngentype_typestr_get(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tret = PyObject_GetAttrString((PyObject *)arr, \"dtypestr\");\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_descr_get(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tret = PyObject_GetAttrString((PyObject *)arr, \"__array_descr__\");\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\n\nstatic PyObject *\ngentype_typenum_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\treturn PyInt_FromLong((long) typecode.type_num);\n}\n\nstatic PyObject *\ngentype_type_get(PyObject *self)\n{\n\treturn (PyObject *)self->ob_type;\n}\n\n\nstatic PyObject *\ngentype_base_get(PyObject *self)\n{\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\n\nstatic PyObject *\ngentype_real_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\n\tif (PyArray_IsScalar(self, ComplexFloating)) {\n\t\tPyArray_TypecodeFromScalar(self, &typecode);\n\t\treturn PyArray_Scalar(&(((PyScalarObject *)self)->obval),\n\t\t\t\t typecode.type_num-PyArray_NUM_FLOATTYPE,\n\t\t\t\t typecode.itemsize >> 1, 0);\n\t}\n\telse if PyArray_IsScalar(self, Object) {\n\t\tPyObject *obj = ((PyObjectScalarObject *)self)->obval;\n\t\tPyObject *ret;\n\t\tret = PyObject_GetAttrString(obj, \"real\");\n\t\tif (ret != NULL) return ret;\n\t}\n\tPy_INCREF(self);\n\treturn (PyObject *)self;\n}\n\nstatic PyObject *\ngentype_imag_get(PyObject *self)\n{\t\n\tPyArray_Typecode typecode;\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\tif (PyArray_IsScalar(self, ComplexFloating)) {\n\t\ttypecode.itemsize >>= 1;\n\t\treturn PyArray_Scalar(&(((PyScalarObject *)self)->obval)\n\t\t\t\t + typecode.itemsize, \n\t\t\t\t typecode.type_num-PyArray_NUM_FLOATTYPE,\n\t\t\t\t typecode.itemsize, 0);\n\t}\n\telse if PyArray_IsScalar(self, Object) {\n\t\tPyObject *obj = ((PyObjectScalarObject *)self)->obval;\n\t\tPyObject *ret;\n\t\tret = PyObject_GetAttrString(obj, \"imag\");\n\t\tif (ret == NULL) {\n\t\t\tPyErr_Clear();\n\t\t\tobj = PyInt_FromLong(0);\n\t\t\tret = PyArray_Scalar((char *)&obj, PyArray_OBJECT, \n\t\t\t\t\t sizeof(void *), 0);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t\treturn ret;\n\t}\n\telse {\n\t\tPyObject *ret;\n\t\tchar *temp;\n\t\ttemp = PyDataMem_NEW(typecode.itemsize);\n\t\tmemset(temp, '\\0', typecode.itemsize);\n\t\tret = PyArray_Scalar(temp, typecode.type_num,\n\t\t\t\t typecode.itemsize, 0);\n\t\tPyDataMem_FREE(temp);\n\t\treturn ret;\n\t}\n}\n\nstatic PyObject *\ngentype_flat_get(PyObject *self)\n{\n\tPyObject *ret, *arr;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tret = PyArray_IterNew(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyGetSetDef gentype_getsets[] = {\n {\"ndim\", \n\t (getter)gentype_ndim_get, \n\t (setter) 0, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)gentype_flags_get, \n\t (setter)0, \n\t \"integer value of flags\"},\n {\"shape\", \n\t (getter)gentype_shape_get, \n\t (setter)0, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)gentype_shape_get, \n\t (setter) 0, \n\t \"tuple of bytes steps in each dimension\"},\n {\"data\",\n\t (getter)gentype_data_get, \n\t (setter) 0, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)gentype_itemsize_get, \n\t (setter)0, \n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)gentype_size_get,\n (setter)0,\n \"number of elements in the gentype\"},\n\t{\"base\",\n\t (getter)gentype_base_get,\n\t (setter)0,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)gentype_type_get, \n\t (setter)0, \n\t \"get gentype type class\"},\n\t{\"dtypechar\",\n\t (getter)gentype_typechar_get,\n\t (setter)0,\n\t \"get gentype type character code\"},\n\t{\"dtypenum\",\n\t (getter)gentype_typenum_get,\n\t (setter)0,\n\t \"get gentype type number code\"},\n\t{\"dtypestr\",\n\t (getter)gentype_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)gentype_real_get, \n\t (setter)0,\n\t \"real part of scalar\"},\n {\"imag\", \n\t (getter)gentype_imag_get, \n\t (setter)0, \n\t \"imaginary part of scalar\"},\n\t{\"flat\", \n\t (getter)gentype_flat_get, \n\t (setter)0, \n\t \"a 1-d view of scalar\"}, \n\t{\"__array_data__\", \n\t (getter)gentype_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)gentype_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)gentype_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)gentype_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)gentype_shape_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t/* Does not have __array_priority__ because it is not a subtype.\n\t */\n \t{NULL, NULL, NULL, NULL} /* Sentinel */\n};\n\n/* 0-dim array from scalar object */\n\nstatic char doc_getarray[] = \"sc.__array__(|type) return 0-dim array\";\n\nstatic PyObject *\ngentype_getarray(PyObject *scalar, PyObject *args) \n{\n\tPyArray_Typecode outcode = {PyArray_NOTYPE, 0, 0};\n\n\tif (!PyArg_ParseTuple(args, \"|O&\", &PyArray_TypecodeConverter,\n\t\t\t &outcode)) return NULL;\n\treturn PyArray_FromScalar(scalar, &outcode);\n}\n\nstatic char doc_sc_wraparray[] = \"sc.__array_wrap__(obj) return scalar from array\";\n\nstatic PyObject *\ngentype_wraparray(PyObject *scalar, PyObject *args)\n{\n\tPyObject *arr;\n\n\tif (PyTuple_Size(args) < 1) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"only accepts 1 argument.\");\n\t\treturn NULL;\n\t}\n\tarr = PyTuple_GET_ITEM(args, 0);\n\tif (!PyArray_Check(arr)) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"can only be called with ndarray object\");\n\t\treturn NULL;\n\t}\n\n\treturn PyArray_Scalar(PyArray_DATA(arr), PyArray_TYPE(arr),\n\t\t\t PyArray_ITEMSIZE(arr), !PyArray_ISNOTSWAPPED(arr));\n}\n\n\n/**begin repeat\n\n#name=tolist, toscalar, tostring, astype, copy, resize, __deepcopy__, choose, sort, argsort, searchsorted, argmax, argmin, reshape, view, swapaxes, max, min, ptp, conj, conjugate, nonzero, all, any, flatten, ravel#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *self, PyObject *args)\n{\n\treturn gentype_generic_method(self, args, NULL, \"@name@\");\n}\n/**end repeat**/\n\nstatic PyObject *\ngentype_squeeze(PyObject *self, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n\tPy_INCREF(self);\n\treturn self;\n}\n\nstatic int\ngentype_getreadbuf(PyObject *, int, void **);\n\nstatic PyObject *\ngentype_byteswap(PyObject *self, PyObject *args)\n{\n\tBool inplace=FALSE;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_BoolConverter, &inplace))\n\t\treturn NULL;\n\t\n\tif (inplace) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"cannot byteswap a scalar in-place\");\n\t\treturn NULL;\n\t}\n\telse {\n\t\t/* get the data, copyswap it and pass it to a new Array scalar\n\t\t */\n\t\tchar *data;\n\t\tint numbytes;\n\t\tPyArray_Typecode type;\n\t\tPyArray_Descr *descr;\n\t\tPyObject *new;\n\t\tchar *newmem;\n\n\t\tnumbytes = gentype_getreadbuf(self, 0, (void **)&data);\n\t\tPyArray_TypecodeFromScalar(self, &type);\n\t\tnewmem = malloc(type.itemsize);\n\t\tif (newmem == NULL) return PyErr_NoMemory();\n\t\telse memcpy(newmem, data, type.itemsize);\n\t\tdescr = PyArray_DescrFromType(type.type_num);\n\t\tdescr->copyswap(newmem, NULL, 1, type.itemsize);\t\t\n\t\tnew = PyArray_Scalar(newmem, type.type_num, type.itemsize, 0);\n\t\tfree(newmem);\n\t\treturn new;\n\t}\n}\n\n/**begin repeat\n\n#name=transpose, getfield, take, put, putmask, repeat, tofile, mean, trace, diagonal, clip, std, sum, cumsum, prod, cumprod, compress#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *self, PyObject *args, PyObject *kwds)\n{\n\treturn gentype_generic_method(self, args, kwds, \"@name@\");\n}\n/**end repeat**/\n\n\nstatic PyObject *\ngentype_reduce(PyObject *self, PyObject *args)\n{\n\tPyObject *ret=NULL, *obj=NULL, *mod=NULL;\n\tconst char *buffer; \n\tint buflen;\n\n\t/* Return a tuple of (callable object, arguments) */\n\n\tret = PyTuple_New(2);\n\tif (ret == NULL) return NULL;\t\n\tif (PyObject_AsReadBuffer(self, (const void **)&buffer, &buflen)<0) {\n\t\tPy_DECREF(ret); return NULL;\n\t}\n\tmod = PyImport_ImportModule(\"scipy.base.multiarray\");\n\tif (mod == NULL) return NULL;\n\tobj = PyObject_GetAttrString(mod, \"scalar\");\n\tPy_DECREF(mod);\n\tif (obj == NULL) return NULL;\n\tPyTuple_SET_ITEM(ret, 0, obj);\n\tobj = PyObject_GetAttrString((PyObject *)self, \"dtypestr\");\n\tif PyArray_IsScalar(self, Object) {\n\t\tmod = ((PyObjectScalarObject *)self)->obval;\n\t\tPyTuple_SET_ITEM(ret, 1,\n\t\t\t\t Py_BuildValue(\"NO\", obj, mod));\n\t}\n\telse {\n\t\tmod = PyString_FromStringAndSize(buffer, buflen);\n\t\tPyTuple_SET_ITEM(ret, 1, \n\t\t\t\t Py_BuildValue(\"NN\", obj, mod));\n\t}\n\treturn ret;\n}\n\n/* ignores everything */\nstatic PyObject *\ngentype_setstate(PyObject *self, PyObject *args)\n{\n\tPy_INCREF(Py_None);\n\treturn (Py_None);\n}\n\nstatic PyObject *\ngentype_dump(PyObject *self, PyObject *args)\n{\n\tPyObject *file=NULL;\n\tint ret;\n\n\tif (!PyArg_ParseTuple(args, \"O\", &file))\n\t\treturn NULL;\n\tret = PyArray_Dump(self, file, 2);\n\tif (ret < 0) return NULL;\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyObject *\ngentype_dumps(PyObject *self, PyObject *args)\n{\n\tif (!PyArg_ParseTuple(args, \"\"))\n\t\treturn NULL;\n\treturn PyArray_Dumps(self, 2);\n}\n\n\n/* setting flags cannot be done for scalars */\nstatic PyObject *\ngentype_setflags(PyObject *self, PyObject *args, PyObject *kwds)\n{\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic int _array_typecode_fromstr(char *, int *, PyArray_Typecode *);\n\n/* need to fill in doc-strings for these methods on import -- copy from \n array docstrings \n*/\nstatic PyMethodDef gentype_methods[] = {\n {\"tolist\",\t (PyCFunction)gentype_tolist,\t1, NULL},\n {\"toscalar\", (PyCFunction)gentype_toscalar, METH_VARARGS, NULL},\n\t{\"tofile\", (PyCFunction)gentype_tofile, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"tostring\", (PyCFunction)gentype_tostring, METH_VARARGS, NULL},\n {\"byteswap\", (PyCFunction)gentype_byteswap,1, NULL},\n {\"astype\", (PyCFunction)gentype_astype, 1, NULL},\n\t{\"getfield\", (PyCFunction)gentype_getfield, \n\t METH_VARARGS | METH_KEYWORDS, NULL},\n {\"copy\", (PyCFunction)gentype_copy, 1, NULL}, \n {\"resize\", (PyCFunction)gentype_resize, 1, NULL}, \n\n\t{\"__array__\", (PyCFunction)gentype_getarray, 1, doc_getarray},\n\t{\"__array_wrap__\", (PyCFunction)gentype_wraparray, 1, doc_sc_wraparray},\n\n /* for the copy module */\n {\"__copy__\", (PyCFunction)gentype_copy, 1, NULL},\n {\"__deepcopy__\", (PyCFunction)gentype___deepcopy__, 1, NULL},\n\n\n {\"__reduce__\", (PyCFunction) gentype_reduce, 1, NULL},\t\n\t/* For consistency does nothing */\n\t{\"__setstate__\", (PyCFunction) gentype_setstate, 1, NULL},\n\n\t{\"dumps\", (PyCFunction) gentype_dumps, 1, NULL},\n\t{\"dump\", (PyCFunction) gentype_dump, 1, NULL},\n\n\t/* Methods for array */\n\t{\"transpose\",\t(PyCFunction)gentype_transpose, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"take\",\t(PyCFunction)gentype_take, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"put\",\t(PyCFunction)gentype_put, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"putmask\",\t(PyCFunction)gentype_putmask, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"repeat\",\t(PyCFunction)gentype_repeat, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"choose\",\t(PyCFunction)gentype_choose, \n\t METH_VARARGS, NULL},\t\n\t{\"sort\",\t(PyCFunction)gentype_sort, \n\t METH_VARARGS, NULL},\n\t{\"argsort\",\t(PyCFunction)gentype_argsort, \n\t METH_VARARGS, NULL},\n\t{\"searchsorted\", (PyCFunction)gentype_searchsorted, \n\t METH_VARARGS, NULL},\t\n\t{\"argmax\",\t(PyCFunction)gentype_argmax, \n\t METH_VARARGS, NULL},\n\t{\"argmin\", (PyCFunction)gentype_argmin,\n\t METH_VARARGS, NULL},\n\t{\"reshape\",\t(PyCFunction)gentype_reshape, \n\t METH_VARARGS, NULL},\n\t{\"squeeze\",\t(PyCFunction)gentype_squeeze, \n\t METH_VARARGS, NULL},\n\t{\"view\", (PyCFunction)gentype_view, \n\t METH_VARARGS, NULL},\n\t{\"swapaxes\", (PyCFunction)gentype_swapaxes,\n\t METH_VARARGS, NULL},\n\t{\"max\", (PyCFunction)gentype_max,\n\t METH_VARARGS, NULL},\n\t{\"min\", (PyCFunction)gentype_min,\n\t METH_VARARGS, NULL},\n\t{\"ptp\", (PyCFunction)gentype_ptp,\n\t METH_VARARGS, NULL},\n\t{\"mean\", (PyCFunction)gentype_mean,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"trace\", (PyCFunction)gentype_trace,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"diagonal\", (PyCFunction)gentype_diagonal,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"clip\", (PyCFunction)gentype_clip,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"conj\", (PyCFunction)gentype_conj,\n\t METH_VARARGS, NULL},\n\t{\"conjugate\", (PyCFunction)gentype_conjugate,\n\t METH_VARARGS, NULL},\n\t{\"nonzero\", (PyCFunction)gentype_nonzero,\n\t METH_VARARGS, NULL},\n\t{\"std\", (PyCFunction)gentype_std,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"sum\", (PyCFunction)gentype_sum,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"cumsum\", (PyCFunction)gentype_cumsum,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"prod\", (PyCFunction)gentype_prod,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"cumprod\", (PyCFunction)gentype_cumprod,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"all\", (PyCFunction)gentype_all,\n\t METH_VARARGS, NULL},\n\t{\"any\", (PyCFunction)gentype_any,\n\t METH_VARARGS, NULL},\n\t{\"compress\", (PyCFunction)gentype_compress,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"flatten\", (PyCFunction)gentype_flatten,\n\t METH_VARARGS, NULL},\n\t{\"ravel\", (PyCFunction)gentype_ravel,\n\t METH_VARARGS, NULL},\n\t{\"setflags\", (PyCFunction)gentype_setflags,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t/* add other methods!!! */\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\nstatic int\ngentype_getreadbuf(PyObject *self, int segment, void **ptrptr)\n{\n\tint numbytes;\n\tPyArray_Typecode outcode;\n\t\n\tif (segment != 0) {\n\t\tPyErr_SetString(PyExc_SystemError, \n\t\t\t\t\"Accessing non-existent array segment\");\n\t\treturn -1;\n\t}\n\n\tPyArray_TypecodeFromScalar(self, &outcode);\n\tnumbytes = outcode.itemsize;\n\tif PyArray_IsScalar(self, Flexible) {\n\t\tif PyArray_IsScalar(self, String)\n\t\t\t*ptrptr = PyString_AS_STRING(self);\n\t\telse if PyArray_IsScalar(self, Unicode)\n\t\t\t*ptrptr = (char *)PyUnicode_AS_DATA(self);\n\t\telse if PyArray_IsScalar(self, Void)\n\t\t\t*ptrptr = ((PyVoidScalarObject *)self)->obval;\n\t}\n\telse \n\t\t*ptrptr = (void *)&(((PyScalarObject *)self)->obval);\n\n\treturn numbytes;\n}\n\nstatic int\ngentype_getsegcount(PyObject *self, int *lenp)\n{\n\tPyArray_Typecode outcode;\n\n\tPyArray_TypecodeFromScalar(self, &outcode);\n\tif (lenp)\n\t\t*lenp = outcode.itemsize;\n\treturn 1;\n}\n\nstatic int\ngentype_getcharbuf(PyObject *self, int segment, const char **ptrptr)\n{\n\tif (PyArray_IsScalar(self, String) ||\t\\\n\t PyArray_IsScalar(self, Unicode))\n\t\treturn gentype_getreadbuf(self, segment, (void **)ptrptr);\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"Non-character array cannot be interpreted \"\\\n\t\t\t\t\"as character buffer.\");\n\t\treturn -1;\n\t}\n}\n\n\nstatic PyBufferProcs gentype_as_buffer = {\n (getreadbufferproc)gentype_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)0, /*bf_getwritebuffer*/\n (getsegcountproc)gentype_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)gentype_getcharbuf, /*bf_getcharbuffer*/\n};\n\n\n#define BASEFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES\n#define LEAFFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES\n\nstatic PyTypeObject PyGenericArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"generic_arrtype\",\t /*tp_name*/\n sizeof(PyObject),\t\t /*tp_basicsize*/\n};\n\n/* works for VOID and UNICODE */\n\nstatic void\nflexible_dealloc(PyObject *v) \n{\n\tPyDataMem_FREE(((PyVoidScalarObject *)v)->obval);\n\tv->ob_type->tp_free(v);\n}\n\nstatic void\nstring_arrtype_dealloc(PyObject *v)\n{\n\tv->ob_type->tp_free(v);\n}\n\nstatic void\nobject_arrtype_dealloc(PyObject *v)\n{\n\tPy_DECREF(((PyObjectScalarObject *)v)->obval);\n\tv->ob_type->tp_free(v);\n}\n\n/* string and unicode inherit from Python Type first and so GET_ITEM is different to\n get to the Python Type.\n */\n\n/**begin repeat \n#name=byte, short, int, long, longlong, ubyte, ushort, uint, ulong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, string, unicode, object#\n#TYPE=BYTE, SHORT, INT, LONG, LONGLONG, UBYTE, USHORT, UINT, ULONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, OBJECT#\n#num=1*16,0,0,1#\n*/\nstatic PyObject *\n@name@_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj=NULL;\n\tPyObject *arr;\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n\n\tif (type->tp_bases && (PyTuple_GET_SIZE(type->tp_bases)==2)) {\n\t\tPyTypeObject *sup;\n\t\tPyObject *ret;\n\t\t/* We are inheriting from a Python type as well so\n\t\t give it first dibs on conversion */\n\t\tsup = (PyTypeObject *)PyTuple_GET_ITEM(type->tp_bases, @num@);\n\t\tret = sup->tp_new(type, args, kwds);\n\t\tif (ret) return ret;\n\t\tPyErr_Clear();\n\t\t/* now do default conversion */\n\t}\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\n\ttypecode.type_num = PyArray_@TYPE@;\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n/**end repeat**/\n\n/* bool->tp_new only returns Py_True or Py_False */\nstatic PyObject *\nbool_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj=NULL;\n\tPyObject *arr;\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n\nstatic PyObject *\nvoid_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj, *arr;\n\tulonglong memu=1;\n\tPyObject *new=NULL;\n\tPyArray_Typecode typecode = {PyArray_VOID, 0, 0};\n\tchar *destptr;\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\t/* For a VOID scalar first see if obj is an integer or long \n\t and create new memory of that size (filled with 0) for the scalar\n\t*/\n\n\tif (PyLong_Check(obj) || PyInt_Check(obj) || \\\n\t PyArray_IsScalar(obj, Integer) ||\n\t (PyArray_Check(obj) && PyArray_NDIM(obj)==0 &&\t\\\n\t PyArray_ISINTEGER(obj))) {\n\t\tnew = obj->ob_type->tp_as_number->nb_long(obj);\n\t}\n\tif (new && PyLong_Check(new)) {\n\t\tPyObject *ret;\n\t\tmemu = PyLong_AsUnsignedLongLong(new);\n\t\tPy_DECREF(new);\n\t\tif (PyErr_Occurred() || (memu > MAX_INT)) {\n\t\t\tPyErr_Clear();\n\t\t\tPyErr_Format(PyExc_OverflowError, \n\t\t\t\t \"size must be smaller than %d\",\n\t\t\t\t (int) MAX_INT);\n\t\t\treturn NULL;\n\t\t}\n\t\tdestptr = PyDataMem_NEW((int) memu);\n\t\tif (destptr == NULL) return PyErr_NoMemory();\n\t\tret = type->tp_alloc(type, 0);\n\t\tif (ret == NULL) {\n\t\t\tPyDataMem_FREE(destptr);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\t((PyVoidScalarObject *)ret)->obval = destptr;\n\t\t((PyVoidScalarObject *)ret)->ob_size = (int) memu;\n\t\tmemset(destptr, '\\0', (size_t) memu);\n\t\treturn ret;\n\t}\n\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n\n\n/**************** Define Hash functions ********************/\n\n/**begin repeat\n#lname=bool,ubyte,ushort#\n#name=Bool,UByte, UShort#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n return (long)(((Py@name@ScalarObject *)obj)->obval);\n}\n/**end repeat**/\n\n/**begin repeat\n#lname=byte,short,uint,ulong#\n#name=Byte,Short,UInt,ULong#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((Py@name@ScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n/**end repeat**/\n\n#if SIZEOF_INT != SIZEOF_LONG\nstatic long\nint_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((PyIntScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n#endif\n\n/**begin repeat\n#char=,u#\n#Char=,U#\n#ext=&& (x >= LONG_MIN),#\n*/\n#if SIZEOF_LONG != SIZEOF_LONGLONG\n/* we assume SIZEOF_LONGLONG=2*SIZEOF_LONG */\nstatic long\n@char@longlong_arrtype_hash(PyObject *obj)\n{\n long y;\n @char@longlong x = (((Py@Char@LongLongScalarObject *)obj)->obval);\n\n if ((x <= LONG_MAX)@ext@) {\n y = (long) x;\n }\n else {\n union Mask {\n long hashvals[2];\n @char@longlong v;\n } both;\n\n both.v = x;\n y = both.hashvals[0] + (1000003)*both.hashvals[1];\n }\n if (y == -1) y = -2;\n return y;\n}\n#endif\n/**end repeat**/\n\n#if SIZEOF_LONG==SIZEOF_LONGLONG\nstatic long\nulonglong_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((PyULongLongScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n#endif\n\n\n\n/* Wrong thing to do for longdouble, but....*/\n/**begin repeat\n#lname=float, longdouble#\n#name=Float, LongDouble#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n return _Py_HashDouble((double) ((Py@name@ScalarObject *)obj)->obval);\n}\n\n/* borrowed from complex_hash */\nstatic long\nc@lname@_arrtype_hash(PyObject *obj)\n{\n long hashreal, hashimag, combined;\n hashreal = _Py_HashDouble((double) \\\n (((PyC@name@ScalarObject *)obj)->obval).real);\n\n if (hashreal == -1) return -1;\n hashimag = _Py_HashDouble((double) \\\n (((PyC@name@ScalarObject *)obj)->obval).imag);\n if (hashimag == -1) return -1;\n\n combined = hashreal + 1000003 * hashimag;\n if (combined == -1) combined = -2;\n return combined;\n}\n/**end repeat**/\n\nstatic long\nobject_arrtype_hash(PyObject *obj)\n{\n return PyObject_Hash(((PyObjectScalarObject *)obj)->obval);\n}\n\n/* just hash the pointer */\nstatic long\nvoid_arrtype_hash(PyObject *obj)\n{\n return _Py_HashPointer((void *)(((PyVoidScalarObject *)obj)->obval));\n}\n\n/**begin repeat\n#name=bool, string, unicode, void, object#\n#NAME=Bool, String, Unicode, Void, Object#\n*/\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@_arrtype\",\t /*tp_name*/\n sizeof(Py@NAME@ScalarObject),\t /*tp_basicsize*/\n};\n/**end repeat**/\n\n/**begin repeat\n#NAME=Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble#\n#name=int*5, uint*5, float*3, complex*3#\n#CNAME=(CHAR, SHORT, INT, LONG, LONGLONG)*2, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE#\n*/\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@\" STRBITSOF_@CNAME@ \"_arrtype\",\t /*tp_name*/\n sizeof(Py@NAME@ScalarObject),\t /*tp_basicsize*/\n};\n\n/**end repeat**/\n\n\n\n\nstatic PyNumberMethods longdoubletype_as_number;\nstatic PyNumberMethods clongdoubletype_as_number;\n\nstatic void \ninitialize_numeric_types(void)\n{\n\tPyGenericArrType_Type.tp_dealloc = (destructor)gentype_dealloc;\n\tPyGenericArrType_Type.tp_as_number = &gentype_as_number;\n\tPyGenericArrType_Type.tp_as_buffer = &gentype_as_buffer;\n\tPyGenericArrType_Type.tp_flags = BASEFLAGS;\n\tPyGenericArrType_Type.tp_methods = gentype_methods;\n\tPyGenericArrType_Type.tp_getset = gentype_getsets;\n\tPyGenericArrType_Type.tp_new = NULL;\n\tPyGenericArrType_Type.tp_free = PyObject_Del;\n\tPyGenericArrType_Type.tp_repr = gentype_repr;\n\tPyGenericArrType_Type.tp_str = gentype_str;\n\tPyGenericArrType_Type.tp_richcompare = gentype_richcompare;\n\n\t/**begin repeat\n#NAME=Numeric, Integer, SignedInteger, UnsignedInteger, Inexact, Floating, \nComplexFloating, Flexible, Character#\n\t*/\n Py@NAME@ArrType_Type.tp_flags = BASEFLAGS;\n\t/**end repeat**/\n\n\t/**begin repeat\n#name=bool, byte, short, int, long, longlong, ubyte, ushort, uint, ulong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, string, unicode, void, object#\n#NAME=Bool, Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, String, Unicode, Void, Object#\n\t*/\n\tPy@NAME@ArrType_Type.tp_flags = LEAFFLAGS;\n\tPy@NAME@ArrType_Type.tp_new = @name@_arrtype_new;\n\tPy@NAME@ArrType_Type.tp_richcompare = gentype_richcompare;\n\t/**end repeat**/\n\t/* Allow the Void type to be subclassed -- for adding new types */\n\tPyVoidArrType_Type.tp_flags = BASEFLAGS;\n\n /**begin repeat\n#name=bool, byte, short, longlong, ubyte, ushort, uint, ulong, ulonglong, float, longdouble, cfloat, clongdouble, void, object#\n#NAME=Bool, Byte, Short, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, LongDouble, CFloat, CLongDouble, Void, Object#\n */\n Py@NAME@ArrType_Type.tp_hash = @name@_arrtype_hash;\n /**end repeat**/\n\n#if SIZEOF_INT != SIZEOF_LONG\n /* We won't be inheriting from Python Int type. */\n PyIntArrType_Type.tp_hash = int_arrtype_hash;\n#endif\n\n#if SIZEOF_LONG != SIZEOF_LONGLONG\n /* We won't be inheriting from Python Int type. */\n PyLongLongArrType_Type.tp_hash = longlong_arrtype_hash;\n#endif\n\n\t/* These need to be coded specially because getitem does not\n\t return a normal Python type\n\t*/\n\tPyLongDoubleArrType_Type.tp_as_number = &longdoubletype_as_number;\n\tPyCLongDoubleArrType_Type.tp_as_number = &clongdoubletype_as_number;\n\n\t/**begin repeat\n#name=int, long, hex, oct, float, repr, str#\n#kind=tp_as_number->nb*5, tp*2#\n\t*/\n\tPyLongDoubleArrType_Type.@kind@_@name@ = longdoubletype_@name@;\n\tPyCLongDoubleArrType_Type.@kind@_@name@ = clongdoubletype_@name@;\n\t/**end repeat**/\n\n\tPyStringArrType_Type.tp_itemsize = sizeof(char);\n\tPyStringArrType_Type.tp_dealloc = string_arrtype_dealloc;\n\tPyFlexibleArrType_Type.tp_dealloc = flexible_dealloc;\n\tPyObjectArrType_Type.tp_dealloc = object_arrtype_dealloc;\n\n\tPyArrayIter_Type.tp_iter = PyObject_SelfIter;\n\tPyArrayMapIter_Type.tp_iter = PyObject_SelfIter;\n}\n\n\nstatic PyTypeObject *typeobjects[] = {\n\t&PyBoolArrType_Type,\n\t&PyByteArrType_Type,\n\t&PyUByteArrType_Type,\n\t&PyShortArrType_Type,\n\t&PyUShortArrType_Type,\n\t&PyIntArrType_Type,\n\t&PyUIntArrType_Type,\n\t&PyLongArrType_Type,\n\t&PyULongArrType_Type,\n\t&PyLongLongArrType_Type,\n\t&PyULongLongArrType_Type,\n\t&PyFloatArrType_Type,\n\t&PyDoubleArrType_Type,\n\t&PyLongDoubleArrType_Type,\n\t&PyCFloatArrType_Type,\n\t&PyCDoubleArrType_Type,\n\t&PyCLongDoubleArrType_Type,\n\t&PyObjectArrType_Type,\n\t&PyStringArrType_Type,\n\t&PyUnicodeArrType_Type,\n\t&PyVoidArrType_Type\n};\n\n\nstatic int\nPyArray_TypenumFromTypeObject(PyObject *type) \n{\n\tint typenum, i;\n\n\ttypenum = PyArray_NOTYPE;\n i = 0;\n\twhile(i < PyArray_NTYPES) {\n\t\tif (type == (PyObject *)typeobjects[i]) {\n\t\t\ttypenum = i;\n\t\t\tbreak;\n\t\t}\n i++;\n\t}\n\tif (typenum != PyArray_NOTYPE)\n\t\treturn typenum;\n\n\t/* Find registered types */\n\t\n\t/* here */\n\n\t/* Convert generic types to specific types */\n\tif ((type == (PyObject *) &PyNumericArrType_Type) || \\\n\t (type == (PyObject *) &PyInexactArrType_Type) || \\\n\t (type == (PyObject *) &PyFloatingArrType_Type))\n\t\treturn PyArray_DOUBLE;\n\telse if (type == (PyObject *)&PyComplexFloatingArrType_Type)\n\t\treturn PyArray_CDOUBLE;\n\telse if ((type == (PyObject *)&PyIntegerArrType_Type) ||\t\\\n\t\t (type == (PyObject *)&PySignedIntegerArrType_Type))\n\t\treturn PyArray_LONG;\n\telse if (type == (PyObject *) &PyUnsignedIntegerArrType_Type)\n\t\treturn PyArray_ULONG;\n else if (type == (PyObject *) &PyCharacterArrType_Type)\n\t\treturn PyArray_STRING;\n\telse if (type == (PyObject *) &PyFlexibleArrType_Type)\n\t\treturn PyArray_VOID;\n\telse if (type == (PyObject *)&PyBool_Type)\n\t\ttypenum = PyArray_BOOL;\n\telse if (type == (PyObject *)&PyInt_Type)\n\t\ttypenum = PyArray_LONG;\n\telse if (type == (PyObject *)&PyFloat_Type)\n\t\ttypenum = PyArray_DOUBLE;\t\n\telse if (type == (PyObject *)&PyComplex_Type)\n\t\ttypenum = PyArray_CDOUBLE;\n\telse if (type == (PyObject *)&PyString_Type)\n\t\ttypenum = PyArray_STRING;\n\telse if (type == (PyObject *)&PyUnicode_Type)\n\t\ttypenum = PyArray_UNICODE;\n\telse if (type == (PyObject *)&PyBuffer_Type)\n\t\ttypenum = PyArray_VOID;\n\telse\n\t\ttypenum = PyArray_OBJECT;\n\treturn typenum;\n}\n\nstatic void \nPyArray_TypecodeFromTypeObject(PyObject *type, PyArray_Typecode *typecode) {\n\tint itemsize = 0;\n\tint type_num;\n\n\ttype_num = PyArray_TypenumFromTypeObject(type);\n\ttypecode->type_num = type_num;\n\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n itemsize = 0;\n\t}\n\telse {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type_num);\n\t\tif (descr != NULL)\n\t\t\titemsize = descr->elsize;\n\t}\n\ttypecode->itemsize = itemsize;\n\treturn;\n}\n\nstatic void \nPyArray_TypecodeFromScalar(PyObject *sc, PyArray_Typecode *typecode)\n{\n\tint type_num;\n\n PyArray_TypecodeFromTypeObject((PyObject *)sc->ob_type, typecode);\n if (typecode->itemsize == 0) {\n type_num = typecode->type_num;\n\t\tif (type_num == PyArray_STRING) \n\t\t\ttypecode->itemsize = PyString_GET_SIZE(sc);\n\t\telse if (type_num == PyArray_UNICODE)\n\t\t\ttypecode->itemsize = PyUnicode_GET_DATA_SIZE(sc);\n\t\telse if (type_num == PyArray_VOID) {\n\t\t\ttypecode->itemsize = \\\n\t\t\t\t((PyVoidScalarObject *)sc)->ob_size;\n\t\t}\n }\n\treturn;\n}\n\nstatic PyObject *\nPyArray_TypeObjectFromType(int type)\n{\n\tPyArray_Descr *descr;\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr == NULL) return NULL;\n\tPy_INCREF((PyObject *)descr->typeobj);\n\treturn (PyObject *)descr->typeobj;\n}\n\n", "source_code_before": "/* -*- c -*- */\n\n/**begin repeat\n\n#name=Bool, Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, Object,#\n#type=Bool, signed char, short, int, long, longlong, unsigned char, unsigned short, unsigned int, unsigned long, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, PyObject *,char#\n*/\ntypedef struct {\n\tPyObject_HEAD;\n\t@type@ obval;\n} Py@name@ScalarObject;\n\n/**end repeat**/\n\n/* Inheritance established later when tp_bases is set (or tp_base for \n single inheritance) */\n\n/**begin repeat\n\n#name=numeric, integer, signedinteger, unsignedinteger, inexact, floating, complexfloating, flexible, \ncharacter#\n#NAME=Numeric, Integer, SignedInteger, UnsignedInteger, Inexact, Floating, ComplexFloating, Flexible, Character#\n*/\n\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@_arrtype\",\t\t /*tp_name*/\n sizeof(PyObject),\t\t /*tp_basicsize*/\n};\n/**end repeat**/\n\n\n#define PyStringScalarObject PyStringObject\n#define PyUnicodeScalarObject PyUnicodeObject\n\ntypedef struct {\n\tPyObject_VAR_HEAD;\n\tchar *obval;\n} PyVoidScalarObject;\n\n/* 0-dim array from array-scalar object */\n\nstatic PyObject *\nPyArray_FromScalar(PyObject *scalar, PyArray_Typecode *outcode)\n{\n\tPyArray_Typecode typecode;\n\tPyObject *r;\n\tchar *memptr;\n\tPyObject *ret;\n\n\t/* convert to 0-dim array of scalar typecode */\n\tPyArray_TypecodeFromScalar(scalar, &typecode);\n\tr = PyArray_New(&PyArray_Type, 0, NULL, typecode.type_num,\n\t\t\tNULL, NULL, typecode.itemsize, 0, NULL);\n\tif (r==NULL) return NULL;\n\n\tswitch(typecode.type_num) {\n\tcase PyArray_STRING:\n\t\tmemptr = PyString_AS_STRING(scalar);\n\t\tbreak;\n\tcase PyArray_UNICODE:\n\t\tmemptr = (char *)PyUnicode_AS_DATA(scalar);\n\t\tbreak;\n\tcase PyArray_VOID:\n\t\tmemptr = (((PyVoidScalarObject *)scalar)->obval);\n\t\tbreak;\n\tdefault:\n\t\tmemptr = &(((PyScalarObject *)scalar)->obval);\n\t\tbreak;\n\t}\n\n\tmemcpy(PyArray_DATA(r), memptr, PyArray_ITEMSIZE(r));\n\tif (PyArray_ISOBJECT(r)) {\n\t\tPy_INCREF(*((PyObject **)memptr));\n\t}\n\t\n\tif (outcode == NULL || \\\n\t outcode->type_num == PyArray_NOTYPE ||\t\\\n\t outcode->type_num == PyArray_TYPE(r))\n\t\treturn r;\n\n\t/* cast if necessary to desired output typecode */\n\tret = PyArray_CastToType((PyArrayObject *)r, outcode);\n\tPy_DECREF(r);\n\treturn ret;\n}\n\n\nstatic void\ngentype_dealloc(PyObject *v) \n{\n\tv->ob_type->tp_free(v);\n}\n\n\nstatic PyObject *\ngentype_power(PyObject *m1, PyObject *m2, PyObject *m3)\n{\n\tPyObject *arr, *ret, *arg2;\n\tchar *msg=\"unsupported operand type(s) for ** or pow()\";\n\t\n\tif (!PyArray_IsScalar(m1,Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_power(m1,m2, \n\t\t\t\t\t\t\t\t Py_None);\n\t\t}\n\t\telse {\n\t\t\tif (!PyArray_IsScalar(m2,Generic)) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_power(m1, arr,\n\t\t\t\t\t\t\t\t Py_None);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_power(m1,m2, \n\t\t\t\t\t\t\t\t Py_None);\n\t\t}\n\t\telse {\n\t\t\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_power(arr, m2,\n\t\t\t\t\t\t\t\t Py_None);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tarr=arg2=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\targ2 = PyArray_FromScalar(m2, NULL);\t\n\tif (arr == NULL || arg2 == NULL) {\n\t\tPy_XDECREF(arr); Py_XDECREF(arg2); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_power(arr, arg2, Py_None);\n\tPy_DECREF(arr);\n\tPy_DECREF(arg2);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_generic_method(PyObject *self, PyObject *args, PyObject *kwds, \n\t\t char *str)\n{\n\tPyObject *arr, *meth, *ret;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tmeth = PyObject_GetAttrString(arr, str);\n\tif (kwds == NULL) \n\t\tret = PyObject_CallObject(meth, args);\n\telse\n\t\tret = PyObject_Call(meth, args, kwds);\n\tPy_DECREF(meth);\n\tPy_DECREF(arr);\n\treturn PyArray_Return((PyArrayObject *)ret);\n}\n\n/**begin repeat\n\n#name=add, subtract, divide, remainder, divmod, lshift, rshift, and, xor, or, floor_divide, true_divide#\n#PYNAME=Add, Subtract, Divide, Remainder, Divmod, Lshift, Rshift, And, Xor, Or, FloorDivide, TrueDivide#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *m1, PyObject *m2)\n{\n\tPyObject *arr, *ret, *tup;\n\n\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_@name@(m1,m2);\n\t\t}\n else if ((m1->ob_type->tp_as_number == NULL) ||\n\t\t\t (m1->ob_type->tp_as_number->nb_@name@ == NULL)) {\n\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_@name@(m1, arr);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\telse {\n\t\t\t/* Convert m2 to a Python object and then try */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m2, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_@PYNAME@(m1, arr);\n\t\t\tif (ret==NULL) {\n\t\t\t\tPyObject *newarr;\n\t\t\t\tPyErr_Clear();\n\t\t\t\t/* Convert object to Array scalar and try again */\n\t\t\t\tnewarr = PyArray_FromAny(m1, NULL, 0, 0, 0);\n\t\t\t\tif (newarr!=NULL) {\n\t\t\t\t\tret = newarr->ob_type->tp_as_number->nb_@name@(m1, newarr);\n\t\t\t\t\tPy_DECREF(newarr);\n\t\t\t\t}\n\t\t\t}\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_@name@(m1,m2);\n\t\t}\n\t\telse if ((m2->ob_type->tp_as_number == NULL) ||\n\t\t\t (m2->ob_type->tp_as_number->nb_@name@ == NULL)) {\n\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_@name@(arr, m2);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\telse {\n\t\t\t/* Convert m1 to a Python object and then try */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m1, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tret = PyNumber_@PYNAME@(arr,m2);\n\t\t\tif (ret==NULL) {\n\t\t\t\tPyObject *newarr;\n\t\t\t\tPyErr_Clear();\n\t\t\t\t/* Convert object to Array and try again */\n\t\t\t\tnewarr = PyArray_FromAny(m1, NULL, 0, 0, 0);\n\t\t\t\tif (newarr!=NULL) {\n\t\t\t\t\tret = newarr->ob_type->tp_as_number->nb_@name@(newarr, m2);\n\t\t\t\t\tPy_DECREF(newarr);\n\t\t\t\t}\n\t\t\t}\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tarr=tup=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\ttup = PyArray_FromScalar(m2, NULL);\n\tif (arr == NULL || tup == NULL) {\n\t\tPy_XDECREF(tup); Py_XDECREF(arr); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_@name@(arr, tup);\n\tPy_DECREF(arr);\n\tPy_DECREF(tup);\n\treturn ret;\n}\n/**end repeat**/\n\n\nstatic PyObject *\ngentype_multiply(PyObject *m1, PyObject *m2)\n{\n\tPyObject *arr, *ret, *tup;\n\tlong repeat;\n\n\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_multiply(m1,m2);\n\t\t}\n\t\telse if ((m1->ob_type->tp_as_number == NULL) ||\n\t\t\t (m1->ob_type->tp_as_number->nb_multiply == NULL)) {\n\t\t\t/* Convert m2 to an int and assume sequence\n\t\t\t repeat */\n\t\t\trepeat = PyInt_AsLong(m2);\n\t\t\tif (repeat == -1 && PyErr_Occurred()) return NULL;\n\t\t\tret = PySequence_Repeat(m1, (int) repeat);\n\t\t\tif (ret == NULL) {\n\t\t\t\tPyErr_Clear();\n\t\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\t\tif (arr == NULL) return NULL;\n\t\t\t\tret = arr->ob_type->tp_as_number->\\\n\t\t\t\t\tnb_multiply(m1, arr);\n\t\t\t\tPy_DECREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t/* Convert m2 to a Python object */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m2, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_Multiply(m1, arr);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_multiply(m1,m2);\n\t\t}\n\t\telse if ((m2->ob_type->tp_as_number == NULL) ||\n\t\t\t (m2->ob_type->tp_as_number->nb_multiply == NULL)) {\n\t\t\t/* Convert m1 to an int and assume sequence\n\t\t\t repeat */\n\t\t\trepeat = PyInt_AsLong(m1);\n\t\t\tif (repeat == -1 && PyErr_Occurred()) return NULL;\n\t\t\tret = PySequence_Repeat(m2, (int) repeat);\n\t\t\tif (ret == NULL) {\n\t\t\t\tPyErr_Clear();\n\t\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\t\tif (arr == NULL) return NULL;\n\t\t\t\tret = arr->ob_type->tp_as_number->\t\\\n\t\t\t\t\tnb_multiply(arr, m2);\n\t\t\t\tPy_DECREF(arr);\n\t\t\t}\t\t\t\n\t\t}\n\t\telse {\n\t\t\t/* Convert m1 to a Python object */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m1, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_Multiply(arr, m2);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\t/* Both are array scalar objects */\n\tarr=tup=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\ttup = PyArray_FromScalar(m2, NULL);\n\tif (arr == NULL || tup == NULL) {\n\t\tPy_XDECREF(tup); Py_XDECREF(arr); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_multiply(arr, tup);\n\tPy_DECREF(arr);\n\tPy_DECREF(tup);\n\treturn ret;\n\n}\n\n\n\n/**begin repeat\n\n#name=negative, absolute, invert, int, long, float, oct, hex#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *m1)\n{\n\tPyObject *arr, *ret;\n\n\tarr = PyArray_FromScalar(m1, NULL);\n\tif (arr == NULL) return NULL;\n\tret = arr->ob_type->tp_as_number->nb_@name@(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n/**end repeat**/\n\nstatic int\ngentype_nonzero_number(PyObject *m1)\n{\n\tPyObject *arr;\n\tint ret;\n\n\tarr = PyArray_FromScalar(m1, NULL);\n\tif (arr == NULL) return -1;\n\tret = arr->ob_type->tp_as_number->nb_nonzero(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_str(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tif (arr==NULL) return NULL;\n\tret = PyObject_Str(arr->descr->getitem(arr->data, arr));\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_repr(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tif (arr==NULL) return NULL;\n\tret = PyObject_Repr(arr->descr->getitem(arr->data, arr));\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic void\nformat_longdouble(char *buf, size_t buflen, longdouble val, int precision)\n{\n register char *cp;\n\n PyOS_snprintf(buf, buflen, \"%.*\" LONGDOUBLE_FMT, precision, val);\n cp = buf;\n if (*cp == '-')\n cp++;\n for (; *cp != '\\0'; cp++) {\n if (!isdigit(Py_CHARMASK(*cp)))\n break;\n }\n if (*cp == '\\0') {\n *cp++ = '.';\n *cp++ = '0';\n *cp++ = '\\0';\n }\n}\n\n#if SIZEOF_LONGDOUBLE == SIZEOF_DOUBLE\n#define PREC_REPR 15\n#define PREC_STR 15\n#else\n#define PREC_REPR 21\n#define PREC_STR 21\n#endif\n\nstatic PyObject *\nlongdoubletype_repr(PyObject *self)\n{\n static char buf[100];\n format_longdouble(buf, sizeof(buf), ((PyLongDoubleScalarObject *)self)->obval, PREC_REPR);\n return PyString_FromString(buf);\n}\n\nstatic PyObject *\nclongdoubletype_repr(PyObject *self)\n{\n static char buf1[100];\n static char buf2[100];\n\tstatic char buf3[202];\n clongdouble x;\n x = ((PyCLongDoubleScalarObject *)self)->obval;\n format_longdouble(buf1, sizeof(buf1), x.real, PREC_REPR);\n format_longdouble(buf2, sizeof(buf2), x.imag, PREC_REPR);\n\n\tsnprintf(buf3, sizeof(buf3), \"(%s+%sj)\", buf1, buf2);\n\treturn PyString_FromString(buf3);\n}\n\n#define longdoubletype_str longdoubletype_repr\n#define clongdoubletype_str clongdoubletype_repr\n\n/** Could improve this with a PyLong_FromLongDouble(longdouble ldval)\n but this would need some more work...\n**/\n\n/**begin repeat\n\n#name=(int, long, hex, oct, float)*2#\n#KIND=(Long*4, Float)*2#\n#char=,,,,,c*5#\n#CHAR=,,,,,C*5#\n#POST=,,,,,.real*5#\n*/\nstatic PyObject *\n@char@longdoubletype_@name@(PyObject *self)\n{\n\tdouble dval;\n\tPyObject *obj, *ret;\n\t\n\tdval = (double)(((Py@CHAR@LongDoubleScalarObject *)self)->obval)@POST@;\n\tobj = Py@KIND@_FromDouble(dval);\n\tret = obj->ob_type->tp_as_number->nb_@name@(obj);\n\tPy_DECREF(obj);\n\treturn ret;\n}\n/**end repeat**/\n\n\nstatic PyObject *gentype_copy(PyObject *, PyObject *);\n\nstatic PyNumberMethods gentype_as_number = {\n (binaryfunc)gentype_add,\t\t /*nb_add*/\n (binaryfunc)gentype_subtract,\t\t /*nb_subtract*/\n (binaryfunc)gentype_multiply,\t\t /*nb_multiply*/\n (binaryfunc)gentype_divide,\t\t /*nb_divide*/\n (binaryfunc)gentype_remainder,\t /*nb_remainder*/\n (binaryfunc)gentype_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)gentype_power,\t\t /*nb_power*/\n (unaryfunc)gentype_negative,\t \n (unaryfunc)gentype_copy,\t\t /*nb_pos*/ \n (unaryfunc)gentype_absolute,\t\t /*(unaryfunc)gentype_abs,*/\n (inquiry)gentype_nonzero_number,\t\t /*nb_nonzero*/\n (unaryfunc)gentype_invert,\t\t /*nb_invert*/\n (binaryfunc)gentype_lshift,\t /*nb_lshift*/\n (binaryfunc)gentype_rshift,\t /*nb_rshift*/\n (binaryfunc)gentype_and,\t /*nb_and*/\n (binaryfunc)gentype_xor,\t /*nb_xor*/\n (binaryfunc)gentype_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)gentype_int,\t\t /*nb_int*/\n (unaryfunc)gentype_long,\t\t /*nb_long*/\n (unaryfunc)gentype_float,\t\t /*nb_float*/\n (unaryfunc)gentype_oct,\t\t /*nb_oct*/\n (unaryfunc)gentype_hex,\t\t /*nb_hex*/\n 0, /*inplace_add*/\n 0, /*inplace_subtract*/\n 0, /*inplace_multiply*/\n 0, /*inplace_divide*/\n 0, /*inplace_remainder*/\n 0, /*inplace_power*/\n 0, /*inplace_lshift*/\n 0, /*inplace_rshift*/\n 0, /*inplace_and*/\n 0, /*inplace_xor*/\n 0, /*inplace_or*/\n (binaryfunc)gentype_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)gentype_true_divide,\t /*nb_true_divide*/\n 0, /*nb_inplace_floor_divide*/\n 0, /*nb_inplace_true_divide*/\n\n};\n\nstatic PyObject *\ngentype_richcompare(PyObject *self, PyObject *other, int cmp_op) \n{\n\n\tPyObject *arr, *ret;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tret = arr->ob_type->tp_richcompare(arr, other, cmp_op);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_ndim_get(PyObject *self)\n{\n\treturn PyInt_FromLong(0);\n}\n\nstatic PyObject *\ngentype_flags_get(PyObject *self)\n{\n\tPyObject *dict;\n\tdict = PyDict_New();\t\n\n#define ADDFLAG(flag, val) PyDict_SetItemString(dict, #flag, Py_##val);\n\n ADDFLAG(CONTIGUOUS, True);\n ADDFLAG(OWN_DATA, True);\n ADDFLAG(FORTRAN, True);\n ADDFLAG(ALIGNED, True);\n ADDFLAG(NOTSWAPPED, True);\n ADDFLAG(WRITEABLE, False);\n ADDFLAG(UPDATEIFCOPY, False);\n\treturn dict;\n#undef ADDFLAG\n}\n\nstatic PyObject *\ngentype_shape_get(PyObject *self)\n{\n\treturn PyTuple_New(0);\n}\n\n/*\nstatic int\ngentype_shape_set(PyObject *self, PyObject *val)\n{\n\tif (!PyTuple_Check(val) || PyTuple_GET_SIZE(val) > 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \\\n\t\t\t\t\"invalid shape for scalar\");\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n*/\n\n\nstatic PyObject *\ngentype_data_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\n\treturn PyBuffer_FromObject(self, 0, typecode.itemsize);\n}\n\n\nstatic PyObject *\ngentype_itemsize_get(PyObject *self)\n{\t\n\tPyArray_Typecode typecode;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\treturn PyInt_FromLong((long) typecode.itemsize);\n}\n\nstatic PyObject *\ngentype_size_get(PyObject *self)\n{\n\treturn PyInt_FromLong(1);\n}\n\n\nstatic PyObject *\ngentype_typechar_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\tPyArray_Descr *descr;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\tdescr = PyArray_DescrFromType(typecode.type_num);\n\tif (PyArray_IsScalar(self, Flexible)) \n\t\treturn PyString_FromFormat(\"%c%d\", (int)(descr->type),\n\t\t\t\t\t typecode.itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(descr->type), 1);\n}\n\nstatic PyObject *\ngentype_typestr_get(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tret = PyObject_GetAttrString((PyObject *)arr, \"dtypestr\");\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_descr_get(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tret = PyObject_GetAttrString((PyObject *)arr, \"__array_descr__\");\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\n\nstatic PyObject *\ngentype_typenum_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\treturn PyInt_FromLong((long) typecode.type_num);\n}\n\nstatic PyObject *\ngentype_type_get(PyObject *self)\n{\n\treturn (PyObject *)self->ob_type;\n}\n\n\nstatic PyObject *\ngentype_base_get(PyObject *self)\n{\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\n\nstatic PyObject *\ngentype_real_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\n\tif (PyArray_IsScalar(self, ComplexFloating)) {\n\t\tPyArray_TypecodeFromScalar(self, &typecode);\n\t\treturn PyArray_Scalar(&(((PyScalarObject *)self)->obval),\n\t\t\t\t typecode.type_num-PyArray_NUM_FLOATTYPE,\n\t\t\t\t typecode.itemsize >> 1, 0);\n\t}\n\telse if PyArray_IsScalar(self, Object) {\n\t\tPyObject *obj = ((PyObjectScalarObject *)self)->obval;\n\t\tPyObject *ret;\n\t\tret = PyObject_GetAttrString(obj, \"real\");\n\t\tif (ret != NULL) return ret;\n\t}\n\tPy_INCREF(self);\n\treturn (PyObject *)self;\n}\n\nstatic PyObject *\ngentype_imag_get(PyObject *self)\n{\t\n\tPyArray_Typecode typecode;\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\tif (PyArray_IsScalar(self, ComplexFloating)) {\n\t\ttypecode.itemsize >>= 1;\n\t\treturn PyArray_Scalar(&(((PyScalarObject *)self)->obval)\n\t\t\t\t + typecode.itemsize, \n\t\t\t\t typecode.type_num-PyArray_NUM_FLOATTYPE,\n\t\t\t\t typecode.itemsize, 0);\n\t}\n\telse if PyArray_IsScalar(self, Object) {\n\t\tPyObject *obj = ((PyObjectScalarObject *)self)->obval;\n\t\tPyObject *ret;\n\t\tret = PyObject_GetAttrString(obj, \"imag\");\n\t\tif (ret == NULL) {\n\t\t\tPyErr_Clear();\n\t\t\tobj = PyInt_FromLong(0);\n\t\t\tret = PyArray_Scalar((char *)&obj, PyArray_OBJECT, \n\t\t\t\t\t sizeof(void *), 0);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t\treturn ret;\n\t}\n\telse {\n\t\tPyObject *ret;\n\t\tchar *temp;\n\t\ttemp = PyDataMem_NEW(typecode.itemsize);\n\t\tmemset(temp, '\\0', typecode.itemsize);\n\t\tret = PyArray_Scalar(temp, typecode.type_num,\n\t\t\t\t typecode.itemsize, 0);\n\t\tPyDataMem_FREE(temp);\n\t\treturn ret;\n\t}\n}\n\nstatic PyObject *\ngentype_flat_get(PyObject *self)\n{\n\tPyObject *ret, *arr;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tret = PyArray_IterNew(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyGetSetDef gentype_getsets[] = {\n {\"ndim\", \n\t (getter)gentype_ndim_get, \n\t (setter) 0, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)gentype_flags_get, \n\t (setter)0, \n\t \"integer value of flags\"},\n {\"shape\", \n\t (getter)gentype_shape_get, \n\t (setter)0, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)gentype_shape_get, \n\t (setter) 0, \n\t \"tuple of bytes steps in each dimension\"},\n {\"data\",\n\t (getter)gentype_data_get, \n\t (setter) 0, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)gentype_itemsize_get, \n\t (setter)0, \n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)gentype_size_get,\n (setter)0,\n \"number of elements in the gentype\"},\n\t{\"base\",\n\t (getter)gentype_base_get,\n\t (setter)0,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)gentype_type_get, \n\t (setter)0, \n\t \"get gentype type class\"},\n\t{\"dtypechar\",\n\t (getter)gentype_typechar_get,\n\t (setter)0,\n\t \"get gentype type character code\"},\n\t{\"dtypenum\",\n\t (getter)gentype_typenum_get,\n\t (setter)0,\n\t \"get gentype type number code\"},\n\t{\"dtypestr\",\n\t (getter)gentype_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)gentype_real_get, \n\t (setter)0,\n\t \"real part of scalar\"},\n {\"imag\", \n\t (getter)gentype_imag_get, \n\t (setter)0, \n\t \"imaginary part of scalar\"},\n\t{\"flat\", \n\t (getter)gentype_flat_get, \n\t (setter)0, \n\t \"a 1-d view of scalar\"}, \n\t{\"__array_data__\", \n\t (getter)gentype_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)gentype_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)gentype_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)gentype_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)gentype_shape_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t/* Does not have __array_priority__ because it is not a subtype.\n\t */\n \t{NULL, NULL, NULL, NULL} /* Sentinel */\n};\n\n/* 0-dim array from scalar object */\n\nstatic char doc_getarray[] = \"sc.__array__(|type) return 0-dim array\";\n\nstatic PyObject *\ngentype_getarray(PyObject *scalar, PyObject *args) \n{\n\tPyArray_Typecode outcode = {PyArray_NOTYPE, 0, 0};\n\n\tif (!PyArg_ParseTuple(args, \"|O&\", &PyArray_TypecodeConverter,\n\t\t\t &outcode)) return NULL;\n\treturn PyArray_FromScalar(scalar, &outcode);\n}\n\nstatic char doc_sc_wraparray[] = \"sc.__array_wrap__(obj) return scalar from array\";\n\nstatic PyObject *\ngentype_wraparray(PyObject *scalar, PyObject *args)\n{\n\tPyObject *arr;\n\n\tif (PyTuple_Size(args) < 1) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"only accepts 1 argument.\");\n\t\treturn NULL;\n\t}\n\tarr = PyTuple_GET_ITEM(args, 0);\n\tif (!PyArray_Check(arr)) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"can only be called with ndarray object\");\n\t\treturn NULL;\n\t}\n\n\treturn PyArray_Scalar(PyArray_DATA(arr), PyArray_TYPE(arr),\n\t\t\t PyArray_ITEMSIZE(arr), !PyArray_ISNOTSWAPPED(arr));\n}\n\n\n/**begin repeat\n\n#name=tolist, toscalar, tostring, astype, copy, resize, __deepcopy__, choose, sort, argsort, searchsorted, argmax, argmin, reshape, view, swapaxes, max, min, ptp, conj, conjugate, nonzero, all, any, flatten, ravel#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *self, PyObject *args)\n{\n\treturn gentype_generic_method(self, args, NULL, \"@name@\");\n}\n/**end repeat**/\n\nstatic PyObject *\ngentype_squeeze(PyObject *self, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n\tPy_INCREF(self);\n\treturn self;\n}\n\nstatic int\ngentype_getreadbuf(PyObject *, int, void **);\n\nstatic PyObject *\ngentype_byteswap(PyObject *self, PyObject *args)\n{\n\tBool inplace=FALSE;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_BoolConverter, &inplace))\n\t\treturn NULL;\n\t\n\tif (inplace) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"cannot byteswap a scalar in-place\");\n\t\treturn NULL;\n\t}\n\telse {\n\t\t/* get the data, copyswap it and pass it to a new Array scalar\n\t\t */\n\t\tchar *data;\n\t\tint numbytes;\n\t\tPyArray_Typecode type;\n\t\tPyArray_Descr *descr;\n\t\tPyObject *new;\n\t\tchar *newmem;\n\n\t\tnumbytes = gentype_getreadbuf(self, 0, (void **)&data);\n\t\tPyArray_TypecodeFromScalar(self, &type);\n\t\tnewmem = malloc(type.itemsize);\n\t\tif (newmem == NULL) return PyErr_NoMemory();\n\t\telse memcpy(newmem, data, type.itemsize);\n\t\tdescr = PyArray_DescrFromType(type.type_num);\n\t\tdescr->copyswap(newmem, NULL, 1, type.itemsize);\t\t\n\t\tnew = PyArray_Scalar(newmem, type.type_num, type.itemsize, 0);\n\t\tfree(newmem);\n\t\treturn new;\n\t}\n}\n\n/**begin repeat\n\n#name=transpose, getfield, take, put, putmask, repeat, tofile, mean, trace, diagonal, clip, std, sum, cumsum, prod, cumprod, compress#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *self, PyObject *args, PyObject *kwds)\n{\n\treturn gentype_generic_method(self, args, kwds, \"@name@\");\n}\n/**end repeat**/\n\n\nstatic PyObject *\ngentype_reduce(PyObject *self, PyObject *args)\n{\n\tPyObject *ret=NULL, *obj=NULL, *mod=NULL;\n\tconst char *buffer; \n\tint buflen;\n\n\t/* Return a tuple of (callable object, arguments) */\n\n\tret = PyTuple_New(2);\n\tif (ret == NULL) return NULL;\t\n\tif (PyObject_AsReadBuffer(self, (const void **)&buffer, &buflen)<0) {\n\t\tPy_DECREF(ret); return NULL;\n\t}\n\tmod = PyImport_ImportModule(\"scipy.base.multiarray\");\n\tif (mod == NULL) return NULL;\n\tobj = PyObject_GetAttrString(mod, \"scalar\");\n\tPy_DECREF(mod);\n\tif (obj == NULL) return NULL;\n\tPyTuple_SET_ITEM(ret, 0, obj);\n\tobj = PyObject_GetAttrString((PyObject *)self, \"dtypestr\");\n\tif PyArray_IsScalar(self, Object) {\n\t\tmod = ((PyObjectScalarObject *)self)->obval;\n\t\tPyTuple_SET_ITEM(ret, 1,\n\t\t\t\t Py_BuildValue(\"NO\", obj, mod));\n\t}\n\telse {\n\t\tmod = PyString_FromStringAndSize(buffer, buflen);\n\t\tPyTuple_SET_ITEM(ret, 1, \n\t\t\t\t Py_BuildValue(\"NN\", obj, mod));\n\t}\n\treturn ret;\n}\n\n/* ignores everything */\nstatic PyObject *\ngentype_setstate(PyObject *self, PyObject *args)\n{\n\tPy_INCREF(Py_None);\n\treturn (Py_None);\n}\n\nstatic PyObject *\ngentype_dump(PyObject *self, PyObject *args)\n{\n\tPyObject *file=NULL;\n\tint ret;\n\n\tif (!PyArg_ParseTuple(args, \"O\", &file))\n\t\treturn NULL;\n\tret = PyArray_Dump(self, file, 2);\n\tif (ret < 0) return NULL;\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyObject *\ngentype_dumps(PyObject *self, PyObject *args)\n{\n\tif (!PyArg_ParseTuple(args, \"\"))\n\t\treturn NULL;\n\treturn PyArray_Dumps(self, 2);\n}\n\n\n/* setting flags cannot be done for scalars */\nstatic PyObject *\ngentype_setflags(PyObject *self, PyObject *args, PyObject *kwds)\n{\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic int _array_typecode_fromstr(char *, int *, PyArray_Typecode *);\n\n/* need to fill in doc-strings for these methods on import -- copy from \n array docstrings \n*/\nstatic PyMethodDef gentype_methods[] = {\n {\"tolist\",\t (PyCFunction)gentype_tolist,\t1, NULL},\n {\"toscalar\", (PyCFunction)gentype_toscalar, METH_VARARGS, NULL},\n\t{\"tofile\", (PyCFunction)gentype_tofile, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"tostring\", (PyCFunction)gentype_tostring, METH_VARARGS, NULL},\n {\"byteswap\", (PyCFunction)gentype_byteswap,1, NULL},\n {\"astype\", (PyCFunction)gentype_astype, 1, NULL},\n\t{\"getfield\", (PyCFunction)gentype_getfield, \n\t METH_VARARGS | METH_KEYWORDS, NULL},\n {\"copy\", (PyCFunction)gentype_copy, 1, NULL}, \n {\"resize\", (PyCFunction)gentype_resize, 1, NULL}, \n\n\t{\"__array__\", (PyCFunction)gentype_getarray, 1, doc_getarray},\n\t{\"__array_wrap__\", (PyCFunction)gentype_wraparray, 1, doc_sc_wraparray},\n\n /* for the copy module */\n {\"__copy__\", (PyCFunction)gentype_copy, 1, NULL},\n {\"__deepcopy__\", (PyCFunction)gentype___deepcopy__, 1, NULL},\n\n\n {\"__reduce__\", (PyCFunction) gentype_reduce, 1, NULL},\t\n\t/* For consistency does nothing */\n\t{\"__setstate__\", (PyCFunction) gentype_setstate, 1, NULL},\n\n\t{\"dumps\", (PyCFunction) gentype_dumps, 1, NULL},\n\t{\"dump\", (PyCFunction) gentype_dump, 1, NULL},\n\n\t/* Methods for array */\n\t{\"transpose\",\t(PyCFunction)gentype_transpose, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"take\",\t(PyCFunction)gentype_take, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"put\",\t(PyCFunction)gentype_put, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"putmask\",\t(PyCFunction)gentype_putmask, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"repeat\",\t(PyCFunction)gentype_repeat, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"choose\",\t(PyCFunction)gentype_choose, \n\t METH_VARARGS, NULL},\t\n\t{\"sort\",\t(PyCFunction)gentype_sort, \n\t METH_VARARGS, NULL},\n\t{\"argsort\",\t(PyCFunction)gentype_argsort, \n\t METH_VARARGS, NULL},\n\t{\"searchsorted\", (PyCFunction)gentype_searchsorted, \n\t METH_VARARGS, NULL},\t\n\t{\"argmax\",\t(PyCFunction)gentype_argmax, \n\t METH_VARARGS, NULL},\n\t{\"argmin\", (PyCFunction)gentype_argmin,\n\t METH_VARARGS, NULL},\n\t{\"reshape\",\t(PyCFunction)gentype_reshape, \n\t METH_VARARGS, NULL},\n\t{\"squeeze\",\t(PyCFunction)gentype_squeeze, \n\t METH_VARARGS, NULL},\n\t{\"view\", (PyCFunction)gentype_view, \n\t METH_VARARGS, NULL},\n\t{\"swapaxes\", (PyCFunction)gentype_swapaxes,\n\t METH_VARARGS, NULL},\n\t{\"max\", (PyCFunction)gentype_max,\n\t METH_VARARGS, NULL},\n\t{\"min\", (PyCFunction)gentype_min,\n\t METH_VARARGS, NULL},\n\t{\"ptp\", (PyCFunction)gentype_ptp,\n\t METH_VARARGS, NULL},\n\t{\"mean\", (PyCFunction)gentype_mean,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"trace\", (PyCFunction)gentype_trace,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"diagonal\", (PyCFunction)gentype_diagonal,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"clip\", (PyCFunction)gentype_clip,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"conj\", (PyCFunction)gentype_conj,\n\t METH_VARARGS, NULL},\n\t{\"conjugate\", (PyCFunction)gentype_conjugate,\n\t METH_VARARGS, NULL},\n\t{\"nonzero\", (PyCFunction)gentype_nonzero,\n\t METH_VARARGS, NULL},\n\t{\"std\", (PyCFunction)gentype_std,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"sum\", (PyCFunction)gentype_sum,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"cumsum\", (PyCFunction)gentype_cumsum,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"prod\", (PyCFunction)gentype_prod,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"cumprod\", (PyCFunction)gentype_cumprod,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"all\", (PyCFunction)gentype_all,\n\t METH_VARARGS, NULL},\n\t{\"any\", (PyCFunction)gentype_any,\n\t METH_VARARGS, NULL},\n\t{\"compress\", (PyCFunction)gentype_compress,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"flatten\", (PyCFunction)gentype_flatten,\n\t METH_VARARGS, NULL},\n\t{\"ravel\", (PyCFunction)gentype_ravel,\n\t METH_VARARGS, NULL},\n\t{\"setflags\", (PyCFunction)gentype_setflags,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t/* add other methods!!! */\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\nstatic int\ngentype_getreadbuf(PyObject *self, int segment, void **ptrptr)\n{\n\tint numbytes;\n\tPyArray_Typecode outcode;\n\t\n\tif (segment != 0) {\n\t\tPyErr_SetString(PyExc_SystemError, \n\t\t\t\t\"Accessing non-existent array segment\");\n\t\treturn -1;\n\t}\n\n\tPyArray_TypecodeFromScalar(self, &outcode);\n\tnumbytes = outcode.itemsize;\n\tif PyArray_IsScalar(self, Flexible) {\n\t\tif PyArray_IsScalar(self, String)\n\t\t\t*ptrptr = PyString_AS_STRING(self);\n\t\telse if PyArray_IsScalar(self, Unicode)\n\t\t\t*ptrptr = (char *)PyUnicode_AS_DATA(self);\n\t\telse if PyArray_IsScalar(self, Void)\n\t\t\t*ptrptr = ((PyVoidScalarObject *)self)->obval;\n\t}\n\telse \n\t\t*ptrptr = (void *)&(((PyScalarObject *)self)->obval);\n\n\treturn numbytes;\n}\n\nstatic int\ngentype_getsegcount(PyObject *self, int *lenp)\n{\n\tPyArray_Typecode outcode;\n\n\tPyArray_TypecodeFromScalar(self, &outcode);\n\tif (lenp)\n\t\t*lenp = outcode.itemsize;\n\treturn 1;\n}\n\nstatic int\ngentype_getcharbuf(PyObject *self, int segment, const char **ptrptr)\n{\n\tif (PyArray_IsScalar(self, String) ||\t\\\n\t PyArray_IsScalar(self, Unicode))\n\t\treturn gentype_getreadbuf(self, segment, (void **)ptrptr);\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"Non-character array cannot be interpreted \"\\\n\t\t\t\t\"as character buffer.\");\n\t\treturn -1;\n\t}\n}\n\n\nstatic PyBufferProcs gentype_as_buffer = {\n (getreadbufferproc)gentype_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)0, /*bf_getwritebuffer*/\n (getsegcountproc)gentype_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)gentype_getcharbuf, /*bf_getcharbuffer*/\n};\n\n\n#define BASEFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES\n#define LEAFFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES\n\nstatic PyTypeObject PyGenericArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"generic_arrtype\",\t /*tp_name*/\n sizeof(PyObject),\t\t /*tp_basicsize*/\n};\n\n/* works for VOID and UNICODE */\n\nstatic void\nflexible_dealloc(PyObject *v) \n{\n\tPyDataMem_FREE(((PyVoidScalarObject *)v)->obval);\n\tv->ob_type->tp_free(v);\n}\n\nstatic void\nstring_arrtype_dealloc(PyObject *v)\n{\n\tv->ob_type->tp_free(v);\n}\n\nstatic void\nobject_arrtype_dealloc(PyObject *v)\n{\n\tPy_DECREF(((PyObjectScalarObject *)v)->obval);\n\tv->ob_type->tp_free(v);\n}\n\n/* string and unicode inherit from Python Type first and so GET_ITEM is different to\n get to the Python Type.\n */\n\n/**begin repeat \n#name=byte, short, int, long, longlong, ubyte, ushort, uint, ulong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, string, unicode, object#\n#TYPE=BYTE, SHORT, INT, LONG, LONGLONG, UBYTE, USHORT, UINT, ULONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, OBJECT#\n#num=1*16,0,0,1#\n*/\nstatic PyObject *\n@name@_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj=NULL;\n\tPyObject *arr;\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n\n\tif (type->tp_bases && (PyTuple_GET_SIZE(type->tp_bases)==2)) {\n\t\tPyTypeObject *sup;\n\t\tPyObject *ret;\n\t\t/* We are inheriting from a Python type as well so\n\t\t give it first dibs on conversion */\n\t\tsup = (PyTypeObject *)PyTuple_GET_ITEM(type->tp_bases, @num@);\n\t\tret = sup->tp_new(type, args, kwds);\n\t\tif (ret) return ret;\n\t\tPyErr_Clear();\n\t\t/* now do default conversion */\n\t}\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\n\ttypecode.type_num = PyArray_@TYPE@;\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n/**end repeat**/\n\n/* bool->tp_new only returns Py_True or Py_False */\nstatic PyObject *\nbool_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj=NULL;\n\tPyObject *arr;\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n\nstatic PyObject *\nvoid_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj, *arr;\n\tulonglong memu=1;\n\tPyObject *new=NULL;\n\tPyArray_Typecode typecode = {PyArray_VOID, 0, 0};\n\tchar *destptr;\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\t/* For a VOID scalar first see if obj is an integer or long \n\t and create new memory of that size (filled with 0) for the scalar\n\t*/\n\n\tif (PyLong_Check(obj) || PyInt_Check(obj) || \\\n\t PyArray_IsScalar(obj, Integer) ||\n\t (PyArray_Check(obj) && PyArray_NDIM(obj)==0 &&\t\\\n\t PyArray_ISINTEGER(obj))) {\n\t\tnew = obj->ob_type->tp_as_number->nb_long(obj);\n\t}\n\tif (new && PyLong_Check(new)) {\n\t\tPyObject *ret;\n\t\tmemu = PyLong_AsUnsignedLongLong(new);\n\t\tPy_DECREF(new);\n\t\tif (PyErr_Occurred() || (memu > MAX_INT)) {\n\t\t\tPyErr_Clear();\n\t\t\tPyErr_Format(PyExc_OverflowError, \n\t\t\t\t \"size must be smaller than %d\",\n\t\t\t\t (int) MAX_INT);\n\t\t\treturn NULL;\n\t\t}\n\t\tdestptr = PyDataMem_NEW((int) memu);\n\t\tif (destptr == NULL) return PyErr_NoMemory();\n\t\tret = type->tp_alloc(type, 0);\n\t\tif (ret == NULL) {\n\t\t\tPyDataMem_FREE(destptr);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\t((PyVoidScalarObject *)ret)->obval = destptr;\n\t\t((PyVoidScalarObject *)ret)->ob_size = (int) memu;\n\t\tmemset(destptr, '\\0', (size_t) memu);\n\t\treturn ret;\n\t}\n\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n\n\n/**************** Define Hash functions ********************/\n\n/**begin repeat\n#lname=bool,ubyte,ushort#\n#name=Bool,UByte, UShort#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n return (long)(((Py@name@ScalarObject *)obj)->obval);\n}\n/**end repeat**/\n\n/**begin repeat\n#lname=byte,short,uint,ulong#\n#name=Byte,Short,UInt,ULong#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((Py@name@ScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n/**end repeat**/\n\n#if SIZEOF_INT != SIZEOF_LONG\nstatic long\nint_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((PyIntScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n#endif\n\n/**begin repeat\n#char=,u#\n#Char=,U#\n#ext=&& (x >= LONG_MIN),#\n*/\n#if SIZEOF_LONG == SIZEOF_LONGLONG\nstatic long\n@char@longlong_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((Py@Char@LongLongScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n#else /* we assume SIZEOF_LONGLONG=2*SIZEOF_LONG */\nstatic long\n@char@longlong_arrtype_hash(PyObject *obj)\n{\n long y;\n @char@longlong x = (((Py@Char@LongLongScalarObject *)obj)->obval);\n\n if ((x <= LONG_MAX)@ext@) {\n y = (long) x;\n }\n else {\n union Mask {\n long hashvals[2];\n @char@longlong v;\n } both;\n\n both.v = x;\n y = both.hashvals[0] + (1000003)*both.hashvals[1];\n }\n if (y == -1) y = -2;\n return y;\n}\n#endif\n/**end repeat**/\n\n/* Wrong thing to do for longdouble, but....*/\n/**begin repeat\n#lname=float, longdouble#\n#name=Float, LongDouble#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n return _Py_HashDouble((double) ((Py@name@ScalarObject *)obj)->obval);\n}\n\n/* borrowed from complex_hash */\nstatic long\nc@lname@_arrtype_hash(PyObject *obj)\n{\n long hashreal, hashimag, combined;\n hashreal = _Py_HashDouble((double) \\\n (((PyC@name@ScalarObject *)obj)->obval).real);\n\n if (hashreal == -1) return -1;\n hashimag = _Py_HashDouble((double) \\\n (((PyC@name@ScalarObject *)obj)->obval).imag);\n if (hashimag == -1) return -1;\n\n combined = hashreal + 1000003 * hashimag;\n if (combined == -1) combined = -2;\n return combined;\n}\n/**end repeat**/\n\nstatic long\nobject_arrtype_hash(PyObject *obj)\n{\n return PyObject_Hash(((PyObjectScalarObject *)obj)->obval);\n}\n\n/* just hash the pointer */\nstatic long\nvoid_arrtype_hash(PyObject *obj)\n{\n return _Py_HashPointer((void *)(((PyVoidScalarObject *)obj)->obval));\n}\n\n/**begin repeat\n#name=bool, string, unicode, void, object#\n#NAME=Bool, String, Unicode, Void, Object#\n*/\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@_arrtype\",\t /*tp_name*/\n sizeof(Py@NAME@ScalarObject),\t /*tp_basicsize*/\n};\n/**end repeat**/\n\n/**begin repeat\n#NAME=Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble#\n#name=int*5, uint*5, float*3, complex*3#\n#CNAME=(CHAR, SHORT, INT, LONG, LONGLONG)*2, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE#\n*/\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@\" STRBITSOF_@CNAME@ \"_arrtype\",\t /*tp_name*/\n sizeof(Py@NAME@ScalarObject),\t /*tp_basicsize*/\n};\n\n/**end repeat**/\n\n\n\n\nstatic PyNumberMethods longdoubletype_as_number;\nstatic PyNumberMethods clongdoubletype_as_number;\n\nstatic void \ninitialize_numeric_types(void)\n{\n\tPyGenericArrType_Type.tp_dealloc = (destructor)gentype_dealloc;\n\tPyGenericArrType_Type.tp_as_number = &gentype_as_number;\n\tPyGenericArrType_Type.tp_as_buffer = &gentype_as_buffer;\n\tPyGenericArrType_Type.tp_flags = BASEFLAGS;\n\tPyGenericArrType_Type.tp_methods = gentype_methods;\n\tPyGenericArrType_Type.tp_getset = gentype_getsets;\n\tPyGenericArrType_Type.tp_new = NULL;\n\tPyGenericArrType_Type.tp_free = PyObject_Del;\n\tPyGenericArrType_Type.tp_repr = gentype_repr;\n\tPyGenericArrType_Type.tp_str = gentype_str;\n\tPyGenericArrType_Type.tp_richcompare = gentype_richcompare;\n\n\t/**begin repeat\n#NAME=Numeric, Integer, SignedInteger, UnsignedInteger, Inexact, Floating, \nComplexFloating, Flexible, Character#\n\t*/\n Py@NAME@ArrType_Type.tp_flags = BASEFLAGS;\n\t/**end repeat**/\n\n\t/**begin repeat\n#name=bool, byte, short, int, long, longlong, ubyte, ushort, uint, ulong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, string, unicode, void, object#\n#NAME=Bool, Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, String, Unicode, Void, Object#\n\t*/\n\tPy@NAME@ArrType_Type.tp_flags = LEAFFLAGS;\n\tPy@NAME@ArrType_Type.tp_new = @name@_arrtype_new;\n\tPy@NAME@ArrType_Type.tp_richcompare = gentype_richcompare;\n\t/**end repeat**/\n\t/* Allow the Void type to be subclassed -- for adding new types */\n\tPyVoidArrType_Type.tp_flags = BASEFLAGS;\n\n /**begin repeat\n#name=bool, byte, short, longlong, ubyte, ushort, uint, ulong, ulonglong, float, longdouble, cfloat, clongdouble, void, object#\n#NAME=Bool, Byte, Short, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, LongDouble, CFloat, CLongDouble, Void, Object#\n */\n Py@NAME@ArrType_Type.tp_hash = @name@_arrtype_hash;\n /**end repeat**/\n\n#if SIZEOF_INT != SIZEOF_LONG\n /* We won't be inheriting from Python Int type. */\n PyIntArrType_Type.tp_hash = int_arrtype_hash;\n#endif\n\n\t/* These need to be coded specially because getitem does not\n\t return a normal Python type\n\t*/\n\tPyLongDoubleArrType_Type.tp_as_number = &longdoubletype_as_number;\n\tPyCLongDoubleArrType_Type.tp_as_number = &clongdoubletype_as_number;\n\n\t/**begin repeat\n#name=int, long, hex, oct, float, repr, str#\n#kind=tp_as_number->nb*5, tp*2#\n\t*/\n\tPyLongDoubleArrType_Type.@kind@_@name@ = longdoubletype_@name@;\n\tPyCLongDoubleArrType_Type.@kind@_@name@ = clongdoubletype_@name@;\n\t/**end repeat**/\n\n\tPyStringArrType_Type.tp_itemsize = sizeof(char);\n\tPyStringArrType_Type.tp_dealloc = string_arrtype_dealloc;\n\tPyFlexibleArrType_Type.tp_dealloc = flexible_dealloc;\n\tPyObjectArrType_Type.tp_dealloc = object_arrtype_dealloc;\n\n\tPyArrayIter_Type.tp_iter = PyObject_SelfIter;\n\tPyArrayMapIter_Type.tp_iter = PyObject_SelfIter;\n}\n\n\nstatic PyTypeObject *typeobjects[] = {\n\t&PyBoolArrType_Type,\n\t&PyByteArrType_Type,\n\t&PyUByteArrType_Type,\n\t&PyShortArrType_Type,\n\t&PyUShortArrType_Type,\n\t&PyIntArrType_Type,\n\t&PyUIntArrType_Type,\n\t&PyLongArrType_Type,\n\t&PyULongArrType_Type,\n\t&PyLongLongArrType_Type,\n\t&PyULongLongArrType_Type,\n\t&PyFloatArrType_Type,\n\t&PyDoubleArrType_Type,\n\t&PyLongDoubleArrType_Type,\n\t&PyCFloatArrType_Type,\n\t&PyCDoubleArrType_Type,\n\t&PyCLongDoubleArrType_Type,\n\t&PyObjectArrType_Type,\n\t&PyStringArrType_Type,\n\t&PyUnicodeArrType_Type,\n\t&PyVoidArrType_Type\n};\n\n\nstatic int\nPyArray_TypenumFromTypeObject(PyObject *type) \n{\n\tint typenum, i;\n\n\ttypenum = PyArray_NOTYPE;\n i = 0;\n\twhile(i < PyArray_NTYPES) {\n\t\tif (type == (PyObject *)typeobjects[i]) {\n\t\t\ttypenum = i;\n\t\t\tbreak;\n\t\t}\n i++;\n\t}\n\tif (typenum != PyArray_NOTYPE)\n\t\treturn typenum;\n\n\t/* Find registered types */\n\t\n\t/* here */\n\n\t/* Convert generic types to specific types */\n\tif ((type == (PyObject *) &PyNumericArrType_Type) || \\\n\t (type == (PyObject *) &PyInexactArrType_Type) || \\\n\t (type == (PyObject *) &PyFloatingArrType_Type))\n\t\treturn PyArray_DOUBLE;\n\telse if (type == (PyObject *)&PyComplexFloatingArrType_Type)\n\t\treturn PyArray_CDOUBLE;\n\telse if ((type == (PyObject *)&PyIntegerArrType_Type) ||\t\\\n\t\t (type == (PyObject *)&PySignedIntegerArrType_Type))\n\t\treturn PyArray_LONG;\n\telse if (type == (PyObject *) &PyUnsignedIntegerArrType_Type)\n\t\treturn PyArray_ULONG;\n else if (type == (PyObject *) &PyCharacterArrType_Type)\n\t\treturn PyArray_STRING;\n\telse if (type == (PyObject *) &PyFlexibleArrType_Type)\n\t\treturn PyArray_VOID;\n\telse if (type == (PyObject *)&PyBool_Type)\n\t\ttypenum = PyArray_BOOL;\n\telse if (type == (PyObject *)&PyInt_Type)\n\t\ttypenum = PyArray_LONG;\n\telse if (type == (PyObject *)&PyFloat_Type)\n\t\ttypenum = PyArray_DOUBLE;\t\n\telse if (type == (PyObject *)&PyComplex_Type)\n\t\ttypenum = PyArray_CDOUBLE;\n\telse if (type == (PyObject *)&PyString_Type)\n\t\ttypenum = PyArray_STRING;\n\telse if (type == (PyObject *)&PyUnicode_Type)\n\t\ttypenum = PyArray_UNICODE;\n\telse if (type == (PyObject *)&PyBuffer_Type)\n\t\ttypenum = PyArray_VOID;\n\telse\n\t\ttypenum = PyArray_OBJECT;\n\treturn typenum;\n}\n\nstatic void \nPyArray_TypecodeFromTypeObject(PyObject *type, PyArray_Typecode *typecode) {\n\tint itemsize = 0;\n\tint type_num;\n\n\ttype_num = PyArray_TypenumFromTypeObject(type);\n\ttypecode->type_num = type_num;\n\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n itemsize = 0;\n\t}\n\telse {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type_num);\n\t\tif (descr != NULL)\n\t\t\titemsize = descr->elsize;\n\t}\n\ttypecode->itemsize = itemsize;\n\treturn;\n}\n\nstatic void \nPyArray_TypecodeFromScalar(PyObject *sc, PyArray_Typecode *typecode)\n{\n\tint type_num;\n\n PyArray_TypecodeFromTypeObject((PyObject *)sc->ob_type, typecode);\n if (typecode->itemsize == 0) {\n type_num = typecode->type_num;\n\t\tif (type_num == PyArray_STRING) \n\t\t\ttypecode->itemsize = PyString_GET_SIZE(sc);\n\t\telse if (type_num == PyArray_UNICODE)\n\t\t\ttypecode->itemsize = PyUnicode_GET_DATA_SIZE(sc);\n\t\telse if (type_num == PyArray_VOID) {\n\t\t\ttypecode->itemsize = \\\n\t\t\t\t((PyVoidScalarObject *)sc)->ob_size;\n\t\t}\n }\n\treturn;\n}\n\nstatic PyObject *\nPyArray_TypeObjectFromType(int type)\n{\n\tPyArray_Descr *descr;\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr == NULL) return NULL;\n\tPy_INCREF((PyObject *)descr->typeobj);\n\treturn (PyObject *)descr->typeobj;\n}\n\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ "#if SIZEOF_LONG != SIZEOF_LONGLONG", "/* we assume SIZEOF_LONGLONG=2*SIZEOF_LONG */", "#if SIZEOF_LONG==SIZEOF_LONGLONG", "static long", "ulonglong_arrtype_hash(PyObject *obj)", "{", " long x = (long)(((PyULongLongScalarObject *)obj)->obval);", " if (x == -1) x=-2;", " return x;", "}", "#endif", "", "", "", "#if SIZEOF_LONG != SIZEOF_LONGLONG", " /* We won't be inheriting from Python Int type. */", " PyLongLongArrType_Type.tp_hash = longlong_arrtype_hash;", "#endif", "" ], "deleted": [ "#if SIZEOF_LONG == SIZEOF_LONGLONG", "static long", "@char@longlong_arrtype_hash(PyObject *obj)", "{", " long x = (long)(((Py@Char@LongLongScalarObject *)obj)->obval);", " if (x == -1) x=-2;", " return x;", "}", "#else /* we assume SIZEOF_LONGLONG=2*SIZEOF_LONG */" ] } } ] }, { "hash": "c060ceef8967821801034b649958ec21d55b38d8", "msg": "More 64-bit fixes.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T09:43:38+00:00", "author_timezone": 0, "committer_date": "2005-10-07T09:43:38+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "1f5d0b48db1e7c5ac9b06e9b122c134897edeba2" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 5, "insertions": 8, "lines": 13, "files": 1, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": "scipy/base/numeric.py", "new_path": "scipy/base/numeric.py", "filename": "numeric.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -196,6 +196,9 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1):\n if issubclass(intc, int):\n _typelessdata.append(intc)\n \n+if issubclass(longlong, int):\n+ _typelessdata.append(longlong)\n+\n def array_repr(arr, max_line_width=None, precision=None, suppress_small=None):\n if arr.size > 0 or arr.shape==(0,):\n lst = array2string(arr, max_line_width, precision, suppress_small,\n@@ -224,8 +227,8 @@ def array_str(a, max_line_width = None, precision = None, suppress_small = None)\n \n little_endian = (sys.byteorder == 'little')\n \n-def indices(dimensions, dtype=intp):\n- \"\"\"indices(dimensions,dtype=intp) returns an array representing a grid\n+def indices(dimensions, dtype=int_):\n+ \"\"\"indices(dimensions,dtype=int_) returns an array representing a grid\n of indices with row-only, and column-only variation.\n \"\"\"\n tmp = ones(dimensions, dtype)\n@@ -260,8 +263,8 @@ def load(file):\n # These are all essentially abbreviations\n # These might wind up in a special abbreviations module\n \n-def ones(shape, dtype=intp, fortran=0):\n- \"\"\"ones(shape, dtype=intp) returns an array of the given\n+def ones(shape, dtype=int_, fortran=0):\n+ \"\"\"ones(shape, dtype=int_) returns an array of the given\n dimensions which is initialized to all ones. \n \"\"\"\n a=zeros(shape, dtype, fortran)\n@@ -269,7 +272,7 @@ def ones(shape, dtype=intp, fortran=0):\n ### a[...]=1 -- slower?\n return a\n \n-def identity(n,dtype=intp):\n+def identity(n,dtype=int_):\n \"\"\"identity(n) returns the identity matrix of shape n x n.\n \"\"\"\n a = array([1]+n*[0],dtype=dtype)\n", "added_lines": 8, "deleted_lines": 5, "source_code": "\nimport sys\nimport types, math\n\nimport multiarray\nimport umath\nfrom umath import *\nfrom numerictypes import *\nfrom _compiled_base import _insert\n\nnewaxis = None\n\nndarray = multiarray.ndarray\nbigndarray = multiarray.bigndarray\nufunc = type(sin)\n\narange = multiarray.arange\narray = multiarray.array\nzeros = multiarray.zeros\nempty = multiarray.empty\nfromstring = multiarray.fromstring\nfromfile = multiarray.fromfile\nfrombuffer = multiarray.frombuffer\nwhere = multiarray.where\nconcatenate = multiarray.concatenate\nfastCopyAndTranspose = multiarray._fastCopyAndTranspose\nregister_dtype = multiarray.register_dtype\ncan_cast = multiarray.can_cast\n\n\ndef asarray(a, dtype=None):\n \"\"\"asarray(a,dtype=None) returns a as an array. Unlike array(),\n no copy is performed if a is already an array. Will return a subclass\n of array. \n \"\"\"\n return array(a, dtype, copy=0)\n\ndef asndarray(a, dtype=None):\n \"\"\"asndarray(a, dtype=None) always returns an actual ndarray object.\n No copy is performed if a is already an array.\n Meant primarily for debugging. \n \"\"\"\n dtype = obj2dtype(dtype)\n # exact check\n while 1:\n if type(a) is ndarray:\n if dtype is None or a.dtype is dtype:\n return a\n else:\n return a.astype(dtype)\n try:\n if dtype is None:\n return a.__array__()\n else:\n return a.__array__(dtype)\n except AttributeError:\n a = array(a,dtype) # copy irrelevant\n dtype = None\n\ndef isfortran(a):\n return a.flags['FNC']\n\n# from Fernando Perez's IPython\ndef zeros_like(a):\n \"\"\"Return an array of zeros of the shape and typecode of a.\n\n If you don't explicitly need the array to be zeroed, you should instead\n use empty_like(), which is faster as it only allocates memory.\"\"\"\n\n a = asarray(a)\n return a.__array_wrap__(zeros(a.shape,a.dtype,\n a.flags['FORTRAN'] and a.ndim > 1))\n\ndef empty_like(a):\n \"\"\"Return an empty (uninitialized) array of the shape and typecode of a.\n\n Note that this does NOT initialize the returned array. If you require\n your array to be initialized, you should use zeros_like().\n\n \"\"\"\n asarray(a)\n return a.__array_wrap__(empty(a.shape,a.dtype,\n a.flags['FORTRAN'] and a.ndim > 1))\n\n# end Fernando's utilities\n\n_mode_from_name_dict = {'v': 0,\n 's' : 1,\n 'f' : 2}\n\ndef _mode_from_name(mode):\n if isinstance(mode, type(\"\")):\n return _mode_from_name_dict[mode.lower()[0]]\n return mode\n \ndef correlate(a,v,mode='valid'):\n mode = _mode_from_name(mode)\n return multiarray.correlate(a,v,mode)\n\n\ndef convolve(a,v,mode='full'):\n \"\"\"Returns the discrete, linear convolution of 1-D\n sequences a and v; mode can be 0 (valid), 1 (same), or 2 (full)\n to specify size of the resulting sequence.\n \"\"\"\n if (len(v) > len(a)):\n a, v = v, a\n mode = _mode_from_name(mode)\n return correlate(a,asarray(v)[::-1],mode)\n\n\ninner = multiarray.inner\ndot = multiarray.dot\n\ndef outer(a,b):\n \"\"\"outer(a,b) returns the outer product of two vectors.\n result(i,j) = a(i)*b(j) when a and b are vectors\n Will accept any arguments that can be made into vectors.\n \"\"\"\n a = asndarray(a)\n b = asndarray(b)\n return a.ravel()[:,newaxis]*b.ravel()[newaxis,:]\n\ndef vdot(a, b):\n \"\"\"Returns the dot product of 2 vectors (or anything that can be made into\n a vector). NB: this is not the same as `dot`, as it takes the conjugate\n of its first argument if complex and always returns a scalar.\"\"\"\n return dot(asarray(a).ravel().conj(), asarray(b).ravel())\n\n# try to import blas optimized dot if available\ntry:\n # importing this changes the dot function for basic 4 types\n # to blas-optimized versions.\n from scipy.lib._dotblas import dot, vdot, inner, alterdot, restoredot\nexcept ImportError:\n def alterdot():\n pass\n def restoredot():\n pass\n\n\ndef _move_axis_to_0(a, axis):\n if axis == 0:\n return a\n n = a.ndim\n if axis < 0:\n axis += n\n axes = range(1, axis+1) + [0,] + range(axis+1, n)\n return a.transpose(axes)\n\ndef cross(a, b, axisa=-1, axisb=-1, axisc=-1):\n \"\"\"Return the cross product of two (arrays of) vectors.\n\n The cross product is performed over the last axis of a and b by default,\n and can handle axes with dimensions 2 and 3. For a dimension of 2,\n the z-component of the equivalent three-dimensional cross product is\n returned.\n \"\"\"\n a = _move_axis_to_0(asndarray(a), axisa)\n b = _move_axis_to_0(asndarray(b), axisb)\n msg = \"incompatible dimensions for cross product\\n\"\\\n \"(dimension must be 2 or 3)\"\n if (a.shape[0] not in [2,3]) or (b.shape[0] not in [2,3]):\n raise ValueError(msg)\n if a.shape[0] == 2:\n if (b.shape[0] == 2):\n cp = a[0]*b[1] - a[1]*b[0]\n if cp.ndim == 0:\n return cp\n else:\n return cp.swapaxes(0,axisc)\n else:\n x = a[1]*b[2]\n y = -a[0]*b[2]\n z = a[0]*b[1] - a[1]*b[0]\n elif a.shape[0] == 3:\n if (b.shape[0] == 3):\n x = a[1]*b[2] - a[2]*b[1]\n y = a[2]*b[0] - a[0]*b[2]\n z = a[0]*b[1] - a[1]*b[0]\n else:\n x = -a[2]*b[1]\n y = a[2]*b[0]\n z = a[0]*b[1] - a[1]*b[0]\n cp = array([x,y,z])\n if cp.ndim == 1:\n return cp\n else:\n return cp.swapaxes(0,axisc)\n \n\n#Use numarray's printing function\nfrom arrayprint import array2string, get_printoptions, set_printoptions\n\n_typelessdata = [int_, float_, complex_]\nif issubclass(intc, int):\n _typelessdata.append(intc)\n\nif issubclass(longlong, int):\n _typelessdata.append(longlong)\n\ndef array_repr(arr, max_line_width=None, precision=None, suppress_small=None):\n if arr.size > 0 or arr.shape==(0,):\n lst = array2string(arr, max_line_width, precision, suppress_small,\n ', ', \"array(\")\n else: # show zero-length shape unless it is (0,)\n lst = \"[], shape=%s\" % (repr(arr.shape),)\n typeless = arr.dtype in _typelessdata\n\n if arr.__class__ is not ndarray:\n cName= arr.__class__.__name__\n else:\n cName = \"array\"\n if typeless and arr.size:\n return cName + \"(%s)\" % lst\n else:\n typename=arr.dtype.__name__[:-8]\n return cName + \"(%s, dtype=%s)\" % (lst, typename)\n\ndef array_str(a, max_line_width = None, precision = None, suppress_small = None):\n return array2string(a, max_line_width, precision, suppress_small, ' ', \"\")\n\nset_string_function = multiarray.set_string_function\nset_string_function(array_str, 0)\nset_string_function(array_repr, 1)\n\n\nlittle_endian = (sys.byteorder == 'little')\n\ndef indices(dimensions, dtype=int_):\n \"\"\"indices(dimensions,dtype=int_) returns an array representing a grid\n of indices with row-only, and column-only variation.\n \"\"\"\n tmp = ones(dimensions, dtype)\n lst = []\n for i in range(len(dimensions)):\n lst.append( add.accumulate(tmp, i, )-1 )\n return array(lst)\n\ndef fromfunction(function, dimensions, **kwargs):\n \"\"\"fromfunction(function, dimensions) returns an array constructed by\n calling function on a tuple of number grids. The function should\n accept as many arguments as there are dimensions which is a list of\n numbers indicating the length of the desired output for each axis.\n\n The function can also accept keyword arguments which will be\n passed in as well. \n \"\"\"\n args = indices(dimensions)\n return function(*args,**kwargs)\n \n\nfrom cPickle import load, loads\n_cload = load\n_file = file\n\ndef load(file):\n if isinstance(file, type(\"\")):\n file = _file(file,\"rb\")\n return _cload(file)\n\n\n# These are all essentially abbreviations\n# These might wind up in a special abbreviations module\n\ndef ones(shape, dtype=int_, fortran=0):\n \"\"\"ones(shape, dtype=int_) returns an array of the given\n dimensions which is initialized to all ones. \n \"\"\"\n a=zeros(shape, dtype, fortran)\n a+=1\n ### a[...]=1 -- slower?\n return a\n \ndef identity(n,dtype=int_):\n \"\"\"identity(n) returns the identity matrix of shape n x n.\n \"\"\"\n a = array([1]+n*[0],dtype=dtype)\n b = empty((n,n),dtype=dtype)\n b.flat = a\n return b\n\ndef allclose (a, b, rtol=1.e-5, atol=1.e-8):\n \"\"\" allclose(a,b,rtol=1.e-5,atol=1.e-8)\n Returns true if all components of a and b are equal\n subject to given tolerances.\n The relative error rtol must be positive and << 1.0\n The absolute error atol comes into play for those elements\n of y that are very small or zero; it says how small x must be also.\n \"\"\"\n x = array(a, copy=0)\n y = array(b, copy=0)\n d = less(absolute(x-y), atol + rtol * absolute(y))\n return alltrue(ravel(d))\n \n\n_errdict = {\"ignore\":ERR_IGNORE,\n \"warn\":ERR_WARN,\n \"raise\":ERR_RAISE,\n \"call\":ERR_CALL}\n\n_errdict_rev = {}\nfor key in _errdict.keys():\n _errdict_rev[_errdict[key]] = key\ndel key\n\ndef seterr(divide=\"ignore\", over=\"ignore\", under=\"ignore\", invalid=\"ignore\", where=0):\n maskvalue = (_errdict[divide] << SHIFT_DIVIDEBYZERO) + \\\n (_errdict[over] << SHIFT_OVERFLOW ) + \\\n (_errdict[under] << SHIFT_UNDERFLOW) + \\\n (_errdict[invalid] << SHIFT_INVALID)\n frame = sys._getframe().f_back\n try:\n wh = where.lower()[0]\n except (AttributeError, TypeError, IndexError):\n wh = None\n if where==0 or wh == 'l':\n frame.f_locals[UFUNC_ERRMASK_NAME] = maskvalue\n elif where == 1 or wh == 'g':\n frame.f_globals[UFUNC_ERRMASK_NAME] = maskvalue\n elif where == 2 or wh == 'b':\n frame.f_builtins[UFUNC_ERRMASK_NAME] = maskvalue\n return\n\n frame.f_locals[UFUNC_ERRMASK_NAME] = maskvalue\n return\n\nseterr()\n\ndef geterr():\n frame = sys._getframe().f_back\n try:\n maskvalue = frame.f_locals[UFUNC_ERRMASK_NAME]\n except KeyError:\n maskvalue = ERR_DEFAULT\n\n mask = 3\n res = {}\n val = (maskvalue >> SHIFT_DIVIDEBYZERO) & mask\n res['divide'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_OVERFLOW) & mask\n res['over'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_UNDERFLOW) & mask\n res['under'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_INVALID) & mask\n res['invalid'] = _errdict_rev[val]\n return res\n\ndef setbufsize(size, where=0):\n if size > 10e6:\n raise ValueError, \"Very big buffers.. %s\" % size\n frame = sys._getframe().f_back\n try:\n wh = where.lower()[0]\n except (AttributeError, TypeError, IndexError):\n wh = None\n if where == 0 or wh == 'l':\n frame.f_locals[UFUNC_BUFSIZE_NAME] = size\n elif where == 1 or wh == 'g':\n frame.f_globals[UFUNC_BUFSIZE_NAME] = size\n elif where == 2 or wh == 'b':\n frame.f_builtins[UFUNC_BUFSIZE_NAME] = size\n return\n\nsetbufsize(10000, 1)\n\ndef getbufsize(size):\n frame = sys._getframe().f_back\n try:\n retval = frame.f_locals[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retval = frame.f_globals[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retval = frame.f_builtins[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retvalue = UFUNC_BUFSIZE_DEFAULT\n\n return retval\n\n\n# Set the UFUNC_BUFSIZE_NAME to something\n# Set the UFUNC_ERRMASK_NAME to something\nseterr(where='builtin')\nsetbufsize(UFUNC_BUFSIZE_DEFAULT,where='builtin')\n\nInf = inf = infty = Infinity = PINF\nnan = NaN = NAN\nfrom oldnumeric import *\n\n\n", "source_code_before": "\nimport sys\nimport types, math\n\nimport multiarray\nimport umath\nfrom umath import *\nfrom numerictypes import *\nfrom _compiled_base import _insert\n\nnewaxis = None\n\nndarray = multiarray.ndarray\nbigndarray = multiarray.bigndarray\nufunc = type(sin)\n\narange = multiarray.arange\narray = multiarray.array\nzeros = multiarray.zeros\nempty = multiarray.empty\nfromstring = multiarray.fromstring\nfromfile = multiarray.fromfile\nfrombuffer = multiarray.frombuffer\nwhere = multiarray.where\nconcatenate = multiarray.concatenate\nfastCopyAndTranspose = multiarray._fastCopyAndTranspose\nregister_dtype = multiarray.register_dtype\ncan_cast = multiarray.can_cast\n\n\ndef asarray(a, dtype=None):\n \"\"\"asarray(a,dtype=None) returns a as an array. Unlike array(),\n no copy is performed if a is already an array. Will return a subclass\n of array. \n \"\"\"\n return array(a, dtype, copy=0)\n\ndef asndarray(a, dtype=None):\n \"\"\"asndarray(a, dtype=None) always returns an actual ndarray object.\n No copy is performed if a is already an array.\n Meant primarily for debugging. \n \"\"\"\n dtype = obj2dtype(dtype)\n # exact check\n while 1:\n if type(a) is ndarray:\n if dtype is None or a.dtype is dtype:\n return a\n else:\n return a.astype(dtype)\n try:\n if dtype is None:\n return a.__array__()\n else:\n return a.__array__(dtype)\n except AttributeError:\n a = array(a,dtype) # copy irrelevant\n dtype = None\n\ndef isfortran(a):\n return a.flags['FNC']\n\n# from Fernando Perez's IPython\ndef zeros_like(a):\n \"\"\"Return an array of zeros of the shape and typecode of a.\n\n If you don't explicitly need the array to be zeroed, you should instead\n use empty_like(), which is faster as it only allocates memory.\"\"\"\n\n a = asarray(a)\n return a.__array_wrap__(zeros(a.shape,a.dtype,\n a.flags['FORTRAN'] and a.ndim > 1))\n\ndef empty_like(a):\n \"\"\"Return an empty (uninitialized) array of the shape and typecode of a.\n\n Note that this does NOT initialize the returned array. If you require\n your array to be initialized, you should use zeros_like().\n\n \"\"\"\n asarray(a)\n return a.__array_wrap__(empty(a.shape,a.dtype,\n a.flags['FORTRAN'] and a.ndim > 1))\n\n# end Fernando's utilities\n\n_mode_from_name_dict = {'v': 0,\n 's' : 1,\n 'f' : 2}\n\ndef _mode_from_name(mode):\n if isinstance(mode, type(\"\")):\n return _mode_from_name_dict[mode.lower()[0]]\n return mode\n \ndef correlate(a,v,mode='valid'):\n mode = _mode_from_name(mode)\n return multiarray.correlate(a,v,mode)\n\n\ndef convolve(a,v,mode='full'):\n \"\"\"Returns the discrete, linear convolution of 1-D\n sequences a and v; mode can be 0 (valid), 1 (same), or 2 (full)\n to specify size of the resulting sequence.\n \"\"\"\n if (len(v) > len(a)):\n a, v = v, a\n mode = _mode_from_name(mode)\n return correlate(a,asarray(v)[::-1],mode)\n\n\ninner = multiarray.inner\ndot = multiarray.dot\n\ndef outer(a,b):\n \"\"\"outer(a,b) returns the outer product of two vectors.\n result(i,j) = a(i)*b(j) when a and b are vectors\n Will accept any arguments that can be made into vectors.\n \"\"\"\n a = asndarray(a)\n b = asndarray(b)\n return a.ravel()[:,newaxis]*b.ravel()[newaxis,:]\n\ndef vdot(a, b):\n \"\"\"Returns the dot product of 2 vectors (or anything that can be made into\n a vector). NB: this is not the same as `dot`, as it takes the conjugate\n of its first argument if complex and always returns a scalar.\"\"\"\n return dot(asarray(a).ravel().conj(), asarray(b).ravel())\n\n# try to import blas optimized dot if available\ntry:\n # importing this changes the dot function for basic 4 types\n # to blas-optimized versions.\n from scipy.lib._dotblas import dot, vdot, inner, alterdot, restoredot\nexcept ImportError:\n def alterdot():\n pass\n def restoredot():\n pass\n\n\ndef _move_axis_to_0(a, axis):\n if axis == 0:\n return a\n n = a.ndim\n if axis < 0:\n axis += n\n axes = range(1, axis+1) + [0,] + range(axis+1, n)\n return a.transpose(axes)\n\ndef cross(a, b, axisa=-1, axisb=-1, axisc=-1):\n \"\"\"Return the cross product of two (arrays of) vectors.\n\n The cross product is performed over the last axis of a and b by default,\n and can handle axes with dimensions 2 and 3. For a dimension of 2,\n the z-component of the equivalent three-dimensional cross product is\n returned.\n \"\"\"\n a = _move_axis_to_0(asndarray(a), axisa)\n b = _move_axis_to_0(asndarray(b), axisb)\n msg = \"incompatible dimensions for cross product\\n\"\\\n \"(dimension must be 2 or 3)\"\n if (a.shape[0] not in [2,3]) or (b.shape[0] not in [2,3]):\n raise ValueError(msg)\n if a.shape[0] == 2:\n if (b.shape[0] == 2):\n cp = a[0]*b[1] - a[1]*b[0]\n if cp.ndim == 0:\n return cp\n else:\n return cp.swapaxes(0,axisc)\n else:\n x = a[1]*b[2]\n y = -a[0]*b[2]\n z = a[0]*b[1] - a[1]*b[0]\n elif a.shape[0] == 3:\n if (b.shape[0] == 3):\n x = a[1]*b[2] - a[2]*b[1]\n y = a[2]*b[0] - a[0]*b[2]\n z = a[0]*b[1] - a[1]*b[0]\n else:\n x = -a[2]*b[1]\n y = a[2]*b[0]\n z = a[0]*b[1] - a[1]*b[0]\n cp = array([x,y,z])\n if cp.ndim == 1:\n return cp\n else:\n return cp.swapaxes(0,axisc)\n \n\n#Use numarray's printing function\nfrom arrayprint import array2string, get_printoptions, set_printoptions\n\n_typelessdata = [int_, float_, complex_]\nif issubclass(intc, int):\n _typelessdata.append(intc)\n\ndef array_repr(arr, max_line_width=None, precision=None, suppress_small=None):\n if arr.size > 0 or arr.shape==(0,):\n lst = array2string(arr, max_line_width, precision, suppress_small,\n ', ', \"array(\")\n else: # show zero-length shape unless it is (0,)\n lst = \"[], shape=%s\" % (repr(arr.shape),)\n typeless = arr.dtype in _typelessdata\n\n if arr.__class__ is not ndarray:\n cName= arr.__class__.__name__\n else:\n cName = \"array\"\n if typeless and arr.size:\n return cName + \"(%s)\" % lst\n else:\n typename=arr.dtype.__name__[:-8]\n return cName + \"(%s, dtype=%s)\" % (lst, typename)\n\ndef array_str(a, max_line_width = None, precision = None, suppress_small = None):\n return array2string(a, max_line_width, precision, suppress_small, ' ', \"\")\n\nset_string_function = multiarray.set_string_function\nset_string_function(array_str, 0)\nset_string_function(array_repr, 1)\n\n\nlittle_endian = (sys.byteorder == 'little')\n\ndef indices(dimensions, dtype=intp):\n \"\"\"indices(dimensions,dtype=intp) returns an array representing a grid\n of indices with row-only, and column-only variation.\n \"\"\"\n tmp = ones(dimensions, dtype)\n lst = []\n for i in range(len(dimensions)):\n lst.append( add.accumulate(tmp, i, )-1 )\n return array(lst)\n\ndef fromfunction(function, dimensions, **kwargs):\n \"\"\"fromfunction(function, dimensions) returns an array constructed by\n calling function on a tuple of number grids. The function should\n accept as many arguments as there are dimensions which is a list of\n numbers indicating the length of the desired output for each axis.\n\n The function can also accept keyword arguments which will be\n passed in as well. \n \"\"\"\n args = indices(dimensions)\n return function(*args,**kwargs)\n \n\nfrom cPickle import load, loads\n_cload = load\n_file = file\n\ndef load(file):\n if isinstance(file, type(\"\")):\n file = _file(file,\"rb\")\n return _cload(file)\n\n\n# These are all essentially abbreviations\n# These might wind up in a special abbreviations module\n\ndef ones(shape, dtype=intp, fortran=0):\n \"\"\"ones(shape, dtype=intp) returns an array of the given\n dimensions which is initialized to all ones. \n \"\"\"\n a=zeros(shape, dtype, fortran)\n a+=1\n ### a[...]=1 -- slower?\n return a\n \ndef identity(n,dtype=intp):\n \"\"\"identity(n) returns the identity matrix of shape n x n.\n \"\"\"\n a = array([1]+n*[0],dtype=dtype)\n b = empty((n,n),dtype=dtype)\n b.flat = a\n return b\n\ndef allclose (a, b, rtol=1.e-5, atol=1.e-8):\n \"\"\" allclose(a,b,rtol=1.e-5,atol=1.e-8)\n Returns true if all components of a and b are equal\n subject to given tolerances.\n The relative error rtol must be positive and << 1.0\n The absolute error atol comes into play for those elements\n of y that are very small or zero; it says how small x must be also.\n \"\"\"\n x = array(a, copy=0)\n y = array(b, copy=0)\n d = less(absolute(x-y), atol + rtol * absolute(y))\n return alltrue(ravel(d))\n \n\n_errdict = {\"ignore\":ERR_IGNORE,\n \"warn\":ERR_WARN,\n \"raise\":ERR_RAISE,\n \"call\":ERR_CALL}\n\n_errdict_rev = {}\nfor key in _errdict.keys():\n _errdict_rev[_errdict[key]] = key\ndel key\n\ndef seterr(divide=\"ignore\", over=\"ignore\", under=\"ignore\", invalid=\"ignore\", where=0):\n maskvalue = (_errdict[divide] << SHIFT_DIVIDEBYZERO) + \\\n (_errdict[over] << SHIFT_OVERFLOW ) + \\\n (_errdict[under] << SHIFT_UNDERFLOW) + \\\n (_errdict[invalid] << SHIFT_INVALID)\n frame = sys._getframe().f_back\n try:\n wh = where.lower()[0]\n except (AttributeError, TypeError, IndexError):\n wh = None\n if where==0 or wh == 'l':\n frame.f_locals[UFUNC_ERRMASK_NAME] = maskvalue\n elif where == 1 or wh == 'g':\n frame.f_globals[UFUNC_ERRMASK_NAME] = maskvalue\n elif where == 2 or wh == 'b':\n frame.f_builtins[UFUNC_ERRMASK_NAME] = maskvalue\n return\n\n frame.f_locals[UFUNC_ERRMASK_NAME] = maskvalue\n return\n\nseterr()\n\ndef geterr():\n frame = sys._getframe().f_back\n try:\n maskvalue = frame.f_locals[UFUNC_ERRMASK_NAME]\n except KeyError:\n maskvalue = ERR_DEFAULT\n\n mask = 3\n res = {}\n val = (maskvalue >> SHIFT_DIVIDEBYZERO) & mask\n res['divide'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_OVERFLOW) & mask\n res['over'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_UNDERFLOW) & mask\n res['under'] = _errdict_rev[val]\n val = (maskvalue >> SHIFT_INVALID) & mask\n res['invalid'] = _errdict_rev[val]\n return res\n\ndef setbufsize(size, where=0):\n if size > 10e6:\n raise ValueError, \"Very big buffers.. %s\" % size\n frame = sys._getframe().f_back\n try:\n wh = where.lower()[0]\n except (AttributeError, TypeError, IndexError):\n wh = None\n if where == 0 or wh == 'l':\n frame.f_locals[UFUNC_BUFSIZE_NAME] = size\n elif where == 1 or wh == 'g':\n frame.f_globals[UFUNC_BUFSIZE_NAME] = size\n elif where == 2 or wh == 'b':\n frame.f_builtins[UFUNC_BUFSIZE_NAME] = size\n return\n\nsetbufsize(10000, 1)\n\ndef getbufsize(size):\n frame = sys._getframe().f_back\n try:\n retval = frame.f_locals[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retval = frame.f_globals[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retval = frame.f_builtins[UFUNC_BUFSIZE_NAME]\n except KeyError:\n retvalue = UFUNC_BUFSIZE_DEFAULT\n\n return retval\n\n\n# Set the UFUNC_BUFSIZE_NAME to something\n# Set the UFUNC_ERRMASK_NAME to something\nseterr(where='builtin')\nsetbufsize(UFUNC_BUFSIZE_DEFAULT,where='builtin')\n\nInf = inf = infty = Infinity = PINF\nnan = NaN = NAN\nfrom oldnumeric import *\n\n\n", "methods": [ { "name": "asarray", "long_name": "asarray( a , dtype = None )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 21, "parameters": [ "a", "dtype" ], "start_line": 31, "end_line": 36, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "asndarray", "long_name": "asndarray( a , dtype = None )", "filename": "numeric.py", "nloc": 16, "complexity": 7, "token_count": 85, "parameters": [ "a", "dtype" ], "start_line": 38, "end_line": 58, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "isfortran", "long_name": "isfortran( a )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 12, "parameters": [ "a" ], "start_line": 60, "end_line": 61, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "zeros_like", "long_name": "zeros_like( a )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 41, "parameters": [ "a" ], "start_line": 64, "end_line": 72, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "empty_like", "long_name": "empty_like( a )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 39, "parameters": [ "a" ], "start_line": 74, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "_mode_from_name", "long_name": "_mode_from_name( mode )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 30, "parameters": [ "mode" ], "start_line": 91, "end_line": 94, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "correlate", "long_name": "correlate( a , v , mode = 'valid' )", "filename": "numeric.py", "nloc": 3, "complexity": 1, "token_count": 28, "parameters": [ "a", "v", "mode" ], "start_line": 96, "end_line": 98, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 0 }, { "name": "convolve", "long_name": "convolve( a , v , mode = 'full' )", "filename": "numeric.py", "nloc": 5, "complexity": 2, "token_count": 55, "parameters": [ "a", "v", "mode" ], "start_line": 101, "end_line": 109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "outer", "long_name": "outer( a , b )", "filename": "numeric.py", "nloc": 4, "complexity": 1, "token_count": 42, "parameters": [ "a", "b" ], "start_line": 115, "end_line": 122, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "vdot", "long_name": "vdot( a , b )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 33, "parameters": [ "a", "b" ], "start_line": 124, "end_line": 128, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "alterdot", "long_name": "alterdot( )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 5, "parameters": [], "start_line": 136, "end_line": 137, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "restoredot", "long_name": "restoredot( )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 5, "parameters": [], "start_line": 138, "end_line": 139, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "_move_axis_to_0", "long_name": "_move_axis_to_0( a , axis )", "filename": "numeric.py", "nloc": 8, "complexity": 3, "token_count": 58, "parameters": [ "a", "axis" ], "start_line": 142, "end_line": 149, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "cross", "long_name": "cross( a , b , axisa = - 1 , axisb = - 1 , axisc = - 1 )", "filename": "numeric.py", "nloc": 32, "complexity": 9, "token_count": 360, "parameters": [ "a", "b", "axisa", "axisb", "axisc" ], "start_line": 151, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( arr , max_line_width = None , precision = None , suppress_small = None )", "filename": "numeric.py", "nloc": 16, "complexity": 6, "token_count": 128, "parameters": [ "arr", "max_line_width", "precision", "suppress_small" ], "start_line": 202, "end_line": 218, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( a , max_line_width = None , precision = None , suppress_small = None )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 32, "parameters": [ "a", "max_line_width", "precision", "suppress_small" ], "start_line": 220, "end_line": 221, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "indices", "long_name": "indices( dimensions , dtype = int_ )", "filename": "numeric.py", "nloc": 6, "complexity": 2, "token_count": 54, "parameters": [ "dimensions", "dtype" ], "start_line": 230, "end_line": 238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "fromfunction", "long_name": "fromfunction( function , dimensions , ** kwargs )", "filename": "numeric.py", "nloc": 3, "complexity": 1, "token_count": 26, "parameters": [ "function", "dimensions", "kwargs" ], "start_line": 240, "end_line": 250, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "load", "long_name": "load( file )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 29, "parameters": [ "file" ], "start_line": 257, "end_line": 260, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "ones", "long_name": "ones( shape , dtype = int_ , fortran = 0 )", "filename": "numeric.py", "nloc": 4, "complexity": 1, "token_count": 29, "parameters": [ "shape", "dtype", "fortran" ], "start_line": 266, "end_line": 273, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "identity", "long_name": "identity( n , dtype = int_ )", "filename": "numeric.py", "nloc": 5, "complexity": 1, "token_count": 49, "parameters": [ "n", "dtype" ], "start_line": 275, "end_line": 281, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "allclose", "long_name": "allclose( a , b , rtol = 1 . e - 5 , atol = 1 . e - 8 )", "filename": "numeric.py", "nloc": 5, "complexity": 1, "token_count": 72, "parameters": [ "a", "b", "rtol", "atol" ], "start_line": 283, "end_line": 294, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "seterr", "long_name": "seterr( divide = \"ignore\" , over = \"ignore\" , under = \"ignore\" , invalid = \"ignore\" , where = 0 )", "filename": "numeric.py", "nloc": 19, "complexity": 8, "token_count": 161, "parameters": [ "divide", "over", "under", "invalid", "where" ], "start_line": 307, "end_line": 326, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "geterr", "long_name": "geterr( )", "filename": "numeric.py", "nloc": 17, "complexity": 2, "token_count": 114, "parameters": [], "start_line": 330, "end_line": 347, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "setbufsize", "long_name": "setbufsize( size , where = 0 )", "filename": "numeric.py", "nloc": 15, "complexity": 9, "token_count": 105, "parameters": [ "size", "where" ], "start_line": 349, "end_line": 363, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "getbufsize", "long_name": "getbufsize( size )", "filename": "numeric.py", "nloc": 11, "complexity": 4, "token_count": 54, "parameters": [ "size" ], "start_line": 367, "end_line": 378, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 } ], "methods_before": [ { "name": "asarray", "long_name": "asarray( a , dtype = None )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 21, "parameters": [ "a", "dtype" ], "start_line": 31, "end_line": 36, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "asndarray", "long_name": "asndarray( a , dtype = None )", "filename": "numeric.py", "nloc": 16, "complexity": 7, "token_count": 85, "parameters": [ "a", "dtype" ], "start_line": 38, "end_line": 58, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "isfortran", "long_name": "isfortran( a )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 12, "parameters": [ "a" ], "start_line": 60, "end_line": 61, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "zeros_like", "long_name": "zeros_like( a )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 41, "parameters": [ "a" ], "start_line": 64, "end_line": 72, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "empty_like", "long_name": "empty_like( a )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 39, "parameters": [ "a" ], "start_line": 74, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "_mode_from_name", "long_name": "_mode_from_name( mode )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 30, "parameters": [ "mode" ], "start_line": 91, "end_line": 94, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "correlate", "long_name": "correlate( a , v , mode = 'valid' )", "filename": "numeric.py", "nloc": 3, "complexity": 1, "token_count": 28, "parameters": [ "a", "v", "mode" ], "start_line": 96, "end_line": 98, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 0 }, { "name": "convolve", "long_name": "convolve( a , v , mode = 'full' )", "filename": "numeric.py", "nloc": 5, "complexity": 2, "token_count": 55, "parameters": [ "a", "v", "mode" ], "start_line": 101, "end_line": 109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "outer", "long_name": "outer( a , b )", "filename": "numeric.py", "nloc": 4, "complexity": 1, "token_count": 42, "parameters": [ "a", "b" ], "start_line": 115, "end_line": 122, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "vdot", "long_name": "vdot( a , b )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 33, "parameters": [ "a", "b" ], "start_line": 124, "end_line": 128, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "alterdot", "long_name": "alterdot( )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 5, "parameters": [], "start_line": 136, "end_line": 137, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "restoredot", "long_name": "restoredot( )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 5, "parameters": [], "start_line": 138, "end_line": 139, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "_move_axis_to_0", "long_name": "_move_axis_to_0( a , axis )", "filename": "numeric.py", "nloc": 8, "complexity": 3, "token_count": 58, "parameters": [ "a", "axis" ], "start_line": 142, "end_line": 149, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "cross", "long_name": "cross( a , b , axisa = - 1 , axisb = - 1 , axisc = - 1 )", "filename": "numeric.py", "nloc": 32, "complexity": 9, "token_count": 360, "parameters": [ "a", "b", "axisa", "axisb", "axisc" ], "start_line": 151, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( arr , max_line_width = None , precision = None , suppress_small = None )", "filename": "numeric.py", "nloc": 16, "complexity": 6, "token_count": 128, "parameters": [ "arr", "max_line_width", "precision", "suppress_small" ], "start_line": 199, "end_line": 215, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( a , max_line_width = None , precision = None , suppress_small = None )", "filename": "numeric.py", "nloc": 2, "complexity": 1, "token_count": 32, "parameters": [ "a", "max_line_width", "precision", "suppress_small" ], "start_line": 217, "end_line": 218, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "indices", "long_name": "indices( dimensions , dtype = intp )", "filename": "numeric.py", "nloc": 6, "complexity": 2, "token_count": 54, "parameters": [ "dimensions", "dtype" ], "start_line": 227, "end_line": 235, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "fromfunction", "long_name": "fromfunction( function , dimensions , ** kwargs )", "filename": "numeric.py", "nloc": 3, "complexity": 1, "token_count": 26, "parameters": [ "function", "dimensions", "kwargs" ], "start_line": 237, "end_line": 247, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "load", "long_name": "load( file )", "filename": "numeric.py", "nloc": 4, "complexity": 2, "token_count": 29, "parameters": [ "file" ], "start_line": 254, "end_line": 257, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "ones", "long_name": "ones( shape , dtype = intp , fortran = 0 )", "filename": "numeric.py", "nloc": 4, "complexity": 1, "token_count": 29, "parameters": [ "shape", "dtype", "fortran" ], "start_line": 263, "end_line": 270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "identity", "long_name": "identity( n , dtype = intp )", "filename": "numeric.py", "nloc": 5, "complexity": 1, "token_count": 49, "parameters": [ "n", "dtype" ], "start_line": 272, "end_line": 278, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "allclose", "long_name": "allclose( a , b , rtol = 1 . e - 5 , atol = 1 . e - 8 )", "filename": "numeric.py", "nloc": 5, "complexity": 1, "token_count": 72, "parameters": [ "a", "b", "rtol", "atol" ], "start_line": 280, "end_line": 291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "seterr", "long_name": "seterr( divide = \"ignore\" , over = \"ignore\" , under = \"ignore\" , invalid = \"ignore\" , where = 0 )", "filename": "numeric.py", "nloc": 19, "complexity": 8, "token_count": 161, "parameters": [ "divide", "over", "under", "invalid", "where" ], "start_line": 304, "end_line": 323, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "geterr", "long_name": "geterr( )", "filename": "numeric.py", "nloc": 17, "complexity": 2, "token_count": 114, "parameters": [], "start_line": 327, "end_line": 344, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "setbufsize", "long_name": "setbufsize( size , where = 0 )", "filename": "numeric.py", "nloc": 15, "complexity": 9, "token_count": 105, "parameters": [ "size", "where" ], "start_line": 346, "end_line": 360, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "getbufsize", "long_name": "getbufsize( size )", "filename": "numeric.py", "nloc": 11, "complexity": 4, "token_count": 54, "parameters": [ "size" ], "start_line": 364, "end_line": 375, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "ones", "long_name": "ones( shape , dtype = intp , fortran = 0 )", "filename": "numeric.py", "nloc": 4, "complexity": 1, "token_count": 29, "parameters": [ "shape", "dtype", "fortran" ], "start_line": 263, "end_line": 270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "indices", "long_name": "indices( dimensions , dtype = int_ )", "filename": "numeric.py", "nloc": 6, "complexity": 2, "token_count": 54, "parameters": [ "dimensions", "dtype" ], "start_line": 230, "end_line": 238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "identity", "long_name": "identity( n , dtype = int_ )", "filename": "numeric.py", "nloc": 5, "complexity": 1, "token_count": 49, "parameters": [ "n", "dtype" ], "start_line": 275, "end_line": 281, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "indices", "long_name": "indices( dimensions , dtype = intp )", "filename": "numeric.py", "nloc": 6, "complexity": 2, "token_count": 54, "parameters": [ "dimensions", "dtype" ], "start_line": 227, "end_line": 235, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "ones", "long_name": "ones( shape , dtype = int_ , fortran = 0 )", "filename": "numeric.py", "nloc": 4, "complexity": 1, "token_count": 29, "parameters": [ "shape", "dtype", "fortran" ], "start_line": 266, "end_line": 273, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "identity", "long_name": "identity( n , dtype = intp )", "filename": "numeric.py", "nloc": 5, "complexity": 1, "token_count": 49, "parameters": [ "n", "dtype" ], "start_line": 272, "end_line": 278, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 } ], "nloc": 256, "complexity": 72, "token_count": 2007, "diff_parsed": { "added": [ "if issubclass(longlong, int):", " _typelessdata.append(longlong)", "", "def indices(dimensions, dtype=int_):", " \"\"\"indices(dimensions,dtype=int_) returns an array representing a grid", "def ones(shape, dtype=int_, fortran=0):", " \"\"\"ones(shape, dtype=int_) returns an array of the given", "def identity(n,dtype=int_):" ], "deleted": [ "def indices(dimensions, dtype=intp):", " \"\"\"indices(dimensions,dtype=intp) returns an array representing a grid", "def ones(shape, dtype=intp, fortran=0):", " \"\"\"ones(shape, dtype=intp) returns an array of the given", "def identity(n,dtype=intp):" ] } } ] }, { "hash": "f47d2fd8877f916427af60c1ae2726e8d07c14bd", "msg": "r201@Blasphemy: kern | 2005-10-07 02:46:04 -0700\n Don't need this anymore", "author": { "name": "Robert Kern", "email": "robert.kern@gmail.com" }, "committer": { "name": "Robert Kern", "email": "robert.kern@gmail.com" }, "author_date": "2005-10-07T09:46:21+00:00", "author_timezone": 0, "committer_date": "2005-10-07T09:46:21+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "c060ceef8967821801034b649958ec21d55b38d8" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 13, "insertions": 0, "lines": 13, "files": 1, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.0, "dmm_unit_interfacing": 0.0, "modified_files": [ { "old_path": "scipy/random.py", "new_path": null, "filename": "random.py", "extension": "py", "change_type": "DELETE", "diff": "@@ -1,13 +0,0 @@\n-from scipy.lib.mtrand import *\n-\n-# Some aliases:\n-ranf = random_sample\n-random = random_sample\n-sample = random_sample\n-\n-def __RandomState_ctor():\n- \"\"\"Return a RandomState instance.\n- \n- This function exists solely to assist (un)pickling.\n- \"\"\"\n- return RandomState()\n", "added_lines": 0, "deleted_lines": 13, "source_code": null, "source_code_before": "from scipy.lib.mtrand import *\n\n# Some aliases:\nranf = random_sample\nrandom = random_sample\nsample = random_sample\n\ndef __RandomState_ctor():\n \"\"\"Return a RandomState instance.\n \n This function exists solely to assist (un)pickling.\n \"\"\"\n return RandomState()\n", "methods": [], "methods_before": [ { "name": "__RandomState_ctor", "long_name": "__RandomState_ctor( )", "filename": "random.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [], "start_line": 8, "end_line": 13, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "__RandomState_ctor", "long_name": "__RandomState_ctor( )", "filename": "random.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [], "start_line": 8, "end_line": 13, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 } ], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [], "deleted": [ "from scipy.lib.mtrand import *", "", "# Some aliases:", "ranf = random_sample", "random = random_sample", "sample = random_sample", "", "def __RandomState_ctor():", " \"\"\"Return a RandomState instance.", "", " This function exists solely to assist (un)pickling.", " \"\"\"", " return RandomState()" ] } } ] }, { "hash": "9caec19092f4bcd91bb0bb4292aaf7184d69d3ee", "msg": "Deleted random package.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T09:48:03+00:00", "author_timezone": 0, "committer_date": "2005-10-07T09:48:03+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "f47d2fd8877f916427af60c1ae2726e8d07c14bd" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 13, "insertions": 0, "lines": 13, "files": 1, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.0, "dmm_unit_interfacing": 0.0, "modified_files": [ { "old_path": "scipy/random/__init__.py", "new_path": null, "filename": "__init__.py", "extension": "py", "change_type": "DELETE", "diff": "@@ -1,13 +0,0 @@\n-from scipy.lib.mtrand import *\n-\n-# Some aliases:\n-ranf = random_sample\n-random = random_sample\n-sample = random_sample\n-\n-def __RandomState_ctor():\n- \"\"\"Return a RandomState instance.\n- \n- This function exists solely to assist (un)pickling.\n- \"\"\"\n- return RandomState()\n", "added_lines": 0, "deleted_lines": 13, "source_code": null, "source_code_before": "from scipy.lib.mtrand import *\n\n# Some aliases:\nranf = random_sample\nrandom = random_sample\nsample = random_sample\n\ndef __RandomState_ctor():\n \"\"\"Return a RandomState instance.\n \n This function exists solely to assist (un)pickling.\n \"\"\"\n return RandomState()\n", "methods": [], "methods_before": [ { "name": "__RandomState_ctor", "long_name": "__RandomState_ctor( )", "filename": "__init__.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [], "start_line": 8, "end_line": 13, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "__RandomState_ctor", "long_name": "__RandomState_ctor( )", "filename": "__init__.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [], "start_line": 8, "end_line": 13, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 } ], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [], "deleted": [ "from scipy.lib.mtrand import *", "", "# Some aliases:", "ranf = random_sample", "random = random_sample", "sample = random_sample", "", "def __RandomState_ctor():", " \"\"\"Return a RandomState instance.", "", " This function exists solely to assist (un)pickling.", " \"\"\"", " return RandomState()" ] } } ] }, { "hash": "7239af6dd544c2ecc625a0e7324d69839277ee41", "msg": "Finished delting random.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T09:49:47+00:00", "author_timezone": 0, "committer_date": "2005-10-07T09:49:47+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "9caec19092f4bcd91bb0bb4292aaf7184d69d3ee" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 1, "insertions": 0, "lines": 1, "files": 1, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.0, "dmm_unit_interfacing": 0.0, "modified_files": [ { "old_path": "scipy/setup.py", "new_path": "scipy/setup.py", "filename": "setup.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -12,7 +12,6 @@ def configuration(parent_package='',top_path=None):\n config.add_subpackage('corelib') # installed as scipy.lib\n config.add_subpackage('fftpack')\n config.add_subpackage('linalg')\n- config.add_subpackage('random')\n config.make_svn_version_py() # installs __svn_version__.py\n return config.todict()\n \n", "added_lines": 0, "deleted_lines": 1, "source_code": "#!/usr/bin/env python\nimport os\n\ndef configuration(parent_package='',top_path=None):\n from scipy.distutils.misc_util import Configuration\n config = Configuration('scipy',parent_package,top_path)\n config.add_subpackage('distutils')\n config.add_subpackage('weave')\n config.add_subpackage('test')\n config.add_subpackage('f2py2e') # installed as scipy.f2py\n config.add_subpackage('base')\n config.add_subpackage('corelib') # installed as scipy.lib\n config.add_subpackage('fftpack')\n config.add_subpackage('linalg')\n config.make_svn_version_py() # installs __svn_version__.py\n return config.todict()\n\nif __name__ == '__main__':\n # Remove current working directory from sys.path\n # to avoid importing scipy.distutils as Python std. distutils:\n import os, sys\n sys.path.remove(os.getcwd())\n\n from scipy.distutils.core import setup\n setup(**configuration(top_path=''))\n", "source_code_before": "#!/usr/bin/env python\nimport os\n\ndef configuration(parent_package='',top_path=None):\n from scipy.distutils.misc_util import Configuration\n config = Configuration('scipy',parent_package,top_path)\n config.add_subpackage('distutils')\n config.add_subpackage('weave')\n config.add_subpackage('test')\n config.add_subpackage('f2py2e') # installed as scipy.f2py\n config.add_subpackage('base')\n config.add_subpackage('corelib') # installed as scipy.lib\n config.add_subpackage('fftpack')\n config.add_subpackage('linalg')\n config.add_subpackage('random')\n config.make_svn_version_py() # installs __svn_version__.py\n return config.todict()\n\nif __name__ == '__main__':\n # Remove current working directory from sys.path\n # to avoid importing scipy.distutils as Python std. distutils:\n import os, sys\n sys.path.remove(os.getcwd())\n\n from scipy.distutils.core import setup\n setup(**configuration(top_path=''))\n", "methods": [ { "name": "configuration", "long_name": "configuration( parent_package = '' , top_path = None )", "filename": "setup.py", "nloc": 13, "complexity": 1, "token_count": 88, "parameters": [ "parent_package", "top_path" ], "start_line": 4, "end_line": 16, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 } ], "methods_before": [ { "name": "configuration", "long_name": "configuration( parent_package = '' , top_path = None )", "filename": "setup.py", "nloc": 14, "complexity": 1, "token_count": 94, "parameters": [ "parent_package", "top_path" ], "start_line": 4, "end_line": 17, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "configuration", "long_name": "configuration( parent_package = '' , top_path = None )", "filename": "setup.py", "nloc": 14, "complexity": 1, "token_count": 94, "parameters": [ "parent_package", "top_path" ], "start_line": 4, "end_line": 17, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "nloc": 19, "complexity": 1, "token_count": 130, "diff_parsed": { "added": [], "deleted": [ " config.add_subpackage('random')" ] } } ] }, { "hash": "8af0fea248072118dcd7047ebec2219183fe7718", "msg": "r206@Blasphemy: kern | 2005-10-07 03:12:29 -0700\n Okay, for real this time. scipy.random will be a module, and developers will actually communicate with each other in the future.", "author": { "name": "Robert Kern", "email": "robert.kern@gmail.com" }, "committer": { "name": "Robert Kern", "email": "robert.kern@gmail.com" }, "author_date": "2005-10-07T10:12:43+00:00", "author_timezone": 0, "committer_date": "2005-10-07T10:12:43+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "7239af6dd544c2ecc625a0e7324d69839277ee41" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 0, "insertions": 13, "lines": 13, "files": 1, "dmm_unit_size": 1.0, "dmm_unit_complexity": 1.0, "dmm_unit_interfacing": 1.0, "modified_files": [ { "old_path": null, "new_path": "scipy/random.py", "filename": "random.py", "extension": "py", "change_type": "ADD", "diff": "@@ -0,0 +1,13 @@\n+from scipy.lib.mtrand import *\n+\n+# Some aliases:\n+ranf = random_sample\n+random = random_sample\n+sample = random_sample\n+\n+def __RandomState_ctor():\n+ \"\"\"Return a RandomState instance.\n+ \n+ This function exists solely to assist (un)pickling.\n+ \"\"\"\n+ return RandomState()\n", "added_lines": 13, "deleted_lines": 0, "source_code": "from scipy.lib.mtrand import *\n\n# Some aliases:\nranf = random_sample\nrandom = random_sample\nsample = random_sample\n\ndef __RandomState_ctor():\n \"\"\"Return a RandomState instance.\n \n This function exists solely to assist (un)pickling.\n \"\"\"\n return RandomState()\n", "source_code_before": null, "methods": [ { "name": "__RandomState_ctor", "long_name": "__RandomState_ctor( )", "filename": "random.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [], "start_line": 8, "end_line": 13, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 } ], "methods_before": [], "changed_methods": [ { "name": "__RandomState_ctor", "long_name": "__RandomState_ctor( )", "filename": "random.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [], "start_line": 8, "end_line": 13, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 } ], "nloc": 6, "complexity": 1, "token_count": 27, "diff_parsed": { "added": [ "from scipy.lib.mtrand import *", "", "# Some aliases:", "ranf = random_sample", "random = random_sample", "sample = random_sample", "", "def __RandomState_ctor():", " \"\"\"Return a RandomState instance.", "", " This function exists solely to assist (un)pickling.", " \"\"\"", " return RandomState()" ], "deleted": [] } } ] }, { "hash": "dfdb8689aaaed931bc8d9d42deec96d0c43a6a79", "msg": "Fixed more intp issues.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T17:07:47+00:00", "author_timezone": 0, "committer_date": "2005-10-07T17:07:47+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "8af0fea248072118dcd7047ebec2219183fe7718" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 2, "insertions": 2, "lines": 4, "files": 1, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": "scipy/base/src/arrayobject.c", "new_path": "scipy/base/src/arrayobject.c", "filename": "arrayobject.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -408,7 +408,7 @@ contiguous_data(PyArrayObject *src)\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n- int stride=elsize;\n+ intp stride=elsize;\n char *new_data;\n \t\n for(i=dest_nd-1; i>=0; i--) {\n@@ -5130,7 +5130,7 @@ array_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n \tchar *data;\n \tint buffer_len;\n \tint res, i, n;\n-\tint dims[MAX_DIMS], strides[MAX_DIMS];\n+\tintp dims[MAX_DIMS], strides[MAX_DIMS];\n \tint swap;\n \n \t/* Get the memory from __array_data__ and __array_offset__ */\n", "added_lines": 2, "deleted_lines": 2, "source_code": " /*\n Provide multidimensional arrays as a basic object type in python. \n\nBased on Original Numeric implementation\nCopyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\nwith contributions from many Numeric Python developers 1995-2004 *\n\nHeavily modified in 2005 with inspiration from Numarray \n\nby\n\nTravis Oliphant\nAssistant Professor at\nBrigham Young University \n\nmaintainer email: oliphant.travis@ieee.org\n\nNumarray design (which provided guidance) by \nSpace Science Telescope Institute \n (J. Todd Miller, Perry Greenfield, Rick White)\n\n*/\n\n/* $Id: arrayobject.c,v 1.59 2005/09/14 00:14:00 teoliphant Exp $ */\n\n/*\n#include \"Python.h\"\n#include \"structmember.h\"\n\n#define _MULTIARRAYMODULE\n#include \"Numeric3/arrayobject.h\"\n*/\n\n/* Helper functions */\n\n#define error_converting(x) (((x) == -1) && PyErr_Occurred())\n\nstatic intp\nPyArray_PyIntAsIntp(PyObject *o)\n{\n\tlonglong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INTP, 0, 0};\n\tintp ret;\n\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((intp *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (longlong) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (longlong) PyLong_AsLongLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\t\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONGLONG != SIZEOF_PY_INTPTR_T)\n\tif ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C intp\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (intp) long_value;\n}\n\n\nstatic PyObject *array_int(PyArrayObject *v);\n\nstatic int\nPyArray_PyIntAsInt(PyObject *o)\n{\n\tlong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INT, 0, 0};\n\tint ret;\n\t\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((int *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (long) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (long) PyLong_AsLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONG != SIZEOF_INT)\n\tif ((long_value < INT_MIN) || (long_value > INT_MAX)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C int\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (int) long_value;\n}\n\n\nstatic double\nPyArray_GetPriority(PyObject *obj, double default_) \n{\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n\n\tif (PyArray_CheckExact(obj) || PyBigArray_CheckExact(obj)) \n\t\treturn priority;\n\n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n if (PyErr_Occurred()) {\n PyErr_Clear(); \n priority = default_;\n }\n Py_XDECREF(ret);\n return priority; \n}\n\n/* Backward compatibility only */\n/* In both Zero and One\n\n ***You must free the memory once you are done with it\n using PyDataMem_FREE(ptr) or you create a memory leak***\n\n If arr is an Object array you are getting a \n BORROWED reference to Zero or One.\n Do not DECREF.\n Please INCREF if you will be hanging on to it.\n\n The memory for the ptr still must be freed in any case;\n*/\n\nstatic char *\nPyArray_Zero(PyArrayObject *arr)\n{\n char *zeroval;\n char *buf;\n int buf_len;\n PyObject *obj, *ret;\n\n zeroval = PyDataMem_NEW(arr->itemsize);\n if (zeroval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n if (PyArray_ISOBJECT(arr)) {\n obj=PyInt_FromLong((long) 0);\n memcpy(zeroval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return zeroval;\n }\n ret = PyObject_GetAttrString((PyObject *)arr, \"_zero\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_zero not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n return NULL;\n }\n memcpy(zeroval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n memset(zeroval, 0, arr->itemsize);\n return zeroval;\n}\n\nstatic char *\nPyArray_One(PyArrayObject *arr)\n{\n char *oneval;\n char *buf;\n int buf_len, ret2;\n PyObject *obj, *ret;\n\n oneval = PyDataMem_NEW(arr->itemsize);\n if (oneval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n obj = PyInt_FromLong((long) 1);\n if (PyArray_ISOBJECT(arr)) {\n memcpy(oneval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return oneval;\n }\n \n ret = PyObject_GetAttrString((PyObject *)arr, \"_one\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_one not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n PyDataMem_FREE(oneval);\n return NULL;\n }\n memcpy(oneval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n\n ret2 = arr->descr->setitem(obj, oneval, arr);\n Py_DECREF(obj);\n if (ret < 0) {\n PyDataMem_FREE(oneval);\n return NULL;\n }\n return oneval;\n}\n\n/* End deprecated */\n\n\nstatic int \ndo_sliced_copy(char *dest, intp *dest_strides, intp *dest_dimensions,\n\t int dest_nd, char *src, intp *src_strides, \n\t intp *src_dimensions, int src_nd, int elsize, \n\t int copies) {\n intp i, j;\n\t\n if (src_nd == 0 && dest_nd == 0) {\n for(j=0; j src_nd) {\n for(i=0; i<*dest_dimensions; i++, dest += *dest_strides) {\n if (do_sliced_copy(dest, dest_strides+1, \n dest_dimensions+1, dest_nd-1,\n src, src_strides, \n src_dimensions, src_nd, \n elsize, copies) == -1) \n return -1;\n }\n return 0;\n }\n\t\n if (dest_nd == 1) {\n if (*dest_dimensions != *src_dimensions) {\n PyErr_SetString(PyExc_ValueError, \n \"matrices are not aligned for copy\");\n return -1;\n }\n for(i=0; i<*dest_dimensions; i++, src += *src_strides) {\n for(j=0; j 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize) && \n ((*src_strides)[*src_nd-1] == *elsize)) {\n if ((*dest_dimensions)[*dest_nd-1] != \n (*src_dimensions)[*src_nd-1]) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"matrices are not aligned\");\n return -1;\n }\n *elsize *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1; *src_nd-=1;\n } else {\n break;\n }\n }\n if (*src_nd == 0) {\n while (*dest_nd > 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize)) {\n *copies *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1;\n } else {\n break;\n }\n }\n }\n return 0;\n}\n\nstatic char *\ncontiguous_data(PyArrayObject *src) \n{\n intp dest_strides[MAX_DIMS], *dest_strides_ptr;\n intp *dest_dimensions=src->dimensions;\n int dest_nd=src->nd;\n intp *src_strides = src->strides;\n intp *src_dimensions=src->dimensions;\n int src_nd=src->nd;\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n intp stride=elsize;\n char *new_data;\n\t\n for(i=dest_nd-1; i>=0; i--) {\n dest_strides[i] = stride;\n stride *= dest_dimensions[i];\n }\n\t\n dest_strides_ptr = dest_strides;\n\t\n if (optimize_slices(&dest_strides_ptr, &dest_dimensions, &dest_nd,\n &src_strides, &src_dimensions, &src_nd,\n &elsize, &copies) == -1) \n return NULL;\n\t\n new_data = (char *)malloc(stride);\n\t\n ret = do_sliced_copy(new_data, dest_strides_ptr, dest_dimensions, \n dest_nd, src->data, src_strides, \n src_dimensions, src_nd, elsize, copies);\n\t\n if (ret != -1) { return new_data; }\n else { free(new_data); return NULL; }\n}\n\n/* end Helper functions */\n\n\nstatic PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n int, intp *, char *, int, int, PyArrayObject *);\n\n/* C-API functions */\n\n/* Used for arrays of python objects to increment the reference count of */\n/* every python object in the array. */\nstatic int \nPyArray_INCREF(PyArrayObject *mp) \n{\n\tintp i, n;\n\n PyObject **data, **data2;\n\t\n if (mp->descr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data;\n for(i=0; idescr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data; \n for(i=0; i 0; n--, a += 1) {\n b = a + 1;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 4:\n for (a = (char*)p ; n > 0; n--, a += 2) {\n b = a + 3;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 8:\n for (a = (char*)p ; n > 0; n--, a += 4) {\n b = a + 7;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n default:\n m = size / 2;\n for (a = (char *)p ; n > 0; n--, a += m) {\n b = a + (size-1);\n for (j=0; j 1, then dst must be contiguous */\nstatic void\ncopy_and_swap(void *dst, void *src, int itemsize, intp numitems,\n intp srcstrides, int swap) \n{\n int i;\n char *s1 = (char *)src;\n char *d1 = (char *)dst;\n \n\n if ((numitems == 1) || (itemsize == srcstrides)) \n memcpy(d1, s1, itemsize*numitems);\n else { \n for (i = 0; i < numitems; i++) {\n memcpy(d1, s1, itemsize);\n d1 += itemsize;\n s1 += srcstrides;\n } \n }\n\n if (swap)\n byte_swap_vector(d1, numitems, itemsize);\n}\n\n\n/* Computer-generated arraytype and scalartype code */\n#include \"scalartypes.inc\"\n#include \"arraytypes.inc\"\n\nstatic char *\nindex2ptr(PyArrayObject *mp, int i) \n{\n\tif (i==0 && (mp->nd == 0 || mp->dimensions[0] > 0)) \n\t\treturn mp->data;\n\t\n if (mp->nd>0 && i>0 && i < mp->dimensions[0]) {\n return mp->data+i*mp->strides[0];\n }\n PyErr_SetString(PyExc_IndexError,\"index out of bounds\");\n return NULL;\n}\n\nstatic intp \nPyArray_Size(PyObject *op) \n{\n if (PyArray_Check(op)) {\n return PyArray_SIZE((PyArrayObject *)op);\n } \n\telse {\n return 0;\n }\n}\n\n/* If destination is not the right type, then src \n will be cast to destination. \n*/\n\n/* Does a flat iterator-based copy. \n\n The arrays are assumed to have the same number of elements\n They can be different sizes and have different types however. \n*/\n\nstatic int\nPyArray_CopyInto(PyArrayObject *dest, PyArrayObject *src)\n{\n intp dsize, ssize, sbytes;\n\tint ncopies, elsize, index;\n PyArrayIterObject *dit=NULL;\n PyArrayIterObject *sit=NULL;\n\tchar *dptr;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n PyArray_CopySwapNFunc *copyswapn;\n \n if (!PyArray_ISWRITEABLE(dest)) {\n PyErr_SetString(PyExc_RuntimeError, \n \"Cannot write to array.\");\n return -1;\n }\n\n if (!PyArray_EquivArrTypes(dest, src)) {\n return PyArray_CastTo(dest, src);\n }\n\n dsize = PyArray_SIZE(dest);\n ssize = PyArray_SIZE(src);\n\tif (ssize == 0) return 0;\n if (dsize % ssize != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Destination number of elements must be\"\\\n \"an integer multiple of the source number of\"\\\n \"elements.\");\n return -1;\n }\n ncopies = dsize / ssize;\n\n\tswap = PyArray_ISNOTSWAPPED(dest) != PyArray_ISNOTSWAPPED(src);\n\tcopyswap = dest->descr->copyswap;\n\tcopyswapn = dest->descr->copyswapn;\n\n elsize = dest->itemsize;\n\n if ((PyArray_ISCONTIGUOUS(dest) && PyArray_ISCONTIGUOUS(src)) \\\n\t || (PyArray_ISFORTRAN(dest) && PyArray_ISFORTRAN(src))) {\n \n PyArray_XDECREF(dest);\n dptr = dest->data;\n sbytes = ssize * src->itemsize;\n while(ncopies--) {\n memmove(dptr, src->data, sbytes);\n dptr += sbytes;\n }\n\t\tif (swap)\n\t\t\tcopyswapn(dest->data, NULL, dsize, 1, elsize);\n PyArray_INCREF(dest);\n return 0;\n }\n\n dit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)dest);\n sit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)src);\n\n if ((dit == NULL) || (sit == NULL)) {\n Py_XDECREF(dit);\n Py_XDECREF(sit);\n return -1;\n }\n\n PyArray_XDECREF(dest);\n while(ncopies--) {\n index = ssize;\n while(index--) {\n memmove(dit->dataptr, sit->dataptr, elsize);\n\t\t\tif (swap)\n\t\t\t\tcopyswap(dit->dataptr, NULL, 1, elsize);\n PyArray_ITER_NEXT(dit);\n PyArray_ITER_NEXT(sit);\n }\n PyArray_ITER_RESET(sit);\n } \n PyArray_INCREF(dest);\n Py_DECREF(dit);\n Py_DECREF(sit);\n\treturn 0;\n}\n\n\nstatic int \nPyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) \n{\n PyArrayObject *src;\n int ret;\n\tPyArray_Typecode typecode = {dest->descr->type_num, \n\t\t\t\t dest->itemsize, \n\t\t\t\t PyArray_ISFORTRAN(dest)};\n\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n\t\t\t\t\t &typecode, 0,\n\t\t\t\t\t dest->nd, 0);\n if (src == NULL) return -1;\n\n ret = PyArray_CopyInto(dest, src);\n Py_DECREF(src);\n return ret;\n}\n\n\n/* These are also old calls (should use PyArray_New) */\n\n/* They all zero-out the memory as previously done */\n\nstatic PyObject *\nPyArray_FromDimsAndDataAndDescr(int nd, int *d, \n PyArray_Descr *descr,\n char *data) {\n\tPyObject *ret;\n\n#if SIZEOF_INTP != SIZEOF_INT\n\tint i;\n\tintp newd[MAX_DIMS];\n\t\n\tfor (i=0; itype_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#else\n\tret = PyArray_New(&PyArray_Type, nd, (intp *)d, \n descr->type_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#endif\n\tif (descr->type_num != PyArray_OBJECT)\n\t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_FromDimsAndData(int nd, int *d, int type, char *data) \n{\n\tPyObject *ret;\n#if SIZEOF_INTP != SIZEOF_INT\n\tintp newd[MAX_DIMS];\n\tint i;\t\n\tfor (i=0; iob_type, m1->nd, \n\t\t\t\t\t m1->dimensions,\n\t\t\t\t\t m1->descr->type_num,\n\t\t\t\t\t NULL, NULL, m1->itemsize,\n\t\t\t\t\t 0, m1);\n\t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n\t\n return (PyObject *)ret;\n}\n\n\nstatic PyObject *array_item(PyArrayObject *, int);\n\nstatic PyObject *\nPyArray_Scalar(char *data, int type_num, int itemsize, int swap)\n{\n PyArray_Descr *descr;\n\tPyTypeObject *type;\n\tPyObject *obj;\t\n\tchar *destptr;\n PyArray_CopySwapFunc *copyswap;\n\n descr = PyArray_DescrFromType(type_num);\n if (descr == NULL) return NULL;\n type = descr->typeobj;\n copyswap = descr->copyswap;\n\tif (type_num == PyArray_STRING) \n\t\tobj = type->tp_alloc(type, itemsize);\n\telse\n\t\tobj = type->tp_alloc(type, 0);\n\tif (obj == NULL) return NULL;\n\tif PyTypeNum_ISFLEXIBLE(type_num) { \n\t\tif (type_num == PyArray_STRING) {\n\t\t\tdestptr = PyString_AS_STRING(obj);\n\t\t\t((PyStringObject *)obj)->ob_shash = -1;\n\t\t\t((PyStringObject *)obj)->ob_sstate =\t\\\n\t\t\t\tSSTATE_NOT_INTERNED; \n\t\t}\n\t\telse {\n\t\t\tdestptr = PyDataMem_NEW(itemsize);\n\t\t\tif (destptr == NULL) {\n\t\t\t\tPyObject_Del(obj);\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tif (type_num == PyArray_UNICODE) {\n\t\t\t\tPyUnicode_AS_UNICODE(obj) = \\\n\t\t\t\t\t(Py_UNICODE *)destptr;\n\t\t\t\t((PyUnicodeObject*)obj)->length = itemsize / \\\n\t\t\t\t\tsizeof(Py_UNICODE);\n\t\t\t\t((PyUnicodeObject*)obj)->hash = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t((PyVoidScalarObject *)obj)->obval = destptr;\n\t\t\t\t((PyVoidScalarObject *)obj)->ob_size = itemsize;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tdestptr = &(((PyScalarObject*)obj)->obval);\n\t}\n\t/* copyswap for OBJECT increments the reference count */\n copyswap(destptr, data, swap, itemsize);\n\treturn obj;\n}\n\n/* returns an Array-Scalar Object of the type of arr\n from the given pointer to memory -- main Scalar creation function\n default new method calls this. \n*/\nstatic PyObject *\nPyArray_ToScalar(char *data, PyArrayObject *arr)\n{\n\tint type_num = arr->descr->type_num;\n\tint itemsize = arr->itemsize;\n int swap = !(PyArray_ISNOTSWAPPED(arr));\n\n\treturn PyArray_Scalar(data, type_num, itemsize, swap);\n}\n\n\n/* Return Python scalar if 0-d array object is encountered */\n\nstatic PyObject *\nPyArray_Return(PyArrayObject *mp) \n{\n \n\tif (mp == NULL) return NULL;\n\n if (PyErr_Occurred()) {\n Py_XDECREF(mp);\n return NULL;\n }\n\n\tif (PyArray_Check((PyObject *)mp) && mp->nd == 0) {\n\t\tPyObject *ret;\n\t\tret = PyArray_ToScalar(mp->data, mp);\n\t\tPy_DECREF(mp);\n\t\treturn ret;\n\t}\n\telse {\n\t\treturn (PyObject *)mp;\n\t}\n}\n\n/*\n returns typenum to associate with this type >=PyArray_USERDEF.\n Also creates a copy of the VOID_DESCR table inserting it's typeobject in\n and it's typenum in the appropriate place.\n \n needs the userdecrs table and PyArray_NUMUSER variables\n defined in arratypes.inc\n*/\nstatic int \nPyArray_RegisterDataType(PyTypeObject *type)\n{\n\tPyArray_Descr *descr;\n\tint typenum;\n\tint i;\n\t\n\tif ((type == &PyVoidArrType_Type) ||\t\t\t\\\n\t !PyType_IsSubtype(type, &PyVoidArrType_Type)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can only register void subtypes.\");\n\t\treturn -1;\n\t}\n\t/* See if this type is already registered */\n\tfor (i=0; itypeobj == type)\n\t\t\treturn descr->type_num;\n\t}\n\tdescr = malloc(sizeof(PyArray_Descr));\n\tmemcpy(descr, PyArray_DescrFromType(PyArray_VOID), \n\t sizeof(PyArray_Descr));\n\ttypenum = PyArray_USERDEF + PyArray_NUMUSERTYPES;\n\tdescr->type_num = typenum;\n\tdescr->typeobj = type;\n\tuserdescrs = realloc(userdescrs, \n\t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n\tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n\treturn typenum;\n}\n\n\n/* \n copyies over from the old descr table for anything\n NULL or zero in what is given. \n frees the copy of the Descr_table already there.\n places a pointer to the new one into the slot.\n*/\nstatic int\nPyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n{\n\tPyArray_Descr *old;\n\tint i;\n\n\tif (!PyArray_ISUSERDEF(typenum)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Data type not registered.\");\n\t\treturn -1;\n\t}\n\told = userdescrs[typenum-PyArray_USERDEF];\n\tdescr->typeobj = old->typeobj;\n\tdescr->type_num = typenum;\n\n#define _NULL_CHECK(member) \\\n\tif (descr->member == NULL) descr->member = old->member\n\n\tfor (i=0; imember == 0) descr->member = old->member\n\n\t_ZERO_CHECK(kind);\n\t_ZERO_CHECK(type);\n\t_ZERO_CHECK(elsize);\n\t_ZERO_CHECK(alignment);\n#undef _ZERO_CHECK\n\n\tfree(old);\n\tuserdescrs[typenum-PyArray_USERDEF] = descr;\n\treturn 0;\n}\n\n\nstatic int\nPyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) \n{\n intp size;\n intp n, n2;\n int n3, n4;\n PyArrayIterObject *it;\n PyObject *obj, *strobj, *tupobj;\n\n n3 = strlen((const char *)sep);\n if (n3 == 0) { /* binary data */\n if (PyArray_ISOBJECT(self)) {\n PyErr_SetString(PyExc_ValueError, \"Cannot write \"\\\n\t\t\t\t\t\"object arrays to a file in \"\\\n\t\t\t\t\t\"binary mode.\");\n return -1;\n }\n\n if (PyArray_ISCONTIGUOUS(self)) {\n size = PyArray_SIZE(self);\n if ((n=fwrite((const void *)self->data, \n (size_t) self->itemsize,\n (size_t) size, fp)) < size) {\n PyErr_Format(PyExc_ValueError, \n \"%ld requested and %ld written\",\n (long) size, (long) n);\n return -1;\n }\n }\n else {\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n while(it->index < it->size) {\n if (fwrite((const void *)it->dataptr, \n (size_t) self->itemsize,\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n \" %d to file\", it->index);\n Py_DECREF(it);\n return -1;\n }\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n } \n }\n else { /* text data */\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n\t\tn4 = strlen((const char *)format);\n while(it->index < it->size) {\n obj = self->descr->getitem(it->dataptr, self);\n if (obj == NULL) {Py_DECREF(it); return -1;}\n\t\t\tif (n4 == 0) { /* standard writing */\n\t\t\t\tstrobj = PyObject_Str(obj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n\t\t\telse { /* use format string */\n\t\t\t\ttupobj = PyTuple_New(1);\n\t\t\t\tif (tupobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t\tPyTuple_SET_ITEM(tupobj,0,obj);\n\t\t\t\tobj = PyString_FromString((const char *)format);\n\t\t\t\tif (obj == NULL) {Py_DECREF(tupobj); \n\t\t\t\t\tPy_DECREF(it); return -1;}\n\t\t\t\tstrobj = PyString_Format(obj, tupobj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tPy_DECREF(tupobj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n if ((n=fwrite(PyString_AS_STRING(strobj), \n 1, n2=PyString_GET_SIZE(strobj),\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n \" to file\", it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n }\n /* write separator for all but last one */\n if (it->index != it->size-1) \n fwrite(sep, 1, n3, fp);\n Py_DECREF(strobj);\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n return 0;\n}\n\nstatic PyObject *\nPyArray_ToList(PyArrayObject *self) \n{\n PyObject *lp;\n PyArrayObject *v;\n intp sz, i;\n\t\n if (!PyArray_Check(self)) return (PyObject *)self;\n\n if (self->nd == 0) \n\t\treturn self->descr->getitem(self->data,self);\n\t\n sz = self->dimensions[0];\n lp = PyList_New(sz);\n\t\n for (i=0; ind >= self->nd) {\n\t\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\t\"array_item not returning smaller\" \\\n\t\t\t\t\t\" dimensional array\");\n\t\t\tPy_DECREF(lp);\n\t\t\treturn NULL;\n\t\t}\n PyList_SetItem(lp, i, PyArray_ToList(v));\n\t\tPy_DECREF(v);\n }\n\t\n return lp;\n}\n\nstatic PyObject *\nPyArray_ToString(PyArrayObject *self)\n{\n intp numbytes;\n intp index;\n char *dptr;\n int elsize;\n PyObject *ret;\n PyArrayIterObject *it;\n \n if (PyArray_TYPE(self) == PyArray_OBJECT) {\n PyErr_SetString(PyExc_ValueError, \"a string for the data\"\\\n\t\t\t\t\"in an object array is not appropriate.\");\n return NULL;\n }\n\n numbytes = PyArray_NBYTES(self);\n if (PyArray_ISONESEGMENT(self)) {\n ret = PyString_FromStringAndSize(self->data, (int) numbytes);\n }\n else {\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it==NULL) return NULL;\n ret = PyString_FromStringAndSize(NULL, (int) numbytes);\n if (ret == NULL) {Py_DECREF(it); return NULL;}\n dptr = PyString_AS_STRING(ret);\n index = it->size;\n elsize = self->itemsize;\n while(index--) {\n memcpy(dptr, it->dataptr, elsize);\n dptr += elsize;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n\treturn ret;\n}\n\n\n/*********************** end C-API functions **********************/\n\n\n/* array object functions */\n\nstatic void \narray_dealloc(PyArrayObject *self) {\n\n if (self->weakreflist != NULL)\n PyObject_ClearWeakRefs((PyObject *)self);\n\n if(self->base) {\n\t\t/* UPDATEIFCOPY means that base points to an \n\t\t array that should be updated with the contents\n\t\t of this array upon destruction.\n self->base->flags must have been WRITEABLE \n (checked previously) and it was locked here\n thus, unlock it.\n\t\t*/\n\t\tif (self->flags & UPDATEIFCOPY) {\n ((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tPy_INCREF(self); /* hold on to self in next call */\n PyArray_CopyInto((PyArrayObject *)self->base, self);\n\t\t\t/* Don't need to DECREF -- because we are deleting\n\t\t\t self already... */\n\t\t}\n\t\t/* In any case base is pointing to something that we need\n\t\t to DECREF -- either a view or a buffer object */\n Py_DECREF(self->base);\n }\n \n if ((self->flags & OWN_DATA) && (self->data != NULL)) {\n\t\t/* Free internal references if an Object array */\n\t\tPyArray_XDECREF(self);\n\n PyDataMem_FREE(self->data);\n }\n\t\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t}\n\t\n self->ob_type->tp_free((PyObject *)self);\n}\n\n/*************************************************************************\n **************** Implement Mapping Protocol ***************************\n *************************************************************************/\n\nstatic int \narray_length(PyArrayObject *self) \n{\n if (self->nd != 0) {\n return self->dimensions[0];\n } else {\n\t\tPyErr_SetString(PyExc_TypeError, \"len() of unsized object.\");\n\t\treturn -1;\n }\n}\n\n\nstatic PyObject *\narray_item(PyArrayObject *self, int i) \n{\n char *item;\n PyArrayObject *r;\n\n\n\tif(self->nd == 0) {\n\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\"0-d arrays can't be indexed.\");\n\t\treturn NULL;\n\t}\n if ((item = index2ptr(self, i)) == NULL) return NULL;\n\n\tr = (PyArrayObject *)PyArray_New(self->ob_type, \n\t\t\t\t\t self->nd-1, self->dimensions+1, \n\t\t\t\t\t self->descr->type_num, \n\t\t\t\t\t self->strides+1, item, \n\t\t\t\t\t self->itemsize, self->flags,\n\t\t\t\t\t self);\n\tif (r == NULL) return NULL;\n\tPy_INCREF(self);\n\tr->base = (PyObject *)self;\n PyArray_UpdateFlags(r, CONTIGUOUS | FORTRAN);\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_item_nice(PyArrayObject *self, int i) \n{\n\treturn PyArray_Return((PyArrayObject *)array_item(self, i));\n}\n\n\nstatic int \narray_ass_item(PyArrayObject *self, int i, PyObject *v) \n{\n PyArrayObject *tmp;\n char *item;\n int ret;\n\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n if (i < 0) i = i+self->dimensions[0];\n\n if (self->nd > 1) {\n if((tmp = (PyArrayObject *)array_item(self, i)) == NULL)\n return -1;\n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n return ret; \n }\n\t\n if ((item = index2ptr(self, i)) == NULL) return -1;\n if (self->descr->setitem(v, item, self) == -1) return -1;\n return 0;\n}\n\n/* -------------------------------------------------------------- */\nstatic int\nslice_coerce_index(PyObject *o, int *v)\n{\n\t*v = PyArray_PyIntAsInt(o);\n\tif (error_converting(*v)) {\n\t\tPyErr_Clear();\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\n/* This is basically PySlice_GetIndicesEx, but with our coercion\n * of indices to integers (plus, that function is new in Python 2.3) */\nstatic int\nslice_GetIndices(PySliceObject *r, int length,\n int *start, int *stop, int *step,\n intp *slicelength)\n{\n\tint defstart, defstop;\n\t\n\tif (r->step == Py_None) {\n\t\t*step = 1;\n\t} else {\n\t\tif (!slice_coerce_index(r->step, step)) return -1;\n\t\tif (*step == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"slice step can not be zero\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tdefstart = *step < 0 ? length - 1 : 0;\n\tdefstop = *step < 0 ? -1 : length;\n\t\n\tif (r->start == Py_None) {\n\t\t*start = *step < 0 ? length-1 : 0;\n\t} else {\n\t\tif (!slice_coerce_index(r->start, start)) return -1;\n\t\tif (*start < 0) *start += length;\n\t\tif (*start < 0) *start = (*step < 0) ? -1 : 0;\n\t\tif (*start >= length) {\n\t\t\t*start = (*step < 0) ? length - 1 : length;\n\t\t}\n\t}\n\t\n\tif (r->stop == Py_None) {\n\t\t*stop = defstop;\n\t} else {\n\t\tif (!slice_coerce_index(r->stop, stop)) return -1;\n\t\tif (*stop < 0) *stop += length;\n if (*stop < 0) *stop = -1;\n if (*stop > length) *stop = length;\n\t}\n\t\n\tif ((*step < 0 && *stop >= *start) || \\\n\t (*step > 0 && *start >= *stop)) {\n\t\t*slicelength = 0;\n\t} else if (*step < 0) {\n\t\t*slicelength = (*stop - *start + 1) / (*step) + 1;\n\t} else {\n\t\t*slicelength = (*stop - *start - 1) / (*step) + 1;\n\t}\n\t\n\treturn 0;\n}\n\n#define PseudoIndex -1\n#define RubberIndex -2\n#define SingleIndex -3\n\nstatic int\nparse_subindex(PyObject *op, int *step_size, intp *n_steps, int max)\n{\n\tint index;\n\t\n\tif (op == Py_None) {\n\t\t*n_steps = PseudoIndex;\n\t\tindex = 0;\n\t} else if (op == Py_Ellipsis) {\n\t\t*n_steps = RubberIndex;\n\t\tindex = 0;\n\t} else if (PySlice_Check(op)) {\n\t\tint stop;\n\t\tif (slice_GetIndices((PySliceObject *)op, max,\n\t\t\t\t &index, &stop, step_size, n_steps) < 0) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"invalid slice\");\n\t\t\t}\n\t\t\tgoto fail;\n\t\t}\n\t\tif (*n_steps <= 0) {\n\t\t\t*n_steps = 0;\n\t\t\t*step_size = 1;\n\t\t\tindex = 0;\n\t\t}\n\t} else {\n\t\tindex = PyArray_PyIntAsInt(op);\n\t\tif (error_converting(index)) {\n\t\t\tPyErr_SetString(PyExc_IndexError,\n\t\t\t\t\t\"each subindex must be either a \"\\\n\t\t\t\t\t\"slice, an integer, Ellipsis, or \"\\\n\t\t\t\t\t\"newaxis\");\n\t\t\tgoto fail;\n\t\t}\n\t\t*n_steps = SingleIndex;\n\t\t*step_size = 0;\n\t\tif (index < 0) index += max;\n\t\tif (index >= max || index < 0) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \"invalid index\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn index;\n fail:\n\treturn -1;\n}\n\n\nstatic int \nparse_index(PyArrayObject *self, PyObject *op, \n intp *dimensions, intp *strides, intp *offset_ptr)\n{\n int i, j, n;\n int nd_old, nd_new, start, offset, n_add, n_pseudo;\n int step_size;\n\tintp n_steps;\n PyObject *op1=NULL;\n int is_slice;\n\n\n if (PySlice_Check(op) || op == Py_Ellipsis || op == Py_None) {\n n = 1;\n op1 = op;\n Py_INCREF(op);\t\n /* this relies on the fact that n==1 for loop below */\n is_slice = 1;\n }\n else {\n if (!PySequence_Check(op)) {\n PyErr_SetString(PyExc_IndexError, \n \"index must be either an int \"\\\n \"or a sequence\");\n return -1;\n }\n n = PySequence_Length(op);\n is_slice = 0;\n }\n\t\n nd_old = nd_new = 0;\n\t\n offset = 0;\n for(i=0; ind ? \\\n self->dimensions[nd_old] : 0);\n Py_DECREF(op1);\n if (start == -1) break;\n\t\t\n if (n_steps == PseudoIndex) {\n dimensions[nd_new] = 1; strides[nd_new] = 0; nd_new++;\n } else {\n if (n_steps == RubberIndex) {\n for(j=i+1, n_pseudo=0; jnd-(n-i-n_pseudo-1+nd_old);\n if (n_add < 0) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = \\\n self->strides[nd_old];\n nd_new++; nd_old++;\n }\n } else {\n if (nd_old >= self->nd) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n offset += self->strides[nd_old]*start;\n nd_old++;\n if (n_steps != SingleIndex) {\n dimensions[nd_new] = n_steps;\n strides[nd_new] = step_size * \\\n self->strides[nd_old-1];\n nd_new++;\n }\n }\n }\n }\n if (i < n) return -1;\n n_add = self->nd-nd_old;\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = self->strides[nd_old];\n nd_new++; nd_old++;\n }\t \n *offset_ptr = offset;\n return nd_new;\n}\n\nstatic void\n_swap_axes(PyArrayMapIterObject *mit, PyArrayObject **ret)\n{\n\tPyObject *new, *tup;\n\tint n1, n2, n3, val;\n\tint i;\n\n\ttup = PyTuple_New(mit->nd);\n\t/* tuple for transpose is \n\t (n1,..,n1+n2-1,0,..,n1-1,n1+n2,...,n3-1)\n\t n1 is the number of dimensions of \n\t the broadcasted index array \n\t n2 is the number of dimensions skipped at the\n\t start\n\t n3 is the number of dimensions of the \n\t result \n\t*/\n\tn1 = mit->iters[0]->nd_m1 + 1;\n\tn2 = mit->iteraxes[0];\n\tn3 = mit->nd;\n\tval = n1;\n\ti = 0;\n\twhile(val < n1+n2) \n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = 0;\n\twhile(val < n1)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = n1+n2;\n\twhile(val < n3)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\n\tnew = PyArray_Transpose(*ret, tup);\n\tPy_DECREF(tup);\n\tPy_DECREF(*ret);\n\t*ret = (PyArrayObject *)new;\n}\n\n\n\nstatic PyObject *\nPyArray_GetMap(PyArrayMapIterObject *mit)\n{\n\n\tPyArrayObject *ret, *temp;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\t/* Unbound map iterator --- Bind should have been called */\n\tif (mit->ait == NULL) return NULL;\n\n\t/* This relies on the map iterator object telling us the shape\n\t of the new array in nd and dimensions.\n\t*/\n\ttemp = mit->ait->ao;\n\tret = (PyArrayObject *)\\\n\t\tPyArray_New(temp->ob_type, mit->nd, mit->dimensions, \n\t\t\t temp->descr->type_num, NULL, NULL, \n\t\t\t temp->itemsize, \n\t\t\t PyArray_ISFORTRAN(temp),\n\t\t\t temp);\n\tif (ret == NULL) return NULL;\n\n\t/* Now just iterate through the new array filling it in\n\t with the next object from the original array as\n\t defined by the mapping iterator */\n\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ret)) \n\t == NULL) \n\t\treturn NULL;\n\tindex = it->size;\n\tswap = ((temp->flags & NOTSWAPPED) != (ret->flags & NOTSWAPPED));\n copyswap = ret->descr->copyswap;\n\tPyArray_MapIterReset(mit);\n\twhile (index--) {\n copyswap(it->dataptr, mit->dataptr, swap, ret->itemsize);\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\t\n\t/* check for consecutive axes */\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, &ret);\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\nstatic int\nPyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)\n{\n\tPyObject *arr=NULL;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n\tPyArray_Typecode typecode = {0, 0, 0};\n PyArray_CopySwapFunc *copyswap;\n\n\t/* Unbound Map Iterator */\n\tif (mit->ait == NULL) return -1;\n\n\ttypecode.type_num = mit->ait->ao->descr->type_num;\n\ttypecode.itemsize = mit->ait->ao->itemsize;\n\n\tarr = PyArray_FromAny(op, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, (PyArrayObject **)&arr);\n\t\t}\n\t}\n\t\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) \n\t\treturn -1;\n\n\tindex = mit->size;\n\tswap = ((mit->ait->ao->flags & NOTSWAPPED) != \\\n\t\t(PyArray_FLAGS(arr) & NOTSWAPPED));\n\n copyswap = PyArray_DESCR(arr)->copyswap;\n\tPyArray_MapIterReset(mit);\n /* Need to decref OBJECT arrays */\n if (PyTypeNum_ISOBJECT(typecode.type_num)) {\n while (index--) {\n Py_XDECREF(*((PyObject **)mit->dataptr));\n Py_INCREF(*((PyObject **)it->dataptr));\n memmove(mit->dataptr, it->dataptr, sizeof(PyObject *));\n copyswap(mit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_MapIterNext(mit);\n PyArray_ITER_NEXT(it);\n if (it->index == it->size)\n PyArray_ITER_RESET(it);\n }\n return 0;\n }\n\n\twhile(index--) {\n\t\tmemmove(mit->dataptr, it->dataptr, PyArray_ITEMSIZE(arr));\n copyswap(mit->dataptr, NULL, swap, PyArray_ITEMSIZE(arr));\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t\tif (it->index == it->size)\n\t\t\tPyArray_ITER_RESET(it);\n\t}\t\t\n\treturn 0;\n}\n\n/* Called when treating array object like a mapping -- called first from \n Python when using a[object] unless object is a standard slice object\n (not an extended one). \n\n*/\n\n/* There are two situations: \n\n 1 - the subscript is a standard view and a reference to the \n array can be returned\n\n 2 - the subscript uses Boolean masks or integer indexing and\n therefore a new array is created and returned. \n\n*/\n\n/* Always returns 0-dimensional arrays */\n\nstatic PyObject *\narray_subscript(PyArrayObject *self, PyObject *op) \n{\n intp dimensions[MAX_DIMS], strides[MAX_DIMS];\n\tintp offset;\n int nd, i;\n PyArrayObject *other;\n\tPyArrayMapIterObject *mit;\n\n if (PyArray_IsScalar(op, Integer) || PyInt_Check(op) || \\\n PyLong_Check(op)) {\n intp value;\n value = PyArray_PyIntAsIntp(op);\n if (PyErr_Occurred())\n PyErr_Clear();\n else if (value >= 0) {\n if (value <= MAX_INT)\n return array_item(self, (int) value);\n }\n else if (value < 0) {\n if (value >= -MAX_INT) {\n if (self->nd > 0) value += self->dimensions[0];\n return array_item(self, (int) value);\n }\n }\n }\n\n\tif (PyArrayMapIter_Check(op)) {\n\t\tmit = (PyArrayMapIterObject *)op;\n\t\t/* bind to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\n\t\t/* If the mapiterator was created with standard indexing\n\t\t behavior, fall through to view-based code */\n\t\tif (!mit->view) return PyArray_GetMap(mit);\n\t\top = mit->indexobj;\n\t}\n\telse { /* wrap arguments into a mapiter object */\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(op);\n\t\tif (mit == NULL) return NULL;\n\t\tif (!mit->view) { /* fancy indexing */\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tother = (PyArrayObject *)PyArray_GetMap(mit);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn (PyObject *)other;\n\t\t}\n\t\tPy_DECREF(mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(op);\n\tif (!error_converting(i)) {\n\t\tif (i < 0 && self->nd > 0) i = i+self->dimensions[0];\n\t\treturn array_item(self, i);\n\t}\n\tPyErr_Clear();\n\n\t/* Standard (view-based) Indexing */\n if ((nd = parse_index(self, op, dimensions, strides, &offset)) \n == -1) \n return NULL;\n\n\t/* This will only work if new array will be a view */\n\tif ((other = (PyArrayObject *)\t\t\t\t\t\\\n\t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n\t\t\t strides, self->data+offset, \n\t\t\t self->itemsize, self->flags,\n\t\t\t self)) == NULL) \n\t\treturn NULL;\n\n\n\tother->base = (PyObject *)self;\n\tPy_INCREF(self);\n\t\n\tPyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);\n\t\n\treturn (PyObject *)other;\n}\n\n\n/* Another assignment hacked by using CopyObject. */\n\n/* This only works if subscript returns a standard view. */\n\n/* Again there are two cases. In the first case, PyArray_CopyObject\n can be used. In the second case, a new indexing function has to be \n used.\n*/\n\nstatic int \narray_ass_sub(PyArrayObject *self, PyObject *index, PyObject *op) \n{\n int ret, i;\n PyArrayObject *tmp;\n\tPyArrayMapIterObject *mit;\n\t\n if (op == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n\tif (PyArrayMapIter_Check(index)) {\n\t\tmit = (PyArrayMapIterObject *)index;\n\t\t/* bind behavior to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\t\n\t\t/* fall through if standard view-based map iterator */\n\t\tif (!mit->view) return PyArray_SetMap(mit, op);\n\t\tindex = mit->indexobj;\n\t}\n\telse {\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(index);\n\t\tif (mit == NULL) return -1;\n\t\tif (!mit->view) {\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tret = PyArray_SetMap(mit, op);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn ret;\n\t\t}\n\t\tPy_DECREF((PyObject*)mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(index);\n\tif (!error_converting(i)) {\n\t\treturn array_ass_item(self, i, op);\n\t}\n\tPyErr_Clear();\n\t\n\t/* Rest of standard (view-based) indexing */\n\n if ((tmp = (PyArrayObject *)array_subscript(self, index)) == NULL)\n return -1; \n ret = PyArray_CopyObject(tmp, op);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\n/* There are places that require that array_subscript return a PyArrayObject\n and not possibly a scalar. Thus, this is the function exposed to \n Python so that 0-dim arrays are passed as scalars\n*/\n\nstatic PyObject *\narray_subscript_nice(PyArrayObject *self, PyObject *op) \n{\n\treturn PyArray_Return((PyArrayObject *)array_subscript(self, op));\n}\n\n\nstatic PyMappingMethods array_as_mapping = {\n (inquiry)array_length,\t\t /*mp_length*/\n (binaryfunc)array_subscript_nice,\t/*mp_subscript*/\n (objobjargproc)array_ass_sub,\t /*mp_ass_subscript*/\n};\n\n/****************** End of Mapping Protocol ******************************/\n\n\n/*************************************************************************\n **************** Implement Buffer Protocol ****************************\n *************************************************************************/\n\n/* removed multiple segment interface */\n\nstatic int \narray_getsegcount(PyArrayObject *self, int *lenp) \n{\n if (lenp)\n *lenp = PyArray_NBYTES(self);\n\n if (PyArray_ISONESEGMENT(self)) {\n return 1;\n }\n\n if (lenp)\n *lenp = 0;\n return 0;\n}\n\nstatic int \narray_getreadbuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (segment != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Accessing non-existing array segment\");\n return -1;\n }\n \n if (PyArray_ISONESEGMENT(self)) {\n *ptrptr = self->data;\n return PyArray_NBYTES(self);\n }\n PyErr_SetString(PyExc_ValueError, \"Array is not a single segment\");\n *ptrptr = NULL;\n return -1;\n}\n\n\nstatic int \narray_getwritebuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (PyArray_CHKFLAGS(self, WRITEABLE)) \n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_ValueError, \"Array cannot be \"\\\n \"accessed as a writeable buffer.\");\n return -1;\n }\n}\n\nstatic int \narray_getcharbuf(PyArrayObject *self, int segment, const char **ptrptr) \n{\n if (self->descr->type_num == PyArray_STRING || \\\n\t self->descr->type_num == PyArray_UNICODE)\n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_TypeError, \n \"Non-character array cannot be interpreted \"\\\n \"as character buffer.\");\n return -1;\n }\n}\n\nstatic PyBufferProcs array_as_buffer = {\n (getreadbufferproc)array_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)array_getwritebuf, /*bf_getwritebuffer*/\n (getsegcountproc)array_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)array_getcharbuf, /*bf_getcharbuffer*/\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Number Protocol ****************************\n *************************************************************************/\n\n\ntypedef struct {\n PyObject *add,\n *subtract,\n *multiply,\n *divide,\n *remainder,\n *power,\n\t\t*sqrt,\n *negative,\n *absolute,\n *invert,\n *left_shift,\n *right_shift,\n *bitwise_and,\n *bitwise_xor,\n *bitwise_or,\n *less,\n *less_equal,\n *equal,\n *not_equal,\n *greater,\n *greater_equal,\n *floor_divide,\n *TRUE_divide,\n\t\t*logical_or,\n\t\t*logical_and,\n\t\t*floor,\n\t\t*ceil,\n\t\t*maximum,\n\t\t*minimum;\t\n\t\n} NumericOps;\n\nstatic NumericOps n_ops = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL};\n\n/* Dictionary can contain any of the numeric operations, by name. \n Those not present will not be changed\n */\n\n#define SET(op) temp=PyDict_GetItemString(dict, #op);\t\\\n\tif (temp != NULL) {\t\t\t\t\\\n\t\tif (!(PyCallable_Check(temp))) return -1; \\\n Py_XDECREF(n_ops.op); \\\n\t\tn_ops.op = temp; \\\n\t}\n\n \nint \nPyArray_SetNumericOps(PyObject *dict) \n{\n PyObject *temp = NULL;\n SET(add);\n SET(subtract);\n SET(multiply);\n SET(divide);\n SET(remainder);\n SET(power);\n\tSET(sqrt);\n SET(negative);\n SET(absolute);\n SET(invert);\n SET(left_shift);\n SET(right_shift);\n SET(bitwise_and);\n SET(bitwise_or);\n SET(bitwise_xor);\n SET(less);\t \n SET(less_equal);\n SET(equal);\n SET(not_equal);\n SET(greater);\n SET(greater_equal);\n SET(floor_divide);\t\n SET(TRUE_divide);\t\n\tSET(logical_or);\n\tSET(logical_and);\n\tSET(floor);\n\tSET(ceil);\n\tSET(maximum);\n\tSET(minimum);\n return 0;\n}\n\n#define GET(op) if (PyDict_SetItemString(dict, #op, n_ops.op)==-1) \\\n\t\tgoto fail;\n\nstatic PyObject *\nPyArray_GetNumericOps(void) \n{\n\tPyObject *dict;\n\tif ((dict = PyDict_New())==NULL) \n\t\treturn NULL;\t\n\tGET(add);\n GET(subtract);\n GET(multiply);\n GET(divide);\n GET(remainder);\n GET(power);\n\tGET(sqrt);\n GET(negative);\n GET(absolute);\n GET(invert);\n GET(left_shift);\n GET(right_shift);\n GET(bitwise_and);\n GET(bitwise_or);\n GET(bitwise_xor);\n GET(less);\t \n GET(less_equal);\n GET(equal);\n GET(not_equal);\n GET(greater);\n GET(greater_equal);\n GET(floor_divide); \n GET(TRUE_divide); \n\tGET(logical_or);\n\tGET(logical_and);\n\tGET(floor);\n\tGET(ceil);\n\tGET(maximum);\n\tGET(minimum);\n\treturn dict;\t\n\n fail:\n\tPy_DECREF(dict);\n\treturn NULL;\t\t\n}\n\nstatic PyObject *\nPyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"reduce\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"accumulate\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OO)\", m1, m2);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(O)\", m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericInplaceBinaryFunction(PyArrayObject *m1, \n\t\t\t\t PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OOO)\", m1, m2, m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\narray_add(PyArrayObject *m1, PyObject *m2) \n{ \n return PyArray_GenericBinaryFunction(m1, m2, n_ops.add); \n}\n\nstatic PyObject *\narray_subtract(PyArrayObject *m1, PyObject *m2) \n{\n\treturn PyArray_GenericBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_negative(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.negative);\n}\n\nstatic PyObject *\narray_absolute(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.absolute);\n}\n\nstatic PyObject *\narray_invert(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.invert);\n}\n\nstatic PyObject *\narray_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_inplace_add(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.add);\n}\n\nstatic PyObject *\narray_inplace_subtract(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_inplace_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_inplace_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_inplace_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_inplace_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_inplace_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_inplace_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_inplace_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_inplace_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_inplace_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.TRUE_divide);\n}\n\nstatic PyObject *\narray_inplace_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_inplace_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.TRUE_divide);\n}\n\n/* Array evaluates as \"TRUE\" if any of the elements are non-zero */\nstatic int \narray_all_nonzero(PyArrayObject *mp) \n{\n\tintp index;\n\tPyArrayIterObject *it;\n\tBool anyTRUE = 0;\n\t\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)mp);\n\tif (it==NULL) return anyTRUE;\n\tindex = it->size;\n\twhile(index--) {\n\t\tif (mp->descr->nonzero(it->dataptr, mp)) {\n\t\t\tanyTRUE = 1;\n\t\t\tbreak;\n\t\t}\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\treturn anyTRUE;\n}\n\nstatic PyObject *\narray_divmod(PyArrayObject *op1, PyObject *op2) \n{\n PyObject *divp, *modp, *result;\n\n divp = array_divide(op1, op2);\n if (divp == NULL) return NULL;\n modp = array_remainder(op1, op2);\n if (modp == NULL) {\n Py_DECREF(divp);\n return NULL;\n }\n result = Py_BuildValue(\"OO\", divp, modp);\n Py_DECREF(divp);\n Py_DECREF(modp);\n return result;\n}\n\n\nstatic PyObject *\narray_int(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can be\"\\\n\t\t\t\t\" converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_int == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to int\");\n Py_DECREF(pv);\n return NULL;\n }\n\n pv2 = pv->ob_type->tp_as_number->nb_int(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_float(PyArrayObject *v) \n{\n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an \"\\\n\t\t\t\t\"int, scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_float == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to float\");\n Py_DECREF(pv);\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_float(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_long(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_long == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to long\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_long(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_oct(PyArrayObject *v) \n{\t \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_oct == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to oct\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_oct(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_hex(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_hex == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to hex\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_hex(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\n_array_copy_nice(PyArrayObject *self)\n{\n\treturn PyArray_Return((PyArrayObject *)\t\t\\\n\t\t\t PyArray_Copy(self));\n}\n\nstatic PyNumberMethods array_as_number = {\n (binaryfunc)array_add,\t\t /*nb_add*/\n (binaryfunc)array_subtract,\t\t /*nb_subtract*/\n (binaryfunc)array_multiply,\t\t /*nb_multiply*/\n (binaryfunc)array_divide,\t\t /*nb_divide*/\n (binaryfunc)array_remainder,\t /*nb_remainder*/\n (binaryfunc)array_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)array_power,\t\t /*nb_power*/\n (unaryfunc)array_negative, /*nb_neg*/\t\n (unaryfunc)_array_copy_nice,\t\t /*nb_pos*/ \n (unaryfunc)array_absolute,\t\t /*(unaryfunc)array_abs,*/\n (inquiry)array_all_nonzero,\t\t /*nb_nonzero*/\n (unaryfunc)array_invert,\t\t /*nb_invert*/\n (binaryfunc)array_left_shift,\t /*nb_lshift*/\n (binaryfunc)array_right_shift,\t /*nb_rshift*/\n (binaryfunc)array_bitwise_and,\t /*nb_and*/\n (binaryfunc)array_bitwise_xor,\t /*nb_xor*/\n (binaryfunc)array_bitwise_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)array_int,\t\t /*nb_int*/\n (unaryfunc)array_long,\t\t /*nb_long*/\n (unaryfunc)array_float,\t\t /*nb_float*/\n (unaryfunc)array_oct,\t\t /*nb_oct*/\n (unaryfunc)array_hex,\t\t /*nb_hex*/\n\n /*This code adds augmented assignment functionality*/\n /*that was made available in Python 2.0*/\n (binaryfunc)array_inplace_add,\t /*inplace_add*/\n (binaryfunc)array_inplace_subtract,\t /*inplace_subtract*/\n (binaryfunc)array_inplace_multiply,\t /*inplace_multiply*/\n (binaryfunc)array_inplace_divide,\t /*inplace_divide*/\n (binaryfunc)array_inplace_remainder, /*inplace_remainder*/\n (ternaryfunc)array_inplace_power,\t /*inplace_power*/\n (binaryfunc)array_inplace_left_shift, /*inplace_lshift*/\n (binaryfunc)array_inplace_right_shift, /*inplace_rshift*/\n (binaryfunc)array_inplace_bitwise_and, /*inplace_and*/\n (binaryfunc)array_inplace_bitwise_xor, /*inplace_xor*/\n (binaryfunc)array_inplace_bitwise_or, /*inplace_or*/\n\n (binaryfunc)array_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)array_TRUE_divide,\t /*nb_TRUE_divide*/\n (binaryfunc)array_inplace_floor_divide, /*nb_inplace_floor_divide*/\n (binaryfunc)array_inplace_TRUE_divide, /*nb_inplace_TRUE_divide*/\n\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Sequence Protocol **************************\n *************************************************************************/\n\n/* Some of this is repeated in the array_as_mapping protocol. But\n we fill it in here so that PySequence_XXXX calls work as expected \n*/\n\n\nstatic PyObject * \narray_slice(PyArrayObject *self, int ilow, int ihigh) \n{\n PyArrayObject *r;\n int l;\n char *data;\n\n if (self->nd == 0) {\n PyErr_SetString(PyExc_ValueError, \"can't slice a scalar\");\n return NULL;\n }\n \t\n l=self->dimensions[0];\n if (ihigh < 0) ihigh += l;\n if (ilow < 0) ilow += l;\n if (ilow < 0) ilow = 0;\n else if (ilow > l) ilow = l;\n if (ihigh < 0) ihigh = 0;\n else if (ihigh > l) ihigh = l;\n if (ihigh < ilow) ihigh = ilow;\n\n if (ihigh != ilow) {\n data = index2ptr(self, ilow);\n if (data == NULL) return NULL;\n } else {\n data = self->data;\n }\n\n self->dimensions[0] = ihigh-ilow;\n r = (PyArrayObject *)\\\n\t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n\t\t\t self->descr->type_num, self->strides, data,\n\t\t\t self->itemsize, self->flags, self);\n\n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n Py_INCREF(self);\n\tPyArray_UpdateFlags(r, UPDATE_ALL_FLAGS); \n return (PyObject *)r;\n}\n\n\nstatic int \narray_ass_slice(PyArrayObject *self, int ilow, int ihigh, PyObject *v) {\n int ret;\n PyArrayObject *tmp;\n\t\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n if ((tmp = (PyArrayObject *)array_slice(self, ilow, ihigh)) \\\n == NULL) \n return -1; \n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\nstatic int\narray_contains(PyArrayObject *self, PyObject *el)\n{\n /* equivalent to any(self == el) */\n\n return PyObject_RichCompareBool((PyObject *)self, el, Py_EQ);\n}\n\n\nstatic PySequenceMethods array_as_sequence = {\n (inquiry)array_length,\t\t/*sq_length*/\n (binaryfunc)NULL, /* sq_concat is handled by nb_add*/\n (intargfunc)NULL, /* sq_repeat is handled nb_multiply*/\n (intargfunc)array_item_nice,\t\t/*sq_item*/\n (intintargfunc)array_slice,\t\t/*sq_slice*/\n (intobjargproc)array_ass_item,\t/*sq_ass_item*/\n (intintobjargproc)array_ass_slice,\t/*sq_ass_slice*/\n\t(objobjproc) array_contains, /* sq_contains */\n\t(binaryfunc) NULL, /* sg_inplace_concat */\n\t(intargfunc) NULL /* sg_inplace_repeat */\n};\n\n\n/****************** End of Sequence Protocol ****************************/\n\n\nstatic int \ndump_data(char **string, int *n, int *max_n, char *data, int nd, \n intp *dimensions, intp *strides, PyArrayObject* self) \n{\n PyArray_Descr *descr=self->descr;\n PyObject *op, *sp;\n char *ostring;\n int i, N;\n\t\n#define CHECK_MEMORY if (*n >= *max_n-16) { *max_n *= 2; \\\n\t\t*string = (char *)realloc(*string, *max_n); }\n\t\n if (nd == 0) {\n\t\t\n if ((op = descr->getitem(data, self)) == NULL) return -1;\n sp = PyObject_Repr(op);\n if (sp == NULL) {Py_DECREF(op); return -1;}\n ostring = PyString_AsString(sp);\n N = PyString_Size(sp)*sizeof(char);\n *n += N;\n CHECK_MEMORY\n memmove(*string+(*n-N), ostring, N);\n Py_DECREF(sp);\n Py_DECREF(op);\n return 0;\n } else {\n CHECK_MEMORY\n (*string)[*n] = '[';\n *n += 1;\n for(i=0; idata, \n\t\t self->nd, self->dimensions, \n self->strides, self) < 0) { \n\t\tfree(string); return NULL; \n\t}\n\t\n\tif (PyArray_ISFLEXIBLE(self)) {\n\t\tchar buf[100];\n\t\tsnprintf(buf, sizeof(buf), \"%d\", self->itemsize);\n\t\tsprintf(string+n, \", '%c%s')\", self->descr->type, buf);\n\t\tret = PyString_FromStringAndSize(string, n+6+strlen(buf));\n\t}\n\telse {\n\t\tsprintf(string+n, \", '%c')\", self->descr->type);\n\t\tret = PyString_FromStringAndSize(string, n+6);\n\t}\n\t\n\n free(string);\n return ret;\n}\n\nstatic PyObject *PyArray_StrFunction=NULL;\nstatic PyObject *PyArray_ReprFunction=NULL;\n\nstatic void \nPyArray_SetStringFunction(PyObject *op, int repr) \n{\n if (repr) {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_ReprFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_ReprFunction = op; \n } else {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_StrFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_StrFunction = op; \n }\n}\n\nstatic PyObject *\narray_repr(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_ReprFunction == NULL) {\n s = array_repr_builtin(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_ReprFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\nstatic PyObject *\narray_str(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_StrFunction == NULL) {\n s = array_repr(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_StrFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\n\nstatic PyObject *\narray_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) \n{\n PyObject *array_other, *result;\n\n switch (cmp_op) \n {\n case Py_LT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less);\n case Py_LE:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less_equal);\n case Py_EQ:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then return the integer\n\t\t\t object 0. This fixes code that used to\n\t\t\t allow equality comparisons between arrays\n\t\t\t and other objects which would give a result\n\t\t\t of 0\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.equal);\n /* If the comparison results in NULL, then the \n\t\t\t two array objects can not be compared together so \n\t\t\t return zero \n */\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n return result;\n case Py_NE:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then objects cannot be \n\t\t\t compared and cannot be equal, therefore, \n\t\t\t return True;\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.not_equal);\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n return result;\n case Py_GT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.greater);\n case Py_GE:\n return PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t other, \n\t\t\t\t\t \t n_ops.greater_equal);\n }\n return NULL;\n}\n\nstatic PyObject *\n_check_axis(PyArrayObject *arr, int *axis, int flags)\n{\n\tPyObject *temp;\n\tint n = arr->nd;\n\n\tif ((*axis >= MAX_DIMS) || (n==0)) {\n\t\ttemp = PyArray_Ravel(arr,0);\n\t\t*axis = 0;\n\t\treturn temp;\n\t}\n\telse {\n\t\tif (flags) {\n\t\t\ttemp = PyArray_FromAny((PyObject *)arr, NULL, \n\t\t\t\t\t 0, 0, flags);\n\t\t\tif (temp == NULL) return NULL;\n\t\t}\n\t\telse {\n\t\t\tPy_INCREF(arr);\n\t\t\ttemp = (PyObject *)arr;\n\t\t}\n\t}\n\tif (*axis < 0) *axis += n;\n\tif ((*axis < 0) || (*axis >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"axis(=%d) out of bounds\", *axis);\n\t\tPy_DECREF(temp);\n\t\treturn NULL;\n\t}\n\treturn temp;\n}\n\n#include \"arraymethods.c\"\n\n/* Lifted from numarray */\nstatic PyObject *\nPyArray_IntTupleFromIntp(int len, intp *vals)\n{\n\tint i;\n PyObject *intTuple = PyTuple_New(len);\n if (!intTuple) goto fail;\n for(i=0; ind == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i = ap->nd-1; i >= 0; --i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int \n_IsFortranContiguous(PyArrayObject *ap) \n{\n\tint sd;\n\tint i;\n\t\n\tif (ap->nd == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i=0; i< ap->nd; ++i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int\n_IsAligned(PyArrayObject *ap) \n{\n\tint i, alignment, aligned=1;\n\tintp ptr;\n\tint type = ap->descr->type_num;\n\n\tif ((type == PyArray_STRING) || (type == PyArray_VOID))\n\t\treturn 1;\n\n\talignment = ap->descr->alignment;\n\n\tptr = (intp) ap->data;\n aligned = (ptr % alignment) == 0;\n for (i=0; i nd; i++)\n aligned &= ((ap->strides[i] % alignment) == 0);\n return aligned != 0;\n}\n\nstatic Bool\n_IsWriteable(PyArrayObject *ap)\n{\n\tPyObject *base=ap->base;\n\tPyBufferProcs *pb;\n\n\t/* If we own our own data, then no-problem */\n\tif ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;\n\n\t/* Get to the final base object \n\t If it is a writeable array, then return TRUE\n\t If we can find an array object \n\t or a writeable buffer object as the final base object\n\t or a string object (for pickling support memory savings).\n\t - this last could be removed if a proper pickleable \n\t buffer was added to Python.\n\t*/\n\n\twhile(PyArray_Check(base)) {\n\t\tif (PyArray_CHKFLAGS(base, OWN_DATA)) \n\t\t\treturn (Bool) (PyArray_ISWRITEABLE(base));\n\t\tbase = PyArray_BASE(base);\n\t}\n\n\t/* here so pickle support works seamlessly \n\t and unpickled array can be set and reset writeable \n\t -- could be abused -- */\n\tif PyString_Check(base) return TRUE;\n\n\tpb = base->ob_type->tp_as_buffer;\n\tif (pb == NULL || pb->bf_getwritebuffer == NULL)\n\t\treturn FALSE;\n\t\n\treturn TRUE;\n}\n\n\nstatic void\nPyArray_UpdateFlags(PyArrayObject *ret, int flagmask)\n{\n\n\tif (flagmask & FORTRAN) {\n\t\tif (_IsFortranContiguous(ret)) {\n\t\t\tret->flags |= FORTRAN;\n\t\t\tif (ret->nd > 1) ret->flags &= ~CONTIGUOUS;\n\t\t}\n\t\telse ret->flags &= ~FORTRAN;\n\t}\n\tif (flagmask & CONTIGUOUS) {\n\t\tif (_IsContiguous(ret)) {\n\t\t\tret->flags |= CONTIGUOUS;\n\t\t\tif (ret->nd > 1) ret->flags &= ~FORTRAN;\n\t\t}\n\t\telse ret->flags &= ~CONTIGUOUS;\n\t}\n\tif (flagmask & ALIGNED) {\n\t\tif (_IsAligned(ret)) ret->flags |= ALIGNED;\n\t\telse ret->flags &= ~ALIGNED;\n\t}\n\treturn;\n}\n\n/* This routine checks to see if newstrides (of length nd) will not \n walk outside of the memory implied by either numbytes or\n a single segment array of the provided dimensions and element size if\n numbytes is 0 */\nstatic Bool\nPyArray_CheckStrides(int elsize, int nd, intp numbytes, \n\t\t intp *dims, intp *newstrides)\n{\n\tint i;\n\t\n\tif (numbytes == 0) \n\t\tnumbytes = PyArray_MultiplyList(dims, nd) * elsize;\n\t\n\tfor (i=0; i numbytes) {\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\treturn TRUE;\n\t\n}\n\n\n/* This is the main array creation routine. */\n\n/* Flags argument has multiple related meanings \n depending on data and strides: \n\n If data is given, then flags is flags associated with data. \n If strides is not given, then a contiguous strides array will be created\n and the CONTIGUOUS bit will be set. If the flags argument \n has the FORTRAN bit set, then a FORTRAN-style strides array will be\n created (and of course the FORTRAN flag bit will be set). \n\n If data is not given but created here, then flags will be DEFAULT_FLAGS\n and a non-zero flags argument can be used to indicate a FORTRAN style\n array is desired. \n*/\n\nstatic intp\n_array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize, \n\t\t int inflag, int *objflags) \n{\n\tint i;\n\t/* Only make Fortran strides if not contiguous as well */\n\tif ((inflag & FORTRAN) && !(inflag & CONTIGUOUS)) {\n\t\tfor (i=0; i 1) *objflags &= ~CONTIGUOUS;\n\t\telse *objflags |= CONTIGUOUS;\n\t}\n\telse {\n\t\tfor (i=nd-1;i>=0;i--) {\n\t\t\tstrides[i] = itemsize;\n\t\t\titemsize *= dims[i] ? dims[i] : 1;\n\t\t}\n\t\t*objflags |= CONTIGUOUS;\n\t\tif (nd > 1) *objflags &= ~FORTRAN;\n\t\telse *objflags |= FORTRAN;\n\t}\n\treturn itemsize;\n}\n\n\t\nstatic PyObject *\nPyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n\t PyArrayObject *obj)\n{\n\tPyArrayObject *self;\n\tPyArray_Descr *descr;\n\tregister int i;\n\tintp sd, temp;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\tif (descr == NULL) return NULL;\n\n\tif (nd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"number of dimensions must be >=0\");\n\t\treturn NULL;\n\t}\n if (nd > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError,\n \"maximum number of dimensions is %d\", MAX_DIMS);\n return NULL;\n\t}\n\n\t/* Check dimensions */\n\tfor (i=nd-1;i>=0;i--) {\n\t\tif (dims[i] < 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"negative dimensions\"\t\\\n\t\t\t\t\t\" are not allowed.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tself = (PyArrayObject *) subtype->tp_alloc(subtype, 0);\n\tif (self == NULL) return NULL;\t\n\tself->descr = descr;\n\tself->dimensions = NULL;\n\tif (data == NULL) { /* strides is NULL too */\n\t\tself->flags = DEFAULT_FLAGS;\n\t\tif (flags) {\n\t\t\tself->flags |= FORTRAN; \n\t\t\tif (nd > 1) self->flags &= ~CONTIGUOUS;\n\t\t\tflags = FORTRAN;\n\t\t}\n\t}\n\telse self->flags = (flags & ~UPDATEIFCOPY);\n\t\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tif (itemsize < 1) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"Type must provide an itemsize.\");\n\t\t\tPyObject_Del(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tself->itemsize = itemsize;\n\t\t/* Guarantee that these kind of arrays are never byteswapped\n\t\t unknowingly. \n\t\t*/\n\t\tif (type_num != PyArray_UNICODE)\n\t\t\tself->flags |= NOTSWAPPED;\n\t}\n\telse self->itemsize = descr->elsize; \n\t\t\n\tsd = self->itemsize;\n\t\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dims, sizeof(intp)*nd);\n\t\tif (strides == NULL) { /* fill it in */\n\t\t\tsd = _array_fill_strides(self->strides, dims, nd, sd,\n\t\t\t\t\t\t flags, &(self->flags));\n\t\t}\n\t\telse {\n\t\t\tif (data == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"If strides is given in \" \\\n\t\t\t\t\t\t\"array creation, data must \" \\\n\t\t\t\t\t\t\"be given too.\");\n\t\t\t\tPyObject_Del(self);\n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\t\treturn NULL;\n\t\t\t}\t\t\t\t\t\n\t\t\tmemcpy(self->strides, strides, sizeof(intp)*nd);\n\t\t}\n\t}\n \t\n\t\t\n\tif (data == NULL) {\n\n\t\t/* Make sure we are aligned on void ptrs (without wasting\n\t\t space if we already are). But, also, allocate something \n\t\t even for zero-space arrays e.g. shape=(0,) -- otherwise\n buffer exposure (a.data) doesn't work as it should. */\n\n\t\tif (sd==0) sd = sizeof(intp);\n\t\telse if ((temp=sd%sizeof(intp))) sd += sizeof(intp) - temp;\n\n\t\tif ((data = PyDataMem_NEW(sd))==NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\tif (self->dimensions != NULL) \n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\n\t\t/* It is bad to have unitialized OBJECT pointers */\n\t\t/* We shouldn't need to check for the OBJECT Letter\n\t\t but perhaps it's best. */\n\t\tif (type_num == PyArray_OBJECT || \\\n\t\t type_num == PyArray_OBJECTLTR) {\n\t\t\tmemset(data, 0, sd);\n\t\t}\n\t}\n\telse {\n self->flags &= ~OWN_DATA; /* If data is passed in, \n\t\t\t\t\t this object won't own it \n\t\t\t\t\t by default.\n\t\t\t\t\t Caller must arrange for \n\t\t\t\t\t this to be reset if truly\n\t\t\t\t\t desired */\n }\n self->data = data;\n\tself->nd = nd;\n\tself->base = (PyObject *)NULL;\n self->weakreflist = (PyObject *)NULL;\n\n /* call the __array_finalize__\n\t method if a subtype and some object passed in */\n\tif ((obj != NULL) && (subtype != &PyArray_Type) && \n\t (subtype != &PyBigArray_Type)) {\n\t\tPyObject *res;\n\t\tres = PyObject_CallMethod((PyObject *)self, \n\t\t\t\t\t \"__array_finalize__\",\n\t\t\t\t\t \"O\", (PyObject *)obj);\n\t\tif (res == NULL) PyErr_Clear();\n\t\telse Py_DECREF(res);\n\t}\n\n\treturn (PyObject *)self;\n}\n\n\n\nstatic PyObject * \nPyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape)\n{\n intp oldsize, newsize;\n int new_nd=newshape->len, k, n, elsize;\n int refcnt;\n intp* new_dimensions=newshape->ptr;\n intp new_strides[MAX_DIMS];\n intp sd;\n intp *dimptr;\n char *new_data;\n\t\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n \"resize only works on contiguous arrays\");\n return NULL;\n }\n\n\n newsize = PyArray_MultiplyList(new_dimensions, new_nd);\n\n if (newsize == 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Newsize is zero. Cannot delete an array \"\\\n \"in this way.\");\n return NULL;\n }\n oldsize = PyArray_SIZE(self);\n \n\tif (oldsize != newsize) {\n\t\tif (!(self->flags & OWN_DATA)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize this array: \"\t\\\n\t\t\t\t\t\"it does not own its data.\");\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\trefcnt = (((PyObject *)self)->ob_refcnt);\n\t\tif ((refcnt > 2) || (self->base != NULL) || \\\n\t\t (self->weakreflist != NULL)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize an array that has \"\\\n\t\t\t\t\t\"been referenced or is referencing\\n\"\\\n\t\t\t\t\t\"another array in this way. Use the \"\\\n\t\t\t\t\t\"resize function.\");\n\t\t\treturn NULL;\n\t\t} \n\t\t\n\t\t/* Reallocate space if needed */\n\t\tnew_data = PyDataMem_RENEW(self->data, \n\t\t\t\t\t newsize*(self->itemsize));\n\t\tif (new_data == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n\t\t\t\t\t\"can't allocate memory for array.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tself->data = new_data;\n\t}\n \n if ((newsize > oldsize) && PyArray_ISWRITEABLE(self)) { \n\t\t/* Fill new memory with zeros */\n elsize = self->itemsize;\n\t\tif ((PyArray_TYPE(self) == PyArray_OBJECT)) {\n\t\t\tPyObject *zero = PyInt_FromLong(0);\n PyObject **optr;\n\t\t\toptr = ((PyObject **)self->data) + oldsize;\n\t\t\tn = newsize - oldsize;\n\t\t\tfor (k=0; kdata+oldsize*elsize, 0, \n\t\t\t (newsize-oldsize)*elsize);\n\t\t}\n\t}\n \n if (self->nd != new_nd) { /* Different number of dimensions. */\n self->nd = new_nd;\n \n /* Need new dimensions and strides arrays */\n dimptr = PyDimMem_RENEW(self->dimensions, 2*new_nd);\n if (dimptr == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n \"can't allocate memory for array \" \\\n \"(array may be corrupted).\");\n return NULL;\n }\n self->dimensions = dimptr;\n\t\tself->strides = dimptr + new_nd;\n }\n\n /* make new_strides variable */\n sd = (intp) self->itemsize;\n sd = _array_fill_strides(new_strides, new_dimensions, new_nd, sd,\n 0, &(self->flags));\n\n \n memmove(self->dimensions, new_dimensions, new_nd*sizeof(intp));\n memmove(self->strides, new_strides, new_nd*sizeof(intp));\n\n Py_INCREF(Py_None);\t\n return Py_None;\n \n}\n\n\nstatic void\nPyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj)\n{\n PyObject **optr;\n intp i,n;\n optr = (PyObject **)(arr->data);\n n = PyArray_SIZE(arr);\n if (obj == NULL) {\n for (i=0; ibase = buffer.base;\n Py_INCREF(buffer.base); \n }\n\n PyDimMem_FREE(dims.ptr);\n if (strides.ptr) PyDimMem_FREE(strides.ptr);\n return PyArray_Return(ret);\n \n fail:\n if (dims.ptr) free(dims.ptr);\n if (strides.ptr) free(strides.ptr);\n return NULL;\n}\n\n\n\n/******************* array attribute get and set routines ******************/\n\nstatic PyObject *\narray_ndim_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong(self->nd);\n}\n\nstatic PyObject *\narray_flags_get(PyArrayObject *self)\n{\n static PyObject *module=NULL;\n\n if (module==NULL) {\n module = PyImport_ImportModule(\"scipy.base._internal\");\n if (module == NULL) return NULL;\n }\n return PyObject_CallMethod(module, \"flagsobj\", \"Oi\", \n self, self->flags);\n}\n\n/*\nstatic int\narray_flags_set(PyArrayObject *self, PyObject *obj) \n{\n\tint flagback = self->flags;\n\n if (PyDict_Check(obj)) {\n PyObject *new;\n\t\tnew = PyDict_GetItemString(obj, \"ALIGNED\");\n\t\tif (new) {\n\t\t\tif (PyObject_Not(new)) self->flags &= ~ALIGNED;\n\t\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\t\telse {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"cannot set aligned flag of \" \\\n\t\t\t\t\t\t\"mis-aligned array to True\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n new = PyDict_GetItemString(obj, \"UPDATEIFCOPY\");\n if (new) {\n if (PyObject_Not(new)) {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n else {\n\t\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return -1;\n }\n }\n new = PyDict_GetItemString(obj, \"WRITEABLE\");\n if (new) {\n\t\t\tif (PyObject_IsTrue(new)) {\n\t\t\t\tif (_IsWriteable(self)) {\n\t\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself->flags = flagback;\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\t\"cannot set \"\t\\\n\t\t\t\t\t\t\t\"WRITEABLE \"\t\\\n\t\t\t\t\t\t\t\"flag to True of \"\\\n\t\t\t\t\t\t\t\"this array \");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n new = PyDict_GetItemString(obj, \"NOTSWAPPED\");\n if (new) {\n if (PyObject_IsTrue(new))\n self->flags |= NOTSWAPPED;\n else {\n self->flags &= ~NOTSWAPPED;\n\t\t\t}\n\t\t}\n return 0;\n }\n PyErr_SetString(PyExc_ValueError, \n \"Object must be a dictionary\");\n return -1;\n}\n*/\n\n\nstatic PyObject *\narray_shape_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->dimensions);\n}\n\n\nstatic int\narray_shape_set(PyArrayObject *self, PyObject *val)\n{\n \tint nd;\n\tPyObject *ret;\n\n\tif (!PyTuple_Check(val)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"shape must be a tuple\");\n\t\treturn -1;\n\t}\n\tret = PyArray_Reshape(self, val);\n\tif (ret == NULL) return -1;\n\t\n\tif (self->nd > 0) { /* Free old dimensions and strides */\n\t\tPyDimMem_FREE(self->dimensions);\n\t}\n\tnd = PyArray_NDIM(ret);\n\tself->nd = nd;\n\tif (nd > 0) { /* create new dimensions and strides */\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\tPyErr_SetString(PyExc_MemoryError,\"\");\n\t\t\treturn -1;\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, PyArray_DIMS(ret), \n\t\t nd*sizeof(intp));\n\t\tmemcpy(self->strides, PyArray_STRIDES(ret), \n\t\t nd*sizeof(intp));\n\t}\n\telse self->dimensions=NULL;\n\tPy_DECREF(ret);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_strides_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic int\narray_strides_set(PyArrayObject *self, PyObject *obj)\n{\n\tPyArray_Dims newstrides = {NULL, 0};\n\tPyArrayObject *new;\n\tintp numbytes;\n\n\tif (!PyArray_IntpConverter(obj, &newstrides) || \\\n\t newstrides.ptr == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"invalid strides.\");\n\t\treturn -1;\n\t}\n\tif (newstrides.len != self->nd) {\n\t\tPyErr_Format(PyExc_ValueError, \"strides must be \"\t\\\n\t\t\t \" same length as shape (%d)\", self->nd);\n\t\treturn -1;\n\t}\n\tnew = self;\n\twhile(new->base != NULL) {\n\t\tif (PyArray_Check(new->base)) \n\t\t\tnew = (PyArrayObject *)new->base;\n\t}\n\tnumbytes = PyArray_MultiplyList(new->dimensions, \n\t\t\t\t\tnew->nd)*new->itemsize;\n\t\n\tif (!PyArray_CheckStrides(self->itemsize, self->nd, numbytes, \n\t\t\t\t self->dimensions, newstrides.ptr)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"strides is not \"\\\n\t\t\t\t\"compatible with available memory\");\n\t\treturn -1;\n\t}\n\tmemcpy(self->strides, newstrides.ptr, sizeof(intp)*newstrides.len);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_protocol_strides_get(PyArrayObject *self)\n{\n\tif PyArray_ISCONTIGUOUS(self) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic PyObject *\narray_priority_get(PyArrayObject *self)\n{\n\tif (PyArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_PRIORITY);\n\telse if (PyBigArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_BIG_PRIORITY);\n\telse\n\t\treturn PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY);\n}\n\n\nstatic PyObject *\narray_data_get(PyArrayObject *self)\n{\n\tintp nbytes;\n\tif (!(PyArray_ISONESEGMENT(self))) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot get single-\"\\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn NULL;\n\t}\t\t\n\tnbytes = PyArray_NBYTES(self);\n\tif PyArray_ISWRITEABLE(self) \n\t\treturn PyBuffer_FromReadWriteObject((PyObject *)self, 0, \n\t\t\t\t\t\t (int) nbytes);\n\telse\n\t\treturn PyBuffer_FromObject((PyObject *)self, 0, (int) nbytes);\n}\n\nstatic int\narray_data_set(PyArrayObject *self, PyObject *op)\n{\n\tvoid *buf;\n\tint buf_len;\n\tint writeable=1;\n\n\tif (PyObject_AsWriteBuffer(op, &buf, &buf_len) < 0) {\n\t\twriteable = 0;\n\t\tif (PyObject_AsReadBuffer(op, (const void **)&buf, \n\t\t\t\t\t &buf_len) < 0) {\n\t\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\t\"Object does not have single-segment\" \\\n\t\t\t\t\t\"buffer interface\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif (!PyArray_ISONESEGMENT(self)) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot set single-\" \\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn -1;\n\t}\n\tif (PyArray_NBYTES(self) > buf_len) {\n\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\"Not enough data for array.\");\n\t\treturn -1;\n\t}\n\tif (self->flags & OWN_DATA) {\n\t\tPyArray_XDECREF(self);\n\t\tPyDataMem_FREE(self->data);\n\t}\n\tif (self->base) {\n\t\tif (self->flags & UPDATEIFCOPY) {\n\t\t\t((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tself->flags &= ~UPDATEIFCOPY;\n\t\t}\n\t\tPy_DECREF(self->base);\n\t}\n\tPy_INCREF(op);\n\tself->base = op;\n\tself->data = buf;\n\tself->flags = CARRAY_FLAGS;\n\tif (!writeable)\n\t\tself->flags &= ~WRITEABLE;\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_itemsize_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->itemsize);\n}\n\nstatic PyObject *\narray_size_get(PyArrayObject *self)\n{\n\tlonglong size=PyArray_SIZE(self);\n\tif (size > MAX_INT || size < MIN_INT)\n\t\treturn PyLong_FromLongLong((longlong) size);\n\telse \n\t\treturn PyInt_FromLong((long) size);\n}\n\n\nstatic PyObject *\narray_typechar_get(PyArrayObject *self)\n{\n\tif PyArray_ISFLEXIBLE(self) \n\t\treturn PyString_FromFormat(\"%c%d\", (self->descr->type),\n\t\t\t\t\t self->itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(self->descr->type), 1);\n}\n\nstatic PyObject *\narray_typestr_get(PyArrayObject *self)\n{\n\tstatic char endians[] = \"<>\";\n\tchar endian;\n\tint which;\n\tunsigned long val = 1;\n\tchar *s;\n\tchar basic_=self->descr->kind;\n\n\ts = (char *)&val; /* s[0] == 0 implies big-endian */\n\twhich = (PyArray_ISNOTSWAPPED(self) ? 0 : 1);\n\tif (s[0] == 0) which = 1 - which;\n\tendian = endians[which]; \n\t\n\tif ((basic_==PyArray_VOIDLTR) || (basic_==PyArray_STRINGLTR) || \\\n\t (basic_==PyArray_OBJECTLTR) || (self->itemsize == 1))\n\t\treturn PyString_FromFormat(\"|%c%d\", basic_, self->itemsize);\n\telse\n\t\treturn PyString_FromFormat(\"%c%c%d\", endian, basic_,\n\t\t\t\t\t self->itemsize);\n}\n\nstatic PyObject *\narray_descr_get(PyArrayObject *self)\n{\n\tPyObject *res;\n\tPyObject *dobj;\n\n\t/* hand this off to the typeobject */\n\t/* or give default */\n\tif (PyArray_ISUSERDEF(self)) {\n\t\tres = PyObject_GetAttrString((PyObject *)self->descr->typeobj, \n\t\t\t\t\t \"__array_descr__\");\n\t\tif (res) return res;\n\t\tPyErr_Clear();\n\t}\n\t/* get default */\n\tdobj = PyTuple_New(2);\n\tif (dobj == NULL) return NULL;\n\tPyTuple_SET_ITEM(dobj, 0, PyString_FromString(\"\"));\n\tPyTuple_SET_ITEM(dobj, 1, array_typestr_get(self));\n\tres = PyList_New(1);\n\tif (res == NULL) {Py_DECREF(dobj); return NULL;}\n\tPyList_SET_ITEM(res, 0, dobj);\n\treturn res;\n}\n\nstatic PyObject *\narray_typenum_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->descr->type_num);\n}\n\n\nstatic PyObject *\narray_type_get(PyArrayObject *self)\n{\n\treturn PyArray_TypeObjectFromType(self->descr->type_num);\n}\n\n/* If the type is changed. \n Also needing change: strides, itemsize\n\n Either itemsize is exactly the same\n or the array is single-segment (contiguous or fortran) with\n compatibile dimensions\n\n*/\n\nstatic int\narray_type_set(PyArrayObject *self, PyObject *arg)\n{\n PyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n intp newdim;\n int index;\n char *msg = \"new type not compatible with array.\";\n\n if ((PyArray_TypecodeConverter(arg, &newtype) < 0) ||\n newtype.type_num == PyArray_NOTYPE) {\n PyErr_SetString(PyExc_TypeError, \"Invalid type for array\");\n return -1;\n }\n if (!(PyArray_ISONESEGMENT(self) ||\t\t\\\n\t (newtype.itemsize != self->itemsize))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1; \n }\n\n\tif (PyArray_ISCONTIGUOUS(self)) index = self->nd - 1;\n\telse index = 0;\n\n if (newtype.itemsize < self->itemsize) {\n /* if it is compatible increase the size of the dimension\n at end (or at the front for FORTRAN)\n */\n if (self->itemsize % newtype.itemsize != 0) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n newdim = self->itemsize / newtype.itemsize;\n\t\tself->dimensions[index] *= newdim;\n self->strides[index] = newtype.itemsize;\n\t}\n \n else if (newtype.itemsize > self->itemsize) {\n \n /* Determine if last (or first if FORTRAN) dimension\n is compatible */\n\n\t\tnewdim = self->dimensions[index] * self->itemsize;\n if ((newdim % newtype.itemsize) != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n\t\t\n self->dimensions[index] = newdim / newtype.itemsize;\n self->strides[index] = newtype.itemsize;\n\t\t\n }\n\t\n \n /* fall through -- adjust type*/\n\n self->descr = PyArray_DescrFromType(newtype.type_num);\n self->itemsize = newtype.itemsize;\n PyArray_UpdateFlags(self, ALIGNED);\n return 0;\n\n}\n\n\n\nstatic PyObject *\narray_base_get(PyArrayObject *self)\n{\n\tif (self->base == NULL) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\telse {\n\t\tPy_INCREF(self->base);\n\t\treturn self->base;\n\t}\n}\n\n\nstatic PyObject *\narray_real_get(PyArrayObject *self)\n{\n\tPyArrayObject *ret;\n\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *)ret;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n}\n\n\nstatic int\narray_real_set(PyArrayObject *self, PyObject *val)\n{\n\tPyArrayObject *ret;\n\tPyArrayObject *new;\n\tint rint;\n\n\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0);\n\tif (new == NULL) return -1;\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) return -1;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\tret = self;\n\t}\t\n\trint = PyArray_CopyInto(ret, new);\n\tPy_DECREF(ret);\n\treturn rint;\n}\n\nstatic PyObject *\narray_imag_get(PyArrayObject *self)\n{\t\n\tPyArrayObject *ret;\n\tint itemsize;\n\tint typenum;\n PyArray_Typecode type = {self->descr->type_num, \n self->itemsize,\t \n PyArray_ISFORTRAN(self)};\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\titemsize = self->itemsize >> 1;\n\t\ttypenum = self->descr->type_num - PyArray_NUM_FLOATTYPE;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t typenum,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data + itemsize,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *) ret;\n\t}\n\telse {\n\t\tret = (PyArrayObject *)PyArray_Zeros(self->nd, \n\t\t\t\t\t\t self->dimensions, &type);\n\t\tret->flags &= ~WRITEABLE;\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic int\narray_imag_set(PyArrayObject *self, PyObject *val)\n{\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyArrayObject *ret;\n\t\tPyArrayObject *new;\n\t\tint rint;\n\n\t\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0); \n\t\tif (new == NULL) return -1;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides+ \\\n\t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) {\n\t\t\tPy_DECREF(new); \n\t\t\treturn -1;\n\t\t}\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\trint = PyArray_CopyInto(ret, new);\n\t\tPy_DECREF(ret);\t\t\n\t\tPy_DECREF(new);\n\t\treturn rint;\n\t}\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError, \"Does not have imaginary \" \\\n\t\t\t\t\"part to set.\");\n\t\treturn -1;\n\t}\n}\n\nstatic PyObject *\narray_flat_get(PyArrayObject *self)\n{\n return PyArray_IterNew((PyObject *)self);\n}\n\nstatic int \narray_flat_set(PyArrayObject *self, PyObject *val)\n{\n\tPyObject *arr=NULL;\n\tint retval = -1;\n\tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n\tPyArray_Typecode typecode = {self->descr->type_num,\n\t\t\t\t self->itemsize,\n\t\t\t\t PyArray_ISFORTRAN(self)};\n int swap;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tarr = PyArray_FromAny(val, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\tarrit = (PyArrayIterObject *)PyArray_IterNew(arr);\n\tif (arrit == NULL) goto exit;\n\tselfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (selfit == NULL) goto exit;\n\n swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);\n copyswap = self->descr->copyswap;\n if (PyArray_ISOBJECT(self)) {\n while(selfit->index < selfit->size) {\n Py_XDECREF(*((PyObject **)selfit->dataptr));\n Py_INCREF(*((PyObject **)arrit->dataptr)); \n memmove(selfit->dataptr, arrit->dataptr, \n sizeof(PyObject *));\n copyswap(selfit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_ITER_NEXT(selfit);\n PyArray_ITER_NEXT(arrit);\n if (arrit->index == arrit->size) \n PyArray_ITER_RESET(arrit);\n }\n retval = 0; \n goto exit;\n }\n\n\twhile(selfit->index < selfit->size) {\n\t\tmemmove(selfit->dataptr, arrit->dataptr, self->itemsize);\n copyswap(selfit->dataptr, NULL, swap, self->itemsize);\n\t\tPyArray_ITER_NEXT(selfit);\n\t\tPyArray_ITER_NEXT(arrit);\n\t\tif (arrit->index == arrit->size) \n\t\t\tPyArray_ITER_RESET(arrit);\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(selfit);\n\tPy_XDECREF(arrit);\n\tPy_XDECREF(arr);\n\treturn retval;\n}\n\nstatic PyGetSetDef array_getsetlist[] = {\n {\"ndim\", \n\t (getter)array_ndim_get, \n\t NULL, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)array_flags_get, \n NULL,\n\t \"special dictionary of flags\"},\n {\"shape\", \n\t (getter)array_shape_get, \n\t (setter)array_shape_set, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)array_strides_get, \n\t (setter)array_strides_set,\n\t \"tuple of bytes steps in each dimension\"},\n {\"data\", \n\t (getter)array_data_get, \n\t (setter)array_data_set, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)array_itemsize_get, \n\t NULL,\n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)array_size_get,\n\t NULL,\n \"number of elements in the array\"},\n\t{\"base\",\n\t (getter)array_base_get,\n\t NULL,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)array_type_get, \n\t (setter)array_type_set,\n\t \"get array type class\"},\n\t{\"dtypechar\",\n\t (getter)array_typechar_get,\n\t NULL,\n\t \"get array type character code\"},\n\t{\"dtypenum\",\n\t (getter)array_typenum_get,\n\t NULL,\n\t \"get array type number code\"},\n\t{\"dtypestr\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)array_real_get, \n\t (setter)array_real_set, \n\t \"real part of array\"},\n {\"imag\", \n\t (getter)array_imag_get, \n\t (setter)array_imag_set, \n\t \"imaginary part of array\"},\n\t{\"flat\", \n\t (getter)array_flat_get, \n\t (setter)array_flat_set, \n\t \"a 1-d view of a contiguous array\"}, \n\t{\"__array_data__\", \n\t (getter)array_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)array_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)array_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)array_protocol_strides_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t{\"__array_priority__\",\n\t (getter)array_priority_get,\n\t NULL,\n\t \"Array priority\"},\n \t{NULL, NULL, NULL, NULL}, /* Sentinel */\n};\n\n/****************** end of attribute get and set routines *******************/\n\n\n\nstatic char Arraytype__doc__[] = \n \"A array object represents a multidimensional, homogeneous array of basic values. It has the folowing data members, m.shape (the size of each dimension in the array), m.itemsize (the size (in bytes) of each element of the array), and m.typecode (a character representing the type of the array elements). Arrays are sequence, mapping and numeric objects. Sequence indexing is similar to lists, with single indices returning a reference that points to the old array data, and slices returning by copy. A array is also allowed to be indexed by a sequence of items.\t Each member of the sequence indexes the corresponding dimension of the array.\";\n\nstatic PyTypeObject PyBigArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.bigndarray\",\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n /* methods */\n (destructor)array_dealloc,\t\t /*tp_dealloc */\n (printfunc)NULL,\t\t\t /*tp_print*/\n 0,\t\t\t\t\t /*tp_getattr*/\n 0,\t\t\t\t\t /*tp_setattr*/\n (cmpfunc)0, \t\t /*tp_compare*/\n (reprfunc)array_repr,\t\t /*tp_repr*/\n &array_as_number,\t\t\t /*tp_as_number*/\n NULL, \t\t\t /*tp_as_sequence*/\n &array_as_mapping,\t\t\t /*tp_as_mapping*/\n (hashfunc)0,\t\t\t /*tp_hash*/\n (ternaryfunc)0,\t\t\t /*tp_call*/\n (reprfunc)array_str, \t /*tp_str*/\n\t\t\n (getattrofunc)0,\t\t\t /*tp_getattro*/\n (setattrofunc)0,\t\t\t /*tp_setattro*/\n NULL, \t /*tp_as_buffer*/\n (Py_TPFLAGS_DEFAULT \n | Py_TPFLAGS_BASETYPE\n | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/\n /*Documentation string */\n Arraytype__doc__,\t\t\t /*tp_doc*/\n\n (traverseproc)0,\t\t\t /*tp_traverse */\n (inquiry)0,\t\t\t /*tp_clear */\n (richcmpfunc)array_richcompare,\t \n offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */\n\n /* Iterator support (use standard) */\n\n (getiterfunc)0, \t\t /* tp_iter */\n (iternextfunc)0,\t\t\t /* tp_iternext */\n\n /* Sub-classing (new-style object) support */\n\n array_methods,\t\t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n array_getsetlist,\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0,\t /* tp_alloc */ \n (newfunc)array_new,\t\t /* tp_new */\n 0,\t \t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n};\n\n/* A standard array will subclass from the Big Array and \n add the array_as_sequence table\n and the array_as_buffer table\n */\n\nstatic PyTypeObject PyArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.ndarray\",\t\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n};\n\n\n/* The rest of this code is to build the right kind of array from a python */\n/* object. */\n\nstatic int \ndiscover_depth(PyObject *s, int max, int stop_at_string) \n{\n int d=0;\n PyObject *e;\n\t\n if(max < 1) return -1;\n\n if(! PySequence_Check(s) || PyInstance_Check(s) || \\\n\t PySequence_Length(s) < 0) {\n PyErr_Clear(); return 0;\n }\n if (PyArray_Check(s))\n\t\treturn PyArray_NDIM(s);\n if(PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))\n\t\treturn stop_at_string ? 0:1;\n if (PySequence_Length(s) == 0) \n\t\treturn 1;\n\t\n if ((e=PySequence_GetItem(s,0)) == NULL) return -1;\n if(e!=s) {\n\t\td=discover_depth(e,max-1, stop_at_string);\n\t\tif(d >= 0) d++;\n\t}\n Py_DECREF(e);\n return d;\n}\n\nstatic int\ndiscover_itemsize(PyObject *s, int nd, int *itemsize) \n{\n\tint n, r, i;\n\tPyObject *e;\n\t\n\tn = PyObject_Length(s);\n\n\tif ((nd == 0) || PyString_Check(s) ||\t\t\\\n\t PyUnicode_Check(s) || PyBuffer_Check(s)) {\n\t\tif PyUnicode_Check(s) \n\t\t\t*itemsize = MAX(*itemsize, sizeof(Py_UNICODE)*n);\n\t\telse\n\t\t\t*itemsize = MAX(*itemsize, n);\n\t\treturn 0;\n\t}\n\tfor (i=0; i n_lower) n_lower = d[1];\n }\n d[1] = n_lower;\n\t\n return 0;\n}\n\nstatic void\n_array_small_type(int chktype, int mintype, int chksize, int minsize, \n\t\t PyArray_Typecode *outtype)\n{\n\touttype->type_num = MAX(chktype, mintype);\n\tif (PyTypeNum_ISFLEXIBLE(outtype->type_num) &&\t\\\n\t PyTypeNum_ISFLEXIBLE(mintype)) {\n\t\t/* Handle string->unicode case separately \n\t\t because string itemsize is twice as large */\n\t\tif (outtype->type_num == PyArray_UNICODE && \n\t\t mintype == PyArray_STRING) {\n\t\t\touttype->itemsize = MAX(chksize, 2*minsize);\n\t\t}\n\t\telse {\n\t\t\touttype->itemsize = MAX(chksize, minsize);\n\t\t}\n\t}\n\telse {\n\t\touttype->itemsize = chksize;\n\t}\n\treturn;\t\n}\n\nstatic void\n_array_find_type(PyObject *op, PyArray_Typecode *minitype, \n\t\t PyArray_Typecode *outtype, int max)\n{\n int l;\n PyObject *ip;\n\tint chktype=0;\n\tint chksize=0;\n\tint mintype, minsize;\n\n\tif (minitype == NULL) {\n\t\tmintype = PyArray_BOOL;\n\t\tminsize = sizeof(Bool);\n\t}\n\telse {\n\t\tmintype = minitype->type_num;\n\t\tminsize = minitype->itemsize;\n\t}\n\n \n if (max < 0 || mintype == -1) goto deflt;\n\t\n if (PyArray_Check(op)) {\n\t\tchktype = PyArray_TYPE(op);\n\t\tchksize = PyArray_ITEMSIZE(op);\n\t\tgoto finish;\n\t}\n\t\n\tif (PyArray_IsScalar(op, Generic)) {\n\t\tPyArray_TypecodeFromScalar(op, outtype);\n\t\tchktype = outtype->type_num;\n\t\tchksize = outtype->itemsize;\n\t\tgoto finish;\n\t}\n\t\n\n if (PyObject_HasAttrString(op, \"__array__\")) {\n ip = PyObject_CallMethod(op, \"__array__\", NULL);\n if(ip && PyArray_Check(ip)) {\n\t\t\tchktype = PyArray_TYPE(ip);\n\t\t\tchksize = PyArray_ITEMSIZE(ip);\n\t\t\tgoto finish;\n\t\t}\n } \n\t\n\tif (PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tint swap=0, res;\n\t\tip = PyObject_GetAttrString(op, \"__array_typestr__\");\n\t\tif (ip && PyString_Check(ip)) {\n\t\t\tres = _array_typecode_fromstr(PyString_AS_STRING(ip), \n\t\t\t\t\t\t &swap, outtype); \n\t\t\tif (res >= 0) {\n\t\t\t\tPy_DECREF(ip);\n\t\t\t\tchktype = outtype->type_num;\n\t\t\t\tchksize = outtype->itemsize;\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t}\n\t\tPy_XDECREF(ip);\n\t}\n\n if (PyString_Check(op)) {\n\t\tchktype = PyArray_STRING;\n\t\tchksize = PyString_GET_SIZE(op);\n\t\tgoto finish;\n }\n\n\tif (PyUnicode_Check(op)) {\n\t\tchktype = PyArray_UNICODE;\n\t\tchksize = PyUnicode_GET_DATA_SIZE(op);\n\t\tgoto finish;\n\t}\n\n\tif (PyBuffer_Check(op)) {\n\t\tchktype = PyArray_VOID;\n\t\tchksize = op->ob_type->tp_as_sequence->sq_length(op);\n\t\tPyErr_Clear();\n\t\tgoto finish;\n\t}\n\n\tif (PyInstance_Check(op)) goto deflt;\n\t\n if (PySequence_Check(op)) {\n\t\tPyArray_Typecode newtype = {mintype, minsize, 0};\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n\t\t\tPyErr_Clear(); \n\t\t\tgoto deflt;\n\t\t}\n if (l == 0 && mintype == 0) {\n\t\t\tnewtype.type_num = PyArray_INTP;\n\t\t\tnewtype.itemsize = sizeof(intp);\n\t\t}\n while (--l >= 0) {\n ip = PySequence_GetItem(op, l);\n if (ip==NULL) {\n\t\t\t\tPyErr_Clear(); \n\t\t\t\tgoto deflt;\n\t\t\t}\n\t\t\t_array_find_type(ip, &newtype, outtype, max-1);\n\t\t\t_array_small_type(outtype->type_num,\n\t\t\t\t\t newtype.type_num, \n\t\t\t\t\t outtype->itemsize,\n\t\t\t\t\t newtype.itemsize,\n\t\t\t\t\t &newtype);\n Py_DECREF(ip);\n }\n\t\tchktype = newtype.type_num;\n\t\tchksize = newtype.itemsize;\n\t\tgoto finish;\n }\n\t\n\tif (PyBool_Check(op)) {\n\t\tchktype = PyArray_BOOL;\n\t\tchksize = sizeof(Bool);\n\t\tgoto finish;\t\t\n\t}\n else if (PyInt_Check(op)) {\n\t\tchktype = PyArray_LONG;\n\t\tchksize = sizeof(long);\n\t\tgoto finish;\n } else if (PyFloat_Check(op)) {\n\t\tchktype = PyArray_DOUBLE;\n\t\tchksize = sizeof(double);\n\t\tgoto finish;\n\t} else if (PyComplex_Check(op)) {\n\t\tchktype = PyArray_CDOUBLE;\n\t\tchksize = sizeof(cdouble);\n\t\tgoto finish;\n\t}\n\n deflt:\n\tchktype = PyArray_OBJECT;\n\tchksize = sizeof(void *);\n\n finish:\n\t_array_small_type(chktype, mintype, chksize, minsize, \n\t\t\t outtype);\n\treturn;\n}\n\nstatic int \nAssign_Array(PyArrayObject *self, PyObject *v) \n{\n PyObject *e;\n int l, r;\n\t\n if (!PySequence_Check(v)) {\n PyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"assignment from non-sequence\");\n return -1;\n }\n\t\n l=PyObject_Length(v);\n if(l < 0) return -1; \n\t\n while(--l >= 0)\n {\n e=PySequence_GetItem(v,l);\n if (e == NULL) return -1; \n\t\t\tr = PySequence_SetItem((PyObject*)self,l,e);\n Py_DECREF(e);\n if(r == -1) return -1;\n }\n return 0;\n}\n\n/* \"Array Scalars don't call this code\" */ \nstatic PyObject *\nArray_FromScalar(PyObject *op, PyArray_Typecode *typecode) \n{\n PyArrayObject *ret;\n\tint itemsize = 0;\n\tint type = typecode->type_num;\n\n\tif PyTypeNum_ISFLEXIBLE(type) {\n\t\titemsize = PyObject_Length(op);\n\t}\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,\n\t\t\t\t\t NULL, NULL, itemsize, 0, NULL);\n\n\tif (ret == NULL) return NULL;\n\n ret->descr->setitem(op, ret->data, ret);\n\t\n if (PyErr_Occurred()) {\n array_dealloc(ret);\n return NULL;\n } else {\n return (PyObject *)ret;\n }\n}\n\n\nstatic PyObject *\nArray_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth)\n{\n PyArrayObject *r;\n int nd;\n\tintp *d;\n\tint stop_at_string;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\t\n\t\n\tstop_at_string = ((type == PyArray_OBJECT) ||\t\\\n\t\t\t (type == PyArray_STRING) ||\t\\\n\t\t\t (type == PyArray_UNICODE) || \\\n\t\t\t (type == PyArray_VOID));\n\n if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string)) > 0)) {\n\t\tif (nd==0)\n\t\t\treturn Array_FromScalar(s, typecode);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid input sequence\");\n return NULL;\n }\n\t\n if ((max_depth && nd > max_depth) ||\t\\\n\t (min_depth && nd < min_depth)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of dimensions\");\n return NULL;\n }\n\t\n\tif ((d=PyDimMem_NEW(nd)) == NULL) {\n\t\treturn PyErr_NoMemory();\n }\n\tif(discover_dimensions(s,nd,d, !stop_at_string) == -1) {\n\t\tPyDimMem_FREE(d);\n\t\treturn NULL;\n\t}\n\tif (itemsize == 0 && PyTypeNum_ISFLEXIBLE(type)) {\n\t\tif (discover_itemsize(s, nd, &itemsize) == -1) {\n\t\t\tPyDimMem_FREE(d);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n r=(PyArrayObject*)PyArray_New(&PyArray_Type, nd, d, \n\t\t\t\t type, NULL, NULL,\n\t\t\t\t itemsize, \n\t\t\t\t typecode->fortran, NULL);\n\n PyDimMem_FREE(d);\n if(!r) return NULL;\n if(Assign_Array(r,s) == -1) {\n\t\tPy_DECREF(r);\n\t\treturn NULL;\n\t}\n return (PyObject*)r;\n}\n\n\nstatic int \nPyArray_ValidType(int type) \n{\n\tPyArray_Descr *descr;\n\t\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr==NULL) return 0;\n\treturn 1;\n}\n\n\n/* If the output is not a CARRAY, then it is buffered also */\n\nstatic int\n_bufferedcast(PyArrayObject *out, PyArrayObject *in)\n{\n\tchar *inbuffer, *bptr, *optr;\n\tchar *outbuffer=NULL;\n\tPyArrayIterObject *it_in=NULL, *it_out=NULL;\n\tregister intp i, index;\n\tintp ncopies = PyArray_SIZE(out) / PyArray_SIZE(in);\n\tint elsize=in->itemsize;\n\tint nels = PyArray_BUFSIZE;\n\tint el;\n\tint inswap, outswap=0;\n\tint obuf=!PyArray_ISCARRAY(out);\n\tint oelsize = out->itemsize;\n\tPyArray_VectorUnaryFunc *castfunc;\n PyArray_CopySwapFunc *in_csn;\n PyArray_CopySwapFunc *out_csn;\n\tint retval = -1;\n\n\tcastfunc = in->descr->cast[out->descr->type_num];\n in_csn = in->descr->copyswap;\n out_csn = out->descr->copyswap;\n\n\t/* If the input or output is STRING, UNICODE, or VOID */\n\t/* then getitem and setitem are used for the cast */\n\t/* and byteswapping is handled by those methods */\n\n\tinswap = !(PyArray_ISFLEXIBLE(in) || PyArray_ISNOTSWAPPED(in));\n\t\n\tinbuffer = PyDataMem_NEW(PyArray_BUFSIZE*elsize);\n\tif (inbuffer == NULL) return -1;\n\tit_in = (PyArrayIterObject *)PyArray_IterNew((PyObject *)in);\n\tif (it_in == NULL) goto exit;\n\n\tif (obuf) {\n\t\toutswap = !(PyArray_ISFLEXIBLE(out) || \\\n\t\t\t PyArray_ISNOTSWAPPED(out));\n\t\toutbuffer = PyDataMem_NEW(PyArray_BUFSIZE*oelsize);\n\t\tif (outbuffer == NULL) goto exit;\n\n\t\tit_out = (PyArrayIterObject *)PyArray_IterNew((PyObject *)out);\n\t\tif (it_out == NULL) goto exit;\n\n\t\tnels = MIN(nels, PyArray_BUFSIZE);\n\t}\n\t\n\toptr = (obuf) ? outbuffer: out->data;\n\tbptr = inbuffer;\n\tel = 0;\t\n\twhile(ncopies--) {\n\t\tindex = it_in->size;\n\t\tPyArray_ITER_RESET(it_in);\n\t\twhile(index--) {\n in_csn(bptr, it_in->dataptr, inswap, elsize);\n\t\t\tbptr += elsize;\n\t\t\tPyArray_ITER_NEXT(it_in);\n\t\t\tel += 1;\n\t\t\tif ((el == nels) || (index == 0)) {\n\t\t\t\t/* buffer filled, do cast */\n\t\t\t\t\n\t\t\t\tcastfunc(inbuffer, optr, el, in, out);\n\t\t\t\t\n\t\t\t\tif (obuf) {\n\t\t\t\t\t/* Copy from outbuffer to array */\n\t\t\t\t\tfor(i=0; idataptr,\n optr, outswap,\n oelsize);\n\t\t\t\t\t\toptr += oelsize;\n\t\t\t\t\t\tPyArray_ITER_NEXT(it_out);\n\t\t\t\t\t}\n\t\t\t\t\toptr = outbuffer;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toptr += out->itemsize * nels;\n\t\t\t\t}\n\t\t\t\tel = 0;\n\t\t\t\tbptr = inbuffer;\n\t\t\t}\n\t\t}\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(it_in);\n\tPyDataMem_FREE(inbuffer);\n\tPyDataMem_FREE(outbuffer);\t\n\tif (obuf) {\n\t\tPy_XDECREF(it_out);\n\t}\n\treturn retval;\n\n}\n\n\n/* For backward compatibility */\n\nstatic PyObject *\nPyArray_Cast(PyArrayObject *mp, int type_num) \n{\n\tPyArray_Typecode type;\n\tPyArray_Descr *descr;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\ttype.itemsize = descr->elsize;\n\ttype.type_num = descr->type_num;\n\ttype.fortran = 0;\n\t\n\treturn PyArray_CastToType(mp, &type);\n}\n\nstatic PyObject * \nPyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at) \n{\n\tPyObject *out;\n\tint ret;\n\n\tif ((mp->descr->type_num == at->type_num) && \\\n\t (at->itemsize==0 || mp->itemsize == at->itemsize) &&\n\t PyArray_ISBEHAVED_RO(mp)) {\n\t\tPy_INCREF(mp);\n\t\treturn (PyObject *)mp;\n\t}\n\t\t\n\tif (at->itemsize == 0) {\n\t\tif (mp->descr->type_num == PyArray_STRING &&\t\\\n\t\t at->type_num == PyArray_UNICODE)\n\t\t\tat->itemsize = mp->itemsize*sizeof(Py_UNICODE);\n\t\tif (mp->descr->type_num == PyArray_UNICODE &&\n\t\t at->type_num == PyArray_STRING) \n\t\t\tat->itemsize = mp->itemsize/sizeof(Py_UNICODE);\n\t\tif (at->type_num == PyArray_VOID)\n\t\t\tat->itemsize = mp->itemsize;\n\t}\n\n\tout = PyArray_New(mp->ob_type, mp->nd, \n\t\t\t mp->dimensions, \n\t\t\t at->type_num,\n\t\t\t NULL, NULL, at->itemsize, \n\t\t\t at->fortran, mp);\n\tif (out == NULL) return NULL;\n\tret = PyArray_CastTo((PyArrayObject *)out, mp);\n\tif (ret != -1) return out;\n\n\tPy_DECREF(out);\n\treturn NULL;\n\t\n}\n\t \n/* The number of elements in out must be an integer multiple\n of the number of elements in mp. \n*/\n\nstatic int\nPyArray_CastTo(PyArrayObject *out, PyArrayObject *mp)\n{\n\n\tint simple;\n\tintp mpsize = PyArray_SIZE(mp);\n\tintp outsize = PyArray_SIZE(out);\n\n\tif (mpsize == 0) return 0;\n\tif (!PyArray_ISWRITEABLE(out)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array is not writeable.\");\n\t\treturn -1;\n\t}\n\tif (outsize % mpsize != 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array must have an integer-multiple\"\\\n\t\t\t\t\" of the number of elements in the input \"\\\n\t\t\t\t\"array\");\n\t\treturn -1; \n\t}\n\n\tsimple = ((PyArray_ISCARRAY(mp) && PyArray_ISCARRAY(out)) || \\\n (PyArray_ISFARRAY(mp) && PyArray_ISFARRAY(out)));\n\t\n\tif (simple) {\n\t\tchar *inptr;\n\t\tchar *optr = out->data;\n\t\tintp obytes = out->itemsize * outsize;\n\t\tintp ncopies = outsize / mpsize;\n\n\t\twhile(ncopies--) {\n\t\t\tinptr = mp->data;\n\t\t\tmp->descr->cast[out->descr->type_num](inptr, \n\t\t\t\t\t\t\t optr,\n\t\t\t\t\t\t\t mpsize,\n\t\t\t\t\t\t\t mp, out);\n\t\t\toptr += obytes;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t/* If not a well-behaved cast, then use buffers */\n\tif (_bufferedcast(out, mp) == -1) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nstatic PyObject *\narray_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags) \n{\n\t\n\tPyArrayObject *ret=NULL;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\tint copy = 0;\n\tint arrflags;\n\tPyArray_Typecode oldtype={PyArray_TYPE(arr),PyArray_ITEMSIZE(arr),0};\n\tchar *msg = \"Cannot copy-back to a read-only array.\";\n\t\n\tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n\tif (itemsize == 0) itemsize = arr->itemsize;\n\ttypecode->type_num = type;\n\ttypecode->itemsize = itemsize;\n\n\t/* Don't copy if sizes are compatible */\n\tif (PyArray_EquivalentTypes(&oldtype, typecode)) {\n\t\tarrflags = arr->flags;\n\n\t\tcopy = (flags & ENSURECOPY) || \\\n\t\t\t((flags & CONTIGUOUS) && (!(arrflags & CONTIGUOUS))) \\\n\t\t\t|| (PyArray_ITEMSIZE(arr) != itemsize) || \\\n\t\t\t((flags & ALIGNED) && (!(arrflags & ALIGNED))) || \\\n\t\t\t((flags & NOTSWAPPED) && (!(arrflags & NOTSWAPPED))) \\\n\t\t\t|| (arr->nd > 1 &&\t\t\t\t\\\n\t\t\t ((flags & FORTRAN) != (arrflags & FORTRAN))) || \\\n\t\t\t((flags & WRITEABLE) && (!(arrflags & WRITEABLE)));\n\t\t\n\t\tif (copy) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_New(arr->ob_type, \n\t\t\t\t\t arr->nd, \n\t\t\t\t\t arr->dimensions,\n\t\t\t\t\t arr->descr->type_num,\n\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t itemsize,\n\t\t\t\t\t flags & FORTRAN,\n\t\t\t\t\t arr);\n\t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t} \n\t\t/* If no copy then just increase the reference\n\t\t count and return the input */\n\t\telse { \n\t\t\tPy_INCREF(arr);\n\t\t\tret = arr;\n\t\t}\n\t}\n\t\n\t/* The desired output type is different than the input\n\t array type */\n\telse {\n\t\t/* Cast to the desired type if we can do it safely\n\t\t Also cast if source is a ndim-0 array to mimic\n\t\t behavior with Python scalars */\n\t\tif (flags & FORCECAST || PyArray_NDIM(arr)==0 ||\n\t\t PyArray_CanCastSafely(PyArray_TYPE(arr), type)) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_CastToType(arr, typecode);\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Array can not be safely cast \"\\\n\t\t\t\t\t\"to required type\");\n\t\t\tret = NULL;\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic int\n_array_typecode_fromstr(char *str, int *swap, PyArray_Typecode *type)\n{\n int type_num;\n char typechar;\n int size;\n unsigned long number = 1;\n char *s;\n char msg[] = \"unsupported typestring\";\n \n s = (char *)&number; /* s[0] == 0 implies big-endian */\n\n *swap = 0;\n\n if (str[0] == '<' || str[0] == '>') {\n\tif ((str[0] == '<') && (s[0] == 0)) *swap = 1;\n\telse if ((str[0] == '>') && (s[0] != 0)) *swap = 1;\n }\n str += 1;\n \n#define _MY_FAIL {\t\t\t\t \\\n\t PyErr_SetString(PyExc_ValueError, msg); \\\n\t return -1;\t\t\t \\\n }\t\t\n\n typechar = str[0];\n size = atoi(str + 1);\n switch (typechar) {\n case 'b':\n\t if (size == sizeof(Bool))\n\t\t type_num = PyArray_BOOL;\t \n\t else _MY_FAIL \n\t break;\t\t \n case 'u':\n if (size == sizeof(uintp))\n type_num = PyArray_UINTP;\n\t else if (size == sizeof(char))\n\t\t type_num = PyArray_UBYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_USHORT;\n\t else if (size == sizeof(int)) \n\t\t type_num = PyArray_UINT;\n\t else if (size == sizeof(ulong)) \n\t\t type_num = PyArray_ULONG;\n\t else if (size == sizeof(ulonglong))\n\t\t type_num = PyArray_ULONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'i':\n if (size == sizeof(intp))\n type_num = PyArray_INTP;\n\t else if (size == sizeof(char)) \n\t\t type_num = PyArray_BYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_SHORT;\n\t else if (size == sizeof(int))\n\t\t type_num = PyArray_INT;\n\t else if (size == sizeof(long)) \n\t\t type_num = PyArray_LONG;\n\t else if (size == sizeof(longlong))\n\t\t type_num = PyArray_LONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'f':\n\t if (size == sizeof(float))\n\t\t type_num = PyArray_FLOAT;\n\t else if (size == sizeof(double))\n\t\t type_num = PyArray_DOUBLE;\n\t else if (size == sizeof(longdouble))\n\t\t type_num = PyArray_LONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'c':\n\t if (size == sizeof(float)*2)\n\t\t type_num = PyArray_CFLOAT;\n\t else if (size == sizeof(double)*2)\n\t\t type_num = PyArray_CDOUBLE;\n\t else if (size == sizeof(longdouble)*2)\n\t\t type_num = PyArray_CLONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'O':\n\t if (size == sizeof(PyObject *))\n\t\t type_num = PyArray_OBJECT;\n\t else _MY_FAIL\n\t break;\n case 'S':\n\t type_num = PyArray_STRING;\n\t break;\n case 'U':\n\t type_num = PyArray_UNICODE;\n\t size *= sizeof(Py_UNICODE);\n\t break;\t \n case 'V':\n\t type_num = PyArray_VOID;\n\t break;\n default:\n\t _MY_FAIL\n }\n\n#undef _MY_FAIL\n\n type->type_num = type_num;\n type->itemsize = size;\n type->fortran = 0;\n return 0;\n}\n\nstatic PyObject *\narray_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n{\n\tPyObject *attr=NULL, *item=NULL, *r;\n\tPyArrayObject *ret=NULL;\n\tPyArray_Typecode type;\n\tchar *data;\n\tint buffer_len;\n\tint res, i, n;\n\tintp dims[MAX_DIMS], strides[MAX_DIMS];\n\tint swap;\n\n\t/* Get the memory from __array_data__ and __array_offset__ */\n\t/* Get the shape */\n\t/* Get the typestring -- ignore array_descr */\n\t/* Get the strides */\n\t\n\tattr = PyObject_GetAttrString(input, \"__array_data__\");\n\tif (attr == NULL) {\n\t\tPy_INCREF(input);\n\t\tattr = input;\n\t}\n\t\n\tres = PyObject_AsWriteBuffer(attr, (void **)&data, &buffer_len);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n\n\tattr = PyObject_GetAttrString(input, \"__array_typestr__\");\n\tif (!PyString_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_typestr__ must be a string.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\t\n\t}\n\tres = _array_typecode_fromstr(PyString_AS_STRING(attr), &swap, &type);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n \n\tattr = PyObject_GetAttrString(input, \"__array_shape__\");\n\tif (!PyTuple_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_shape__ must be a tuple.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\n\t}\n\tn = PyTuple_GET_SIZE(attr);\n\tfor (i=0; ibase = input;\n \n\tattr = PyObject_GetAttrString(input, \"__array_strides__\");\n\tif (attr != NULL && attr != Py_None) {\n\t\tif (!PyTuple_Check(attr)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"__array_strides__ must be a tuple.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tif (n != PyTuple_GET_SIZE(attr)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"mismatch in length of \"\\\n\t\t\t\t\t\"__array_strides__ and \"\\\n\t\t\t\t\t\"__array_shape__.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tfor (i=0; istrides, strides, n*sizeof(intp));\n\t}\n\n\tif (swap) {\n\t\tPyObject *tmp;\n\t\ttmp = PyObject_CallMethod((PyObject *)ret, \"byteswap\", \"\");\n\t\tPy_DECREF(tmp);\n\t}\n\n\tPyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);\n\tr = array_fromarray(ret, intype, flags);\n\tPy_DECREF(ret);\n\treturn r;\n}\n\nstatic PyObject *\narray_fromattr(PyObject *op, PyArray_Typecode *typecode, int flags) \n{\n PyObject *new, *r;\n\t \n if (typecode->type_num == PyArray_NOTYPE) {\n new = PyObject_CallMethod(op, \"__array__\", NULL);\n } else {\n new = PyObject_CallMethod(op, \"__array__\", \"i\", \n typecode->type_num);\n }\n if (new == NULL) return NULL;\n if (!PyArray_Check(new)) {\n PyErr_SetString(PyExc_ValueError, \n \"object __array__ method not \" \\\n \"producing an array.\");\n Py_DECREF(new);\n return NULL;\n }\n r = array_fromarray((PyArrayObject *)new, typecode, flags);\n Py_DECREF(new);\n return r;\n} \n\n\nstatic PyObject *\narray_fromobject(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth, int flags) \n{\n /* This is the main code to make a NumPy array from a Python\n Object. It is called from lot's of different places which\n is why there are so many checks. The comments try to\n explain some of the checks. */\n\n\tint type = typecode->type_num;\n PyObject *r=NULL;\n\n\t/* Is input object already an array? */\n\t/* This is where the flags are used */\n if (PyArray_Check(op)) \n\t\tr = array_fromarray((PyArrayObject *)op, typecode, flags);\n\telse if (PyObject_HasAttrString(op, \"__array__\")) {\n\t\t/* Code that returns the object to convert for a non\n\t\t multiarray input object from the __array__ attribute of the\n\t\t object. */\n r = array_fromattr(op, typecode, flags);\n\t}\n\telse if (PyObject_HasAttrString(op, \"__array_shape__\") &&\n\t\t PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tr = array_frominterface(op, typecode, flags);\n\t}\n\telse {\n\t\tif (type == PyArray_NOTYPE) {\n\t\t\t_array_find_type(op, NULL, typecode, MAX_DIMS);\n\t\t}\n\t\tif (PySequence_Check(op))\n\t\t\tr = Array_FromSequence(op, typecode, \n\t\t\t\t\t min_depth, max_depth);\n\t\telse\n\t\t\tr = Array_FromScalar(op, typecode);\n\t}\n\n /* If we didn't succed return NULL */\n if (r == NULL) return NULL;\n\t\n\t/* Be sure we succeed here */\n\t\n if(!PyArray_Check(r)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Internal error array_fromobject \"\\\n\t\t\t\t\"not producing an array\");\n\t\tPy_DECREF(r);\n return NULL;\n }\n\n if (min_depth != 0 && ((PyArrayObject *)r)->nd < min_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object of too small depth for desired array\");\n return NULL;\n }\n if (max_depth != 0 && ((PyArrayObject *)r)->nd > max_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object too deep for desired array\");\n return NULL;\n }\n return r;\n}\n\nstatic void\nPyArray_ArrayType(PyObject *op, PyArray_Typecode *intype, \n\t\t PyArray_Typecode *outtype) \n{\n\t_array_find_type(op, intype, outtype, MAX_DIMS);\n\treturn;\n}\n\nstatic int \nPyArray_ObjectType(PyObject *op, int minimum_type) \n{\n\tPyArray_Typecode intype, outtype;\n\tintype.type_num = minimum_type;\n\t_array_find_type(op, &intype, &outtype, MAX_DIMS);\n\treturn outtype.type_num;\n}\n\n\n\n/* flags is any of \n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough\n to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, and WRITEABLE\n and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, the returned array will be a copy of the object, \n (C) contiguous in memory, aligned, notswapped, and writeable.\n \n So CONTIGUOUS | ENSURECOPY passed in means that the returned\n array does not have to be CONTIGUOUS or a COPY but should be\n ALIGNED, NOTSWAPPED and WRITEABLE. \n\n typecode->fortran can be set to request a\n fortran-contiguous array. Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n*/\n\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n{\n \tPyArray_Typecode mine = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode *type;\n\t\n\tif (typecode == NULL) type = &mine;\n\telse type = typecode;\n\t\t\n\tif (requires & ENSURECOPY) {\n\t\trequires |= DEFAULT_FLAGS;\n\t}\n\t/* Ensure that type->fortran and flags & FORTRAN are the\n\t same */\n\tif (requires & FORTRAN) typecode->fortran = 1;\n\tif (type->fortran == 1) {\n\t\trequires |= FARRAY_FLAGS;\n\t\tif (min_depth > 2) requires &= ~CONTIGUOUS;\n\t}\n\n\t/* make sure itemsize is not 0 unless warranted. */\n\tif ((type->itemsize == 0) && (type->type_num != PyArray_NOTYPE)) {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type->type_num);\n\t\tif (descr != NULL) type->itemsize = descr->elsize;\n\t\telse return NULL;\n\t}\n\t\n\treturn array_fromobject(op, type, min_depth, max_depth, \n\t\t\t\trequires);\t\n}\n\n/* This is a quick wrapper around PyArray_FromAny(op, NULL, 0, 0, 0) */\n/* that special cases Arrays and PyArray_Scalars up front */\n/* It steals a reference to the object */\n\n/* Because it decrefs op if any conversion needs to take place \n -- so it can be used like PyArray_EnsureArray(some_function(...)) */\n\nstatic PyObject *\nPyArray_EnsureArray(PyObject *op)\n{\n PyObject *new;\n\n if (op == NULL) return NULL;\n\n if (PyArray_Check(op)) return op;\n\n if (PyArray_IsScalar(op, Generic)) {\n new = PyArray_FromScalar(op, NULL);\n Py_DECREF(op);\n return new;\n }\n new = PyArray_FromAny(op, NULL, 0, 0, 0);\n Py_DECREF(op);\n return new;\n}\n\n/* These are all compressed into a single API */\n/* Deprecated calls -- Use PyArray_FromAny */\n\nstatic PyObject *\nPyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, BEHAVED_FLAGS);\n}\n\nstatic PyObject *\nPyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n\t\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, DEFAULT_FLAGS);\n}\n\nstatic PyObject *\nPyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n\t\t\t ENSURECOPY);\n}\n\n/* End of deprecated */\n\n\nstatic int \nPyArray_CanCastSafely(int fromtype, int totype) \n{\n\tPyArray_Descr *from, *to;\n\n if (fromtype == totype) return 1;\n if (fromtype == PyArray_BOOL) return 1;\n\tif (totype == PyArray_BOOL) return 0;\n if (totype == PyArray_OBJECT || totype == PyArray_VOID) return 1;\n\tif (fromtype == PyArray_OBJECT || fromtype == PyArray_VOID) return 0;\n\n\tfrom = PyArray_DescrFromType(fromtype);\n\tto = PyArray_DescrFromType(totype);\n \n switch(fromtype) {\n case PyArray_BYTE:\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISUNSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_UBYTE:\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_FLOAT:\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\tif (PyTypeNum_ISCOMPLEX(totype)) \n\t\t\treturn ((to->elsize >> 1) >= from->elsize);\n\t\telse\n\t\t\treturn (totype > fromtype);\n case PyArray_CFLOAT:\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn (totype > fromtype);\n\tcase PyArray_STRING:\n\tcase PyArray_UNICODE:\n\t\treturn (totype > fromtype);\n default:\n return 0;\n }\n}\n\nstatic Bool\nPyArray_CanCastTo(PyArray_Typecode *from, PyArray_Typecode *to)\n{\n\tint fromtype=from->type_num;\n\tint totype=to->type_num;\n\tBool ret;\n\n\tret = (Bool) PyArray_CanCastSafely(fromtype, totype);\n\tif (ret) { /* Check String and Unicode more closely */\n\t\tif (fromtype == PyArray_STRING) {\n\t\t\tif (totype == PyArray_STRING) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t\telse if (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize * sizeof(Py_UNICODE)\\\n\t\t\t\t <= to->itemsize);\n\t\t\t}\n\t\t}\n\t\telse if (fromtype == PyArray_UNICODE) {\n\t\t\tif (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}\n\n\n\n/*********************** Element-wise Array Iterator ***********************/\n/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/\n/* and Python's array iterator ***/\n \n\nstatic PyObject *\nPyArray_IterNew(PyObject *obj)\n{\n PyArrayIterObject *it;\n\tint i, nd; \n\tPyArrayObject *ao = (PyArrayObject *)obj;\n\n if (!PyArray_Check(ao)) {\n PyErr_BadInternalCall();\n return NULL;\n }\n\n it = PyObject_GC_New(PyArrayIterObject, &PyArrayIter_Type);\n if (it == NULL)\n return NULL;\n\n\tnd = ao->nd;\n\tPyArray_UpdateFlags(ao, CONTIGUOUS);\n\tit->contiguous = 0;\n\tif PyArray_ISCONTIGUOUS(ao) it->contiguous = 1;\n Py_INCREF(ao);\n it->ao = ao;\n\tit->size = PyArray_SIZE(ao);\n\tit->nd_m1 = nd - 1;\n\tit->factors[nd-1] = 1;\n\tfor (i=0; i < nd; i++) {\n\t\tit->dims_m1[i] = it->ao->dimensions[i] - 1;\n\t\tit->strides[i] = it->ao->strides[i];\n\t\tit->backstrides[i] = it->strides[i] *\t\\\n\t\t\tit->dims_m1[i];\n\t\tif (i > 0)\n\t\t\tit->factors[nd-i-1] = it->factors[nd-i] *\t\\\n\t\t\t\tit->ao->dimensions[nd-i];\n\t}\n\tPyArray_ITER_RESET(it);\n\t\n PyObject_GC_Track(it);\n return (PyObject *)it;\n}\n\n/* Returns an array scalar holding the element desired */\n\nstatic PyObject *\narrayiter_next(PyArrayIterObject *it)\n{\n\tPyObject *ret;\n\n\tif (it->index < it->size) {\n\t\tret = PyArray_ToScalar(it->dataptr, it->ao);\n\t\tPyArray_ITER_NEXT(it);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narrayiter_dealloc(PyArrayIterObject *it)\n{\n PyObject_GC_UnTrack(it);\n Py_XDECREF(it->ao);\n PyObject_GC_Del(it);\n }\n\nstatic int\narrayiter_traverse(PyArrayIterObject *it, visitproc visit, void *arg)\n{\n if (it->ao != NULL)\n return visit((PyObject *)(it->ao), arg);\n return 0;\n}\n\n\nstatic int\niter_length(PyArrayIterObject *self) \n{\n return (int) self->size;\n}\n\n\nstatic PyObject *\niter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tint index, strides, itemsize;\n\tintp count=0;\n\tchar *dptr, *optr;\n\tPyObject *r;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn NULL;\n\t}\n\tindex = (ind->dimensions[0]);\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\t/* Get size of return array */\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0)\n\t\t\tcount++;\n\t\tdptr += strides;\n\t}\n\titemsize = self->ao->itemsize;\n\tr = PyArray_New(self->ao->ob_type, 1, &count, \n\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\titemsize, 0, self->ao);\n\tif (r==NULL) return NULL;\n\n\t/* Set up loop */\n\toptr = PyArray_DATA(r);\n\tindex = ind->dimensions[0];\n\tdptr = ind->data;\n\n copyswap = self->ao->descr->copyswap;\n\t/* Loop over Boolean array */\n\tswap = !(PyArray_ISNOTSWAPPED(self->ao));\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\t\toptr += itemsize;\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\nstatic PyObject *\niter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tintp num;\n\tPyObject *r;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint swap;\n\tchar *optr;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = self->ao->itemsize;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t}\n\t\n\tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n\t\t\tself->ao->descr->type_num, NULL, \n\t\t\tNULL, self->ao->itemsize, \n\t\t\t0, self->ao);\n\tif (r==NULL) return NULL;\n\n\toptr = PyArray_DATA(r);\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) {Py_DECREF(r); return NULL;}\n\tindex = ind_it->size;\n copyswap = PyArray_DESCR(r)->copyswap;\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif (num < 0 || num >= self->size) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\tPy_DECREF(r);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\toptr += itemsize;\n\t\tPyArray_ITER_NEXT(ind_it);\n\t}\n\tPy_DECREF(ind_it);\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\n\nstatic PyObject *\niter_subscript(PyArrayIterObject *self, PyObject *ind)\n{\n\tint i;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *r;\n\tchar *dptr;\n\tint size;\n\tPyObject *obj = NULL;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\t\t\n\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\tobj = iter_subscript(self, ind);\n\t\tPy_DECREF(ind);\n\t\treturn obj;\n\t}\n\n\t/* Tuples not accepted --- i.e. no NewAxis */\n\t/* Could implement this with adjusted strides\n\t and dimensions in iterator */\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\tPyArray_ITER_RESET(self);\n\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n\t\t\treturn PyArray_ToScalar(self->dataptr, self->ao);\n\t\t}\n\t\telse { /* empty array */\n\t\t\tintp ii = 0;\n\t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n\t\t\t\t\tself->ao->descr->type_num, NULL, \n\t\t\t\t\tNULL, self->ao->itemsize, 0,\n\t\t\t\t\tself->ao);\n\t\t\treturn r;\t\t\t\n\t\t}\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) \n\t\t\tgoto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start)\n\t\tif (n_steps == SingleIndex) { /* Integer */\n\t\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn r;\n\t\t}\n\t\tsize = self->ao->itemsize;\n\t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n\t\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\t\tsize, 0, self->ao);\n\t\tif (r==NULL) goto fail; \n\t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n copyswap = PyArray_DESCR(r)->copyswap;\n\t\twhile(n_steps--) {\n copyswap(dptr, self->dataptr, swap, size);\n\t\t\tfor(i=0; i< step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tdptr += size;\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer) || PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tr = iter_subscript_Bool(self, (PyArrayObject *)obj);\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tobj = new;\n\t\t\tr = iter_subscript_int(self, (PyArrayObject *)obj);\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"unsupported iterator index\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPy_DECREF(obj);\n\t\treturn r;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\n fail:\n\tPy_XDECREF(obj);\n\treturn NULL;\n\n}\n\n\nstatic int\niter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tint index, strides, itemsize;\n\tchar *dptr;\n PyArray_CopySwapFunc *copyswap;\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn -1;\n\t}\n\titemsize = self->ao->itemsize;\n\tindex = ind->dimensions[0];\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\tPyArray_ITER_RESET(self);\n\t/* Loop over Boolean array */\n copyswap = self->ao->descr->copyswap;\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(self->dataptr, val->dataptr, swap,\n itemsize);\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index==val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn 0;\n}\n\nstatic int\niter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tPyArray_Typecode typecode;\n\tintp num;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = typecode.itemsize = self->ao->itemsize;\n\ttypecode.type_num = self->ao->descr->type_num;\n copyswap = self->ao->descr->copyswap;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\treturn 0;\n\t}\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) return -1;\n\tindex = ind_it->size;\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif ((num < 0) || (num >= self->size)) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\treturn -1;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\tPyArray_ITER_NEXT(ind_it);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index == val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPy_DECREF(ind_it);\n\treturn 0;\n}\n\n\nstatic int\niter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) \n{\n\tint i;\n\tPyObject *arrval=NULL;\n\tPyArrayIterObject *val_it=NULL;\n\tPyArray_Typecode type;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint swap;\n\tint itemsize;\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *obj;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\ti = iter_ass_subscript(self, ind, val);\n\t\tPy_DECREF(ind);\n\t\treturn i;\n\t}\n\t\n\ttype.type_num = self->ao->descr->type_num;\n\titemsize = type.itemsize = self->ao->itemsize;\n\t\n\tarrval = PyArray_FromAny(val, &type, 0, 0, 0);\n\tif (arrval==NULL) return -1;\n\tval_it = (PyArrayIterObject *)PyArray_IterNew(arrval);\n\tif (val_it==NULL) goto fail;\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\n copyswap = PyArray_DESCR(arrval)->copyswap;\n\tswap = (PyArray_ISNOTSWAPPED(self->ao)!=PyArray_ISNOTSWAPPED(arrval));\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n copyswap(self->dataptr, PyArray_DATA(arrval), \n swap, itemsize);\n\t\t}\n\t\tgoto succeed;\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) goto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start);\n\t\tif (n_steps == SingleIndex) { /* Integer */\n copyswap(self->dataptr, PyArray_DATA(arrval),\n swap, itemsize);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\tgoto succeed;\n\t\t}\n\t\twhile(n_steps--) {\n copyswap(self->dataptr, val_it->dataptr,\n swap, itemsize);\n\t\t\tfor(i=0; i < step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tPyArray_ITER_NEXT(val_it);\n\t\t\tif (val_it->index == val_it->size) \n\t\t\t\tPyArray_ITER_RESET(val_it);\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\tgoto succeed;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer))\n\t\tobj = PyArray_FromScalar(ind, &indtype);\n\telse if (PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tif (iter_ass_sub_Bool(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tPy_DECREF(obj);\n\t\t\tobj = new;\n\t\t\tif (iter_ass_sub_int(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t}\n\t\telse goto fail;\n\t\tPy_DECREF(obj);\n\t\tgoto succeed;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\tgoto fail;\n\n succeed:\n\tPy_DECREF(val_it);\n\tPy_DECREF(arrval);\n\treturn 0;\n\n fail:\n\tPy_XDECREF(val_it);\n\tPy_XDECREF(arrval);\n\treturn -1;\n\t\n}\n\n\nstatic PyMappingMethods iter_as_mapping = {\n (inquiry)iter_length,\t\t /*mp_length*/\n (binaryfunc)iter_subscript,\t /*mp_subscript*/\n (objobjargproc)iter_ass_subscript,\t/*mp_ass_subscript*/\n};\n\nstatic char doc_iter_array[] = \"__array__(type=None)\\n Get array \"\\\n \"from iterator\";\n\nstatic PyObject *\niter_array(PyArrayIterObject *it, PyObject *op) \n{\n \n PyObject *r;\n intp size;\n\n /* Any argument ignored */\n\n /* Two options: \n 1) underlying array is contiguous\n -- return 1-d wrapper around it \n 2) underlying array is not contiguous\n -- make new 1-d contiguous array with updateifcopy flag set\n to copy back to the old array\n */\n\n size = PyArray_SIZE(it->ao);\n if (PyArray_ISCONTIGUOUS(it->ao)) {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n\t\t\t\tit->ao->flags,\n it->ao); \n\t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, NULL, it->ao->itemsize, 0, it->ao);\n\t\tif (r==NULL) return NULL;\n\t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n\t\t\tPy_DECREF(r); \n\t\t\treturn NULL;\n\t\t}\n PyArray_FLAGS(r) |= UPDATEIFCOPY;\n it->ao->flags &= ~WRITEABLE;\n }\n Py_INCREF(it->ao);\n PyArray_BASE(r) = (PyObject *)it->ao;\n return r;\n \n}\n\nstatic char doc_iter_copy[] = \"copy()\\n Get a copy of 1-d array\";\n\nstatic PyObject *\niter_copy(PyArrayIterObject *it, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\t\n\treturn PyArray_Flatten(it->ao, 0);\n}\n\nstatic PyMethodDef iter_methods[] = {\n /* to get array */\n {\"__array__\", (PyCFunction)iter_array, 1, doc_iter_array},\n\t{\"copy\", (PyCFunction)iter_copy, 1, doc_iter_copy},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\nstatic PyTypeObject PyArrayIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.flatiter\",\t\t /* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arrayiter_dealloc,\t\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0, \t\t\t /* tp_as_sequence */\n &iter_as_mapping, \t /* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0,\t \t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arrayiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arrayiter_next,\t\t/* tp_iternext */\n iter_methods,\t\t\t\t/* tp_methods */\n};\n\n/** END of Array Iterator **/\n\n\n\n/*********************** Subscript Array Iterator *************************\n * *\n * This object handles subscript behavior for array objects. *\n * It is an iterator object with a next method *\n * It abstracts the n-dimensional mapping behavior to make the looping *\n * code more understandable (maybe) *\n * and so that indexing can be set up ahead of time *\n */ \n\n/* This checks the args for any fancy indexing objects */\n\n#define SOBJ_NOTFANCY 0 \n#define SOBJ_ISFANCY 1\n#define SOBJ_BADARRAY 2\n#define SOBJ_TOOMANY 3\n#define SOBJ_LISTTUP 4\n\nstatic int\nfancy_indexing_check(PyObject *args)\n{\n\tint i, n;\n\tPyObject *obj;\n\tint retval = SOBJ_NOTFANCY;\n\n\tif (PyTuple_Check(args)) {\n\t\tn = PyTuple_GET_SIZE(args);\n\t\tif (n >= MAX_DIMS) return SOBJ_TOOMANY;\n\t\tfor (i=0; i=MAX_DIMS) return SOBJ_ISFANCY;\n\t\tfor (i=0; i SOBJ_ISFANCY) return retval;\n\t\t}\n\t}\n\n\treturn retval;\n}\n\n/* convert an indexing object to an INTP indexing array iterator\n if possible -- otherwise, it is a Slice or Ellipsis object\n and has to be interpreted on bind to a particular \n array so leave it NULL for now.\n */\nstatic int\n_convert_obj(PyObject *obj, PyArrayIterObject **iter)\n{\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tPyObject *arr;\n\n\tif (PySlice_Check(obj) || (obj == Py_Ellipsis))\n\t\t*iter = NULL;\n\telse {\n\t\tarr = PyArray_FromAny(obj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) return -1;\n\t\t*iter = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (*iter == NULL) return -1;\n\t}\n\treturn 0;\n}\n\n/* Adjust dimensionality and strides for index object iterators \n --- i.e. broadcast\n */\nstatic int\nPyArray_Broadcast(PyArrayMultiIterObject *mit)\n{\n\tint i, nd, k, j;\n\tintp tmp;\n\tPyArrayIterObject *it;\n\t\n\t/* Discover the broadcast number of dimensions */\n\tfor (i=0, nd=0; inumiter; i++) \n\t\tnd = MAX(nd, mit->iters[i]->ao->nd);\n\tmit->nd = nd;\n\n\t/* Discover the broadcast shape in each dimension */\n\tfor (i=0; idimensions[i] = 1;\n\t\tfor (j=0; jnumiter; j++) {\n\t\t\tit = mit->iters[j];\n\t\t\t/* This prepends 1 to shapes not already \n\t\t\t equal to nd */\n\t\t\tk = i + it->ao->nd - nd;\n\t\t\tif (k>=0) {\n\t\t\t\ttmp = it->ao->dimensions[k];\n\t\t\t\tif (tmp == 1) continue;\n\t\t\t\tif (mit->dimensions[i] == 1) \n\t\t\t\t\tmit->dimensions[i] = tmp;\n\t\t\t\telse if (mit->dimensions[i] != tmp) {\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\t\"index objects are \" \\\n\t\t\t\t\t\t\t\"not broadcastable \" \\\n\t\t\t\t\t\t\t\"to a single shape.\");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Reset the iterator dimensions and strides of each iterator\n\t object -- using 0 valued strides for broadcasting */\n\n\ttmp = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tmit->size = tmp;\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tit->nd_m1 = mit->nd - 1;\n\t\tit->size = tmp;\n\t\tnd = it->ao->nd;\n\t\tit->factors[mit->nd-1] = 1;\n\t\tfor (j=0; j < mit->nd; j++) {\n\t\t\tit->dims_m1[j] = mit->dimensions[j] - 1;\n\t\t\tk = j + nd - mit->nd;\n\t\t\t/* If this dimension was added or shape\n\t\t\t of underlying array was 1 */\n\t\t\tif ((k < 0) || \\\n\t\t\t it->ao->dimensions[k] != mit->dimensions[j]) {\n\t\t\t\tit->contiguous = 0;\n\t\t\t\tit->strides[j] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tit->strides[j] = it->ao->strides[k];\n\t\t\t}\n\t\t\tit->backstrides[j] = it->strides[j] *\t\\\n\t\t\t\tit->dims_m1[j];\n\t\t\tif (j > 0)\n\t\t\t\tit->factors[mit->nd-j-1] =\t\t\\\n\t\t\t\t\tit->factors[mit->nd-j] *\t\\\n\t\t\t\t\tmit->dimensions[mit->nd-j];\n\t\t}\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn 0;\n}\n\n/* Reset the map iterator to the beginning */\nstatic void\nPyArray_MapIterReset(PyArrayMapIterObject *mit)\n{\n\tint i,j; intp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index = 0;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\n\tif (mit->subspace != NULL) {\n\t\tmemcpy(coord, mit->bscoord, sizeof(intp)*mit->ait->ao->nd);\n\t\tPyArray_ITER_RESET(mit->subspace);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tj = mit->iteraxes[i];\n\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* This function needs to update the state of the map iterator\n and point mit->dataptr to the memory-location of the next object\n*/\nstatic void\nPyArray_MapIterNext(PyArrayMapIterObject *mit)\n{\n\tint i, j;\n\tintp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index += 1;\n\tif (mit->index >= mit->size) return;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\t/* Sub-space iteration */\n\tif (mit->subspace != NULL) {\n\t\tPyArray_ITER_NEXT(mit->subspace);\n\t\tif (mit->subspace->index == mit->subspace->size) {\n\t\t\t/* reset coord to coordinates of \n\t\t\t beginning of the subspace */\n\t\t\tmemcpy(coord, mit->bscoord, \n\t\t\t sizeof(intp)*mit->ait->ao->nd);\n\t\t\tPyArray_ITER_RESET(mit->subspace);\n\t\t\tfor (i=0; inumiter; i++) {\n\t\t\t\tit = mit->iters[i];\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t\tj = mit->iteraxes[i];\n\t\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t\t sizeof(intp));\n\t\t\t}\n\t\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\t}\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* Bind a mapiteration to a particular array */\n\n/* Determine if subspace iteration is necessary. If so, \n 1) Fill in mit->iteraxes\n\t 2) Create subspace iterator\n\t 3) Update nd, dimensions, and size. \n\n Subspace iteration is necessary if: arr->nd > mit->numiter\n*/\n\n/* Need to check for index-errors somewhere. \n\n Let's do it at bind time and also convert all <0 values to >0 here\n as well. \n*/\nstatic void\nPyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n{\n\tint subnd;\n\tPyObject *sub=NULL, *obj=NULL;\n\tint i, j, n, curraxis, ellipexp, noellip;\n\tPyArrayIterObject *it;\n\tintp dimsize;\n\tintp *indptr;\n\n\t/* Remove old binding if any */\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\n\tPy_XDECREF(mit->subspace);\n\tmit->subspace = NULL;\n\t\n\tsubnd = arr->nd - mit->numiter;\n\tif (subnd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Too many indices for array.\");\n\t\treturn;\n\t}\n\n\tmit->ait = (PyArrayIterObject *)PyArray_IterNew((PyObject *)arr);\n\tif (mit->ait == NULL) return;\n\n\t/* If this is just a view, then do nothing more */\n\t/* views are handled by just adjusting the strides\n\t and dimensions of the object.\n\t*/\n\t \n\tif (mit->view) return;\n\n\t/* no subspace iteration needed. Return */\n\tif (subnd == 0) {\n\t\tn = arr->nd;\n\t\tfor (i=0; iiteraxes[i] = i;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\t/* all indexing arrays have been converted to 0 \n\t therefore we can extract the subspace with a simple\n\t getitem call which will use view semantics\n\t*/\n\t\n\tsub = PyObject_GetItem((PyObject *)arr, mit->indexobj);\n\tif (sub == NULL) goto fail;\n\tmit->subspace = (PyArrayIterObject *)PyArray_IterNew(sub);\n\tif (mit->subspace == NULL) goto fail;\n\tPy_DECREF(sub);\n\n\t/* Expand dimensions of result */\n\tn = mit->subspace->ao->nd;\n\tfor (i=0; idimensions[mit->nd+i] = mit->subspace->ao->dimensions[i];\n\tmit->nd += n;\n\n\t/* Now, we still need to interpret the ellipsis and slice objects \n\t to determine which axes the indexing arrays are referring to\n\t*/\n\tn = PyTuple_GET_SIZE(mit->indexobj);\n\n\t/* The number of dimensions an ellipsis takes up */\n\tellipexp = arr->nd - n + 1;\n\t/* Now fill in iteraxes -- remember indexing arrays have been \n converted to 0's in mit->indexobj */\n\tcurraxis = 0;\n\tj = 0;\n\tnoellip = 1; /* Only expand the first ellipsis */\n\tmemset(mit->bscoord, '\\0', sizeof(intp)*arr->nd);\n\tfor (i=0; iindexobj, i);\n\t\tif (PyInt_Check(obj) || PyLong_Check(obj)) \n\t\t\tmit->iteraxes[j++] = curraxis++;\n\t\telse if (noellip && obj == Py_Ellipsis) {\n\t\t\tcurraxis += ellipexp;\n\t\t\tnoellip = 0;\n\t\t}\n\t\telse {\n\t\t\tint start=0;\n\t\t\tint stop, step;\n\t\t\t/* Should be slice object or\n\t\t\t another Ellipsis */\n\t\t\tif (obj == Py_Ellipsis) {\n\t\t\t\tmit->bscoord[curraxis] = 0;\n\t\t\t}\n\t\t\telse if (!PySlice_Check(obj) || \\\n\t\t\t\t (slice_GetIndices((PySliceObject *)obj, \n\t\t\t\t\t\t arr->dimensions[curraxis],\n\t\t\t\t\t\t &start, &stop, &step,\n\t\t\t\t\t\t &dimsize) < 0)) {\n\t\t\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t\t\t \"unexpected object \"\t\\\n\t\t\t\t\t \"(%s) in selection position %d\",\n\t\t\t\t\t obj->ob_type->tp_name, i);\n\t\t\t goto fail;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmit->bscoord[curraxis] = start;\n\t\t\t}\n\t\t\tcurraxis += 1; \n\t\t}\n\t}\n finish:\n\t/* Here check the indexes (now that we have iteraxes) */\n\tmit->size = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tPyArray_ITER_RESET(it);\n\t\tdimsize = arr->dimensions[mit->iteraxes[i]];\n\t\twhile(it->index < it->size) {\n\t\t\tindptr = ((intp *)it->dataptr);\n\t\t\tif (*indptr < 0) *indptr += dimsize;\n\t\t\tif (*indptr < 0 || *indptr >= dimsize) {\n\t\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t\t \"index (%d) out of range \"\\\n\t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n\t\t\t\t\t *indptr, dimsize-1, \n\t\t\t\t\t mit->iteraxes[i]);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn;\n\n fail:\n\tPy_XDECREF(sub);\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\treturn;\n}\n\n/* This function takes a Boolean array and constructs index objects and\n iterators as if nonzero(Bool) had been called\n*/\nstatic int\n_nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)\n{\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\tPyArrayObject *ba =NULL, *new=NULL;\n\tint nd, j;\n\tintp size, i, count;\n\tBool *ptr;\n\tintp coords[MAX_DIMS], dims_m1[MAX_DIMS];\n\tintp *dptr[MAX_DIMS];\n\n\tba = (PyArrayObject *)PyArray_FromAny(myBool, &typecode, 0, 0, \n\t\t\t\t\t CARRAY_FLAGS);\n\tif (ba == NULL) return -1;\n\tnd = ba->nd;\n\tfor (j=0; jdata;\n\tcount = 0;\n\n\t/* pre-determine how many nonzero entries there are */\n\tfor (i=0; iao->data;\n\t\tcoords[j] = 0;\n\t\tdims_m1[j] = ba->dimensions[j]-1;\n\t}\n\n\tptr = (Bool *)ba->data;\n\n\tif (count == 0) return nd;\n\n\t/* Loop through the Boolean array and copy coordinates\n\t for non-zero entries */\n\tfor (i=0; i=0; j--) {\n\t\t\tif (coords[j] < dims_m1[j]) {\n\t\t\t\tcoords[j]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcoords[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn nd;\n\n fail:\n\tfor (j=0; jiters[i] = NULL;\n \tmit->view = 0;\n \tmit->index = 0;\n \tmit->ait = NULL;\n \tmit->subspace = NULL;\n\tmit->numiter = 0;\n\tmit->consec = 1;\n\tfancy = fancy_indexing_check(indexobj);\n\tPy_INCREF(indexobj);\n\tmit->indexobj = indexobj;\n\tif (fancy == SOBJ_NOTFANCY) { /* bail out */\n\t\tmit->view = 1;\n\t\tgoto ret;\n\t}\n\n\tif (fancy == SOBJ_BADARRAY) {\n\t\tPyErr_SetString(PyExc_TypeError,\t\t\t\\\n\t\t\t\t\"Arrays used as indexes must be of \" \\\n\t\t\t\t\"integer type\");\n\t\tgoto fail;\n\t}\n\tif (fancy == SOBJ_TOOMANY) {\n\t\tPyErr_SetString(PyExc_TypeError,\"Too many indicies\");\n\t\tgoto fail;\n\t}\n\n\tif (fancy == SOBJ_LISTTUP) {\n\t\tPyObject *newobj;\n\t\tnewobj = PySequence_Tuple(indexobj);\n\t\tif (newobj == NULL) goto fail;\n\t\tPy_DECREF(indexobj);\n\t\tindexobj = newobj;\n\t\tmit->indexobj = indexobj;\n\t}\n\n#undef SOBJ_NOTFANCY \n#undef SOBJ_ISFANCY \n#undef SOBJ_BADARRAY \n#undef SOBJ_TOOMANY \n#undef SOBJ_LISTTUP \n\n\n\t/* Must have some kind of fancy indexing if we are here */\n\t/* indexobj is either a list, an arrayobject, or a tuple \n\t (with at least 1 list or arrayobject or Bool object), */\n\t\n\t/* convert all inputs to iterators */\n\tif (PyArray_Check(indexobj) &&\t\t\t\\\n\t (PyArray_TYPE(indexobj) == PyArray_BOOL)) {\n\t\tmit->numiter = _nonzero_indices(indexobj, mit->iters);\n\t\tif (mit->numiter < 0) goto fail;\n\t\tmit->nd = 1;\n\t\tmit->dimensions[0] = mit->iters[0]->dims_m1[0]+1;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = PyTuple_New(mit->numiter);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tPyTuple_SET_ITEM(mit->indexobj, i, \n\t\t\t\t\t PyInt_FromLong(0));\n\t\t}\n\t}\n\n\telse if (PyList_Check(indexobj) || PyArray_Check(indexobj)) {\n\t\tmit->numiter = 1;\n\t\tarr = PyArray_FromAny(indexobj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) goto fail;\n\t\tmit->iters[0] = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (mit->iters[0] == NULL) goto fail;\n\t\tmit->nd = PyArray_NDIM(arr);\n\t\tmemcpy(mit->dimensions,PyArray_DIMS(arr),mit->nd*sizeof(intp));\n\t\tmit->size = PyArray_SIZE(arr);\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = Py_BuildValue(\"(N)\", PyInt_FromLong(0));\n\t}\n\telse { /* must be a tuple */\n\t\tPyObject *obj;\n\t\tPyArrayIterObject *iter;\n\t\tPyObject *new;\n\t\t/* Make a copy of the tuple -- we will be replacing \n\t\t index objects with 0's */\n\t\tn = PyTuple_GET_SIZE(indexobj);\n\t\tnew = PyTuple_New(n);\n\t\tif (new == NULL) goto fail;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = new;\n\t\tstarted = 0;\n\t\tnonindex = 0;\n\t\tfor (i=0; iconsec = 0;\n\t\t\t\tmit->iters[(mit->numiter)++] = iter;\n\t\t\t\tPyTuple_SET_ITEM(new,i,\n\t\t\t\t\t\t PyInt_FromLong(0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (started) nonindex = 1;\n\t\t\t\tPy_INCREF(obj);\n\t\t\t\tPyTuple_SET_ITEM(new,i,obj);\n\t\t\t}\n\t\t}\n\t\t/* Store the number of iterators actually converted */\n\t\t/* These will be mapped to actual axes at bind time */\n\t\tif (PyArray_Broadcast((PyArrayMultiIterObject *)mit) < 0)\n\t\t\tgoto fail;\n\t}\n\n ret:\n PyObject_GC_Track(mit);\n return (PyObject *)mit;\n \n fail:\n\tPy_XDECREF(arr);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n\treturn NULL;\n}\n\n\n/* return unbound mapiter object */\n\nstatic PyObject *\narraymapiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) \n{\n\tPyObject *newtup, *res;\n\tint n;\n\n\tif (!PyTuple_Check(args)) {\n\t\tPyErr_BadInternalCall();\n\t\treturn NULL;\n\t}\n\n\tn = PyTuple_GET_SIZE(args);\n\t\n\tif (n < 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"must be initialized with >= 1 argument\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n > 1) {\n\t\tnewtup = PyTuple_GetSlice(args, 0, n);\n\t\tif (newtup == NULL) return NULL;\n\t\tres = PyArray_MapIterNew(newtup);\n\t\tPy_DECREF(newtup);\n\t}\n\telse { /* n == 1 */\n\t\tnewtup = PyTuple_GET_ITEM(args, 0);\n\t\tres = PyArray_MapIterNew(newtup);\n\t}\n\n\treturn res; \t\n}\n\n\n/* Returns a 0-dim array holding the element desired */\n\nstatic PyObject *\narraymapiter_next(PyArrayMapIterObject *mit)\n{\n\tPyObject *ret;\n\tif (mit->ait == NULL) return NULL;\n\tif (mit->view) return NULL;\n\tif (mit->index < mit->size) {\n\t\tret = PyArray_ToScalar(mit->dataptr, mit->ait->ao);\n\t\tPyArray_MapIterNext(mit);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narraymapiter_dealloc(PyArrayMapIterObject *mit)\n{\n\tint i;\n PyObject_GC_UnTrack(mit);\n Py_XDECREF(mit->ait);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n}\n\nstatic int\narraymapiter_traverse(PyArrayMapIterObject *mit, visitproc visit, void *arg)\n{\n\tint ret, i;\n if (mit->ait != NULL)\n if ((ret = visit((PyObject *)(mit->ait), arg)) != 0) \n\t\t\treturn ret;\t\n\n\tif (mit->iters != NULL) \n\t\tfor (i=0; inumiter; i++) \n\t\t\tif (mit->iters[i] != NULL) \n\t\t\t\tif ((ret=visit((PyObject *)mit->iters[i], \n\t\t\t\t\t arg)) != 0)\n\t\t\t\t\treturn ret;\n\n\tif (mit->indexobj != NULL)\n\t\tif ((ret = visit(mit->indexobj, arg)) != 0) return ret;\n\t\n return 0;\n}\n\n/* \nstatic char doc_mapiter_bind[] = \"obj.bind(a)\\n Bind an array to the \"\\\n\t\"mapiter object\";\n\nstatic PyObject *\nmapiter_bind(PyArrayMapIterObject *mit, PyObject *args)\n{\n\tPyObject *r;\n intp size, strides;\n int nd;\n\tPyArrayObject *arr;\n\n if (!PyArg_ParseTuple(args, \"O!\", &PyArray_Type, &arr)) return NULL;\n\n\tPyArray_MapIterBind(mit, arr);\n\n\tif (mit->ait == NULL) return NULL;\n\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyMethodDef mapiter_methods[] = {\n\t{\"bind\", (PyCFunction)mapiter_bind, 1, doc_mapiter_bind},\n {NULL,\t\tNULL}\t\t\n};\n*/\n\n\nstatic PyTypeObject PyArrayMapIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.mapiter\",\t\t \t/* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arraymapiter_dealloc,\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0,\t\t\t\t\t/* tp_as_sequence */\n 0,\t\t\t\t\t/* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0, \t\t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arraymapiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arraymapiter_next,\t/* tp_iternext */\n 0,\t \t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n 0,\t\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0, \t /* tp_alloc */\n (newfunc)arraymapiter_new,\t /* tp_new */\n 0,\t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n\n};\n\n/** END of Subscript Iterator **/\n\n\n\n", "source_code_before": " /*\n Provide multidimensional arrays as a basic object type in python. \n\nBased on Original Numeric implementation\nCopyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\nwith contributions from many Numeric Python developers 1995-2004 *\n\nHeavily modified in 2005 with inspiration from Numarray \n\nby\n\nTravis Oliphant\nAssistant Professor at\nBrigham Young University \n\nmaintainer email: oliphant.travis@ieee.org\n\nNumarray design (which provided guidance) by \nSpace Science Telescope Institute \n (J. Todd Miller, Perry Greenfield, Rick White)\n\n*/\n\n/* $Id: arrayobject.c,v 1.59 2005/09/14 00:14:00 teoliphant Exp $ */\n\n/*\n#include \"Python.h\"\n#include \"structmember.h\"\n\n#define _MULTIARRAYMODULE\n#include \"Numeric3/arrayobject.h\"\n*/\n\n/* Helper functions */\n\n#define error_converting(x) (((x) == -1) && PyErr_Occurred())\n\nstatic intp\nPyArray_PyIntAsIntp(PyObject *o)\n{\n\tlonglong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INTP, 0, 0};\n\tintp ret;\n\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((intp *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (longlong) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (longlong) PyLong_AsLongLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\t\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONGLONG != SIZEOF_PY_INTPTR_T)\n\tif ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C intp\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (intp) long_value;\n}\n\n\nstatic PyObject *array_int(PyArrayObject *v);\n\nstatic int\nPyArray_PyIntAsInt(PyObject *o)\n{\n\tlong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INT, 0, 0};\n\tint ret;\n\t\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((int *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (long) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (long) PyLong_AsLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONG != SIZEOF_INT)\n\tif ((long_value < INT_MIN) || (long_value > INT_MAX)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C int\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (int) long_value;\n}\n\n\nstatic double\nPyArray_GetPriority(PyObject *obj, double default_) \n{\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n\n\tif (PyArray_CheckExact(obj) || PyBigArray_CheckExact(obj)) \n\t\treturn priority;\n\n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n if (PyErr_Occurred()) {\n PyErr_Clear(); \n priority = default_;\n }\n Py_XDECREF(ret);\n return priority; \n}\n\n/* Backward compatibility only */\n/* In both Zero and One\n\n ***You must free the memory once you are done with it\n using PyDataMem_FREE(ptr) or you create a memory leak***\n\n If arr is an Object array you are getting a \n BORROWED reference to Zero or One.\n Do not DECREF.\n Please INCREF if you will be hanging on to it.\n\n The memory for the ptr still must be freed in any case;\n*/\n\nstatic char *\nPyArray_Zero(PyArrayObject *arr)\n{\n char *zeroval;\n char *buf;\n int buf_len;\n PyObject *obj, *ret;\n\n zeroval = PyDataMem_NEW(arr->itemsize);\n if (zeroval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n if (PyArray_ISOBJECT(arr)) {\n obj=PyInt_FromLong((long) 0);\n memcpy(zeroval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return zeroval;\n }\n ret = PyObject_GetAttrString((PyObject *)arr, \"_zero\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_zero not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n return NULL;\n }\n memcpy(zeroval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n memset(zeroval, 0, arr->itemsize);\n return zeroval;\n}\n\nstatic char *\nPyArray_One(PyArrayObject *arr)\n{\n char *oneval;\n char *buf;\n int buf_len, ret2;\n PyObject *obj, *ret;\n\n oneval = PyDataMem_NEW(arr->itemsize);\n if (oneval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n obj = PyInt_FromLong((long) 1);\n if (PyArray_ISOBJECT(arr)) {\n memcpy(oneval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return oneval;\n }\n \n ret = PyObject_GetAttrString((PyObject *)arr, \"_one\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_one not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n PyDataMem_FREE(oneval);\n return NULL;\n }\n memcpy(oneval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n\n ret2 = arr->descr->setitem(obj, oneval, arr);\n Py_DECREF(obj);\n if (ret < 0) {\n PyDataMem_FREE(oneval);\n return NULL;\n }\n return oneval;\n}\n\n/* End deprecated */\n\n\nstatic int \ndo_sliced_copy(char *dest, intp *dest_strides, intp *dest_dimensions,\n\t int dest_nd, char *src, intp *src_strides, \n\t intp *src_dimensions, int src_nd, int elsize, \n\t int copies) {\n intp i, j;\n\t\n if (src_nd == 0 && dest_nd == 0) {\n for(j=0; j src_nd) {\n for(i=0; i<*dest_dimensions; i++, dest += *dest_strides) {\n if (do_sliced_copy(dest, dest_strides+1, \n dest_dimensions+1, dest_nd-1,\n src, src_strides, \n src_dimensions, src_nd, \n elsize, copies) == -1) \n return -1;\n }\n return 0;\n }\n\t\n if (dest_nd == 1) {\n if (*dest_dimensions != *src_dimensions) {\n PyErr_SetString(PyExc_ValueError, \n \"matrices are not aligned for copy\");\n return -1;\n }\n for(i=0; i<*dest_dimensions; i++, src += *src_strides) {\n for(j=0; j 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize) && \n ((*src_strides)[*src_nd-1] == *elsize)) {\n if ((*dest_dimensions)[*dest_nd-1] != \n (*src_dimensions)[*src_nd-1]) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"matrices are not aligned\");\n return -1;\n }\n *elsize *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1; *src_nd-=1;\n } else {\n break;\n }\n }\n if (*src_nd == 0) {\n while (*dest_nd > 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize)) {\n *copies *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1;\n } else {\n break;\n }\n }\n }\n return 0;\n}\n\nstatic char *\ncontiguous_data(PyArrayObject *src) \n{\n intp dest_strides[MAX_DIMS], *dest_strides_ptr;\n intp *dest_dimensions=src->dimensions;\n int dest_nd=src->nd;\n intp *src_strides = src->strides;\n intp *src_dimensions=src->dimensions;\n int src_nd=src->nd;\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n int stride=elsize;\n char *new_data;\n\t\n for(i=dest_nd-1; i>=0; i--) {\n dest_strides[i] = stride;\n stride *= dest_dimensions[i];\n }\n\t\n dest_strides_ptr = dest_strides;\n\t\n if (optimize_slices(&dest_strides_ptr, &dest_dimensions, &dest_nd,\n &src_strides, &src_dimensions, &src_nd,\n &elsize, &copies) == -1) \n return NULL;\n\t\n new_data = (char *)malloc(stride);\n\t\n ret = do_sliced_copy(new_data, dest_strides_ptr, dest_dimensions, \n dest_nd, src->data, src_strides, \n src_dimensions, src_nd, elsize, copies);\n\t\n if (ret != -1) { return new_data; }\n else { free(new_data); return NULL; }\n}\n\n/* end Helper functions */\n\n\nstatic PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n int, intp *, char *, int, int, PyArrayObject *);\n\n/* C-API functions */\n\n/* Used for arrays of python objects to increment the reference count of */\n/* every python object in the array. */\nstatic int \nPyArray_INCREF(PyArrayObject *mp) \n{\n\tintp i, n;\n\n PyObject **data, **data2;\n\t\n if (mp->descr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data;\n for(i=0; idescr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data; \n for(i=0; i 0; n--, a += 1) {\n b = a + 1;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 4:\n for (a = (char*)p ; n > 0; n--, a += 2) {\n b = a + 3;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 8:\n for (a = (char*)p ; n > 0; n--, a += 4) {\n b = a + 7;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n default:\n m = size / 2;\n for (a = (char *)p ; n > 0; n--, a += m) {\n b = a + (size-1);\n for (j=0; j 1, then dst must be contiguous */\nstatic void\ncopy_and_swap(void *dst, void *src, int itemsize, intp numitems,\n intp srcstrides, int swap) \n{\n int i;\n char *s1 = (char *)src;\n char *d1 = (char *)dst;\n \n\n if ((numitems == 1) || (itemsize == srcstrides)) \n memcpy(d1, s1, itemsize*numitems);\n else { \n for (i = 0; i < numitems; i++) {\n memcpy(d1, s1, itemsize);\n d1 += itemsize;\n s1 += srcstrides;\n } \n }\n\n if (swap)\n byte_swap_vector(d1, numitems, itemsize);\n}\n\n\n/* Computer-generated arraytype and scalartype code */\n#include \"scalartypes.inc\"\n#include \"arraytypes.inc\"\n\nstatic char *\nindex2ptr(PyArrayObject *mp, int i) \n{\n\tif (i==0 && (mp->nd == 0 || mp->dimensions[0] > 0)) \n\t\treturn mp->data;\n\t\n if (mp->nd>0 && i>0 && i < mp->dimensions[0]) {\n return mp->data+i*mp->strides[0];\n }\n PyErr_SetString(PyExc_IndexError,\"index out of bounds\");\n return NULL;\n}\n\nstatic intp \nPyArray_Size(PyObject *op) \n{\n if (PyArray_Check(op)) {\n return PyArray_SIZE((PyArrayObject *)op);\n } \n\telse {\n return 0;\n }\n}\n\n/* If destination is not the right type, then src \n will be cast to destination. \n*/\n\n/* Does a flat iterator-based copy. \n\n The arrays are assumed to have the same number of elements\n They can be different sizes and have different types however. \n*/\n\nstatic int\nPyArray_CopyInto(PyArrayObject *dest, PyArrayObject *src)\n{\n intp dsize, ssize, sbytes;\n\tint ncopies, elsize, index;\n PyArrayIterObject *dit=NULL;\n PyArrayIterObject *sit=NULL;\n\tchar *dptr;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n PyArray_CopySwapNFunc *copyswapn;\n \n if (!PyArray_ISWRITEABLE(dest)) {\n PyErr_SetString(PyExc_RuntimeError, \n \"Cannot write to array.\");\n return -1;\n }\n\n if (!PyArray_EquivArrTypes(dest, src)) {\n return PyArray_CastTo(dest, src);\n }\n\n dsize = PyArray_SIZE(dest);\n ssize = PyArray_SIZE(src);\n\tif (ssize == 0) return 0;\n if (dsize % ssize != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Destination number of elements must be\"\\\n \"an integer multiple of the source number of\"\\\n \"elements.\");\n return -1;\n }\n ncopies = dsize / ssize;\n\n\tswap = PyArray_ISNOTSWAPPED(dest) != PyArray_ISNOTSWAPPED(src);\n\tcopyswap = dest->descr->copyswap;\n\tcopyswapn = dest->descr->copyswapn;\n\n elsize = dest->itemsize;\n\n if ((PyArray_ISCONTIGUOUS(dest) && PyArray_ISCONTIGUOUS(src)) \\\n\t || (PyArray_ISFORTRAN(dest) && PyArray_ISFORTRAN(src))) {\n \n PyArray_XDECREF(dest);\n dptr = dest->data;\n sbytes = ssize * src->itemsize;\n while(ncopies--) {\n memmove(dptr, src->data, sbytes);\n dptr += sbytes;\n }\n\t\tif (swap)\n\t\t\tcopyswapn(dest->data, NULL, dsize, 1, elsize);\n PyArray_INCREF(dest);\n return 0;\n }\n\n dit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)dest);\n sit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)src);\n\n if ((dit == NULL) || (sit == NULL)) {\n Py_XDECREF(dit);\n Py_XDECREF(sit);\n return -1;\n }\n\n PyArray_XDECREF(dest);\n while(ncopies--) {\n index = ssize;\n while(index--) {\n memmove(dit->dataptr, sit->dataptr, elsize);\n\t\t\tif (swap)\n\t\t\t\tcopyswap(dit->dataptr, NULL, 1, elsize);\n PyArray_ITER_NEXT(dit);\n PyArray_ITER_NEXT(sit);\n }\n PyArray_ITER_RESET(sit);\n } \n PyArray_INCREF(dest);\n Py_DECREF(dit);\n Py_DECREF(sit);\n\treturn 0;\n}\n\n\nstatic int \nPyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) \n{\n PyArrayObject *src;\n int ret;\n\tPyArray_Typecode typecode = {dest->descr->type_num, \n\t\t\t\t dest->itemsize, \n\t\t\t\t PyArray_ISFORTRAN(dest)};\n\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n\t\t\t\t\t &typecode, 0,\n\t\t\t\t\t dest->nd, 0);\n if (src == NULL) return -1;\n\n ret = PyArray_CopyInto(dest, src);\n Py_DECREF(src);\n return ret;\n}\n\n\n/* These are also old calls (should use PyArray_New) */\n\n/* They all zero-out the memory as previously done */\n\nstatic PyObject *\nPyArray_FromDimsAndDataAndDescr(int nd, int *d, \n PyArray_Descr *descr,\n char *data) {\n\tPyObject *ret;\n\n#if SIZEOF_INTP != SIZEOF_INT\n\tint i;\n\tintp newd[MAX_DIMS];\n\t\n\tfor (i=0; itype_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#else\n\tret = PyArray_New(&PyArray_Type, nd, (intp *)d, \n descr->type_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#endif\n\tif (descr->type_num != PyArray_OBJECT)\n\t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_FromDimsAndData(int nd, int *d, int type, char *data) \n{\n\tPyObject *ret;\n#if SIZEOF_INTP != SIZEOF_INT\n\tintp newd[MAX_DIMS];\n\tint i;\t\n\tfor (i=0; iob_type, m1->nd, \n\t\t\t\t\t m1->dimensions,\n\t\t\t\t\t m1->descr->type_num,\n\t\t\t\t\t NULL, NULL, m1->itemsize,\n\t\t\t\t\t 0, m1);\n\t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n\t\n return (PyObject *)ret;\n}\n\n\nstatic PyObject *array_item(PyArrayObject *, int);\n\nstatic PyObject *\nPyArray_Scalar(char *data, int type_num, int itemsize, int swap)\n{\n PyArray_Descr *descr;\n\tPyTypeObject *type;\n\tPyObject *obj;\t\n\tchar *destptr;\n PyArray_CopySwapFunc *copyswap;\n\n descr = PyArray_DescrFromType(type_num);\n if (descr == NULL) return NULL;\n type = descr->typeobj;\n copyswap = descr->copyswap;\n\tif (type_num == PyArray_STRING) \n\t\tobj = type->tp_alloc(type, itemsize);\n\telse\n\t\tobj = type->tp_alloc(type, 0);\n\tif (obj == NULL) return NULL;\n\tif PyTypeNum_ISFLEXIBLE(type_num) { \n\t\tif (type_num == PyArray_STRING) {\n\t\t\tdestptr = PyString_AS_STRING(obj);\n\t\t\t((PyStringObject *)obj)->ob_shash = -1;\n\t\t\t((PyStringObject *)obj)->ob_sstate =\t\\\n\t\t\t\tSSTATE_NOT_INTERNED; \n\t\t}\n\t\telse {\n\t\t\tdestptr = PyDataMem_NEW(itemsize);\n\t\t\tif (destptr == NULL) {\n\t\t\t\tPyObject_Del(obj);\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tif (type_num == PyArray_UNICODE) {\n\t\t\t\tPyUnicode_AS_UNICODE(obj) = \\\n\t\t\t\t\t(Py_UNICODE *)destptr;\n\t\t\t\t((PyUnicodeObject*)obj)->length = itemsize / \\\n\t\t\t\t\tsizeof(Py_UNICODE);\n\t\t\t\t((PyUnicodeObject*)obj)->hash = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t((PyVoidScalarObject *)obj)->obval = destptr;\n\t\t\t\t((PyVoidScalarObject *)obj)->ob_size = itemsize;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tdestptr = &(((PyScalarObject*)obj)->obval);\n\t}\n\t/* copyswap for OBJECT increments the reference count */\n copyswap(destptr, data, swap, itemsize);\n\treturn obj;\n}\n\n/* returns an Array-Scalar Object of the type of arr\n from the given pointer to memory -- main Scalar creation function\n default new method calls this. \n*/\nstatic PyObject *\nPyArray_ToScalar(char *data, PyArrayObject *arr)\n{\n\tint type_num = arr->descr->type_num;\n\tint itemsize = arr->itemsize;\n int swap = !(PyArray_ISNOTSWAPPED(arr));\n\n\treturn PyArray_Scalar(data, type_num, itemsize, swap);\n}\n\n\n/* Return Python scalar if 0-d array object is encountered */\n\nstatic PyObject *\nPyArray_Return(PyArrayObject *mp) \n{\n \n\tif (mp == NULL) return NULL;\n\n if (PyErr_Occurred()) {\n Py_XDECREF(mp);\n return NULL;\n }\n\n\tif (PyArray_Check((PyObject *)mp) && mp->nd == 0) {\n\t\tPyObject *ret;\n\t\tret = PyArray_ToScalar(mp->data, mp);\n\t\tPy_DECREF(mp);\n\t\treturn ret;\n\t}\n\telse {\n\t\treturn (PyObject *)mp;\n\t}\n}\n\n/*\n returns typenum to associate with this type >=PyArray_USERDEF.\n Also creates a copy of the VOID_DESCR table inserting it's typeobject in\n and it's typenum in the appropriate place.\n \n needs the userdecrs table and PyArray_NUMUSER variables\n defined in arratypes.inc\n*/\nstatic int \nPyArray_RegisterDataType(PyTypeObject *type)\n{\n\tPyArray_Descr *descr;\n\tint typenum;\n\tint i;\n\t\n\tif ((type == &PyVoidArrType_Type) ||\t\t\t\\\n\t !PyType_IsSubtype(type, &PyVoidArrType_Type)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can only register void subtypes.\");\n\t\treturn -1;\n\t}\n\t/* See if this type is already registered */\n\tfor (i=0; itypeobj == type)\n\t\t\treturn descr->type_num;\n\t}\n\tdescr = malloc(sizeof(PyArray_Descr));\n\tmemcpy(descr, PyArray_DescrFromType(PyArray_VOID), \n\t sizeof(PyArray_Descr));\n\ttypenum = PyArray_USERDEF + PyArray_NUMUSERTYPES;\n\tdescr->type_num = typenum;\n\tdescr->typeobj = type;\n\tuserdescrs = realloc(userdescrs, \n\t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n\tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n\treturn typenum;\n}\n\n\n/* \n copyies over from the old descr table for anything\n NULL or zero in what is given. \n frees the copy of the Descr_table already there.\n places a pointer to the new one into the slot.\n*/\nstatic int\nPyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n{\n\tPyArray_Descr *old;\n\tint i;\n\n\tif (!PyArray_ISUSERDEF(typenum)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Data type not registered.\");\n\t\treturn -1;\n\t}\n\told = userdescrs[typenum-PyArray_USERDEF];\n\tdescr->typeobj = old->typeobj;\n\tdescr->type_num = typenum;\n\n#define _NULL_CHECK(member) \\\n\tif (descr->member == NULL) descr->member = old->member\n\n\tfor (i=0; imember == 0) descr->member = old->member\n\n\t_ZERO_CHECK(kind);\n\t_ZERO_CHECK(type);\n\t_ZERO_CHECK(elsize);\n\t_ZERO_CHECK(alignment);\n#undef _ZERO_CHECK\n\n\tfree(old);\n\tuserdescrs[typenum-PyArray_USERDEF] = descr;\n\treturn 0;\n}\n\n\nstatic int\nPyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) \n{\n intp size;\n intp n, n2;\n int n3, n4;\n PyArrayIterObject *it;\n PyObject *obj, *strobj, *tupobj;\n\n n3 = strlen((const char *)sep);\n if (n3 == 0) { /* binary data */\n if (PyArray_ISOBJECT(self)) {\n PyErr_SetString(PyExc_ValueError, \"Cannot write \"\\\n\t\t\t\t\t\"object arrays to a file in \"\\\n\t\t\t\t\t\"binary mode.\");\n return -1;\n }\n\n if (PyArray_ISCONTIGUOUS(self)) {\n size = PyArray_SIZE(self);\n if ((n=fwrite((const void *)self->data, \n (size_t) self->itemsize,\n (size_t) size, fp)) < size) {\n PyErr_Format(PyExc_ValueError, \n \"%ld requested and %ld written\",\n (long) size, (long) n);\n return -1;\n }\n }\n else {\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n while(it->index < it->size) {\n if (fwrite((const void *)it->dataptr, \n (size_t) self->itemsize,\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n \" %d to file\", it->index);\n Py_DECREF(it);\n return -1;\n }\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n } \n }\n else { /* text data */\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n\t\tn4 = strlen((const char *)format);\n while(it->index < it->size) {\n obj = self->descr->getitem(it->dataptr, self);\n if (obj == NULL) {Py_DECREF(it); return -1;}\n\t\t\tif (n4 == 0) { /* standard writing */\n\t\t\t\tstrobj = PyObject_Str(obj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n\t\t\telse { /* use format string */\n\t\t\t\ttupobj = PyTuple_New(1);\n\t\t\t\tif (tupobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t\tPyTuple_SET_ITEM(tupobj,0,obj);\n\t\t\t\tobj = PyString_FromString((const char *)format);\n\t\t\t\tif (obj == NULL) {Py_DECREF(tupobj); \n\t\t\t\t\tPy_DECREF(it); return -1;}\n\t\t\t\tstrobj = PyString_Format(obj, tupobj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tPy_DECREF(tupobj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n if ((n=fwrite(PyString_AS_STRING(strobj), \n 1, n2=PyString_GET_SIZE(strobj),\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n \" to file\", it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n }\n /* write separator for all but last one */\n if (it->index != it->size-1) \n fwrite(sep, 1, n3, fp);\n Py_DECREF(strobj);\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n return 0;\n}\n\nstatic PyObject *\nPyArray_ToList(PyArrayObject *self) \n{\n PyObject *lp;\n PyArrayObject *v;\n intp sz, i;\n\t\n if (!PyArray_Check(self)) return (PyObject *)self;\n\n if (self->nd == 0) \n\t\treturn self->descr->getitem(self->data,self);\n\t\n sz = self->dimensions[0];\n lp = PyList_New(sz);\n\t\n for (i=0; ind >= self->nd) {\n\t\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\t\"array_item not returning smaller\" \\\n\t\t\t\t\t\" dimensional array\");\n\t\t\tPy_DECREF(lp);\n\t\t\treturn NULL;\n\t\t}\n PyList_SetItem(lp, i, PyArray_ToList(v));\n\t\tPy_DECREF(v);\n }\n\t\n return lp;\n}\n\nstatic PyObject *\nPyArray_ToString(PyArrayObject *self)\n{\n intp numbytes;\n intp index;\n char *dptr;\n int elsize;\n PyObject *ret;\n PyArrayIterObject *it;\n \n if (PyArray_TYPE(self) == PyArray_OBJECT) {\n PyErr_SetString(PyExc_ValueError, \"a string for the data\"\\\n\t\t\t\t\"in an object array is not appropriate.\");\n return NULL;\n }\n\n numbytes = PyArray_NBYTES(self);\n if (PyArray_ISONESEGMENT(self)) {\n ret = PyString_FromStringAndSize(self->data, (int) numbytes);\n }\n else {\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it==NULL) return NULL;\n ret = PyString_FromStringAndSize(NULL, (int) numbytes);\n if (ret == NULL) {Py_DECREF(it); return NULL;}\n dptr = PyString_AS_STRING(ret);\n index = it->size;\n elsize = self->itemsize;\n while(index--) {\n memcpy(dptr, it->dataptr, elsize);\n dptr += elsize;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n\treturn ret;\n}\n\n\n/*********************** end C-API functions **********************/\n\n\n/* array object functions */\n\nstatic void \narray_dealloc(PyArrayObject *self) {\n\n if (self->weakreflist != NULL)\n PyObject_ClearWeakRefs((PyObject *)self);\n\n if(self->base) {\n\t\t/* UPDATEIFCOPY means that base points to an \n\t\t array that should be updated with the contents\n\t\t of this array upon destruction.\n self->base->flags must have been WRITEABLE \n (checked previously) and it was locked here\n thus, unlock it.\n\t\t*/\n\t\tif (self->flags & UPDATEIFCOPY) {\n ((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tPy_INCREF(self); /* hold on to self in next call */\n PyArray_CopyInto((PyArrayObject *)self->base, self);\n\t\t\t/* Don't need to DECREF -- because we are deleting\n\t\t\t self already... */\n\t\t}\n\t\t/* In any case base is pointing to something that we need\n\t\t to DECREF -- either a view or a buffer object */\n Py_DECREF(self->base);\n }\n \n if ((self->flags & OWN_DATA) && (self->data != NULL)) {\n\t\t/* Free internal references if an Object array */\n\t\tPyArray_XDECREF(self);\n\n PyDataMem_FREE(self->data);\n }\n\t\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t}\n\t\n self->ob_type->tp_free((PyObject *)self);\n}\n\n/*************************************************************************\n **************** Implement Mapping Protocol ***************************\n *************************************************************************/\n\nstatic int \narray_length(PyArrayObject *self) \n{\n if (self->nd != 0) {\n return self->dimensions[0];\n } else {\n\t\tPyErr_SetString(PyExc_TypeError, \"len() of unsized object.\");\n\t\treturn -1;\n }\n}\n\n\nstatic PyObject *\narray_item(PyArrayObject *self, int i) \n{\n char *item;\n PyArrayObject *r;\n\n\n\tif(self->nd == 0) {\n\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\"0-d arrays can't be indexed.\");\n\t\treturn NULL;\n\t}\n if ((item = index2ptr(self, i)) == NULL) return NULL;\n\n\tr = (PyArrayObject *)PyArray_New(self->ob_type, \n\t\t\t\t\t self->nd-1, self->dimensions+1, \n\t\t\t\t\t self->descr->type_num, \n\t\t\t\t\t self->strides+1, item, \n\t\t\t\t\t self->itemsize, self->flags,\n\t\t\t\t\t self);\n\tif (r == NULL) return NULL;\n\tPy_INCREF(self);\n\tr->base = (PyObject *)self;\n PyArray_UpdateFlags(r, CONTIGUOUS | FORTRAN);\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_item_nice(PyArrayObject *self, int i) \n{\n\treturn PyArray_Return((PyArrayObject *)array_item(self, i));\n}\n\n\nstatic int \narray_ass_item(PyArrayObject *self, int i, PyObject *v) \n{\n PyArrayObject *tmp;\n char *item;\n int ret;\n\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n if (i < 0) i = i+self->dimensions[0];\n\n if (self->nd > 1) {\n if((tmp = (PyArrayObject *)array_item(self, i)) == NULL)\n return -1;\n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n return ret; \n }\n\t\n if ((item = index2ptr(self, i)) == NULL) return -1;\n if (self->descr->setitem(v, item, self) == -1) return -1;\n return 0;\n}\n\n/* -------------------------------------------------------------- */\nstatic int\nslice_coerce_index(PyObject *o, int *v)\n{\n\t*v = PyArray_PyIntAsInt(o);\n\tif (error_converting(*v)) {\n\t\tPyErr_Clear();\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\n/* This is basically PySlice_GetIndicesEx, but with our coercion\n * of indices to integers (plus, that function is new in Python 2.3) */\nstatic int\nslice_GetIndices(PySliceObject *r, int length,\n int *start, int *stop, int *step,\n intp *slicelength)\n{\n\tint defstart, defstop;\n\t\n\tif (r->step == Py_None) {\n\t\t*step = 1;\n\t} else {\n\t\tif (!slice_coerce_index(r->step, step)) return -1;\n\t\tif (*step == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"slice step can not be zero\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tdefstart = *step < 0 ? length - 1 : 0;\n\tdefstop = *step < 0 ? -1 : length;\n\t\n\tif (r->start == Py_None) {\n\t\t*start = *step < 0 ? length-1 : 0;\n\t} else {\n\t\tif (!slice_coerce_index(r->start, start)) return -1;\n\t\tif (*start < 0) *start += length;\n\t\tif (*start < 0) *start = (*step < 0) ? -1 : 0;\n\t\tif (*start >= length) {\n\t\t\t*start = (*step < 0) ? length - 1 : length;\n\t\t}\n\t}\n\t\n\tif (r->stop == Py_None) {\n\t\t*stop = defstop;\n\t} else {\n\t\tif (!slice_coerce_index(r->stop, stop)) return -1;\n\t\tif (*stop < 0) *stop += length;\n if (*stop < 0) *stop = -1;\n if (*stop > length) *stop = length;\n\t}\n\t\n\tif ((*step < 0 && *stop >= *start) || \\\n\t (*step > 0 && *start >= *stop)) {\n\t\t*slicelength = 0;\n\t} else if (*step < 0) {\n\t\t*slicelength = (*stop - *start + 1) / (*step) + 1;\n\t} else {\n\t\t*slicelength = (*stop - *start - 1) / (*step) + 1;\n\t}\n\t\n\treturn 0;\n}\n\n#define PseudoIndex -1\n#define RubberIndex -2\n#define SingleIndex -3\n\nstatic int\nparse_subindex(PyObject *op, int *step_size, intp *n_steps, int max)\n{\n\tint index;\n\t\n\tif (op == Py_None) {\n\t\t*n_steps = PseudoIndex;\n\t\tindex = 0;\n\t} else if (op == Py_Ellipsis) {\n\t\t*n_steps = RubberIndex;\n\t\tindex = 0;\n\t} else if (PySlice_Check(op)) {\n\t\tint stop;\n\t\tif (slice_GetIndices((PySliceObject *)op, max,\n\t\t\t\t &index, &stop, step_size, n_steps) < 0) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"invalid slice\");\n\t\t\t}\n\t\t\tgoto fail;\n\t\t}\n\t\tif (*n_steps <= 0) {\n\t\t\t*n_steps = 0;\n\t\t\t*step_size = 1;\n\t\t\tindex = 0;\n\t\t}\n\t} else {\n\t\tindex = PyArray_PyIntAsInt(op);\n\t\tif (error_converting(index)) {\n\t\t\tPyErr_SetString(PyExc_IndexError,\n\t\t\t\t\t\"each subindex must be either a \"\\\n\t\t\t\t\t\"slice, an integer, Ellipsis, or \"\\\n\t\t\t\t\t\"newaxis\");\n\t\t\tgoto fail;\n\t\t}\n\t\t*n_steps = SingleIndex;\n\t\t*step_size = 0;\n\t\tif (index < 0) index += max;\n\t\tif (index >= max || index < 0) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \"invalid index\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn index;\n fail:\n\treturn -1;\n}\n\n\nstatic int \nparse_index(PyArrayObject *self, PyObject *op, \n intp *dimensions, intp *strides, intp *offset_ptr)\n{\n int i, j, n;\n int nd_old, nd_new, start, offset, n_add, n_pseudo;\n int step_size;\n\tintp n_steps;\n PyObject *op1=NULL;\n int is_slice;\n\n\n if (PySlice_Check(op) || op == Py_Ellipsis || op == Py_None) {\n n = 1;\n op1 = op;\n Py_INCREF(op);\t\n /* this relies on the fact that n==1 for loop below */\n is_slice = 1;\n }\n else {\n if (!PySequence_Check(op)) {\n PyErr_SetString(PyExc_IndexError, \n \"index must be either an int \"\\\n \"or a sequence\");\n return -1;\n }\n n = PySequence_Length(op);\n is_slice = 0;\n }\n\t\n nd_old = nd_new = 0;\n\t\n offset = 0;\n for(i=0; ind ? \\\n self->dimensions[nd_old] : 0);\n Py_DECREF(op1);\n if (start == -1) break;\n\t\t\n if (n_steps == PseudoIndex) {\n dimensions[nd_new] = 1; strides[nd_new] = 0; nd_new++;\n } else {\n if (n_steps == RubberIndex) {\n for(j=i+1, n_pseudo=0; jnd-(n-i-n_pseudo-1+nd_old);\n if (n_add < 0) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = \\\n self->strides[nd_old];\n nd_new++; nd_old++;\n }\n } else {\n if (nd_old >= self->nd) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n offset += self->strides[nd_old]*start;\n nd_old++;\n if (n_steps != SingleIndex) {\n dimensions[nd_new] = n_steps;\n strides[nd_new] = step_size * \\\n self->strides[nd_old-1];\n nd_new++;\n }\n }\n }\n }\n if (i < n) return -1;\n n_add = self->nd-nd_old;\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = self->strides[nd_old];\n nd_new++; nd_old++;\n }\t \n *offset_ptr = offset;\n return nd_new;\n}\n\nstatic void\n_swap_axes(PyArrayMapIterObject *mit, PyArrayObject **ret)\n{\n\tPyObject *new, *tup;\n\tint n1, n2, n3, val;\n\tint i;\n\n\ttup = PyTuple_New(mit->nd);\n\t/* tuple for transpose is \n\t (n1,..,n1+n2-1,0,..,n1-1,n1+n2,...,n3-1)\n\t n1 is the number of dimensions of \n\t the broadcasted index array \n\t n2 is the number of dimensions skipped at the\n\t start\n\t n3 is the number of dimensions of the \n\t result \n\t*/\n\tn1 = mit->iters[0]->nd_m1 + 1;\n\tn2 = mit->iteraxes[0];\n\tn3 = mit->nd;\n\tval = n1;\n\ti = 0;\n\twhile(val < n1+n2) \n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = 0;\n\twhile(val < n1)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = n1+n2;\n\twhile(val < n3)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\n\tnew = PyArray_Transpose(*ret, tup);\n\tPy_DECREF(tup);\n\tPy_DECREF(*ret);\n\t*ret = (PyArrayObject *)new;\n}\n\n\n\nstatic PyObject *\nPyArray_GetMap(PyArrayMapIterObject *mit)\n{\n\n\tPyArrayObject *ret, *temp;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\t/* Unbound map iterator --- Bind should have been called */\n\tif (mit->ait == NULL) return NULL;\n\n\t/* This relies on the map iterator object telling us the shape\n\t of the new array in nd and dimensions.\n\t*/\n\ttemp = mit->ait->ao;\n\tret = (PyArrayObject *)\\\n\t\tPyArray_New(temp->ob_type, mit->nd, mit->dimensions, \n\t\t\t temp->descr->type_num, NULL, NULL, \n\t\t\t temp->itemsize, \n\t\t\t PyArray_ISFORTRAN(temp),\n\t\t\t temp);\n\tif (ret == NULL) return NULL;\n\n\t/* Now just iterate through the new array filling it in\n\t with the next object from the original array as\n\t defined by the mapping iterator */\n\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ret)) \n\t == NULL) \n\t\treturn NULL;\n\tindex = it->size;\n\tswap = ((temp->flags & NOTSWAPPED) != (ret->flags & NOTSWAPPED));\n copyswap = ret->descr->copyswap;\n\tPyArray_MapIterReset(mit);\n\twhile (index--) {\n copyswap(it->dataptr, mit->dataptr, swap, ret->itemsize);\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\t\n\t/* check for consecutive axes */\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, &ret);\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\nstatic int\nPyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)\n{\n\tPyObject *arr=NULL;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n\tPyArray_Typecode typecode = {0, 0, 0};\n PyArray_CopySwapFunc *copyswap;\n\n\t/* Unbound Map Iterator */\n\tif (mit->ait == NULL) return -1;\n\n\ttypecode.type_num = mit->ait->ao->descr->type_num;\n\ttypecode.itemsize = mit->ait->ao->itemsize;\n\n\tarr = PyArray_FromAny(op, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, (PyArrayObject **)&arr);\n\t\t}\n\t}\n\t\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) \n\t\treturn -1;\n\n\tindex = mit->size;\n\tswap = ((mit->ait->ao->flags & NOTSWAPPED) != \\\n\t\t(PyArray_FLAGS(arr) & NOTSWAPPED));\n\n copyswap = PyArray_DESCR(arr)->copyswap;\n\tPyArray_MapIterReset(mit);\n /* Need to decref OBJECT arrays */\n if (PyTypeNum_ISOBJECT(typecode.type_num)) {\n while (index--) {\n Py_XDECREF(*((PyObject **)mit->dataptr));\n Py_INCREF(*((PyObject **)it->dataptr));\n memmove(mit->dataptr, it->dataptr, sizeof(PyObject *));\n copyswap(mit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_MapIterNext(mit);\n PyArray_ITER_NEXT(it);\n if (it->index == it->size)\n PyArray_ITER_RESET(it);\n }\n return 0;\n }\n\n\twhile(index--) {\n\t\tmemmove(mit->dataptr, it->dataptr, PyArray_ITEMSIZE(arr));\n copyswap(mit->dataptr, NULL, swap, PyArray_ITEMSIZE(arr));\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t\tif (it->index == it->size)\n\t\t\tPyArray_ITER_RESET(it);\n\t}\t\t\n\treturn 0;\n}\n\n/* Called when treating array object like a mapping -- called first from \n Python when using a[object] unless object is a standard slice object\n (not an extended one). \n\n*/\n\n/* There are two situations: \n\n 1 - the subscript is a standard view and a reference to the \n array can be returned\n\n 2 - the subscript uses Boolean masks or integer indexing and\n therefore a new array is created and returned. \n\n*/\n\n/* Always returns 0-dimensional arrays */\n\nstatic PyObject *\narray_subscript(PyArrayObject *self, PyObject *op) \n{\n intp dimensions[MAX_DIMS], strides[MAX_DIMS];\n\tintp offset;\n int nd, i;\n PyArrayObject *other;\n\tPyArrayMapIterObject *mit;\n\n if (PyArray_IsScalar(op, Integer) || PyInt_Check(op) || \\\n PyLong_Check(op)) {\n intp value;\n value = PyArray_PyIntAsIntp(op);\n if (PyErr_Occurred())\n PyErr_Clear();\n else if (value >= 0) {\n if (value <= MAX_INT)\n return array_item(self, (int) value);\n }\n else if (value < 0) {\n if (value >= -MAX_INT) {\n if (self->nd > 0) value += self->dimensions[0];\n return array_item(self, (int) value);\n }\n }\n }\n\n\tif (PyArrayMapIter_Check(op)) {\n\t\tmit = (PyArrayMapIterObject *)op;\n\t\t/* bind to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\n\t\t/* If the mapiterator was created with standard indexing\n\t\t behavior, fall through to view-based code */\n\t\tif (!mit->view) return PyArray_GetMap(mit);\n\t\top = mit->indexobj;\n\t}\n\telse { /* wrap arguments into a mapiter object */\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(op);\n\t\tif (mit == NULL) return NULL;\n\t\tif (!mit->view) { /* fancy indexing */\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tother = (PyArrayObject *)PyArray_GetMap(mit);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn (PyObject *)other;\n\t\t}\n\t\tPy_DECREF(mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(op);\n\tif (!error_converting(i)) {\n\t\tif (i < 0 && self->nd > 0) i = i+self->dimensions[0];\n\t\treturn array_item(self, i);\n\t}\n\tPyErr_Clear();\n\n\t/* Standard (view-based) Indexing */\n if ((nd = parse_index(self, op, dimensions, strides, &offset)) \n == -1) \n return NULL;\n\n\t/* This will only work if new array will be a view */\n\tif ((other = (PyArrayObject *)\t\t\t\t\t\\\n\t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n\t\t\t strides, self->data+offset, \n\t\t\t self->itemsize, self->flags,\n\t\t\t self)) == NULL) \n\t\treturn NULL;\n\n\n\tother->base = (PyObject *)self;\n\tPy_INCREF(self);\n\t\n\tPyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);\n\t\n\treturn (PyObject *)other;\n}\n\n\n/* Another assignment hacked by using CopyObject. */\n\n/* This only works if subscript returns a standard view. */\n\n/* Again there are two cases. In the first case, PyArray_CopyObject\n can be used. In the second case, a new indexing function has to be \n used.\n*/\n\nstatic int \narray_ass_sub(PyArrayObject *self, PyObject *index, PyObject *op) \n{\n int ret, i;\n PyArrayObject *tmp;\n\tPyArrayMapIterObject *mit;\n\t\n if (op == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n\tif (PyArrayMapIter_Check(index)) {\n\t\tmit = (PyArrayMapIterObject *)index;\n\t\t/* bind behavior to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\t\n\t\t/* fall through if standard view-based map iterator */\n\t\tif (!mit->view) return PyArray_SetMap(mit, op);\n\t\tindex = mit->indexobj;\n\t}\n\telse {\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(index);\n\t\tif (mit == NULL) return -1;\n\t\tif (!mit->view) {\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tret = PyArray_SetMap(mit, op);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn ret;\n\t\t}\n\t\tPy_DECREF((PyObject*)mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(index);\n\tif (!error_converting(i)) {\n\t\treturn array_ass_item(self, i, op);\n\t}\n\tPyErr_Clear();\n\t\n\t/* Rest of standard (view-based) indexing */\n\n if ((tmp = (PyArrayObject *)array_subscript(self, index)) == NULL)\n return -1; \n ret = PyArray_CopyObject(tmp, op);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\n/* There are places that require that array_subscript return a PyArrayObject\n and not possibly a scalar. Thus, this is the function exposed to \n Python so that 0-dim arrays are passed as scalars\n*/\n\nstatic PyObject *\narray_subscript_nice(PyArrayObject *self, PyObject *op) \n{\n\treturn PyArray_Return((PyArrayObject *)array_subscript(self, op));\n}\n\n\nstatic PyMappingMethods array_as_mapping = {\n (inquiry)array_length,\t\t /*mp_length*/\n (binaryfunc)array_subscript_nice,\t/*mp_subscript*/\n (objobjargproc)array_ass_sub,\t /*mp_ass_subscript*/\n};\n\n/****************** End of Mapping Protocol ******************************/\n\n\n/*************************************************************************\n **************** Implement Buffer Protocol ****************************\n *************************************************************************/\n\n/* removed multiple segment interface */\n\nstatic int \narray_getsegcount(PyArrayObject *self, int *lenp) \n{\n if (lenp)\n *lenp = PyArray_NBYTES(self);\n\n if (PyArray_ISONESEGMENT(self)) {\n return 1;\n }\n\n if (lenp)\n *lenp = 0;\n return 0;\n}\n\nstatic int \narray_getreadbuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (segment != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Accessing non-existing array segment\");\n return -1;\n }\n \n if (PyArray_ISONESEGMENT(self)) {\n *ptrptr = self->data;\n return PyArray_NBYTES(self);\n }\n PyErr_SetString(PyExc_ValueError, \"Array is not a single segment\");\n *ptrptr = NULL;\n return -1;\n}\n\n\nstatic int \narray_getwritebuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (PyArray_CHKFLAGS(self, WRITEABLE)) \n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_ValueError, \"Array cannot be \"\\\n \"accessed as a writeable buffer.\");\n return -1;\n }\n}\n\nstatic int \narray_getcharbuf(PyArrayObject *self, int segment, const char **ptrptr) \n{\n if (self->descr->type_num == PyArray_STRING || \\\n\t self->descr->type_num == PyArray_UNICODE)\n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_TypeError, \n \"Non-character array cannot be interpreted \"\\\n \"as character buffer.\");\n return -1;\n }\n}\n\nstatic PyBufferProcs array_as_buffer = {\n (getreadbufferproc)array_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)array_getwritebuf, /*bf_getwritebuffer*/\n (getsegcountproc)array_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)array_getcharbuf, /*bf_getcharbuffer*/\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Number Protocol ****************************\n *************************************************************************/\n\n\ntypedef struct {\n PyObject *add,\n *subtract,\n *multiply,\n *divide,\n *remainder,\n *power,\n\t\t*sqrt,\n *negative,\n *absolute,\n *invert,\n *left_shift,\n *right_shift,\n *bitwise_and,\n *bitwise_xor,\n *bitwise_or,\n *less,\n *less_equal,\n *equal,\n *not_equal,\n *greater,\n *greater_equal,\n *floor_divide,\n *TRUE_divide,\n\t\t*logical_or,\n\t\t*logical_and,\n\t\t*floor,\n\t\t*ceil,\n\t\t*maximum,\n\t\t*minimum;\t\n\t\n} NumericOps;\n\nstatic NumericOps n_ops = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL};\n\n/* Dictionary can contain any of the numeric operations, by name. \n Those not present will not be changed\n */\n\n#define SET(op) temp=PyDict_GetItemString(dict, #op);\t\\\n\tif (temp != NULL) {\t\t\t\t\\\n\t\tif (!(PyCallable_Check(temp))) return -1; \\\n Py_XDECREF(n_ops.op); \\\n\t\tn_ops.op = temp; \\\n\t}\n\n \nint \nPyArray_SetNumericOps(PyObject *dict) \n{\n PyObject *temp = NULL;\n SET(add);\n SET(subtract);\n SET(multiply);\n SET(divide);\n SET(remainder);\n SET(power);\n\tSET(sqrt);\n SET(negative);\n SET(absolute);\n SET(invert);\n SET(left_shift);\n SET(right_shift);\n SET(bitwise_and);\n SET(bitwise_or);\n SET(bitwise_xor);\n SET(less);\t \n SET(less_equal);\n SET(equal);\n SET(not_equal);\n SET(greater);\n SET(greater_equal);\n SET(floor_divide);\t\n SET(TRUE_divide);\t\n\tSET(logical_or);\n\tSET(logical_and);\n\tSET(floor);\n\tSET(ceil);\n\tSET(maximum);\n\tSET(minimum);\n return 0;\n}\n\n#define GET(op) if (PyDict_SetItemString(dict, #op, n_ops.op)==-1) \\\n\t\tgoto fail;\n\nstatic PyObject *\nPyArray_GetNumericOps(void) \n{\n\tPyObject *dict;\n\tif ((dict = PyDict_New())==NULL) \n\t\treturn NULL;\t\n\tGET(add);\n GET(subtract);\n GET(multiply);\n GET(divide);\n GET(remainder);\n GET(power);\n\tGET(sqrt);\n GET(negative);\n GET(absolute);\n GET(invert);\n GET(left_shift);\n GET(right_shift);\n GET(bitwise_and);\n GET(bitwise_or);\n GET(bitwise_xor);\n GET(less);\t \n GET(less_equal);\n GET(equal);\n GET(not_equal);\n GET(greater);\n GET(greater_equal);\n GET(floor_divide); \n GET(TRUE_divide); \n\tGET(logical_or);\n\tGET(logical_and);\n\tGET(floor);\n\tGET(ceil);\n\tGET(maximum);\n\tGET(minimum);\n\treturn dict;\t\n\n fail:\n\tPy_DECREF(dict);\n\treturn NULL;\t\t\n}\n\nstatic PyObject *\nPyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"reduce\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"accumulate\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OO)\", m1, m2);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(O)\", m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericInplaceBinaryFunction(PyArrayObject *m1, \n\t\t\t\t PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OOO)\", m1, m2, m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\narray_add(PyArrayObject *m1, PyObject *m2) \n{ \n return PyArray_GenericBinaryFunction(m1, m2, n_ops.add); \n}\n\nstatic PyObject *\narray_subtract(PyArrayObject *m1, PyObject *m2) \n{\n\treturn PyArray_GenericBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_negative(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.negative);\n}\n\nstatic PyObject *\narray_absolute(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.absolute);\n}\n\nstatic PyObject *\narray_invert(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.invert);\n}\n\nstatic PyObject *\narray_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_inplace_add(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.add);\n}\n\nstatic PyObject *\narray_inplace_subtract(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_inplace_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_inplace_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_inplace_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_inplace_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_inplace_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_inplace_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_inplace_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_inplace_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_inplace_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.TRUE_divide);\n}\n\nstatic PyObject *\narray_inplace_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_inplace_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.TRUE_divide);\n}\n\n/* Array evaluates as \"TRUE\" if any of the elements are non-zero */\nstatic int \narray_all_nonzero(PyArrayObject *mp) \n{\n\tintp index;\n\tPyArrayIterObject *it;\n\tBool anyTRUE = 0;\n\t\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)mp);\n\tif (it==NULL) return anyTRUE;\n\tindex = it->size;\n\twhile(index--) {\n\t\tif (mp->descr->nonzero(it->dataptr, mp)) {\n\t\t\tanyTRUE = 1;\n\t\t\tbreak;\n\t\t}\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\treturn anyTRUE;\n}\n\nstatic PyObject *\narray_divmod(PyArrayObject *op1, PyObject *op2) \n{\n PyObject *divp, *modp, *result;\n\n divp = array_divide(op1, op2);\n if (divp == NULL) return NULL;\n modp = array_remainder(op1, op2);\n if (modp == NULL) {\n Py_DECREF(divp);\n return NULL;\n }\n result = Py_BuildValue(\"OO\", divp, modp);\n Py_DECREF(divp);\n Py_DECREF(modp);\n return result;\n}\n\n\nstatic PyObject *\narray_int(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can be\"\\\n\t\t\t\t\" converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_int == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to int\");\n Py_DECREF(pv);\n return NULL;\n }\n\n pv2 = pv->ob_type->tp_as_number->nb_int(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_float(PyArrayObject *v) \n{\n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an \"\\\n\t\t\t\t\"int, scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_float == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to float\");\n Py_DECREF(pv);\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_float(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_long(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_long == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to long\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_long(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_oct(PyArrayObject *v) \n{\t \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_oct == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to oct\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_oct(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_hex(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_hex == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to hex\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_hex(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\n_array_copy_nice(PyArrayObject *self)\n{\n\treturn PyArray_Return((PyArrayObject *)\t\t\\\n\t\t\t PyArray_Copy(self));\n}\n\nstatic PyNumberMethods array_as_number = {\n (binaryfunc)array_add,\t\t /*nb_add*/\n (binaryfunc)array_subtract,\t\t /*nb_subtract*/\n (binaryfunc)array_multiply,\t\t /*nb_multiply*/\n (binaryfunc)array_divide,\t\t /*nb_divide*/\n (binaryfunc)array_remainder,\t /*nb_remainder*/\n (binaryfunc)array_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)array_power,\t\t /*nb_power*/\n (unaryfunc)array_negative, /*nb_neg*/\t\n (unaryfunc)_array_copy_nice,\t\t /*nb_pos*/ \n (unaryfunc)array_absolute,\t\t /*(unaryfunc)array_abs,*/\n (inquiry)array_all_nonzero,\t\t /*nb_nonzero*/\n (unaryfunc)array_invert,\t\t /*nb_invert*/\n (binaryfunc)array_left_shift,\t /*nb_lshift*/\n (binaryfunc)array_right_shift,\t /*nb_rshift*/\n (binaryfunc)array_bitwise_and,\t /*nb_and*/\n (binaryfunc)array_bitwise_xor,\t /*nb_xor*/\n (binaryfunc)array_bitwise_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)array_int,\t\t /*nb_int*/\n (unaryfunc)array_long,\t\t /*nb_long*/\n (unaryfunc)array_float,\t\t /*nb_float*/\n (unaryfunc)array_oct,\t\t /*nb_oct*/\n (unaryfunc)array_hex,\t\t /*nb_hex*/\n\n /*This code adds augmented assignment functionality*/\n /*that was made available in Python 2.0*/\n (binaryfunc)array_inplace_add,\t /*inplace_add*/\n (binaryfunc)array_inplace_subtract,\t /*inplace_subtract*/\n (binaryfunc)array_inplace_multiply,\t /*inplace_multiply*/\n (binaryfunc)array_inplace_divide,\t /*inplace_divide*/\n (binaryfunc)array_inplace_remainder, /*inplace_remainder*/\n (ternaryfunc)array_inplace_power,\t /*inplace_power*/\n (binaryfunc)array_inplace_left_shift, /*inplace_lshift*/\n (binaryfunc)array_inplace_right_shift, /*inplace_rshift*/\n (binaryfunc)array_inplace_bitwise_and, /*inplace_and*/\n (binaryfunc)array_inplace_bitwise_xor, /*inplace_xor*/\n (binaryfunc)array_inplace_bitwise_or, /*inplace_or*/\n\n (binaryfunc)array_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)array_TRUE_divide,\t /*nb_TRUE_divide*/\n (binaryfunc)array_inplace_floor_divide, /*nb_inplace_floor_divide*/\n (binaryfunc)array_inplace_TRUE_divide, /*nb_inplace_TRUE_divide*/\n\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Sequence Protocol **************************\n *************************************************************************/\n\n/* Some of this is repeated in the array_as_mapping protocol. But\n we fill it in here so that PySequence_XXXX calls work as expected \n*/\n\n\nstatic PyObject * \narray_slice(PyArrayObject *self, int ilow, int ihigh) \n{\n PyArrayObject *r;\n int l;\n char *data;\n\n if (self->nd == 0) {\n PyErr_SetString(PyExc_ValueError, \"can't slice a scalar\");\n return NULL;\n }\n \t\n l=self->dimensions[0];\n if (ihigh < 0) ihigh += l;\n if (ilow < 0) ilow += l;\n if (ilow < 0) ilow = 0;\n else if (ilow > l) ilow = l;\n if (ihigh < 0) ihigh = 0;\n else if (ihigh > l) ihigh = l;\n if (ihigh < ilow) ihigh = ilow;\n\n if (ihigh != ilow) {\n data = index2ptr(self, ilow);\n if (data == NULL) return NULL;\n } else {\n data = self->data;\n }\n\n self->dimensions[0] = ihigh-ilow;\n r = (PyArrayObject *)\\\n\t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n\t\t\t self->descr->type_num, self->strides, data,\n\t\t\t self->itemsize, self->flags, self);\n\n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n Py_INCREF(self);\n\tPyArray_UpdateFlags(r, UPDATE_ALL_FLAGS); \n return (PyObject *)r;\n}\n\n\nstatic int \narray_ass_slice(PyArrayObject *self, int ilow, int ihigh, PyObject *v) {\n int ret;\n PyArrayObject *tmp;\n\t\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n if ((tmp = (PyArrayObject *)array_slice(self, ilow, ihigh)) \\\n == NULL) \n return -1; \n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\nstatic int\narray_contains(PyArrayObject *self, PyObject *el)\n{\n /* equivalent to any(self == el) */\n\n return PyObject_RichCompareBool((PyObject *)self, el, Py_EQ);\n}\n\n\nstatic PySequenceMethods array_as_sequence = {\n (inquiry)array_length,\t\t/*sq_length*/\n (binaryfunc)NULL, /* sq_concat is handled by nb_add*/\n (intargfunc)NULL, /* sq_repeat is handled nb_multiply*/\n (intargfunc)array_item_nice,\t\t/*sq_item*/\n (intintargfunc)array_slice,\t\t/*sq_slice*/\n (intobjargproc)array_ass_item,\t/*sq_ass_item*/\n (intintobjargproc)array_ass_slice,\t/*sq_ass_slice*/\n\t(objobjproc) array_contains, /* sq_contains */\n\t(binaryfunc) NULL, /* sg_inplace_concat */\n\t(intargfunc) NULL /* sg_inplace_repeat */\n};\n\n\n/****************** End of Sequence Protocol ****************************/\n\n\nstatic int \ndump_data(char **string, int *n, int *max_n, char *data, int nd, \n intp *dimensions, intp *strides, PyArrayObject* self) \n{\n PyArray_Descr *descr=self->descr;\n PyObject *op, *sp;\n char *ostring;\n int i, N;\n\t\n#define CHECK_MEMORY if (*n >= *max_n-16) { *max_n *= 2; \\\n\t\t*string = (char *)realloc(*string, *max_n); }\n\t\n if (nd == 0) {\n\t\t\n if ((op = descr->getitem(data, self)) == NULL) return -1;\n sp = PyObject_Repr(op);\n if (sp == NULL) {Py_DECREF(op); return -1;}\n ostring = PyString_AsString(sp);\n N = PyString_Size(sp)*sizeof(char);\n *n += N;\n CHECK_MEMORY\n memmove(*string+(*n-N), ostring, N);\n Py_DECREF(sp);\n Py_DECREF(op);\n return 0;\n } else {\n CHECK_MEMORY\n (*string)[*n] = '[';\n *n += 1;\n for(i=0; idata, \n\t\t self->nd, self->dimensions, \n self->strides, self) < 0) { \n\t\tfree(string); return NULL; \n\t}\n\t\n\tif (PyArray_ISFLEXIBLE(self)) {\n\t\tchar buf[100];\n\t\tsnprintf(buf, sizeof(buf), \"%d\", self->itemsize);\n\t\tsprintf(string+n, \", '%c%s')\", self->descr->type, buf);\n\t\tret = PyString_FromStringAndSize(string, n+6+strlen(buf));\n\t}\n\telse {\n\t\tsprintf(string+n, \", '%c')\", self->descr->type);\n\t\tret = PyString_FromStringAndSize(string, n+6);\n\t}\n\t\n\n free(string);\n return ret;\n}\n\nstatic PyObject *PyArray_StrFunction=NULL;\nstatic PyObject *PyArray_ReprFunction=NULL;\n\nstatic void \nPyArray_SetStringFunction(PyObject *op, int repr) \n{\n if (repr) {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_ReprFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_ReprFunction = op; \n } else {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_StrFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_StrFunction = op; \n }\n}\n\nstatic PyObject *\narray_repr(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_ReprFunction == NULL) {\n s = array_repr_builtin(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_ReprFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\nstatic PyObject *\narray_str(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_StrFunction == NULL) {\n s = array_repr(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_StrFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\n\nstatic PyObject *\narray_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) \n{\n PyObject *array_other, *result;\n\n switch (cmp_op) \n {\n case Py_LT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less);\n case Py_LE:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less_equal);\n case Py_EQ:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then return the integer\n\t\t\t object 0. This fixes code that used to\n\t\t\t allow equality comparisons between arrays\n\t\t\t and other objects which would give a result\n\t\t\t of 0\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.equal);\n /* If the comparison results in NULL, then the \n\t\t\t two array objects can not be compared together so \n\t\t\t return zero \n */\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n return result;\n case Py_NE:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then objects cannot be \n\t\t\t compared and cannot be equal, therefore, \n\t\t\t return True;\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.not_equal);\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n return result;\n case Py_GT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.greater);\n case Py_GE:\n return PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t other, \n\t\t\t\t\t \t n_ops.greater_equal);\n }\n return NULL;\n}\n\nstatic PyObject *\n_check_axis(PyArrayObject *arr, int *axis, int flags)\n{\n\tPyObject *temp;\n\tint n = arr->nd;\n\n\tif ((*axis >= MAX_DIMS) || (n==0)) {\n\t\ttemp = PyArray_Ravel(arr,0);\n\t\t*axis = 0;\n\t\treturn temp;\n\t}\n\telse {\n\t\tif (flags) {\n\t\t\ttemp = PyArray_FromAny((PyObject *)arr, NULL, \n\t\t\t\t\t 0, 0, flags);\n\t\t\tif (temp == NULL) return NULL;\n\t\t}\n\t\telse {\n\t\t\tPy_INCREF(arr);\n\t\t\ttemp = (PyObject *)arr;\n\t\t}\n\t}\n\tif (*axis < 0) *axis += n;\n\tif ((*axis < 0) || (*axis >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"axis(=%d) out of bounds\", *axis);\n\t\tPy_DECREF(temp);\n\t\treturn NULL;\n\t}\n\treturn temp;\n}\n\n#include \"arraymethods.c\"\n\n/* Lifted from numarray */\nstatic PyObject *\nPyArray_IntTupleFromIntp(int len, intp *vals)\n{\n\tint i;\n PyObject *intTuple = PyTuple_New(len);\n if (!intTuple) goto fail;\n for(i=0; ind == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i = ap->nd-1; i >= 0; --i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int \n_IsFortranContiguous(PyArrayObject *ap) \n{\n\tint sd;\n\tint i;\n\t\n\tif (ap->nd == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i=0; i< ap->nd; ++i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int\n_IsAligned(PyArrayObject *ap) \n{\n\tint i, alignment, aligned=1;\n\tintp ptr;\n\tint type = ap->descr->type_num;\n\n\tif ((type == PyArray_STRING) || (type == PyArray_VOID))\n\t\treturn 1;\n\n\talignment = ap->descr->alignment;\n\n\tptr = (intp) ap->data;\n aligned = (ptr % alignment) == 0;\n for (i=0; i nd; i++)\n aligned &= ((ap->strides[i] % alignment) == 0);\n return aligned != 0;\n}\n\nstatic Bool\n_IsWriteable(PyArrayObject *ap)\n{\n\tPyObject *base=ap->base;\n\tPyBufferProcs *pb;\n\n\t/* If we own our own data, then no-problem */\n\tif ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;\n\n\t/* Get to the final base object \n\t If it is a writeable array, then return TRUE\n\t If we can find an array object \n\t or a writeable buffer object as the final base object\n\t or a string object (for pickling support memory savings).\n\t - this last could be removed if a proper pickleable \n\t buffer was added to Python.\n\t*/\n\n\twhile(PyArray_Check(base)) {\n\t\tif (PyArray_CHKFLAGS(base, OWN_DATA)) \n\t\t\treturn (Bool) (PyArray_ISWRITEABLE(base));\n\t\tbase = PyArray_BASE(base);\n\t}\n\n\t/* here so pickle support works seamlessly \n\t and unpickled array can be set and reset writeable \n\t -- could be abused -- */\n\tif PyString_Check(base) return TRUE;\n\n\tpb = base->ob_type->tp_as_buffer;\n\tif (pb == NULL || pb->bf_getwritebuffer == NULL)\n\t\treturn FALSE;\n\t\n\treturn TRUE;\n}\n\n\nstatic void\nPyArray_UpdateFlags(PyArrayObject *ret, int flagmask)\n{\n\n\tif (flagmask & FORTRAN) {\n\t\tif (_IsFortranContiguous(ret)) {\n\t\t\tret->flags |= FORTRAN;\n\t\t\tif (ret->nd > 1) ret->flags &= ~CONTIGUOUS;\n\t\t}\n\t\telse ret->flags &= ~FORTRAN;\n\t}\n\tif (flagmask & CONTIGUOUS) {\n\t\tif (_IsContiguous(ret)) {\n\t\t\tret->flags |= CONTIGUOUS;\n\t\t\tif (ret->nd > 1) ret->flags &= ~FORTRAN;\n\t\t}\n\t\telse ret->flags &= ~CONTIGUOUS;\n\t}\n\tif (flagmask & ALIGNED) {\n\t\tif (_IsAligned(ret)) ret->flags |= ALIGNED;\n\t\telse ret->flags &= ~ALIGNED;\n\t}\n\treturn;\n}\n\n/* This routine checks to see if newstrides (of length nd) will not \n walk outside of the memory implied by either numbytes or\n a single segment array of the provided dimensions and element size if\n numbytes is 0 */\nstatic Bool\nPyArray_CheckStrides(int elsize, int nd, intp numbytes, \n\t\t intp *dims, intp *newstrides)\n{\n\tint i;\n\t\n\tif (numbytes == 0) \n\t\tnumbytes = PyArray_MultiplyList(dims, nd) * elsize;\n\t\n\tfor (i=0; i numbytes) {\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\treturn TRUE;\n\t\n}\n\n\n/* This is the main array creation routine. */\n\n/* Flags argument has multiple related meanings \n depending on data and strides: \n\n If data is given, then flags is flags associated with data. \n If strides is not given, then a contiguous strides array will be created\n and the CONTIGUOUS bit will be set. If the flags argument \n has the FORTRAN bit set, then a FORTRAN-style strides array will be\n created (and of course the FORTRAN flag bit will be set). \n\n If data is not given but created here, then flags will be DEFAULT_FLAGS\n and a non-zero flags argument can be used to indicate a FORTRAN style\n array is desired. \n*/\n\nstatic intp\n_array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize, \n\t\t int inflag, int *objflags) \n{\n\tint i;\n\t/* Only make Fortran strides if not contiguous as well */\n\tif ((inflag & FORTRAN) && !(inflag & CONTIGUOUS)) {\n\t\tfor (i=0; i 1) *objflags &= ~CONTIGUOUS;\n\t\telse *objflags |= CONTIGUOUS;\n\t}\n\telse {\n\t\tfor (i=nd-1;i>=0;i--) {\n\t\t\tstrides[i] = itemsize;\n\t\t\titemsize *= dims[i] ? dims[i] : 1;\n\t\t}\n\t\t*objflags |= CONTIGUOUS;\n\t\tif (nd > 1) *objflags &= ~FORTRAN;\n\t\telse *objflags |= FORTRAN;\n\t}\n\treturn itemsize;\n}\n\n\t\nstatic PyObject *\nPyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n\t PyArrayObject *obj)\n{\n\tPyArrayObject *self;\n\tPyArray_Descr *descr;\n\tregister int i;\n\tintp sd, temp;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\tif (descr == NULL) return NULL;\n\n\tif (nd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"number of dimensions must be >=0\");\n\t\treturn NULL;\n\t}\n if (nd > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError,\n \"maximum number of dimensions is %d\", MAX_DIMS);\n return NULL;\n\t}\n\n\t/* Check dimensions */\n\tfor (i=nd-1;i>=0;i--) {\n\t\tif (dims[i] < 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"negative dimensions\"\t\\\n\t\t\t\t\t\" are not allowed.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tself = (PyArrayObject *) subtype->tp_alloc(subtype, 0);\n\tif (self == NULL) return NULL;\t\n\tself->descr = descr;\n\tself->dimensions = NULL;\n\tif (data == NULL) { /* strides is NULL too */\n\t\tself->flags = DEFAULT_FLAGS;\n\t\tif (flags) {\n\t\t\tself->flags |= FORTRAN; \n\t\t\tif (nd > 1) self->flags &= ~CONTIGUOUS;\n\t\t\tflags = FORTRAN;\n\t\t}\n\t}\n\telse self->flags = (flags & ~UPDATEIFCOPY);\n\t\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tif (itemsize < 1) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"Type must provide an itemsize.\");\n\t\t\tPyObject_Del(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tself->itemsize = itemsize;\n\t\t/* Guarantee that these kind of arrays are never byteswapped\n\t\t unknowingly. \n\t\t*/\n\t\tif (type_num != PyArray_UNICODE)\n\t\t\tself->flags |= NOTSWAPPED;\n\t}\n\telse self->itemsize = descr->elsize; \n\t\t\n\tsd = self->itemsize;\n\t\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dims, sizeof(intp)*nd);\n\t\tif (strides == NULL) { /* fill it in */\n\t\t\tsd = _array_fill_strides(self->strides, dims, nd, sd,\n\t\t\t\t\t\t flags, &(self->flags));\n\t\t}\n\t\telse {\n\t\t\tif (data == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"If strides is given in \" \\\n\t\t\t\t\t\t\"array creation, data must \" \\\n\t\t\t\t\t\t\"be given too.\");\n\t\t\t\tPyObject_Del(self);\n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\t\treturn NULL;\n\t\t\t}\t\t\t\t\t\n\t\t\tmemcpy(self->strides, strides, sizeof(intp)*nd);\n\t\t}\n\t}\n \t\n\t\t\n\tif (data == NULL) {\n\n\t\t/* Make sure we are aligned on void ptrs (without wasting\n\t\t space if we already are). But, also, allocate something \n\t\t even for zero-space arrays e.g. shape=(0,) -- otherwise\n buffer exposure (a.data) doesn't work as it should. */\n\n\t\tif (sd==0) sd = sizeof(intp);\n\t\telse if ((temp=sd%sizeof(intp))) sd += sizeof(intp) - temp;\n\n\t\tif ((data = PyDataMem_NEW(sd))==NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\tif (self->dimensions != NULL) \n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\n\t\t/* It is bad to have unitialized OBJECT pointers */\n\t\t/* We shouldn't need to check for the OBJECT Letter\n\t\t but perhaps it's best. */\n\t\tif (type_num == PyArray_OBJECT || \\\n\t\t type_num == PyArray_OBJECTLTR) {\n\t\t\tmemset(data, 0, sd);\n\t\t}\n\t}\n\telse {\n self->flags &= ~OWN_DATA; /* If data is passed in, \n\t\t\t\t\t this object won't own it \n\t\t\t\t\t by default.\n\t\t\t\t\t Caller must arrange for \n\t\t\t\t\t this to be reset if truly\n\t\t\t\t\t desired */\n }\n self->data = data;\n\tself->nd = nd;\n\tself->base = (PyObject *)NULL;\n self->weakreflist = (PyObject *)NULL;\n\n /* call the __array_finalize__\n\t method if a subtype and some object passed in */\n\tif ((obj != NULL) && (subtype != &PyArray_Type) && \n\t (subtype != &PyBigArray_Type)) {\n\t\tPyObject *res;\n\t\tres = PyObject_CallMethod((PyObject *)self, \n\t\t\t\t\t \"__array_finalize__\",\n\t\t\t\t\t \"O\", (PyObject *)obj);\n\t\tif (res == NULL) PyErr_Clear();\n\t\telse Py_DECREF(res);\n\t}\n\n\treturn (PyObject *)self;\n}\n\n\n\nstatic PyObject * \nPyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape)\n{\n intp oldsize, newsize;\n int new_nd=newshape->len, k, n, elsize;\n int refcnt;\n intp* new_dimensions=newshape->ptr;\n intp new_strides[MAX_DIMS];\n intp sd;\n intp *dimptr;\n char *new_data;\n\t\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n \"resize only works on contiguous arrays\");\n return NULL;\n }\n\n\n newsize = PyArray_MultiplyList(new_dimensions, new_nd);\n\n if (newsize == 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Newsize is zero. Cannot delete an array \"\\\n \"in this way.\");\n return NULL;\n }\n oldsize = PyArray_SIZE(self);\n \n\tif (oldsize != newsize) {\n\t\tif (!(self->flags & OWN_DATA)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize this array: \"\t\\\n\t\t\t\t\t\"it does not own its data.\");\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\trefcnt = (((PyObject *)self)->ob_refcnt);\n\t\tif ((refcnt > 2) || (self->base != NULL) || \\\n\t\t (self->weakreflist != NULL)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize an array that has \"\\\n\t\t\t\t\t\"been referenced or is referencing\\n\"\\\n\t\t\t\t\t\"another array in this way. Use the \"\\\n\t\t\t\t\t\"resize function.\");\n\t\t\treturn NULL;\n\t\t} \n\t\t\n\t\t/* Reallocate space if needed */\n\t\tnew_data = PyDataMem_RENEW(self->data, \n\t\t\t\t\t newsize*(self->itemsize));\n\t\tif (new_data == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n\t\t\t\t\t\"can't allocate memory for array.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tself->data = new_data;\n\t}\n \n if ((newsize > oldsize) && PyArray_ISWRITEABLE(self)) { \n\t\t/* Fill new memory with zeros */\n elsize = self->itemsize;\n\t\tif ((PyArray_TYPE(self) == PyArray_OBJECT)) {\n\t\t\tPyObject *zero = PyInt_FromLong(0);\n PyObject **optr;\n\t\t\toptr = ((PyObject **)self->data) + oldsize;\n\t\t\tn = newsize - oldsize;\n\t\t\tfor (k=0; kdata+oldsize*elsize, 0, \n\t\t\t (newsize-oldsize)*elsize);\n\t\t}\n\t}\n \n if (self->nd != new_nd) { /* Different number of dimensions. */\n self->nd = new_nd;\n \n /* Need new dimensions and strides arrays */\n dimptr = PyDimMem_RENEW(self->dimensions, 2*new_nd);\n if (dimptr == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n \"can't allocate memory for array \" \\\n \"(array may be corrupted).\");\n return NULL;\n }\n self->dimensions = dimptr;\n\t\tself->strides = dimptr + new_nd;\n }\n\n /* make new_strides variable */\n sd = (intp) self->itemsize;\n sd = _array_fill_strides(new_strides, new_dimensions, new_nd, sd,\n 0, &(self->flags));\n\n \n memmove(self->dimensions, new_dimensions, new_nd*sizeof(intp));\n memmove(self->strides, new_strides, new_nd*sizeof(intp));\n\n Py_INCREF(Py_None);\t\n return Py_None;\n \n}\n\n\nstatic void\nPyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj)\n{\n PyObject **optr;\n intp i,n;\n optr = (PyObject **)(arr->data);\n n = PyArray_SIZE(arr);\n if (obj == NULL) {\n for (i=0; ibase = buffer.base;\n Py_INCREF(buffer.base); \n }\n\n PyDimMem_FREE(dims.ptr);\n if (strides.ptr) PyDimMem_FREE(strides.ptr);\n return PyArray_Return(ret);\n \n fail:\n if (dims.ptr) free(dims.ptr);\n if (strides.ptr) free(strides.ptr);\n return NULL;\n}\n\n\n\n/******************* array attribute get and set routines ******************/\n\nstatic PyObject *\narray_ndim_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong(self->nd);\n}\n\nstatic PyObject *\narray_flags_get(PyArrayObject *self)\n{\n static PyObject *module=NULL;\n\n if (module==NULL) {\n module = PyImport_ImportModule(\"scipy.base._internal\");\n if (module == NULL) return NULL;\n }\n return PyObject_CallMethod(module, \"flagsobj\", \"Oi\", \n self, self->flags);\n}\n\n/*\nstatic int\narray_flags_set(PyArrayObject *self, PyObject *obj) \n{\n\tint flagback = self->flags;\n\n if (PyDict_Check(obj)) {\n PyObject *new;\n\t\tnew = PyDict_GetItemString(obj, \"ALIGNED\");\n\t\tif (new) {\n\t\t\tif (PyObject_Not(new)) self->flags &= ~ALIGNED;\n\t\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\t\telse {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"cannot set aligned flag of \" \\\n\t\t\t\t\t\t\"mis-aligned array to True\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n new = PyDict_GetItemString(obj, \"UPDATEIFCOPY\");\n if (new) {\n if (PyObject_Not(new)) {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n else {\n\t\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return -1;\n }\n }\n new = PyDict_GetItemString(obj, \"WRITEABLE\");\n if (new) {\n\t\t\tif (PyObject_IsTrue(new)) {\n\t\t\t\tif (_IsWriteable(self)) {\n\t\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself->flags = flagback;\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\t\"cannot set \"\t\\\n\t\t\t\t\t\t\t\"WRITEABLE \"\t\\\n\t\t\t\t\t\t\t\"flag to True of \"\\\n\t\t\t\t\t\t\t\"this array \");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n new = PyDict_GetItemString(obj, \"NOTSWAPPED\");\n if (new) {\n if (PyObject_IsTrue(new))\n self->flags |= NOTSWAPPED;\n else {\n self->flags &= ~NOTSWAPPED;\n\t\t\t}\n\t\t}\n return 0;\n }\n PyErr_SetString(PyExc_ValueError, \n \"Object must be a dictionary\");\n return -1;\n}\n*/\n\n\nstatic PyObject *\narray_shape_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->dimensions);\n}\n\n\nstatic int\narray_shape_set(PyArrayObject *self, PyObject *val)\n{\n \tint nd;\n\tPyObject *ret;\n\n\tif (!PyTuple_Check(val)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"shape must be a tuple\");\n\t\treturn -1;\n\t}\n\tret = PyArray_Reshape(self, val);\n\tif (ret == NULL) return -1;\n\t\n\tif (self->nd > 0) { /* Free old dimensions and strides */\n\t\tPyDimMem_FREE(self->dimensions);\n\t}\n\tnd = PyArray_NDIM(ret);\n\tself->nd = nd;\n\tif (nd > 0) { /* create new dimensions and strides */\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\tPyErr_SetString(PyExc_MemoryError,\"\");\n\t\t\treturn -1;\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, PyArray_DIMS(ret), \n\t\t nd*sizeof(intp));\n\t\tmemcpy(self->strides, PyArray_STRIDES(ret), \n\t\t nd*sizeof(intp));\n\t}\n\telse self->dimensions=NULL;\n\tPy_DECREF(ret);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_strides_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic int\narray_strides_set(PyArrayObject *self, PyObject *obj)\n{\n\tPyArray_Dims newstrides = {NULL, 0};\n\tPyArrayObject *new;\n\tintp numbytes;\n\n\tif (!PyArray_IntpConverter(obj, &newstrides) || \\\n\t newstrides.ptr == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"invalid strides.\");\n\t\treturn -1;\n\t}\n\tif (newstrides.len != self->nd) {\n\t\tPyErr_Format(PyExc_ValueError, \"strides must be \"\t\\\n\t\t\t \" same length as shape (%d)\", self->nd);\n\t\treturn -1;\n\t}\n\tnew = self;\n\twhile(new->base != NULL) {\n\t\tif (PyArray_Check(new->base)) \n\t\t\tnew = (PyArrayObject *)new->base;\n\t}\n\tnumbytes = PyArray_MultiplyList(new->dimensions, \n\t\t\t\t\tnew->nd)*new->itemsize;\n\t\n\tif (!PyArray_CheckStrides(self->itemsize, self->nd, numbytes, \n\t\t\t\t self->dimensions, newstrides.ptr)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"strides is not \"\\\n\t\t\t\t\"compatible with available memory\");\n\t\treturn -1;\n\t}\n\tmemcpy(self->strides, newstrides.ptr, sizeof(intp)*newstrides.len);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_protocol_strides_get(PyArrayObject *self)\n{\n\tif PyArray_ISCONTIGUOUS(self) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic PyObject *\narray_priority_get(PyArrayObject *self)\n{\n\tif (PyArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_PRIORITY);\n\telse if (PyBigArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_BIG_PRIORITY);\n\telse\n\t\treturn PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY);\n}\n\n\nstatic PyObject *\narray_data_get(PyArrayObject *self)\n{\n\tintp nbytes;\n\tif (!(PyArray_ISONESEGMENT(self))) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot get single-\"\\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn NULL;\n\t}\t\t\n\tnbytes = PyArray_NBYTES(self);\n\tif PyArray_ISWRITEABLE(self) \n\t\treturn PyBuffer_FromReadWriteObject((PyObject *)self, 0, \n\t\t\t\t\t\t (int) nbytes);\n\telse\n\t\treturn PyBuffer_FromObject((PyObject *)self, 0, (int) nbytes);\n}\n\nstatic int\narray_data_set(PyArrayObject *self, PyObject *op)\n{\n\tvoid *buf;\n\tint buf_len;\n\tint writeable=1;\n\n\tif (PyObject_AsWriteBuffer(op, &buf, &buf_len) < 0) {\n\t\twriteable = 0;\n\t\tif (PyObject_AsReadBuffer(op, (const void **)&buf, \n\t\t\t\t\t &buf_len) < 0) {\n\t\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\t\"Object does not have single-segment\" \\\n\t\t\t\t\t\"buffer interface\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif (!PyArray_ISONESEGMENT(self)) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot set single-\" \\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn -1;\n\t}\n\tif (PyArray_NBYTES(self) > buf_len) {\n\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\"Not enough data for array.\");\n\t\treturn -1;\n\t}\n\tif (self->flags & OWN_DATA) {\n\t\tPyArray_XDECREF(self);\n\t\tPyDataMem_FREE(self->data);\n\t}\n\tif (self->base) {\n\t\tif (self->flags & UPDATEIFCOPY) {\n\t\t\t((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tself->flags &= ~UPDATEIFCOPY;\n\t\t}\n\t\tPy_DECREF(self->base);\n\t}\n\tPy_INCREF(op);\n\tself->base = op;\n\tself->data = buf;\n\tself->flags = CARRAY_FLAGS;\n\tif (!writeable)\n\t\tself->flags &= ~WRITEABLE;\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_itemsize_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->itemsize);\n}\n\nstatic PyObject *\narray_size_get(PyArrayObject *self)\n{\n\tlonglong size=PyArray_SIZE(self);\n\tif (size > MAX_INT || size < MIN_INT)\n\t\treturn PyLong_FromLongLong((longlong) size);\n\telse \n\t\treturn PyInt_FromLong((long) size);\n}\n\n\nstatic PyObject *\narray_typechar_get(PyArrayObject *self)\n{\n\tif PyArray_ISFLEXIBLE(self) \n\t\treturn PyString_FromFormat(\"%c%d\", (self->descr->type),\n\t\t\t\t\t self->itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(self->descr->type), 1);\n}\n\nstatic PyObject *\narray_typestr_get(PyArrayObject *self)\n{\n\tstatic char endians[] = \"<>\";\n\tchar endian;\n\tint which;\n\tunsigned long val = 1;\n\tchar *s;\n\tchar basic_=self->descr->kind;\n\n\ts = (char *)&val; /* s[0] == 0 implies big-endian */\n\twhich = (PyArray_ISNOTSWAPPED(self) ? 0 : 1);\n\tif (s[0] == 0) which = 1 - which;\n\tendian = endians[which]; \n\t\n\tif ((basic_==PyArray_VOIDLTR) || (basic_==PyArray_STRINGLTR) || \\\n\t (basic_==PyArray_OBJECTLTR) || (self->itemsize == 1))\n\t\treturn PyString_FromFormat(\"|%c%d\", basic_, self->itemsize);\n\telse\n\t\treturn PyString_FromFormat(\"%c%c%d\", endian, basic_,\n\t\t\t\t\t self->itemsize);\n}\n\nstatic PyObject *\narray_descr_get(PyArrayObject *self)\n{\n\tPyObject *res;\n\tPyObject *dobj;\n\n\t/* hand this off to the typeobject */\n\t/* or give default */\n\tif (PyArray_ISUSERDEF(self)) {\n\t\tres = PyObject_GetAttrString((PyObject *)self->descr->typeobj, \n\t\t\t\t\t \"__array_descr__\");\n\t\tif (res) return res;\n\t\tPyErr_Clear();\n\t}\n\t/* get default */\n\tdobj = PyTuple_New(2);\n\tif (dobj == NULL) return NULL;\n\tPyTuple_SET_ITEM(dobj, 0, PyString_FromString(\"\"));\n\tPyTuple_SET_ITEM(dobj, 1, array_typestr_get(self));\n\tres = PyList_New(1);\n\tif (res == NULL) {Py_DECREF(dobj); return NULL;}\n\tPyList_SET_ITEM(res, 0, dobj);\n\treturn res;\n}\n\nstatic PyObject *\narray_typenum_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->descr->type_num);\n}\n\n\nstatic PyObject *\narray_type_get(PyArrayObject *self)\n{\n\treturn PyArray_TypeObjectFromType(self->descr->type_num);\n}\n\n/* If the type is changed. \n Also needing change: strides, itemsize\n\n Either itemsize is exactly the same\n or the array is single-segment (contiguous or fortran) with\n compatibile dimensions\n\n*/\n\nstatic int\narray_type_set(PyArrayObject *self, PyObject *arg)\n{\n PyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n intp newdim;\n int index;\n char *msg = \"new type not compatible with array.\";\n\n if ((PyArray_TypecodeConverter(arg, &newtype) < 0) ||\n newtype.type_num == PyArray_NOTYPE) {\n PyErr_SetString(PyExc_TypeError, \"Invalid type for array\");\n return -1;\n }\n if (!(PyArray_ISONESEGMENT(self) ||\t\t\\\n\t (newtype.itemsize != self->itemsize))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1; \n }\n\n\tif (PyArray_ISCONTIGUOUS(self)) index = self->nd - 1;\n\telse index = 0;\n\n if (newtype.itemsize < self->itemsize) {\n /* if it is compatible increase the size of the dimension\n at end (or at the front for FORTRAN)\n */\n if (self->itemsize % newtype.itemsize != 0) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n newdim = self->itemsize / newtype.itemsize;\n\t\tself->dimensions[index] *= newdim;\n self->strides[index] = newtype.itemsize;\n\t}\n \n else if (newtype.itemsize > self->itemsize) {\n \n /* Determine if last (or first if FORTRAN) dimension\n is compatible */\n\n\t\tnewdim = self->dimensions[index] * self->itemsize;\n if ((newdim % newtype.itemsize) != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n\t\t\n self->dimensions[index] = newdim / newtype.itemsize;\n self->strides[index] = newtype.itemsize;\n\t\t\n }\n\t\n \n /* fall through -- adjust type*/\n\n self->descr = PyArray_DescrFromType(newtype.type_num);\n self->itemsize = newtype.itemsize;\n PyArray_UpdateFlags(self, ALIGNED);\n return 0;\n\n}\n\n\n\nstatic PyObject *\narray_base_get(PyArrayObject *self)\n{\n\tif (self->base == NULL) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\telse {\n\t\tPy_INCREF(self->base);\n\t\treturn self->base;\n\t}\n}\n\n\nstatic PyObject *\narray_real_get(PyArrayObject *self)\n{\n\tPyArrayObject *ret;\n\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *)ret;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n}\n\n\nstatic int\narray_real_set(PyArrayObject *self, PyObject *val)\n{\n\tPyArrayObject *ret;\n\tPyArrayObject *new;\n\tint rint;\n\n\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0);\n\tif (new == NULL) return -1;\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) return -1;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\tret = self;\n\t}\t\n\trint = PyArray_CopyInto(ret, new);\n\tPy_DECREF(ret);\n\treturn rint;\n}\n\nstatic PyObject *\narray_imag_get(PyArrayObject *self)\n{\t\n\tPyArrayObject *ret;\n\tint itemsize;\n\tint typenum;\n PyArray_Typecode type = {self->descr->type_num, \n self->itemsize,\t \n PyArray_ISFORTRAN(self)};\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\titemsize = self->itemsize >> 1;\n\t\ttypenum = self->descr->type_num - PyArray_NUM_FLOATTYPE;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t typenum,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data + itemsize,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *) ret;\n\t}\n\telse {\n\t\tret = (PyArrayObject *)PyArray_Zeros(self->nd, \n\t\t\t\t\t\t self->dimensions, &type);\n\t\tret->flags &= ~WRITEABLE;\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic int\narray_imag_set(PyArrayObject *self, PyObject *val)\n{\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyArrayObject *ret;\n\t\tPyArrayObject *new;\n\t\tint rint;\n\n\t\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0); \n\t\tif (new == NULL) return -1;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides+ \\\n\t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) {\n\t\t\tPy_DECREF(new); \n\t\t\treturn -1;\n\t\t}\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\trint = PyArray_CopyInto(ret, new);\n\t\tPy_DECREF(ret);\t\t\n\t\tPy_DECREF(new);\n\t\treturn rint;\n\t}\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError, \"Does not have imaginary \" \\\n\t\t\t\t\"part to set.\");\n\t\treturn -1;\n\t}\n}\n\nstatic PyObject *\narray_flat_get(PyArrayObject *self)\n{\n return PyArray_IterNew((PyObject *)self);\n}\n\nstatic int \narray_flat_set(PyArrayObject *self, PyObject *val)\n{\n\tPyObject *arr=NULL;\n\tint retval = -1;\n\tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n\tPyArray_Typecode typecode = {self->descr->type_num,\n\t\t\t\t self->itemsize,\n\t\t\t\t PyArray_ISFORTRAN(self)};\n int swap;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tarr = PyArray_FromAny(val, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\tarrit = (PyArrayIterObject *)PyArray_IterNew(arr);\n\tif (arrit == NULL) goto exit;\n\tselfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (selfit == NULL) goto exit;\n\n swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);\n copyswap = self->descr->copyswap;\n if (PyArray_ISOBJECT(self)) {\n while(selfit->index < selfit->size) {\n Py_XDECREF(*((PyObject **)selfit->dataptr));\n Py_INCREF(*((PyObject **)arrit->dataptr)); \n memmove(selfit->dataptr, arrit->dataptr, \n sizeof(PyObject *));\n copyswap(selfit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_ITER_NEXT(selfit);\n PyArray_ITER_NEXT(arrit);\n if (arrit->index == arrit->size) \n PyArray_ITER_RESET(arrit);\n }\n retval = 0; \n goto exit;\n }\n\n\twhile(selfit->index < selfit->size) {\n\t\tmemmove(selfit->dataptr, arrit->dataptr, self->itemsize);\n copyswap(selfit->dataptr, NULL, swap, self->itemsize);\n\t\tPyArray_ITER_NEXT(selfit);\n\t\tPyArray_ITER_NEXT(arrit);\n\t\tif (arrit->index == arrit->size) \n\t\t\tPyArray_ITER_RESET(arrit);\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(selfit);\n\tPy_XDECREF(arrit);\n\tPy_XDECREF(arr);\n\treturn retval;\n}\n\nstatic PyGetSetDef array_getsetlist[] = {\n {\"ndim\", \n\t (getter)array_ndim_get, \n\t NULL, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)array_flags_get, \n NULL,\n\t \"special dictionary of flags\"},\n {\"shape\", \n\t (getter)array_shape_get, \n\t (setter)array_shape_set, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)array_strides_get, \n\t (setter)array_strides_set,\n\t \"tuple of bytes steps in each dimension\"},\n {\"data\", \n\t (getter)array_data_get, \n\t (setter)array_data_set, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)array_itemsize_get, \n\t NULL,\n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)array_size_get,\n\t NULL,\n \"number of elements in the array\"},\n\t{\"base\",\n\t (getter)array_base_get,\n\t NULL,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)array_type_get, \n\t (setter)array_type_set,\n\t \"get array type class\"},\n\t{\"dtypechar\",\n\t (getter)array_typechar_get,\n\t NULL,\n\t \"get array type character code\"},\n\t{\"dtypenum\",\n\t (getter)array_typenum_get,\n\t NULL,\n\t \"get array type number code\"},\n\t{\"dtypestr\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)array_real_get, \n\t (setter)array_real_set, \n\t \"real part of array\"},\n {\"imag\", \n\t (getter)array_imag_get, \n\t (setter)array_imag_set, \n\t \"imaginary part of array\"},\n\t{\"flat\", \n\t (getter)array_flat_get, \n\t (setter)array_flat_set, \n\t \"a 1-d view of a contiguous array\"}, \n\t{\"__array_data__\", \n\t (getter)array_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)array_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)array_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)array_protocol_strides_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t{\"__array_priority__\",\n\t (getter)array_priority_get,\n\t NULL,\n\t \"Array priority\"},\n \t{NULL, NULL, NULL, NULL}, /* Sentinel */\n};\n\n/****************** end of attribute get and set routines *******************/\n\n\n\nstatic char Arraytype__doc__[] = \n \"A array object represents a multidimensional, homogeneous array of basic values. It has the folowing data members, m.shape (the size of each dimension in the array), m.itemsize (the size (in bytes) of each element of the array), and m.typecode (a character representing the type of the array elements). Arrays are sequence, mapping and numeric objects. Sequence indexing is similar to lists, with single indices returning a reference that points to the old array data, and slices returning by copy. A array is also allowed to be indexed by a sequence of items.\t Each member of the sequence indexes the corresponding dimension of the array.\";\n\nstatic PyTypeObject PyBigArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.bigndarray\",\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n /* methods */\n (destructor)array_dealloc,\t\t /*tp_dealloc */\n (printfunc)NULL,\t\t\t /*tp_print*/\n 0,\t\t\t\t\t /*tp_getattr*/\n 0,\t\t\t\t\t /*tp_setattr*/\n (cmpfunc)0, \t\t /*tp_compare*/\n (reprfunc)array_repr,\t\t /*tp_repr*/\n &array_as_number,\t\t\t /*tp_as_number*/\n NULL, \t\t\t /*tp_as_sequence*/\n &array_as_mapping,\t\t\t /*tp_as_mapping*/\n (hashfunc)0,\t\t\t /*tp_hash*/\n (ternaryfunc)0,\t\t\t /*tp_call*/\n (reprfunc)array_str, \t /*tp_str*/\n\t\t\n (getattrofunc)0,\t\t\t /*tp_getattro*/\n (setattrofunc)0,\t\t\t /*tp_setattro*/\n NULL, \t /*tp_as_buffer*/\n (Py_TPFLAGS_DEFAULT \n | Py_TPFLAGS_BASETYPE\n | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/\n /*Documentation string */\n Arraytype__doc__,\t\t\t /*tp_doc*/\n\n (traverseproc)0,\t\t\t /*tp_traverse */\n (inquiry)0,\t\t\t /*tp_clear */\n (richcmpfunc)array_richcompare,\t \n offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */\n\n /* Iterator support (use standard) */\n\n (getiterfunc)0, \t\t /* tp_iter */\n (iternextfunc)0,\t\t\t /* tp_iternext */\n\n /* Sub-classing (new-style object) support */\n\n array_methods,\t\t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n array_getsetlist,\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0,\t /* tp_alloc */ \n (newfunc)array_new,\t\t /* tp_new */\n 0,\t \t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n};\n\n/* A standard array will subclass from the Big Array and \n add the array_as_sequence table\n and the array_as_buffer table\n */\n\nstatic PyTypeObject PyArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.ndarray\",\t\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n};\n\n\n/* The rest of this code is to build the right kind of array from a python */\n/* object. */\n\nstatic int \ndiscover_depth(PyObject *s, int max, int stop_at_string) \n{\n int d=0;\n PyObject *e;\n\t\n if(max < 1) return -1;\n\n if(! PySequence_Check(s) || PyInstance_Check(s) || \\\n\t PySequence_Length(s) < 0) {\n PyErr_Clear(); return 0;\n }\n if (PyArray_Check(s))\n\t\treturn PyArray_NDIM(s);\n if(PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))\n\t\treturn stop_at_string ? 0:1;\n if (PySequence_Length(s) == 0) \n\t\treturn 1;\n\t\n if ((e=PySequence_GetItem(s,0)) == NULL) return -1;\n if(e!=s) {\n\t\td=discover_depth(e,max-1, stop_at_string);\n\t\tif(d >= 0) d++;\n\t}\n Py_DECREF(e);\n return d;\n}\n\nstatic int\ndiscover_itemsize(PyObject *s, int nd, int *itemsize) \n{\n\tint n, r, i;\n\tPyObject *e;\n\t\n\tn = PyObject_Length(s);\n\n\tif ((nd == 0) || PyString_Check(s) ||\t\t\\\n\t PyUnicode_Check(s) || PyBuffer_Check(s)) {\n\t\tif PyUnicode_Check(s) \n\t\t\t*itemsize = MAX(*itemsize, sizeof(Py_UNICODE)*n);\n\t\telse\n\t\t\t*itemsize = MAX(*itemsize, n);\n\t\treturn 0;\n\t}\n\tfor (i=0; i n_lower) n_lower = d[1];\n }\n d[1] = n_lower;\n\t\n return 0;\n}\n\nstatic void\n_array_small_type(int chktype, int mintype, int chksize, int minsize, \n\t\t PyArray_Typecode *outtype)\n{\n\touttype->type_num = MAX(chktype, mintype);\n\tif (PyTypeNum_ISFLEXIBLE(outtype->type_num) &&\t\\\n\t PyTypeNum_ISFLEXIBLE(mintype)) {\n\t\t/* Handle string->unicode case separately \n\t\t because string itemsize is twice as large */\n\t\tif (outtype->type_num == PyArray_UNICODE && \n\t\t mintype == PyArray_STRING) {\n\t\t\touttype->itemsize = MAX(chksize, 2*minsize);\n\t\t}\n\t\telse {\n\t\t\touttype->itemsize = MAX(chksize, minsize);\n\t\t}\n\t}\n\telse {\n\t\touttype->itemsize = chksize;\n\t}\n\treturn;\t\n}\n\nstatic void\n_array_find_type(PyObject *op, PyArray_Typecode *minitype, \n\t\t PyArray_Typecode *outtype, int max)\n{\n int l;\n PyObject *ip;\n\tint chktype=0;\n\tint chksize=0;\n\tint mintype, minsize;\n\n\tif (minitype == NULL) {\n\t\tmintype = PyArray_BOOL;\n\t\tminsize = sizeof(Bool);\n\t}\n\telse {\n\t\tmintype = minitype->type_num;\n\t\tminsize = minitype->itemsize;\n\t}\n\n \n if (max < 0 || mintype == -1) goto deflt;\n\t\n if (PyArray_Check(op)) {\n\t\tchktype = PyArray_TYPE(op);\n\t\tchksize = PyArray_ITEMSIZE(op);\n\t\tgoto finish;\n\t}\n\t\n\tif (PyArray_IsScalar(op, Generic)) {\n\t\tPyArray_TypecodeFromScalar(op, outtype);\n\t\tchktype = outtype->type_num;\n\t\tchksize = outtype->itemsize;\n\t\tgoto finish;\n\t}\n\t\n\n if (PyObject_HasAttrString(op, \"__array__\")) {\n ip = PyObject_CallMethod(op, \"__array__\", NULL);\n if(ip && PyArray_Check(ip)) {\n\t\t\tchktype = PyArray_TYPE(ip);\n\t\t\tchksize = PyArray_ITEMSIZE(ip);\n\t\t\tgoto finish;\n\t\t}\n } \n\t\n\tif (PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tint swap=0, res;\n\t\tip = PyObject_GetAttrString(op, \"__array_typestr__\");\n\t\tif (ip && PyString_Check(ip)) {\n\t\t\tres = _array_typecode_fromstr(PyString_AS_STRING(ip), \n\t\t\t\t\t\t &swap, outtype); \n\t\t\tif (res >= 0) {\n\t\t\t\tPy_DECREF(ip);\n\t\t\t\tchktype = outtype->type_num;\n\t\t\t\tchksize = outtype->itemsize;\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t}\n\t\tPy_XDECREF(ip);\n\t}\n\n if (PyString_Check(op)) {\n\t\tchktype = PyArray_STRING;\n\t\tchksize = PyString_GET_SIZE(op);\n\t\tgoto finish;\n }\n\n\tif (PyUnicode_Check(op)) {\n\t\tchktype = PyArray_UNICODE;\n\t\tchksize = PyUnicode_GET_DATA_SIZE(op);\n\t\tgoto finish;\n\t}\n\n\tif (PyBuffer_Check(op)) {\n\t\tchktype = PyArray_VOID;\n\t\tchksize = op->ob_type->tp_as_sequence->sq_length(op);\n\t\tPyErr_Clear();\n\t\tgoto finish;\n\t}\n\n\tif (PyInstance_Check(op)) goto deflt;\n\t\n if (PySequence_Check(op)) {\n\t\tPyArray_Typecode newtype = {mintype, minsize, 0};\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n\t\t\tPyErr_Clear(); \n\t\t\tgoto deflt;\n\t\t}\n if (l == 0 && mintype == 0) {\n\t\t\tnewtype.type_num = PyArray_INTP;\n\t\t\tnewtype.itemsize = sizeof(intp);\n\t\t}\n while (--l >= 0) {\n ip = PySequence_GetItem(op, l);\n if (ip==NULL) {\n\t\t\t\tPyErr_Clear(); \n\t\t\t\tgoto deflt;\n\t\t\t}\n\t\t\t_array_find_type(ip, &newtype, outtype, max-1);\n\t\t\t_array_small_type(outtype->type_num,\n\t\t\t\t\t newtype.type_num, \n\t\t\t\t\t outtype->itemsize,\n\t\t\t\t\t newtype.itemsize,\n\t\t\t\t\t &newtype);\n Py_DECREF(ip);\n }\n\t\tchktype = newtype.type_num;\n\t\tchksize = newtype.itemsize;\n\t\tgoto finish;\n }\n\t\n\tif (PyBool_Check(op)) {\n\t\tchktype = PyArray_BOOL;\n\t\tchksize = sizeof(Bool);\n\t\tgoto finish;\t\t\n\t}\n else if (PyInt_Check(op)) {\n\t\tchktype = PyArray_LONG;\n\t\tchksize = sizeof(long);\n\t\tgoto finish;\n } else if (PyFloat_Check(op)) {\n\t\tchktype = PyArray_DOUBLE;\n\t\tchksize = sizeof(double);\n\t\tgoto finish;\n\t} else if (PyComplex_Check(op)) {\n\t\tchktype = PyArray_CDOUBLE;\n\t\tchksize = sizeof(cdouble);\n\t\tgoto finish;\n\t}\n\n deflt:\n\tchktype = PyArray_OBJECT;\n\tchksize = sizeof(void *);\n\n finish:\n\t_array_small_type(chktype, mintype, chksize, minsize, \n\t\t\t outtype);\n\treturn;\n}\n\nstatic int \nAssign_Array(PyArrayObject *self, PyObject *v) \n{\n PyObject *e;\n int l, r;\n\t\n if (!PySequence_Check(v)) {\n PyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"assignment from non-sequence\");\n return -1;\n }\n\t\n l=PyObject_Length(v);\n if(l < 0) return -1; \n\t\n while(--l >= 0)\n {\n e=PySequence_GetItem(v,l);\n if (e == NULL) return -1; \n\t\t\tr = PySequence_SetItem((PyObject*)self,l,e);\n Py_DECREF(e);\n if(r == -1) return -1;\n }\n return 0;\n}\n\n/* \"Array Scalars don't call this code\" */ \nstatic PyObject *\nArray_FromScalar(PyObject *op, PyArray_Typecode *typecode) \n{\n PyArrayObject *ret;\n\tint itemsize = 0;\n\tint type = typecode->type_num;\n\n\tif PyTypeNum_ISFLEXIBLE(type) {\n\t\titemsize = PyObject_Length(op);\n\t}\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,\n\t\t\t\t\t NULL, NULL, itemsize, 0, NULL);\n\n\tif (ret == NULL) return NULL;\n\n ret->descr->setitem(op, ret->data, ret);\n\t\n if (PyErr_Occurred()) {\n array_dealloc(ret);\n return NULL;\n } else {\n return (PyObject *)ret;\n }\n}\n\n\nstatic PyObject *\nArray_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth)\n{\n PyArrayObject *r;\n int nd;\n\tintp *d;\n\tint stop_at_string;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\t\n\t\n\tstop_at_string = ((type == PyArray_OBJECT) ||\t\\\n\t\t\t (type == PyArray_STRING) ||\t\\\n\t\t\t (type == PyArray_UNICODE) || \\\n\t\t\t (type == PyArray_VOID));\n\n if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string)) > 0)) {\n\t\tif (nd==0)\n\t\t\treturn Array_FromScalar(s, typecode);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid input sequence\");\n return NULL;\n }\n\t\n if ((max_depth && nd > max_depth) ||\t\\\n\t (min_depth && nd < min_depth)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of dimensions\");\n return NULL;\n }\n\t\n\tif ((d=PyDimMem_NEW(nd)) == NULL) {\n\t\treturn PyErr_NoMemory();\n }\n\tif(discover_dimensions(s,nd,d, !stop_at_string) == -1) {\n\t\tPyDimMem_FREE(d);\n\t\treturn NULL;\n\t}\n\tif (itemsize == 0 && PyTypeNum_ISFLEXIBLE(type)) {\n\t\tif (discover_itemsize(s, nd, &itemsize) == -1) {\n\t\t\tPyDimMem_FREE(d);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n r=(PyArrayObject*)PyArray_New(&PyArray_Type, nd, d, \n\t\t\t\t type, NULL, NULL,\n\t\t\t\t itemsize, \n\t\t\t\t typecode->fortran, NULL);\n\n PyDimMem_FREE(d);\n if(!r) return NULL;\n if(Assign_Array(r,s) == -1) {\n\t\tPy_DECREF(r);\n\t\treturn NULL;\n\t}\n return (PyObject*)r;\n}\n\n\nstatic int \nPyArray_ValidType(int type) \n{\n\tPyArray_Descr *descr;\n\t\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr==NULL) return 0;\n\treturn 1;\n}\n\n\n/* If the output is not a CARRAY, then it is buffered also */\n\nstatic int\n_bufferedcast(PyArrayObject *out, PyArrayObject *in)\n{\n\tchar *inbuffer, *bptr, *optr;\n\tchar *outbuffer=NULL;\n\tPyArrayIterObject *it_in=NULL, *it_out=NULL;\n\tregister intp i, index;\n\tintp ncopies = PyArray_SIZE(out) / PyArray_SIZE(in);\n\tint elsize=in->itemsize;\n\tint nels = PyArray_BUFSIZE;\n\tint el;\n\tint inswap, outswap=0;\n\tint obuf=!PyArray_ISCARRAY(out);\n\tint oelsize = out->itemsize;\n\tPyArray_VectorUnaryFunc *castfunc;\n PyArray_CopySwapFunc *in_csn;\n PyArray_CopySwapFunc *out_csn;\n\tint retval = -1;\n\n\tcastfunc = in->descr->cast[out->descr->type_num];\n in_csn = in->descr->copyswap;\n out_csn = out->descr->copyswap;\n\n\t/* If the input or output is STRING, UNICODE, or VOID */\n\t/* then getitem and setitem are used for the cast */\n\t/* and byteswapping is handled by those methods */\n\n\tinswap = !(PyArray_ISFLEXIBLE(in) || PyArray_ISNOTSWAPPED(in));\n\t\n\tinbuffer = PyDataMem_NEW(PyArray_BUFSIZE*elsize);\n\tif (inbuffer == NULL) return -1;\n\tit_in = (PyArrayIterObject *)PyArray_IterNew((PyObject *)in);\n\tif (it_in == NULL) goto exit;\n\n\tif (obuf) {\n\t\toutswap = !(PyArray_ISFLEXIBLE(out) || \\\n\t\t\t PyArray_ISNOTSWAPPED(out));\n\t\toutbuffer = PyDataMem_NEW(PyArray_BUFSIZE*oelsize);\n\t\tif (outbuffer == NULL) goto exit;\n\n\t\tit_out = (PyArrayIterObject *)PyArray_IterNew((PyObject *)out);\n\t\tif (it_out == NULL) goto exit;\n\n\t\tnels = MIN(nels, PyArray_BUFSIZE);\n\t}\n\t\n\toptr = (obuf) ? outbuffer: out->data;\n\tbptr = inbuffer;\n\tel = 0;\t\n\twhile(ncopies--) {\n\t\tindex = it_in->size;\n\t\tPyArray_ITER_RESET(it_in);\n\t\twhile(index--) {\n in_csn(bptr, it_in->dataptr, inswap, elsize);\n\t\t\tbptr += elsize;\n\t\t\tPyArray_ITER_NEXT(it_in);\n\t\t\tel += 1;\n\t\t\tif ((el == nels) || (index == 0)) {\n\t\t\t\t/* buffer filled, do cast */\n\t\t\t\t\n\t\t\t\tcastfunc(inbuffer, optr, el, in, out);\n\t\t\t\t\n\t\t\t\tif (obuf) {\n\t\t\t\t\t/* Copy from outbuffer to array */\n\t\t\t\t\tfor(i=0; idataptr,\n optr, outswap,\n oelsize);\n\t\t\t\t\t\toptr += oelsize;\n\t\t\t\t\t\tPyArray_ITER_NEXT(it_out);\n\t\t\t\t\t}\n\t\t\t\t\toptr = outbuffer;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toptr += out->itemsize * nels;\n\t\t\t\t}\n\t\t\t\tel = 0;\n\t\t\t\tbptr = inbuffer;\n\t\t\t}\n\t\t}\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(it_in);\n\tPyDataMem_FREE(inbuffer);\n\tPyDataMem_FREE(outbuffer);\t\n\tif (obuf) {\n\t\tPy_XDECREF(it_out);\n\t}\n\treturn retval;\n\n}\n\n\n/* For backward compatibility */\n\nstatic PyObject *\nPyArray_Cast(PyArrayObject *mp, int type_num) \n{\n\tPyArray_Typecode type;\n\tPyArray_Descr *descr;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\ttype.itemsize = descr->elsize;\n\ttype.type_num = descr->type_num;\n\ttype.fortran = 0;\n\t\n\treturn PyArray_CastToType(mp, &type);\n}\n\nstatic PyObject * \nPyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at) \n{\n\tPyObject *out;\n\tint ret;\n\n\tif ((mp->descr->type_num == at->type_num) && \\\n\t (at->itemsize==0 || mp->itemsize == at->itemsize) &&\n\t PyArray_ISBEHAVED_RO(mp)) {\n\t\tPy_INCREF(mp);\n\t\treturn (PyObject *)mp;\n\t}\n\t\t\n\tif (at->itemsize == 0) {\n\t\tif (mp->descr->type_num == PyArray_STRING &&\t\\\n\t\t at->type_num == PyArray_UNICODE)\n\t\t\tat->itemsize = mp->itemsize*sizeof(Py_UNICODE);\n\t\tif (mp->descr->type_num == PyArray_UNICODE &&\n\t\t at->type_num == PyArray_STRING) \n\t\t\tat->itemsize = mp->itemsize/sizeof(Py_UNICODE);\n\t\tif (at->type_num == PyArray_VOID)\n\t\t\tat->itemsize = mp->itemsize;\n\t}\n\n\tout = PyArray_New(mp->ob_type, mp->nd, \n\t\t\t mp->dimensions, \n\t\t\t at->type_num,\n\t\t\t NULL, NULL, at->itemsize, \n\t\t\t at->fortran, mp);\n\tif (out == NULL) return NULL;\n\tret = PyArray_CastTo((PyArrayObject *)out, mp);\n\tif (ret != -1) return out;\n\n\tPy_DECREF(out);\n\treturn NULL;\n\t\n}\n\t \n/* The number of elements in out must be an integer multiple\n of the number of elements in mp. \n*/\n\nstatic int\nPyArray_CastTo(PyArrayObject *out, PyArrayObject *mp)\n{\n\n\tint simple;\n\tintp mpsize = PyArray_SIZE(mp);\n\tintp outsize = PyArray_SIZE(out);\n\n\tif (mpsize == 0) return 0;\n\tif (!PyArray_ISWRITEABLE(out)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array is not writeable.\");\n\t\treturn -1;\n\t}\n\tif (outsize % mpsize != 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array must have an integer-multiple\"\\\n\t\t\t\t\" of the number of elements in the input \"\\\n\t\t\t\t\"array\");\n\t\treturn -1; \n\t}\n\n\tsimple = ((PyArray_ISCARRAY(mp) && PyArray_ISCARRAY(out)) || \\\n (PyArray_ISFARRAY(mp) && PyArray_ISFARRAY(out)));\n\t\n\tif (simple) {\n\t\tchar *inptr;\n\t\tchar *optr = out->data;\n\t\tintp obytes = out->itemsize * outsize;\n\t\tintp ncopies = outsize / mpsize;\n\n\t\twhile(ncopies--) {\n\t\t\tinptr = mp->data;\n\t\t\tmp->descr->cast[out->descr->type_num](inptr, \n\t\t\t\t\t\t\t optr,\n\t\t\t\t\t\t\t mpsize,\n\t\t\t\t\t\t\t mp, out);\n\t\t\toptr += obytes;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t/* If not a well-behaved cast, then use buffers */\n\tif (_bufferedcast(out, mp) == -1) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nstatic PyObject *\narray_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags) \n{\n\t\n\tPyArrayObject *ret=NULL;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\tint copy = 0;\n\tint arrflags;\n\tPyArray_Typecode oldtype={PyArray_TYPE(arr),PyArray_ITEMSIZE(arr),0};\n\tchar *msg = \"Cannot copy-back to a read-only array.\";\n\t\n\tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n\tif (itemsize == 0) itemsize = arr->itemsize;\n\ttypecode->type_num = type;\n\ttypecode->itemsize = itemsize;\n\n\t/* Don't copy if sizes are compatible */\n\tif (PyArray_EquivalentTypes(&oldtype, typecode)) {\n\t\tarrflags = arr->flags;\n\n\t\tcopy = (flags & ENSURECOPY) || \\\n\t\t\t((flags & CONTIGUOUS) && (!(arrflags & CONTIGUOUS))) \\\n\t\t\t|| (PyArray_ITEMSIZE(arr) != itemsize) || \\\n\t\t\t((flags & ALIGNED) && (!(arrflags & ALIGNED))) || \\\n\t\t\t((flags & NOTSWAPPED) && (!(arrflags & NOTSWAPPED))) \\\n\t\t\t|| (arr->nd > 1 &&\t\t\t\t\\\n\t\t\t ((flags & FORTRAN) != (arrflags & FORTRAN))) || \\\n\t\t\t((flags & WRITEABLE) && (!(arrflags & WRITEABLE)));\n\t\t\n\t\tif (copy) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_New(arr->ob_type, \n\t\t\t\t\t arr->nd, \n\t\t\t\t\t arr->dimensions,\n\t\t\t\t\t arr->descr->type_num,\n\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t itemsize,\n\t\t\t\t\t flags & FORTRAN,\n\t\t\t\t\t arr);\n\t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t} \n\t\t/* If no copy then just increase the reference\n\t\t count and return the input */\n\t\telse { \n\t\t\tPy_INCREF(arr);\n\t\t\tret = arr;\n\t\t}\n\t}\n\t\n\t/* The desired output type is different than the input\n\t array type */\n\telse {\n\t\t/* Cast to the desired type if we can do it safely\n\t\t Also cast if source is a ndim-0 array to mimic\n\t\t behavior with Python scalars */\n\t\tif (flags & FORCECAST || PyArray_NDIM(arr)==0 ||\n\t\t PyArray_CanCastSafely(PyArray_TYPE(arr), type)) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_CastToType(arr, typecode);\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Array can not be safely cast \"\\\n\t\t\t\t\t\"to required type\");\n\t\t\tret = NULL;\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic int\n_array_typecode_fromstr(char *str, int *swap, PyArray_Typecode *type)\n{\n int type_num;\n char typechar;\n int size;\n unsigned long number = 1;\n char *s;\n char msg[] = \"unsupported typestring\";\n \n s = (char *)&number; /* s[0] == 0 implies big-endian */\n\n *swap = 0;\n\n if (str[0] == '<' || str[0] == '>') {\n\tif ((str[0] == '<') && (s[0] == 0)) *swap = 1;\n\telse if ((str[0] == '>') && (s[0] != 0)) *swap = 1;\n }\n str += 1;\n \n#define _MY_FAIL {\t\t\t\t \\\n\t PyErr_SetString(PyExc_ValueError, msg); \\\n\t return -1;\t\t\t \\\n }\t\t\n\n typechar = str[0];\n size = atoi(str + 1);\n switch (typechar) {\n case 'b':\n\t if (size == sizeof(Bool))\n\t\t type_num = PyArray_BOOL;\t \n\t else _MY_FAIL \n\t break;\t\t \n case 'u':\n if (size == sizeof(uintp))\n type_num = PyArray_UINTP;\n\t else if (size == sizeof(char))\n\t\t type_num = PyArray_UBYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_USHORT;\n\t else if (size == sizeof(int)) \n\t\t type_num = PyArray_UINT;\n\t else if (size == sizeof(ulong)) \n\t\t type_num = PyArray_ULONG;\n\t else if (size == sizeof(ulonglong))\n\t\t type_num = PyArray_ULONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'i':\n if (size == sizeof(intp))\n type_num = PyArray_INTP;\n\t else if (size == sizeof(char)) \n\t\t type_num = PyArray_BYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_SHORT;\n\t else if (size == sizeof(int))\n\t\t type_num = PyArray_INT;\n\t else if (size == sizeof(long)) \n\t\t type_num = PyArray_LONG;\n\t else if (size == sizeof(longlong))\n\t\t type_num = PyArray_LONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'f':\n\t if (size == sizeof(float))\n\t\t type_num = PyArray_FLOAT;\n\t else if (size == sizeof(double))\n\t\t type_num = PyArray_DOUBLE;\n\t else if (size == sizeof(longdouble))\n\t\t type_num = PyArray_LONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'c':\n\t if (size == sizeof(float)*2)\n\t\t type_num = PyArray_CFLOAT;\n\t else if (size == sizeof(double)*2)\n\t\t type_num = PyArray_CDOUBLE;\n\t else if (size == sizeof(longdouble)*2)\n\t\t type_num = PyArray_CLONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'O':\n\t if (size == sizeof(PyObject *))\n\t\t type_num = PyArray_OBJECT;\n\t else _MY_FAIL\n\t break;\n case 'S':\n\t type_num = PyArray_STRING;\n\t break;\n case 'U':\n\t type_num = PyArray_UNICODE;\n\t size *= sizeof(Py_UNICODE);\n\t break;\t \n case 'V':\n\t type_num = PyArray_VOID;\n\t break;\n default:\n\t _MY_FAIL\n }\n\n#undef _MY_FAIL\n\n type->type_num = type_num;\n type->itemsize = size;\n type->fortran = 0;\n return 0;\n}\n\nstatic PyObject *\narray_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n{\n\tPyObject *attr=NULL, *item=NULL, *r;\n\tPyArrayObject *ret=NULL;\n\tPyArray_Typecode type;\n\tchar *data;\n\tint buffer_len;\n\tint res, i, n;\n\tint dims[MAX_DIMS], strides[MAX_DIMS];\n\tint swap;\n\n\t/* Get the memory from __array_data__ and __array_offset__ */\n\t/* Get the shape */\n\t/* Get the typestring -- ignore array_descr */\n\t/* Get the strides */\n\t\n\tattr = PyObject_GetAttrString(input, \"__array_data__\");\n\tif (attr == NULL) {\n\t\tPy_INCREF(input);\n\t\tattr = input;\n\t}\n\t\n\tres = PyObject_AsWriteBuffer(attr, (void **)&data, &buffer_len);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n\n\tattr = PyObject_GetAttrString(input, \"__array_typestr__\");\n\tif (!PyString_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_typestr__ must be a string.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\t\n\t}\n\tres = _array_typecode_fromstr(PyString_AS_STRING(attr), &swap, &type);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n \n\tattr = PyObject_GetAttrString(input, \"__array_shape__\");\n\tif (!PyTuple_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_shape__ must be a tuple.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\n\t}\n\tn = PyTuple_GET_SIZE(attr);\n\tfor (i=0; ibase = input;\n \n\tattr = PyObject_GetAttrString(input, \"__array_strides__\");\n\tif (attr != NULL && attr != Py_None) {\n\t\tif (!PyTuple_Check(attr)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"__array_strides__ must be a tuple.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tif (n != PyTuple_GET_SIZE(attr)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"mismatch in length of \"\\\n\t\t\t\t\t\"__array_strides__ and \"\\\n\t\t\t\t\t\"__array_shape__.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tfor (i=0; istrides, strides, n*sizeof(intp));\n\t}\n\n\tif (swap) {\n\t\tPyObject *tmp;\n\t\ttmp = PyObject_CallMethod((PyObject *)ret, \"byteswap\", \"\");\n\t\tPy_DECREF(tmp);\n\t}\n\n\tPyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);\n\tr = array_fromarray(ret, intype, flags);\n\tPy_DECREF(ret);\n\treturn r;\n}\n\nstatic PyObject *\narray_fromattr(PyObject *op, PyArray_Typecode *typecode, int flags) \n{\n PyObject *new, *r;\n\t \n if (typecode->type_num == PyArray_NOTYPE) {\n new = PyObject_CallMethod(op, \"__array__\", NULL);\n } else {\n new = PyObject_CallMethod(op, \"__array__\", \"i\", \n typecode->type_num);\n }\n if (new == NULL) return NULL;\n if (!PyArray_Check(new)) {\n PyErr_SetString(PyExc_ValueError, \n \"object __array__ method not \" \\\n \"producing an array.\");\n Py_DECREF(new);\n return NULL;\n }\n r = array_fromarray((PyArrayObject *)new, typecode, flags);\n Py_DECREF(new);\n return r;\n} \n\n\nstatic PyObject *\narray_fromobject(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth, int flags) \n{\n /* This is the main code to make a NumPy array from a Python\n Object. It is called from lot's of different places which\n is why there are so many checks. The comments try to\n explain some of the checks. */\n\n\tint type = typecode->type_num;\n PyObject *r=NULL;\n\n\t/* Is input object already an array? */\n\t/* This is where the flags are used */\n if (PyArray_Check(op)) \n\t\tr = array_fromarray((PyArrayObject *)op, typecode, flags);\n\telse if (PyObject_HasAttrString(op, \"__array__\")) {\n\t\t/* Code that returns the object to convert for a non\n\t\t multiarray input object from the __array__ attribute of the\n\t\t object. */\n r = array_fromattr(op, typecode, flags);\n\t}\n\telse if (PyObject_HasAttrString(op, \"__array_shape__\") &&\n\t\t PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tr = array_frominterface(op, typecode, flags);\n\t}\n\telse {\n\t\tif (type == PyArray_NOTYPE) {\n\t\t\t_array_find_type(op, NULL, typecode, MAX_DIMS);\n\t\t}\n\t\tif (PySequence_Check(op))\n\t\t\tr = Array_FromSequence(op, typecode, \n\t\t\t\t\t min_depth, max_depth);\n\t\telse\n\t\t\tr = Array_FromScalar(op, typecode);\n\t}\n\n /* If we didn't succed return NULL */\n if (r == NULL) return NULL;\n\t\n\t/* Be sure we succeed here */\n\t\n if(!PyArray_Check(r)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Internal error array_fromobject \"\\\n\t\t\t\t\"not producing an array\");\n\t\tPy_DECREF(r);\n return NULL;\n }\n\n if (min_depth != 0 && ((PyArrayObject *)r)->nd < min_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object of too small depth for desired array\");\n return NULL;\n }\n if (max_depth != 0 && ((PyArrayObject *)r)->nd > max_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object too deep for desired array\");\n return NULL;\n }\n return r;\n}\n\nstatic void\nPyArray_ArrayType(PyObject *op, PyArray_Typecode *intype, \n\t\t PyArray_Typecode *outtype) \n{\n\t_array_find_type(op, intype, outtype, MAX_DIMS);\n\treturn;\n}\n\nstatic int \nPyArray_ObjectType(PyObject *op, int minimum_type) \n{\n\tPyArray_Typecode intype, outtype;\n\tintype.type_num = minimum_type;\n\t_array_find_type(op, &intype, &outtype, MAX_DIMS);\n\treturn outtype.type_num;\n}\n\n\n\n/* flags is any of \n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough\n to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, and WRITEABLE\n and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, the returned array will be a copy of the object, \n (C) contiguous in memory, aligned, notswapped, and writeable.\n \n So CONTIGUOUS | ENSURECOPY passed in means that the returned\n array does not have to be CONTIGUOUS or a COPY but should be\n ALIGNED, NOTSWAPPED and WRITEABLE. \n\n typecode->fortran can be set to request a\n fortran-contiguous array. Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n*/\n\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n{\n \tPyArray_Typecode mine = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode *type;\n\t\n\tif (typecode == NULL) type = &mine;\n\telse type = typecode;\n\t\t\n\tif (requires & ENSURECOPY) {\n\t\trequires |= DEFAULT_FLAGS;\n\t}\n\t/* Ensure that type->fortran and flags & FORTRAN are the\n\t same */\n\tif (requires & FORTRAN) typecode->fortran = 1;\n\tif (type->fortran == 1) {\n\t\trequires |= FARRAY_FLAGS;\n\t\tif (min_depth > 2) requires &= ~CONTIGUOUS;\n\t}\n\n\t/* make sure itemsize is not 0 unless warranted. */\n\tif ((type->itemsize == 0) && (type->type_num != PyArray_NOTYPE)) {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type->type_num);\n\t\tif (descr != NULL) type->itemsize = descr->elsize;\n\t\telse return NULL;\n\t}\n\t\n\treturn array_fromobject(op, type, min_depth, max_depth, \n\t\t\t\trequires);\t\n}\n\n/* This is a quick wrapper around PyArray_FromAny(op, NULL, 0, 0, 0) */\n/* that special cases Arrays and PyArray_Scalars up front */\n/* It steals a reference to the object */\n\n/* Because it decrefs op if any conversion needs to take place \n -- so it can be used like PyArray_EnsureArray(some_function(...)) */\n\nstatic PyObject *\nPyArray_EnsureArray(PyObject *op)\n{\n PyObject *new;\n\n if (op == NULL) return NULL;\n\n if (PyArray_Check(op)) return op;\n\n if (PyArray_IsScalar(op, Generic)) {\n new = PyArray_FromScalar(op, NULL);\n Py_DECREF(op);\n return new;\n }\n new = PyArray_FromAny(op, NULL, 0, 0, 0);\n Py_DECREF(op);\n return new;\n}\n\n/* These are all compressed into a single API */\n/* Deprecated calls -- Use PyArray_FromAny */\n\nstatic PyObject *\nPyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, BEHAVED_FLAGS);\n}\n\nstatic PyObject *\nPyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n\t\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, DEFAULT_FLAGS);\n}\n\nstatic PyObject *\nPyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n\t\t\t ENSURECOPY);\n}\n\n/* End of deprecated */\n\n\nstatic int \nPyArray_CanCastSafely(int fromtype, int totype) \n{\n\tPyArray_Descr *from, *to;\n\n if (fromtype == totype) return 1;\n if (fromtype == PyArray_BOOL) return 1;\n\tif (totype == PyArray_BOOL) return 0;\n if (totype == PyArray_OBJECT || totype == PyArray_VOID) return 1;\n\tif (fromtype == PyArray_OBJECT || fromtype == PyArray_VOID) return 0;\n\n\tfrom = PyArray_DescrFromType(fromtype);\n\tto = PyArray_DescrFromType(totype);\n \n switch(fromtype) {\n case PyArray_BYTE:\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISUNSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_UBYTE:\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_FLOAT:\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\tif (PyTypeNum_ISCOMPLEX(totype)) \n\t\t\treturn ((to->elsize >> 1) >= from->elsize);\n\t\telse\n\t\t\treturn (totype > fromtype);\n case PyArray_CFLOAT:\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn (totype > fromtype);\n\tcase PyArray_STRING:\n\tcase PyArray_UNICODE:\n\t\treturn (totype > fromtype);\n default:\n return 0;\n }\n}\n\nstatic Bool\nPyArray_CanCastTo(PyArray_Typecode *from, PyArray_Typecode *to)\n{\n\tint fromtype=from->type_num;\n\tint totype=to->type_num;\n\tBool ret;\n\n\tret = (Bool) PyArray_CanCastSafely(fromtype, totype);\n\tif (ret) { /* Check String and Unicode more closely */\n\t\tif (fromtype == PyArray_STRING) {\n\t\t\tif (totype == PyArray_STRING) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t\telse if (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize * sizeof(Py_UNICODE)\\\n\t\t\t\t <= to->itemsize);\n\t\t\t}\n\t\t}\n\t\telse if (fromtype == PyArray_UNICODE) {\n\t\t\tif (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}\n\n\n\n/*********************** Element-wise Array Iterator ***********************/\n/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/\n/* and Python's array iterator ***/\n \n\nstatic PyObject *\nPyArray_IterNew(PyObject *obj)\n{\n PyArrayIterObject *it;\n\tint i, nd; \n\tPyArrayObject *ao = (PyArrayObject *)obj;\n\n if (!PyArray_Check(ao)) {\n PyErr_BadInternalCall();\n return NULL;\n }\n\n it = PyObject_GC_New(PyArrayIterObject, &PyArrayIter_Type);\n if (it == NULL)\n return NULL;\n\n\tnd = ao->nd;\n\tPyArray_UpdateFlags(ao, CONTIGUOUS);\n\tit->contiguous = 0;\n\tif PyArray_ISCONTIGUOUS(ao) it->contiguous = 1;\n Py_INCREF(ao);\n it->ao = ao;\n\tit->size = PyArray_SIZE(ao);\n\tit->nd_m1 = nd - 1;\n\tit->factors[nd-1] = 1;\n\tfor (i=0; i < nd; i++) {\n\t\tit->dims_m1[i] = it->ao->dimensions[i] - 1;\n\t\tit->strides[i] = it->ao->strides[i];\n\t\tit->backstrides[i] = it->strides[i] *\t\\\n\t\t\tit->dims_m1[i];\n\t\tif (i > 0)\n\t\t\tit->factors[nd-i-1] = it->factors[nd-i] *\t\\\n\t\t\t\tit->ao->dimensions[nd-i];\n\t}\n\tPyArray_ITER_RESET(it);\n\t\n PyObject_GC_Track(it);\n return (PyObject *)it;\n}\n\n/* Returns an array scalar holding the element desired */\n\nstatic PyObject *\narrayiter_next(PyArrayIterObject *it)\n{\n\tPyObject *ret;\n\n\tif (it->index < it->size) {\n\t\tret = PyArray_ToScalar(it->dataptr, it->ao);\n\t\tPyArray_ITER_NEXT(it);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narrayiter_dealloc(PyArrayIterObject *it)\n{\n PyObject_GC_UnTrack(it);\n Py_XDECREF(it->ao);\n PyObject_GC_Del(it);\n }\n\nstatic int\narrayiter_traverse(PyArrayIterObject *it, visitproc visit, void *arg)\n{\n if (it->ao != NULL)\n return visit((PyObject *)(it->ao), arg);\n return 0;\n}\n\n\nstatic int\niter_length(PyArrayIterObject *self) \n{\n return (int) self->size;\n}\n\n\nstatic PyObject *\niter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tint index, strides, itemsize;\n\tintp count=0;\n\tchar *dptr, *optr;\n\tPyObject *r;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn NULL;\n\t}\n\tindex = (ind->dimensions[0]);\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\t/* Get size of return array */\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0)\n\t\t\tcount++;\n\t\tdptr += strides;\n\t}\n\titemsize = self->ao->itemsize;\n\tr = PyArray_New(self->ao->ob_type, 1, &count, \n\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\titemsize, 0, self->ao);\n\tif (r==NULL) return NULL;\n\n\t/* Set up loop */\n\toptr = PyArray_DATA(r);\n\tindex = ind->dimensions[0];\n\tdptr = ind->data;\n\n copyswap = self->ao->descr->copyswap;\n\t/* Loop over Boolean array */\n\tswap = !(PyArray_ISNOTSWAPPED(self->ao));\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\t\toptr += itemsize;\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\nstatic PyObject *\niter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tintp num;\n\tPyObject *r;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint swap;\n\tchar *optr;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = self->ao->itemsize;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t}\n\t\n\tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n\t\t\tself->ao->descr->type_num, NULL, \n\t\t\tNULL, self->ao->itemsize, \n\t\t\t0, self->ao);\n\tif (r==NULL) return NULL;\n\n\toptr = PyArray_DATA(r);\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) {Py_DECREF(r); return NULL;}\n\tindex = ind_it->size;\n copyswap = PyArray_DESCR(r)->copyswap;\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif (num < 0 || num >= self->size) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\tPy_DECREF(r);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\toptr += itemsize;\n\t\tPyArray_ITER_NEXT(ind_it);\n\t}\n\tPy_DECREF(ind_it);\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\n\nstatic PyObject *\niter_subscript(PyArrayIterObject *self, PyObject *ind)\n{\n\tint i;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *r;\n\tchar *dptr;\n\tint size;\n\tPyObject *obj = NULL;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\t\t\n\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\tobj = iter_subscript(self, ind);\n\t\tPy_DECREF(ind);\n\t\treturn obj;\n\t}\n\n\t/* Tuples not accepted --- i.e. no NewAxis */\n\t/* Could implement this with adjusted strides\n\t and dimensions in iterator */\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\tPyArray_ITER_RESET(self);\n\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n\t\t\treturn PyArray_ToScalar(self->dataptr, self->ao);\n\t\t}\n\t\telse { /* empty array */\n\t\t\tintp ii = 0;\n\t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n\t\t\t\t\tself->ao->descr->type_num, NULL, \n\t\t\t\t\tNULL, self->ao->itemsize, 0,\n\t\t\t\t\tself->ao);\n\t\t\treturn r;\t\t\t\n\t\t}\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) \n\t\t\tgoto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start)\n\t\tif (n_steps == SingleIndex) { /* Integer */\n\t\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn r;\n\t\t}\n\t\tsize = self->ao->itemsize;\n\t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n\t\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\t\tsize, 0, self->ao);\n\t\tif (r==NULL) goto fail; \n\t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n copyswap = PyArray_DESCR(r)->copyswap;\n\t\twhile(n_steps--) {\n copyswap(dptr, self->dataptr, swap, size);\n\t\t\tfor(i=0; i< step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tdptr += size;\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer) || PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tr = iter_subscript_Bool(self, (PyArrayObject *)obj);\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tobj = new;\n\t\t\tr = iter_subscript_int(self, (PyArrayObject *)obj);\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"unsupported iterator index\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPy_DECREF(obj);\n\t\treturn r;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\n fail:\n\tPy_XDECREF(obj);\n\treturn NULL;\n\n}\n\n\nstatic int\niter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tint index, strides, itemsize;\n\tchar *dptr;\n PyArray_CopySwapFunc *copyswap;\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn -1;\n\t}\n\titemsize = self->ao->itemsize;\n\tindex = ind->dimensions[0];\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\tPyArray_ITER_RESET(self);\n\t/* Loop over Boolean array */\n copyswap = self->ao->descr->copyswap;\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(self->dataptr, val->dataptr, swap,\n itemsize);\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index==val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn 0;\n}\n\nstatic int\niter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tPyArray_Typecode typecode;\n\tintp num;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = typecode.itemsize = self->ao->itemsize;\n\ttypecode.type_num = self->ao->descr->type_num;\n copyswap = self->ao->descr->copyswap;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\treturn 0;\n\t}\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) return -1;\n\tindex = ind_it->size;\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif ((num < 0) || (num >= self->size)) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\treturn -1;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\tPyArray_ITER_NEXT(ind_it);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index == val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPy_DECREF(ind_it);\n\treturn 0;\n}\n\n\nstatic int\niter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) \n{\n\tint i;\n\tPyObject *arrval=NULL;\n\tPyArrayIterObject *val_it=NULL;\n\tPyArray_Typecode type;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint swap;\n\tint itemsize;\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *obj;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\ti = iter_ass_subscript(self, ind, val);\n\t\tPy_DECREF(ind);\n\t\treturn i;\n\t}\n\t\n\ttype.type_num = self->ao->descr->type_num;\n\titemsize = type.itemsize = self->ao->itemsize;\n\t\n\tarrval = PyArray_FromAny(val, &type, 0, 0, 0);\n\tif (arrval==NULL) return -1;\n\tval_it = (PyArrayIterObject *)PyArray_IterNew(arrval);\n\tif (val_it==NULL) goto fail;\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\n copyswap = PyArray_DESCR(arrval)->copyswap;\n\tswap = (PyArray_ISNOTSWAPPED(self->ao)!=PyArray_ISNOTSWAPPED(arrval));\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n copyswap(self->dataptr, PyArray_DATA(arrval), \n swap, itemsize);\n\t\t}\n\t\tgoto succeed;\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) goto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start);\n\t\tif (n_steps == SingleIndex) { /* Integer */\n copyswap(self->dataptr, PyArray_DATA(arrval),\n swap, itemsize);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\tgoto succeed;\n\t\t}\n\t\twhile(n_steps--) {\n copyswap(self->dataptr, val_it->dataptr,\n swap, itemsize);\n\t\t\tfor(i=0; i < step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tPyArray_ITER_NEXT(val_it);\n\t\t\tif (val_it->index == val_it->size) \n\t\t\t\tPyArray_ITER_RESET(val_it);\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\tgoto succeed;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer))\n\t\tobj = PyArray_FromScalar(ind, &indtype);\n\telse if (PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tif (iter_ass_sub_Bool(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tPy_DECREF(obj);\n\t\t\tobj = new;\n\t\t\tif (iter_ass_sub_int(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t}\n\t\telse goto fail;\n\t\tPy_DECREF(obj);\n\t\tgoto succeed;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\tgoto fail;\n\n succeed:\n\tPy_DECREF(val_it);\n\tPy_DECREF(arrval);\n\treturn 0;\n\n fail:\n\tPy_XDECREF(val_it);\n\tPy_XDECREF(arrval);\n\treturn -1;\n\t\n}\n\n\nstatic PyMappingMethods iter_as_mapping = {\n (inquiry)iter_length,\t\t /*mp_length*/\n (binaryfunc)iter_subscript,\t /*mp_subscript*/\n (objobjargproc)iter_ass_subscript,\t/*mp_ass_subscript*/\n};\n\nstatic char doc_iter_array[] = \"__array__(type=None)\\n Get array \"\\\n \"from iterator\";\n\nstatic PyObject *\niter_array(PyArrayIterObject *it, PyObject *op) \n{\n \n PyObject *r;\n intp size;\n\n /* Any argument ignored */\n\n /* Two options: \n 1) underlying array is contiguous\n -- return 1-d wrapper around it \n 2) underlying array is not contiguous\n -- make new 1-d contiguous array with updateifcopy flag set\n to copy back to the old array\n */\n\n size = PyArray_SIZE(it->ao);\n if (PyArray_ISCONTIGUOUS(it->ao)) {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n\t\t\t\tit->ao->flags,\n it->ao); \n\t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, NULL, it->ao->itemsize, 0, it->ao);\n\t\tif (r==NULL) return NULL;\n\t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n\t\t\tPy_DECREF(r); \n\t\t\treturn NULL;\n\t\t}\n PyArray_FLAGS(r) |= UPDATEIFCOPY;\n it->ao->flags &= ~WRITEABLE;\n }\n Py_INCREF(it->ao);\n PyArray_BASE(r) = (PyObject *)it->ao;\n return r;\n \n}\n\nstatic char doc_iter_copy[] = \"copy()\\n Get a copy of 1-d array\";\n\nstatic PyObject *\niter_copy(PyArrayIterObject *it, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\t\n\treturn PyArray_Flatten(it->ao, 0);\n}\n\nstatic PyMethodDef iter_methods[] = {\n /* to get array */\n {\"__array__\", (PyCFunction)iter_array, 1, doc_iter_array},\n\t{\"copy\", (PyCFunction)iter_copy, 1, doc_iter_copy},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\nstatic PyTypeObject PyArrayIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.flatiter\",\t\t /* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arrayiter_dealloc,\t\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0, \t\t\t /* tp_as_sequence */\n &iter_as_mapping, \t /* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0,\t \t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arrayiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arrayiter_next,\t\t/* tp_iternext */\n iter_methods,\t\t\t\t/* tp_methods */\n};\n\n/** END of Array Iterator **/\n\n\n\n/*********************** Subscript Array Iterator *************************\n * *\n * This object handles subscript behavior for array objects. *\n * It is an iterator object with a next method *\n * It abstracts the n-dimensional mapping behavior to make the looping *\n * code more understandable (maybe) *\n * and so that indexing can be set up ahead of time *\n */ \n\n/* This checks the args for any fancy indexing objects */\n\n#define SOBJ_NOTFANCY 0 \n#define SOBJ_ISFANCY 1\n#define SOBJ_BADARRAY 2\n#define SOBJ_TOOMANY 3\n#define SOBJ_LISTTUP 4\n\nstatic int\nfancy_indexing_check(PyObject *args)\n{\n\tint i, n;\n\tPyObject *obj;\n\tint retval = SOBJ_NOTFANCY;\n\n\tif (PyTuple_Check(args)) {\n\t\tn = PyTuple_GET_SIZE(args);\n\t\tif (n >= MAX_DIMS) return SOBJ_TOOMANY;\n\t\tfor (i=0; i=MAX_DIMS) return SOBJ_ISFANCY;\n\t\tfor (i=0; i SOBJ_ISFANCY) return retval;\n\t\t}\n\t}\n\n\treturn retval;\n}\n\n/* convert an indexing object to an INTP indexing array iterator\n if possible -- otherwise, it is a Slice or Ellipsis object\n and has to be interpreted on bind to a particular \n array so leave it NULL for now.\n */\nstatic int\n_convert_obj(PyObject *obj, PyArrayIterObject **iter)\n{\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tPyObject *arr;\n\n\tif (PySlice_Check(obj) || (obj == Py_Ellipsis))\n\t\t*iter = NULL;\n\telse {\n\t\tarr = PyArray_FromAny(obj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) return -1;\n\t\t*iter = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (*iter == NULL) return -1;\n\t}\n\treturn 0;\n}\n\n/* Adjust dimensionality and strides for index object iterators \n --- i.e. broadcast\n */\nstatic int\nPyArray_Broadcast(PyArrayMultiIterObject *mit)\n{\n\tint i, nd, k, j;\n\tintp tmp;\n\tPyArrayIterObject *it;\n\t\n\t/* Discover the broadcast number of dimensions */\n\tfor (i=0, nd=0; inumiter; i++) \n\t\tnd = MAX(nd, mit->iters[i]->ao->nd);\n\tmit->nd = nd;\n\n\t/* Discover the broadcast shape in each dimension */\n\tfor (i=0; idimensions[i] = 1;\n\t\tfor (j=0; jnumiter; j++) {\n\t\t\tit = mit->iters[j];\n\t\t\t/* This prepends 1 to shapes not already \n\t\t\t equal to nd */\n\t\t\tk = i + it->ao->nd - nd;\n\t\t\tif (k>=0) {\n\t\t\t\ttmp = it->ao->dimensions[k];\n\t\t\t\tif (tmp == 1) continue;\n\t\t\t\tif (mit->dimensions[i] == 1) \n\t\t\t\t\tmit->dimensions[i] = tmp;\n\t\t\t\telse if (mit->dimensions[i] != tmp) {\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\t\"index objects are \" \\\n\t\t\t\t\t\t\t\"not broadcastable \" \\\n\t\t\t\t\t\t\t\"to a single shape.\");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Reset the iterator dimensions and strides of each iterator\n\t object -- using 0 valued strides for broadcasting */\n\n\ttmp = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tmit->size = tmp;\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tit->nd_m1 = mit->nd - 1;\n\t\tit->size = tmp;\n\t\tnd = it->ao->nd;\n\t\tit->factors[mit->nd-1] = 1;\n\t\tfor (j=0; j < mit->nd; j++) {\n\t\t\tit->dims_m1[j] = mit->dimensions[j] - 1;\n\t\t\tk = j + nd - mit->nd;\n\t\t\t/* If this dimension was added or shape\n\t\t\t of underlying array was 1 */\n\t\t\tif ((k < 0) || \\\n\t\t\t it->ao->dimensions[k] != mit->dimensions[j]) {\n\t\t\t\tit->contiguous = 0;\n\t\t\t\tit->strides[j] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tit->strides[j] = it->ao->strides[k];\n\t\t\t}\n\t\t\tit->backstrides[j] = it->strides[j] *\t\\\n\t\t\t\tit->dims_m1[j];\n\t\t\tif (j > 0)\n\t\t\t\tit->factors[mit->nd-j-1] =\t\t\\\n\t\t\t\t\tit->factors[mit->nd-j] *\t\\\n\t\t\t\t\tmit->dimensions[mit->nd-j];\n\t\t}\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn 0;\n}\n\n/* Reset the map iterator to the beginning */\nstatic void\nPyArray_MapIterReset(PyArrayMapIterObject *mit)\n{\n\tint i,j; intp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index = 0;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\n\tif (mit->subspace != NULL) {\n\t\tmemcpy(coord, mit->bscoord, sizeof(intp)*mit->ait->ao->nd);\n\t\tPyArray_ITER_RESET(mit->subspace);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tj = mit->iteraxes[i];\n\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* This function needs to update the state of the map iterator\n and point mit->dataptr to the memory-location of the next object\n*/\nstatic void\nPyArray_MapIterNext(PyArrayMapIterObject *mit)\n{\n\tint i, j;\n\tintp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index += 1;\n\tif (mit->index >= mit->size) return;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\t/* Sub-space iteration */\n\tif (mit->subspace != NULL) {\n\t\tPyArray_ITER_NEXT(mit->subspace);\n\t\tif (mit->subspace->index == mit->subspace->size) {\n\t\t\t/* reset coord to coordinates of \n\t\t\t beginning of the subspace */\n\t\t\tmemcpy(coord, mit->bscoord, \n\t\t\t sizeof(intp)*mit->ait->ao->nd);\n\t\t\tPyArray_ITER_RESET(mit->subspace);\n\t\t\tfor (i=0; inumiter; i++) {\n\t\t\t\tit = mit->iters[i];\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t\tj = mit->iteraxes[i];\n\t\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t\t sizeof(intp));\n\t\t\t}\n\t\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\t}\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* Bind a mapiteration to a particular array */\n\n/* Determine if subspace iteration is necessary. If so, \n 1) Fill in mit->iteraxes\n\t 2) Create subspace iterator\n\t 3) Update nd, dimensions, and size. \n\n Subspace iteration is necessary if: arr->nd > mit->numiter\n*/\n\n/* Need to check for index-errors somewhere. \n\n Let's do it at bind time and also convert all <0 values to >0 here\n as well. \n*/\nstatic void\nPyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n{\n\tint subnd;\n\tPyObject *sub=NULL, *obj=NULL;\n\tint i, j, n, curraxis, ellipexp, noellip;\n\tPyArrayIterObject *it;\n\tintp dimsize;\n\tintp *indptr;\n\n\t/* Remove old binding if any */\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\n\tPy_XDECREF(mit->subspace);\n\tmit->subspace = NULL;\n\t\n\tsubnd = arr->nd - mit->numiter;\n\tif (subnd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Too many indices for array.\");\n\t\treturn;\n\t}\n\n\tmit->ait = (PyArrayIterObject *)PyArray_IterNew((PyObject *)arr);\n\tif (mit->ait == NULL) return;\n\n\t/* If this is just a view, then do nothing more */\n\t/* views are handled by just adjusting the strides\n\t and dimensions of the object.\n\t*/\n\t \n\tif (mit->view) return;\n\n\t/* no subspace iteration needed. Return */\n\tif (subnd == 0) {\n\t\tn = arr->nd;\n\t\tfor (i=0; iiteraxes[i] = i;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\t/* all indexing arrays have been converted to 0 \n\t therefore we can extract the subspace with a simple\n\t getitem call which will use view semantics\n\t*/\n\t\n\tsub = PyObject_GetItem((PyObject *)arr, mit->indexobj);\n\tif (sub == NULL) goto fail;\n\tmit->subspace = (PyArrayIterObject *)PyArray_IterNew(sub);\n\tif (mit->subspace == NULL) goto fail;\n\tPy_DECREF(sub);\n\n\t/* Expand dimensions of result */\n\tn = mit->subspace->ao->nd;\n\tfor (i=0; idimensions[mit->nd+i] = mit->subspace->ao->dimensions[i];\n\tmit->nd += n;\n\n\t/* Now, we still need to interpret the ellipsis and slice objects \n\t to determine which axes the indexing arrays are referring to\n\t*/\n\tn = PyTuple_GET_SIZE(mit->indexobj);\n\n\t/* The number of dimensions an ellipsis takes up */\n\tellipexp = arr->nd - n + 1;\n\t/* Now fill in iteraxes -- remember indexing arrays have been \n converted to 0's in mit->indexobj */\n\tcurraxis = 0;\n\tj = 0;\n\tnoellip = 1; /* Only expand the first ellipsis */\n\tmemset(mit->bscoord, '\\0', sizeof(intp)*arr->nd);\n\tfor (i=0; iindexobj, i);\n\t\tif (PyInt_Check(obj) || PyLong_Check(obj)) \n\t\t\tmit->iteraxes[j++] = curraxis++;\n\t\telse if (noellip && obj == Py_Ellipsis) {\n\t\t\tcurraxis += ellipexp;\n\t\t\tnoellip = 0;\n\t\t}\n\t\telse {\n\t\t\tint start=0;\n\t\t\tint stop, step;\n\t\t\t/* Should be slice object or\n\t\t\t another Ellipsis */\n\t\t\tif (obj == Py_Ellipsis) {\n\t\t\t\tmit->bscoord[curraxis] = 0;\n\t\t\t}\n\t\t\telse if (!PySlice_Check(obj) || \\\n\t\t\t\t (slice_GetIndices((PySliceObject *)obj, \n\t\t\t\t\t\t arr->dimensions[curraxis],\n\t\t\t\t\t\t &start, &stop, &step,\n\t\t\t\t\t\t &dimsize) < 0)) {\n\t\t\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t\t\t \"unexpected object \"\t\\\n\t\t\t\t\t \"(%s) in selection position %d\",\n\t\t\t\t\t obj->ob_type->tp_name, i);\n\t\t\t goto fail;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmit->bscoord[curraxis] = start;\n\t\t\t}\n\t\t\tcurraxis += 1; \n\t\t}\n\t}\n finish:\n\t/* Here check the indexes (now that we have iteraxes) */\n\tmit->size = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tPyArray_ITER_RESET(it);\n\t\tdimsize = arr->dimensions[mit->iteraxes[i]];\n\t\twhile(it->index < it->size) {\n\t\t\tindptr = ((intp *)it->dataptr);\n\t\t\tif (*indptr < 0) *indptr += dimsize;\n\t\t\tif (*indptr < 0 || *indptr >= dimsize) {\n\t\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t\t \"index (%d) out of range \"\\\n\t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n\t\t\t\t\t *indptr, dimsize-1, \n\t\t\t\t\t mit->iteraxes[i]);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn;\n\n fail:\n\tPy_XDECREF(sub);\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\treturn;\n}\n\n/* This function takes a Boolean array and constructs index objects and\n iterators as if nonzero(Bool) had been called\n*/\nstatic int\n_nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)\n{\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\tPyArrayObject *ba =NULL, *new=NULL;\n\tint nd, j;\n\tintp size, i, count;\n\tBool *ptr;\n\tintp coords[MAX_DIMS], dims_m1[MAX_DIMS];\n\tintp *dptr[MAX_DIMS];\n\n\tba = (PyArrayObject *)PyArray_FromAny(myBool, &typecode, 0, 0, \n\t\t\t\t\t CARRAY_FLAGS);\n\tif (ba == NULL) return -1;\n\tnd = ba->nd;\n\tfor (j=0; jdata;\n\tcount = 0;\n\n\t/* pre-determine how many nonzero entries there are */\n\tfor (i=0; iao->data;\n\t\tcoords[j] = 0;\n\t\tdims_m1[j] = ba->dimensions[j]-1;\n\t}\n\n\tptr = (Bool *)ba->data;\n\n\tif (count == 0) return nd;\n\n\t/* Loop through the Boolean array and copy coordinates\n\t for non-zero entries */\n\tfor (i=0; i=0; j--) {\n\t\t\tif (coords[j] < dims_m1[j]) {\n\t\t\t\tcoords[j]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcoords[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn nd;\n\n fail:\n\tfor (j=0; jiters[i] = NULL;\n \tmit->view = 0;\n \tmit->index = 0;\n \tmit->ait = NULL;\n \tmit->subspace = NULL;\n\tmit->numiter = 0;\n\tmit->consec = 1;\n\tfancy = fancy_indexing_check(indexobj);\n\tPy_INCREF(indexobj);\n\tmit->indexobj = indexobj;\n\tif (fancy == SOBJ_NOTFANCY) { /* bail out */\n\t\tmit->view = 1;\n\t\tgoto ret;\n\t}\n\n\tif (fancy == SOBJ_BADARRAY) {\n\t\tPyErr_SetString(PyExc_TypeError,\t\t\t\\\n\t\t\t\t\"Arrays used as indexes must be of \" \\\n\t\t\t\t\"integer type\");\n\t\tgoto fail;\n\t}\n\tif (fancy == SOBJ_TOOMANY) {\n\t\tPyErr_SetString(PyExc_TypeError,\"Too many indicies\");\n\t\tgoto fail;\n\t}\n\n\tif (fancy == SOBJ_LISTTUP) {\n\t\tPyObject *newobj;\n\t\tnewobj = PySequence_Tuple(indexobj);\n\t\tif (newobj == NULL) goto fail;\n\t\tPy_DECREF(indexobj);\n\t\tindexobj = newobj;\n\t\tmit->indexobj = indexobj;\n\t}\n\n#undef SOBJ_NOTFANCY \n#undef SOBJ_ISFANCY \n#undef SOBJ_BADARRAY \n#undef SOBJ_TOOMANY \n#undef SOBJ_LISTTUP \n\n\n\t/* Must have some kind of fancy indexing if we are here */\n\t/* indexobj is either a list, an arrayobject, or a tuple \n\t (with at least 1 list or arrayobject or Bool object), */\n\t\n\t/* convert all inputs to iterators */\n\tif (PyArray_Check(indexobj) &&\t\t\t\\\n\t (PyArray_TYPE(indexobj) == PyArray_BOOL)) {\n\t\tmit->numiter = _nonzero_indices(indexobj, mit->iters);\n\t\tif (mit->numiter < 0) goto fail;\n\t\tmit->nd = 1;\n\t\tmit->dimensions[0] = mit->iters[0]->dims_m1[0]+1;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = PyTuple_New(mit->numiter);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tPyTuple_SET_ITEM(mit->indexobj, i, \n\t\t\t\t\t PyInt_FromLong(0));\n\t\t}\n\t}\n\n\telse if (PyList_Check(indexobj) || PyArray_Check(indexobj)) {\n\t\tmit->numiter = 1;\n\t\tarr = PyArray_FromAny(indexobj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) goto fail;\n\t\tmit->iters[0] = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (mit->iters[0] == NULL) goto fail;\n\t\tmit->nd = PyArray_NDIM(arr);\n\t\tmemcpy(mit->dimensions,PyArray_DIMS(arr),mit->nd*sizeof(intp));\n\t\tmit->size = PyArray_SIZE(arr);\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = Py_BuildValue(\"(N)\", PyInt_FromLong(0));\n\t}\n\telse { /* must be a tuple */\n\t\tPyObject *obj;\n\t\tPyArrayIterObject *iter;\n\t\tPyObject *new;\n\t\t/* Make a copy of the tuple -- we will be replacing \n\t\t index objects with 0's */\n\t\tn = PyTuple_GET_SIZE(indexobj);\n\t\tnew = PyTuple_New(n);\n\t\tif (new == NULL) goto fail;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = new;\n\t\tstarted = 0;\n\t\tnonindex = 0;\n\t\tfor (i=0; iconsec = 0;\n\t\t\t\tmit->iters[(mit->numiter)++] = iter;\n\t\t\t\tPyTuple_SET_ITEM(new,i,\n\t\t\t\t\t\t PyInt_FromLong(0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (started) nonindex = 1;\n\t\t\t\tPy_INCREF(obj);\n\t\t\t\tPyTuple_SET_ITEM(new,i,obj);\n\t\t\t}\n\t\t}\n\t\t/* Store the number of iterators actually converted */\n\t\t/* These will be mapped to actual axes at bind time */\n\t\tif (PyArray_Broadcast((PyArrayMultiIterObject *)mit) < 0)\n\t\t\tgoto fail;\n\t}\n\n ret:\n PyObject_GC_Track(mit);\n return (PyObject *)mit;\n \n fail:\n\tPy_XDECREF(arr);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n\treturn NULL;\n}\n\n\n/* return unbound mapiter object */\n\nstatic PyObject *\narraymapiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) \n{\n\tPyObject *newtup, *res;\n\tint n;\n\n\tif (!PyTuple_Check(args)) {\n\t\tPyErr_BadInternalCall();\n\t\treturn NULL;\n\t}\n\n\tn = PyTuple_GET_SIZE(args);\n\t\n\tif (n < 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"must be initialized with >= 1 argument\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n > 1) {\n\t\tnewtup = PyTuple_GetSlice(args, 0, n);\n\t\tif (newtup == NULL) return NULL;\n\t\tres = PyArray_MapIterNew(newtup);\n\t\tPy_DECREF(newtup);\n\t}\n\telse { /* n == 1 */\n\t\tnewtup = PyTuple_GET_ITEM(args, 0);\n\t\tres = PyArray_MapIterNew(newtup);\n\t}\n\n\treturn res; \t\n}\n\n\n/* Returns a 0-dim array holding the element desired */\n\nstatic PyObject *\narraymapiter_next(PyArrayMapIterObject *mit)\n{\n\tPyObject *ret;\n\tif (mit->ait == NULL) return NULL;\n\tif (mit->view) return NULL;\n\tif (mit->index < mit->size) {\n\t\tret = PyArray_ToScalar(mit->dataptr, mit->ait->ao);\n\t\tPyArray_MapIterNext(mit);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narraymapiter_dealloc(PyArrayMapIterObject *mit)\n{\n\tint i;\n PyObject_GC_UnTrack(mit);\n Py_XDECREF(mit->ait);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n}\n\nstatic int\narraymapiter_traverse(PyArrayMapIterObject *mit, visitproc visit, void *arg)\n{\n\tint ret, i;\n if (mit->ait != NULL)\n if ((ret = visit((PyObject *)(mit->ait), arg)) != 0) \n\t\t\treturn ret;\t\n\n\tif (mit->iters != NULL) \n\t\tfor (i=0; inumiter; i++) \n\t\t\tif (mit->iters[i] != NULL) \n\t\t\t\tif ((ret=visit((PyObject *)mit->iters[i], \n\t\t\t\t\t arg)) != 0)\n\t\t\t\t\treturn ret;\n\n\tif (mit->indexobj != NULL)\n\t\tif ((ret = visit(mit->indexobj, arg)) != 0) return ret;\n\t\n return 0;\n}\n\n/* \nstatic char doc_mapiter_bind[] = \"obj.bind(a)\\n Bind an array to the \"\\\n\t\"mapiter object\";\n\nstatic PyObject *\nmapiter_bind(PyArrayMapIterObject *mit, PyObject *args)\n{\n\tPyObject *r;\n intp size, strides;\n int nd;\n\tPyArrayObject *arr;\n\n if (!PyArg_ParseTuple(args, \"O!\", &PyArray_Type, &arr)) return NULL;\n\n\tPyArray_MapIterBind(mit, arr);\n\n\tif (mit->ait == NULL) return NULL;\n\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyMethodDef mapiter_methods[] = {\n\t{\"bind\", (PyCFunction)mapiter_bind, 1, doc_mapiter_bind},\n {NULL,\t\tNULL}\t\t\n};\n*/\n\n\nstatic PyTypeObject PyArrayMapIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.mapiter\",\t\t \t/* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arraymapiter_dealloc,\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0,\t\t\t\t\t/* tp_as_sequence */\n 0,\t\t\t\t\t/* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0, \t\t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arraymapiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arraymapiter_next,\t/* tp_iternext */\n 0,\t \t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n 0,\t\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0, \t /* tp_alloc */\n (newfunc)arraymapiter_new,\t /* tp_new */\n 0,\t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n\n};\n\n/** END of Subscript Iterator **/\n\n\n\n", "methods": [ { "name": "PyArray_PyIntAsIntp", "long_name": "PyArray_PyIntAsIntp( PyObject * o)", "filename": "arrayobject.c", "nloc": 59, "complexity": 19, "token_count": 385, "parameters": [ "o" ], "start_line": 40, "end_line": 103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "PyArray_PyIntAsInt", "long_name": "PyArray_PyIntAsInt( PyObject * o)", "filename": "arrayobject.c", "nloc": 57, "complexity": 19, "token_count": 389, "parameters": [ "o" ], "start_line": 109, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 81, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_Zero", "long_name": "PyArray_Zero( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 190, "parameters": [ "arr" ], "start_line": 206, "end_line": 241, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_One", "long_name": "PyArray_One( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 40, "complexity": 7, "token_count": 222, "parameters": [ "arr" ], "start_line": 244, "end_line": 287, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "do_sliced_copy", "long_name": "do_sliced_copy( char * dest , intp * dest_strides , intp * dest_dimensions , int dest_nd , char * src , intp * src_strides , intp * src_dimensions , int src_nd , int elsize , int copies)", "filename": "arrayobject.c", "nloc": 48, "complexity": 13, "token_count": 313, "parameters": [ "dest", "dest_strides", "dest_dimensions", "dest_nd", "src", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 293, "end_line": 343, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "optimize_slices", "long_name": "optimize_slices( intp ** dest_strides , intp ** dest_dimensions , int * dest_nd , intp ** src_strides , intp ** src_dimensions , int * src_nd , int * elsize , int * copies)", "filename": "arrayobject.c", "nloc": 32, "complexity": 8, "token_count": 214, "parameters": [ "dest_strides", "dest_dimensions", "dest_nd", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 366, "end_line": 397, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 400, "end_line": 434, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_INCREF", "long_name": "PyArray_INCREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 447, "end_line": 469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_XDECREF", "long_name": "PyArray_XDECREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 472, "end_line": 493, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "byte_swap_vector", "long_name": "byte_swap_vector( * p , int n , int size)", "filename": "arrayobject.c", "nloc": 38, "complexity": 10, "token_count": 340, "parameters": [ "p", "n", "size" ], "start_line": 497, "end_line": 535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "copy_and_swap", "long_name": "copy_and_swap( * dst , * src , int itemsize , intp numitems , intp srcstrides , int swap)", "filename": "arrayobject.c", "nloc": 18, "complexity": 5, "token_count": 120, "parameters": [ "dst", "src", "itemsize", "numitems", "srcstrides", "swap" ], "start_line": 540, "end_line": 560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "index2ptr", "long_name": "index2ptr( PyArrayObject * mp , int i)", "filename": "arrayobject.c", "nloc": 10, "complexity": 7, "token_count": 86, "parameters": [ "mp", "i" ], "start_line": 568, "end_line": 578, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Size", "long_name": "PyArray_Size( PyObject * op)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 33, "parameters": [ "op" ], "start_line": 581, "end_line": 589, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_CopyInto", "long_name": "PyArray_CopyInto( PyArrayObject * dest , PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 71, "complexity": 16, "token_count": 425, "parameters": [ "dest", "src" ], "start_line": 602, "end_line": 682, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 15, "complexity": 2, "token_count": 88, "parameters": [ "dest", "src_object" ], "start_line": 686, "end_line": 702, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndDataAndDescr", "long_name": "PyArray_FromDimsAndDataAndDescr( int nd , int * d , PyArray_Descr * descr , char * data)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 144, "parameters": [ "nd", "d", "descr", "data" ], "start_line": 710, "end_line": 731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 4, "token_count": 133, "parameters": [ "nd", "d", "type", "data" ], "start_line": 735, "end_line": 754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 129, "parameters": [ "nd", "d", "type" ], "start_line": 758, "end_line": 775, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 73, "parameters": [ "m1" ], "start_line": 781, "end_line": 793, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_Scalar", "long_name": "PyArray_Scalar( char * data , int type_num , int itemsize , int swap)", "filename": "arrayobject.c", "nloc": 48, "complexity": 8, "token_count": 289, "parameters": [ "data", "type_num", "itemsize", "swap" ], "start_line": 799, "end_line": 848, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyArray_ToScalar", "long_name": "PyArray_ToScalar( char * data , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 51, "parameters": [ "data", "arr" ], "start_line": 855, "end_line": 862, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_Return", "long_name": "PyArray_Return( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 85, "parameters": [ "mp" ], "start_line": 868, "end_line": 887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 27, "complexity": 5, "token_count": 158, "parameters": [ "type" ], "start_line": 898, "end_line": 926, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 936, "end_line": 979, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 87, "complexity": 16, "token_count": 571, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 983, "end_line": 1072, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "PyArray_ToList", "long_name": "PyArray_ToList( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 24, "complexity": 5, "token_count": 151, "parameters": [ "self" ], "start_line": 1075, "end_line": 1103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_ToString", "long_name": "PyArray_ToString( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 191, "parameters": [ "self" ], "start_line": 1106, "end_line": 1141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_dealloc", "long_name": "array_dealloc( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 20, "complexity": 7, "token_count": 144, "parameters": [ "self" ], "start_line": 1150, "end_line": 1187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_length", "long_name": "array_length( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 1194, "end_line": 1202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 146, "parameters": [ "self", "i" ], "start_line": 1206, "end_line": 1230, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_item_nice", "long_name": "array_item_nice( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "i" ], "start_line": 1233, "end_line": 1236, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_ass_item", "long_name": "array_ass_item( PyArrayObject * self , int i , PyObject * v)", "filename": "arrayobject.c", "nloc": 27, "complexity": 8, "token_count": 177, "parameters": [ "self", "i", "v" ], "start_line": 1240, "end_line": 1270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "slice_coerce_index", "long_name": "slice_coerce_index( PyObject * o , int * v)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "o", "v" ], "start_line": 1274, "end_line": 1282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "slice_GetIndices", "long_name": "slice_GetIndices( PySliceObject * r , int length , int * start , int * stop , int * step , intp * slicelength)", "filename": "arrayobject.c", "nloc": 45, "complexity": 24, "token_count": 376, "parameters": [ "r", "length", "start", "stop", "step", "slicelength" ], "start_line": 1288, "end_line": 1338, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "parse_subindex", "long_name": "parse_subindex( PyObject * op , int * step_size , intp * n_steps , int max)", "filename": "arrayobject.c", "nloc": 45, "complexity": 11, "token_count": 223, "parameters": [ "op", "step_size", "n_steps", "max" ], "start_line": 1345, "end_line": 1390, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "parse_index", "long_name": "parse_index( PyArrayObject * self , PyObject * op , intp * dimensions , intp * strides , intp * offset_ptr)", "filename": "arrayobject.c", "nloc": 89, "complexity": 20, "token_count": 540, "parameters": [ "self", "op", "dimensions", "strides", "offset_ptr" ], "start_line": 1394, "end_line": 1489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "_swap_axes", "long_name": "_swap_axes( PyArrayMapIterObject * mit , PyArrayObject ** ret)", "filename": "arrayobject.c", "nloc": 24, "complexity": 4, "token_count": 187, "parameters": [ "mit", "ret" ], "start_line": 1492, "end_line": 1526, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 248, "parameters": [ "mit" ], "start_line": 1531, "end_line": 1581, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "PyArray_SetMap", "long_name": "PyArray_SetMap( PyArrayMapIterObject * mit , PyObject * op)", "filename": "arrayobject.c", "nloc": 50, "complexity": 12, "token_count": 392, "parameters": [ "mit", "op" ], "start_line": 1584, "end_line": 1643, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 421, "parameters": [ "self", "op" ], "start_line": 1664, "end_line": 1739, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "array_ass_sub", "long_name": "array_ass_sub( PyArrayObject * self , PyObject * index , PyObject * op)", "filename": "arrayobject.c", "nloc": 43, "complexity": 9, "token_count": 251, "parameters": [ "self", "index", "op" ], "start_line": 1752, "end_line": 1804, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "array_subscript_nice", "long_name": "array_subscript_nice( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "self", "op" ], "start_line": 1812, "end_line": 1815, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_getsegcount", "long_name": "array_getsegcount( PyArrayObject * self , int * lenp)", "filename": "arrayobject.c", "nloc": 11, "complexity": 4, "token_count": 48, "parameters": [ "self", "lenp" ], "start_line": 1834, "end_line": 1846, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_getreadbuf", "long_name": "array_getreadbuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 72, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1849, "end_line": 1864, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_getwritebuf", "long_name": "array_getwritebuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1868, "end_line": 1877, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_getcharbuf", "long_name": "array_getcharbuf( PyArrayObject * self , int segment , const char ** ptrptr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 3, "token_count": 65, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1880, "end_line": 1891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_SetNumericOps", "long_name": "PyArray_SetNumericOps( PyObject * dict)", "filename": "arrayobject.c", "nloc": 34, "complexity": 1, "token_count": 162, "parameters": [ "dict" ], "start_line": 1959, "end_line": 1992, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_GetNumericOps", "long_name": "PyArray_GetNumericOps()", "filename": "arrayobject.c", "nloc": 39, "complexity": 2, "token_count": 183, "parameters": [], "start_line": 1998, "end_line": 2037, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_GenericReduceFunction", "long_name": "PyArray_GenericReduceFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2040, "end_line": 2059, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericAccumulateFunction", "long_name": "PyArray_GenericAccumulateFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2063, "end_line": 2082, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericBinaryFunction", "long_name": "PyArray_GenericBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 69, "parameters": [ "m1", "m2", "op" ], "start_line": 2086, "end_line": 2097, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericUnaryFunction", "long_name": "PyArray_GenericUnaryFunction( PyArrayObject * m1 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 63, "parameters": [ "m1", "op" ], "start_line": 2100, "end_line": 2111, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericInplaceBinaryFunction", "long_name": "PyArray_GenericInplaceBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 13, "complexity": 2, "token_count": 71, "parameters": [ "m1", "m2", "op" ], "start_line": 2114, "end_line": 2126, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_add", "long_name": "array_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2129, "end_line": 2132, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_subtract", "long_name": "array_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2135, "end_line": 2138, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_multiply", "long_name": "array_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2141, "end_line": 2144, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_divide", "long_name": "array_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2147, "end_line": 2150, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_remainder", "long_name": "array_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2153, "end_line": 2156, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_power", "long_name": "array_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2159, "end_line": 2162, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_negative", "long_name": "array_negative( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2165, "end_line": 2168, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_absolute", "long_name": "array_absolute( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2171, "end_line": 2174, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_invert", "long_name": "array_invert( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2177, "end_line": 2180, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_left_shift", "long_name": "array_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2183, "end_line": 2186, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_right_shift", "long_name": "array_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2189, "end_line": 2192, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_and", "long_name": "array_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2195, "end_line": 2198, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_or", "long_name": "array_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2201, "end_line": 2204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_xor", "long_name": "array_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2207, "end_line": 2210, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_add", "long_name": "array_inplace_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2213, "end_line": 2216, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_subtract", "long_name": "array_inplace_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2219, "end_line": 2222, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_multiply", "long_name": "array_inplace_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2225, "end_line": 2228, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_divide", "long_name": "array_inplace_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2231, "end_line": 2234, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_remainder", "long_name": "array_inplace_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2237, "end_line": 2240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_power", "long_name": "array_inplace_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2243, "end_line": 2246, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_left_shift", "long_name": "array_inplace_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2249, "end_line": 2252, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_right_shift", "long_name": "array_inplace_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2255, "end_line": 2258, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_and", "long_name": "array_inplace_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2261, "end_line": 2264, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_or", "long_name": "array_inplace_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2267, "end_line": 2270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_xor", "long_name": "array_inplace_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2273, "end_line": 2276, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_floor_divide", "long_name": "array_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2279, "end_line": 2282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_TRUE_divide", "long_name": "array_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2285, "end_line": 2288, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_floor_divide", "long_name": "array_inplace_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2291, "end_line": 2295, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_inplace_TRUE_divide", "long_name": "array_inplace_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2298, "end_line": 2302, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_all_nonzero", "long_name": "array_all_nonzero( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 93, "parameters": [ "mp" ], "start_line": 2306, "end_line": 2324, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_divmod", "long_name": "array_divmod( PyArrayObject * op1 , PyObject * op2)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 89, "parameters": [ "op1", "op2" ], "start_line": 2327, "end_line": 2342, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_int", "long_name": "array_int( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2346, "end_line": 2372, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_float", "long_name": "array_float( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2375, "end_line": 2400, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_long", "long_name": "array_long( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2403, "end_line": 2425, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_oct", "long_name": "array_oct( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2428, "end_line": 2450, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_hex", "long_name": "array_hex( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2453, "end_line": 2475, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "_array_copy_nice", "long_name": "_array_copy_nice( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 22, "parameters": [ "self" ], "start_line": 2478, "end_line": 2482, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 254, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2543, "end_line": 2581, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_ass_slice", "long_name": "array_ass_slice( PyArrayObject * self , int ilow , int ihigh , PyObject * v)", "filename": "arrayobject.c", "nloc": 20, "complexity": 4, "token_count": 108, "parameters": [ "self", "ilow", "ihigh", "v" ], "start_line": 2585, "end_line": 2606, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_contains", "long_name": "array_contains( PyArrayObject * self , PyObject * el)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "el" ], "start_line": 2609, "end_line": 2614, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "dump_data", "long_name": "dump_data( char ** string , int * n , int * max_n , char * data , int nd , intp * dimensions , intp * strides , PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 41, "complexity": 7, "token_count": 308, "parameters": [ "string", "n", "max_n", "data", "nd", "dimensions", "strides", "self" ], "start_line": 2635, "end_line": 2682, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "array_repr_builtin", "long_name": "array_repr_builtin( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 30, "complexity": 4, "token_count": 222, "parameters": [ "self" ], "start_line": 2685, "end_line": 2721, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_SetStringFunction", "long_name": "PyArray_SetStringFunction( PyObject * op , int repr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 48, "parameters": [ "op", "repr" ], "start_line": 2727, "end_line": 2744, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2747, "end_line": 2759, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2762, "end_line": 2774, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_richcompare", "long_name": "array_richcompare( PyArrayObject * self , PyObject * other , int cmp_op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 13, "token_count": 273, "parameters": [ "self", "other", "cmp_op" ], "start_line": 2778, "end_line": 2855, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 78, "top_nesting_level": 0 }, { "name": "_check_axis", "long_name": "_check_axis( PyArrayObject * arr , int * axis , int flags)", "filename": "arrayobject.c", "nloc": 29, "complexity": 8, "token_count": 164, "parameters": [ "arr", "axis", "flags" ], "start_line": 2858, "end_line": 2887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyArray_IntTupleFromIntp", "long_name": "PyArray_IntTupleFromIntp( int len , intp * vals)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 91, "parameters": [ "len", "vals" ], "start_line": 2893, "end_line": 2909, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_IntpFromSequence", "long_name": "PyArray_IntpFromSequence( PyObject * seq , intp * vals , int maxvals)", "filename": "arrayobject.c", "nloc": 21, "complexity": 7, "token_count": 161, "parameters": [ "seq", "vals", "maxvals" ], "start_line": 2914, "end_line": 2937, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "_IsContiguous", "long_name": "_IsContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 109, "parameters": [ "ap" ], "start_line": 2943, "end_line": 2959, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsFortranContiguous", "long_name": "_IsFortranContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 107, "parameters": [ "ap" ], "start_line": 2963, "end_line": 2979, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsAligned", "long_name": "_IsAligned( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 110, "parameters": [ "ap" ], "start_line": 2983, "end_line": 2999, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsWriteable", "long_name": "_IsWriteable( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 16, "complexity": 8, "token_count": 109, "parameters": [ "ap" ], "start_line": 3002, "end_line": 3035, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_UpdateFlags", "long_name": "PyArray_UpdateFlags( PyArrayObject * ret , int flagmask)", "filename": "arrayobject.c", "nloc": 22, "complexity": 9, "token_count": 129, "parameters": [ "ret", "flagmask" ], "start_line": 3039, "end_line": 3061, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_CheckStrides", "long_name": "PyArray_CheckStrides( int elsize , int nd , intp numbytes , intp * dims , intp * newstrides)", "filename": "arrayobject.c", "nloc": 13, "complexity": 4, "token_count": 84, "parameters": [ "elsize", "nd", "numbytes", "dims", "newstrides" ], "start_line": 3068, "end_line": 3083, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "_array_fill_strides", "long_name": "_array_fill_strides( intp * strides , intp * dims , int nd , intp itemsize , int inflag , int * objflags)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 171, "parameters": [ "strides", "dims", "nd", "itemsize", "inflag", "objflags" ], "start_line": 3103, "end_line": 3127, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyArrayObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 676, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3131, "end_line": 3275, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "PyArray_Resize", "long_name": "PyArray_Resize( PyArrayObject * self , PyArray_Dims * newshape)", "filename": "arrayobject.c", "nloc": 87, "complexity": 15, "token_count": 501, "parameters": [ "self", "newshape" ], "start_line": 3280, "end_line": 3385, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_FillObjectArray", "long_name": "PyArray_FillObjectArray( PyArrayObject * arr , PyObject * obj)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 98, "parameters": [ "arr", "obj" ], "start_line": 3389, "end_line": 3406, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_new", "long_name": "array_new( PyTypeObject * subtype , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 100, "complexity": 20, "token_count": 593, "parameters": [ "subtype", "args", "kwds" ], "start_line": 3410, "end_line": 3525, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 116, "top_nesting_level": 0 }, { "name": "array_ndim_get", "long_name": "array_ndim_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 3532, "end_line": 3535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flags_get", "long_name": "array_flags_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 10, "complexity": 3, "token_count": 55, "parameters": [ "self" ], "start_line": 3538, "end_line": 3548, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_shape_get", "long_name": "array_shape_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3621, "end_line": 3624, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_shape_set", "long_name": "array_shape_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 33, "complexity": 6, "token_count": 206, "parameters": [ "self", "val" ], "start_line": 3628, "end_line": 3662, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_strides_get", "long_name": "array_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3666, "end_line": 3669, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_strides_set", "long_name": "array_strides_set( PyArrayObject * self , PyObject * obj)", "filename": "arrayobject.c", "nloc": 32, "complexity": 7, "token_count": 209, "parameters": [ "self", "obj" ], "start_line": 3672, "end_line": 3705, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_protocol_strides_get", "long_name": "array_protocol_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 35, "parameters": [ "self" ], "start_line": 3709, "end_line": 3716, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_priority_get", "long_name": "array_priority_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 3, "token_count": 42, "parameters": [ "self" ], "start_line": 3719, "end_line": 3727, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_data_get", "long_name": "array_data_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 82, "parameters": [ "self" ], "start_line": 3731, "end_line": 3745, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_data_set", "long_name": "array_data_set( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 44, "complexity": 9, "token_count": 229, "parameters": [ "self", "op" ], "start_line": 3748, "end_line": 3792, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "array_itemsize_get", "long_name": "array_itemsize_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 3796, "end_line": 3799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_size_get", "long_name": "array_size_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "self" ], "start_line": 3802, "end_line": 3809, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typechar_get", "long_name": "array_typechar_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 47, "parameters": [ "self" ], "start_line": 3813, "end_line": 3820, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typestr_get", "long_name": "array_typestr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 7, "token_count": 141, "parameters": [ "self" ], "start_line": 3823, "end_line": 3843, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_descr_get", "long_name": "array_descr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 128, "parameters": [ "self" ], "start_line": 3846, "end_line": 3868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_typenum_get", "long_name": "array_typenum_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 3871, "end_line": 3874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_get", "long_name": "array_type_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 3878, "end_line": 3881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_set", "long_name": "array_type_set( PyArrayObject * self , PyObject * arg)", "filename": "arrayobject.c", "nloc": 41, "complexity": 10, "token_count": 294, "parameters": [ "self", "arg" ], "start_line": 3893, "end_line": 3951, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "array_base_get", "long_name": "array_base_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 41, "parameters": [ "self" ], "start_line": 3956, "end_line": 3966, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 125, "parameters": [ "self" ], "start_line": 3970, "end_line": 3995, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 173, "parameters": [ "self", "val" ], "start_line": 3999, "end_line": 4031, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 33, "complexity": 3, "token_count": 186, "parameters": [ "self" ], "start_line": 4034, "end_line": 4067, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 199, "parameters": [ "self", "val" ], "start_line": 4070, "end_line": 4107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_flat_get", "long_name": "array_flat_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 4110, "end_line": 4113, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 50, "complexity": 9, "token_count": 358, "parameters": [ "self", "val" ], "start_line": 4116, "end_line": 4168, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "discover_depth", "long_name": "discover_depth( PyObject * s , int max , int stop_at_string)", "filename": "arrayobject.c", "nloc": 23, "complexity": 14, "token_count": 169, "parameters": [ "s", "max", "stop_at_string" ], "start_line": 4344, "end_line": 4369, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "discover_itemsize", "long_name": "discover_itemsize( PyObject * s , int nd , int * itemsize)", "filename": "arrayobject.c", "nloc": 21, "complexity": 9, "token_count": 161, "parameters": [ "s", "nd", "itemsize" ], "start_line": 4372, "end_line": 4394, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "discover_dimensions", "long_name": "discover_dimensions( PyObject * s , int nd , intp * d , int check_it)", "filename": "arrayobject.c", "nloc": 24, "complexity": 10, "token_count": 188, "parameters": [ "s", "nd", "d", "check_it" ], "start_line": 4401, "end_line": 4427, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_array_small_type", "long_name": "_array_small_type( int chktype , int mintype , int chksize , int minsize , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 100, "parameters": [ "chktype", "mintype", "chksize", "minsize", "outtype" ], "start_line": 4430, "end_line": 4450, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 123, "complexity": 28, "token_count": 661, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4453, "end_line": 4591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "Assign_Array", "long_name": "Assign_Array( PyArrayObject * self , PyObject * v)", "filename": "arrayobject.c", "nloc": 21, "complexity": 6, "token_count": 121, "parameters": [ "self", "v" ], "start_line": 4594, "end_line": 4617, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromScalar", "long_name": "Array_FromScalar( PyObject * op , PyArray_Typecode * typecode)", "filename": "arrayobject.c", "nloc": 19, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode" ], "start_line": 4621, "end_line": 4644, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromSequence", "long_name": "Array_FromSequence( PyObject * s , PyArray_Typecode * typecode , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 51, "complexity": 17, "token_count": 313, "parameters": [ "s", "typecode", "min_depth", "max_depth" ], "start_line": 4648, "end_line": 4705, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_ValidType", "long_name": "PyArray_ValidType( int type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 2, "token_count": 30, "parameters": [ "type" ], "start_line": 4709, "end_line": 4716, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "_bufferedcast", "long_name": "_bufferedcast( PyArrayObject * out , PyArrayObject * in)", "filename": "arrayobject.c", "nloc": 75, "complexity": 16, "token_count": 477, "parameters": [ "out", "in" ], "start_line": 4722, "end_line": 4812, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "PyArray_Cast", "long_name": "PyArray_Cast( PyArrayObject * mp , int type_num)", "filename": "arrayobject.c", "nloc": 10, "complexity": 1, "token_count": 56, "parameters": [ "mp", "type_num" ], "start_line": 4818, "end_line": 4829, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 229, "parameters": [ "mp", "at" ], "start_line": 4832, "end_line": 4867, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_CastTo", "long_name": "PyArray_CastTo( PyArrayObject * out , PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 40, "complexity": 10, "token_count": 214, "parameters": [ "out", "mp" ], "start_line": 4874, "end_line": 4920, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 77, "complexity": 26, "token_count": 508, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4923, "end_line": 5013, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "_array_typecode_fromstr", "long_name": "_array_typecode_fromstr( char * str , int * swap , PyArray_Typecode * type)", "filename": "arrayobject.c", "nloc": 94, "complexity": 36, "token_count": 533, "parameters": [ "str", "swap", "type" ], "start_line": 5017, "end_line": 5122, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5125, "end_line": 5219, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_fromattr", "long_name": "array_fromattr( PyObject * op , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 21, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode", "flags" ], "start_line": 5222, "end_line": 5243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_fromobject", "long_name": "array_fromobject( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int flags)", "filename": "arrayobject.c", "nloc": 46, "complexity": 13, "token_count": 270, "parameters": [ "op", "typecode", "min_depth", "max_depth", "flags" ], "start_line": 5247, "end_line": 5309, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_ArrayType", "long_name": "PyArray_ArrayType( PyObject * op , PyArray_Typecode * intype , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 29, "parameters": [ "op", "intype", "outtype" ], "start_line": 5312, "end_line": 5317, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ObjectType", "long_name": "PyArray_ObjectType( PyObject * op , int minimum_type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 40, "parameters": [ "op", "minimum_type" ], "start_line": 5320, "end_line": 5326, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_FromAny", "long_name": "PyArray_FromAny( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int requires)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 165, "parameters": [ "op", "typecode", "min_depth", "max_depth", "requires" ], "start_line": 5380, "end_line": 5410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "PyArray_EnsureArray", "long_name": "PyArray_EnsureArray( PyObject * op)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 82, "parameters": [ "op" ], "start_line": 5420, "end_line": 5436, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5442, "end_line": 5447, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5450, "end_line": 5456, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5459, "end_line": 5465, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_CanCastSafely", "long_name": "PyArray_CanCastSafely( int fromtype , int totype)", "filename": "arrayobject.c", "nloc": 69, "complexity": 35, "token_count": 386, "parameters": [ "fromtype", "totype" ], "start_line": 5471, "end_line": 5542, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_CanCastTo", "long_name": "PyArray_CanCastTo( PyArray_Typecode * from , PyArray_Typecode * to)", "filename": "arrayobject.c", "nloc": 24, "complexity": 7, "token_count": 134, "parameters": [ "from", "to" ], "start_line": 5545, "end_line": 5569, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_IterNew", "long_name": "PyArray_IterNew( PyObject * obj)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 258, "parameters": [ "obj" ], "start_line": 5579, "end_line": 5616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "arrayiter_next", "long_name": "arrayiter_next( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "it" ], "start_line": 5621, "end_line": 5631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "arrayiter_dealloc", "long_name": "arrayiter_dealloc( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 25, "parameters": [ "it" ], "start_line": 5634, "end_line": 5639, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "arrayiter_traverse", "long_name": "arrayiter_traverse( PyArrayIterObject * it , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 6, "complexity": 2, "token_count": 42, "parameters": [ "it", "visit", "arg" ], "start_line": 5642, "end_line": 5647, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "iter_length", "long_name": "iter_length( PyArrayIterObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 5651, "end_line": 5654, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 268, "parameters": [ "self", "ind" ], "start_line": 5658, "end_line": 5706, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 50, "complexity": 8, "token_count": 337, "parameters": [ "self", "ind" ], "start_line": 5709, "end_line": 5761, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 585, "parameters": [ "self", "ind" ], "start_line": 5765, "end_line": 5884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "iter_ass_sub_Bool", "long_name": "iter_ass_sub_Bool( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 31, "complexity": 5, "token_count": 176, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5888, "end_line": 5920, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 41, "complexity": 8, "token_count": 283, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5923, "end_line": 5964, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_ass_subscript", "long_name": "iter_ass_subscript( PyArrayIterObject * self , PyObject * ind , PyObject * val)", "filename": "arrayobject.c", "nloc": 103, "complexity": 24, "token_count": 636, "parameters": [ "self", "ind", "val" ], "start_line": 5968, "end_line": 6090, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 29, "complexity": 5, "token_count": 213, "parameters": [ "it", "op" ], "start_line": 6103, "end_line": 6144, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_copy", "long_name": "iter_copy( PyArrayIterObject * it , PyObject * args)", "filename": "arrayobject.c", "nloc": 5, "complexity": 2, "token_count": 35, "parameters": [ "it", "args" ], "start_line": 6149, "end_line": 6153, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "fancy_indexing_check", "long_name": "fancy_indexing_check( PyObject * args)", "filename": "arrayobject.c", "nloc": 55, "complexity": 22, "token_count": 293, "parameters": [ "args" ], "start_line": 6218, "end_line": 6279, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 62, "top_nesting_level": 0 }, { "name": "_convert_obj", "long_name": "_convert_obj( PyObject * obj , PyArrayIterObject ** iter)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 105, "parameters": [ "obj", "iter" ], "start_line": 6287, "end_line": 6302, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyArray_Broadcast", "long_name": "PyArray_Broadcast( PyArrayMultiIterObject * mit)", "filename": "arrayobject.c", "nloc": 58, "complexity": 13, "token_count": 464, "parameters": [ "mit" ], "start_line": 6308, "end_line": 6377, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterReset", "long_name": "PyArray_MapIterReset( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 35, "complexity": 4, "token_count": 261, "parameters": [ "mit" ], "start_line": 6381, "end_line": 6417, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNext", "long_name": "PyArray_MapIterNext( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 41, "complexity": 6, "token_count": 296, "parameters": [ "mit" ], "start_line": 6423, "end_line": 6467, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 682, "parameters": [ "mit", "arr" ], "start_line": 6485, "end_line": 6621, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "_nonzero_indices", "long_name": "_nonzero_indices( PyObject * myBool , PyArrayIterObject ** iters)", "filename": "arrayobject.c", "nloc": 57, "complexity": 15, "token_count": 454, "parameters": [ "myBool", "iters" ], "start_line": 6627, "end_line": 6696, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNew", "long_name": "PyArray_MapIterNew( PyObject * indexobj)", "filename": "arrayobject.c", "nloc": 111, "complexity": 24, "token_count": 745, "parameters": [ "indexobj" ], "start_line": 6699, "end_line": 6832, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 134, "top_nesting_level": 0 }, { "name": "arraymapiter_new", "long_name": "arraymapiter_new( PyTypeObject * type , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 130, "parameters": [ "type", "args", "kwds" ], "start_line": 6838, "end_line": 6868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "arraymapiter_next", "long_name": "arraymapiter_next( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 12, "complexity": 4, "token_count": 70, "parameters": [ "mit" ], "start_line": 6874, "end_line": 6885, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "arraymapiter_dealloc", "long_name": "arraymapiter_dealloc( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 60, "parameters": [ "mit" ], "start_line": 6888, "end_line": 6897, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "arraymapiter_traverse", "long_name": "arraymapiter_traverse( PyArrayMapIterObject * mit , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 16, "complexity": 9, "token_count": 146, "parameters": [ "mit", "visit", "arg" ], "start_line": 6900, "end_line": 6918, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyArray_PyIntAsIntp", "long_name": "PyArray_PyIntAsIntp( PyObject * o)", "filename": "arrayobject.c", "nloc": 59, "complexity": 19, "token_count": 385, "parameters": [ "o" ], "start_line": 40, "end_line": 103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "PyArray_PyIntAsInt", "long_name": "PyArray_PyIntAsInt( PyObject * o)", "filename": "arrayobject.c", "nloc": 57, "complexity": 19, "token_count": 389, "parameters": [ "o" ], "start_line": 109, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 81, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_Zero", "long_name": "PyArray_Zero( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 190, "parameters": [ "arr" ], "start_line": 206, "end_line": 241, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_One", "long_name": "PyArray_One( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 40, "complexity": 7, "token_count": 222, "parameters": [ "arr" ], "start_line": 244, "end_line": 287, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "do_sliced_copy", "long_name": "do_sliced_copy( char * dest , intp * dest_strides , intp * dest_dimensions , int dest_nd , char * src , intp * src_strides , intp * src_dimensions , int src_nd , int elsize , int copies)", "filename": "arrayobject.c", "nloc": 48, "complexity": 13, "token_count": 313, "parameters": [ "dest", "dest_strides", "dest_dimensions", "dest_nd", "src", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 293, "end_line": 343, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "optimize_slices", "long_name": "optimize_slices( intp ** dest_strides , intp ** dest_dimensions , int * dest_nd , intp ** src_strides , intp ** src_dimensions , int * src_nd , int * elsize , int * copies)", "filename": "arrayobject.c", "nloc": 32, "complexity": 8, "token_count": 214, "parameters": [ "dest_strides", "dest_dimensions", "dest_nd", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 366, "end_line": 397, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 400, "end_line": 434, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_INCREF", "long_name": "PyArray_INCREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 447, "end_line": 469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_XDECREF", "long_name": "PyArray_XDECREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 472, "end_line": 493, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "byte_swap_vector", "long_name": "byte_swap_vector( * p , int n , int size)", "filename": "arrayobject.c", "nloc": 38, "complexity": 10, "token_count": 340, "parameters": [ "p", "n", "size" ], "start_line": 497, "end_line": 535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "copy_and_swap", "long_name": "copy_and_swap( * dst , * src , int itemsize , intp numitems , intp srcstrides , int swap)", "filename": "arrayobject.c", "nloc": 18, "complexity": 5, "token_count": 120, "parameters": [ "dst", "src", "itemsize", "numitems", "srcstrides", "swap" ], "start_line": 540, "end_line": 560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "index2ptr", "long_name": "index2ptr( PyArrayObject * mp , int i)", "filename": "arrayobject.c", "nloc": 10, "complexity": 7, "token_count": 86, "parameters": [ "mp", "i" ], "start_line": 568, "end_line": 578, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Size", "long_name": "PyArray_Size( PyObject * op)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 33, "parameters": [ "op" ], "start_line": 581, "end_line": 589, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_CopyInto", "long_name": "PyArray_CopyInto( PyArrayObject * dest , PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 71, "complexity": 16, "token_count": 425, "parameters": [ "dest", "src" ], "start_line": 602, "end_line": 682, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 15, "complexity": 2, "token_count": 88, "parameters": [ "dest", "src_object" ], "start_line": 686, "end_line": 702, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndDataAndDescr", "long_name": "PyArray_FromDimsAndDataAndDescr( int nd , int * d , PyArray_Descr * descr , char * data)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 144, "parameters": [ "nd", "d", "descr", "data" ], "start_line": 710, "end_line": 731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 4, "token_count": 133, "parameters": [ "nd", "d", "type", "data" ], "start_line": 735, "end_line": 754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 129, "parameters": [ "nd", "d", "type" ], "start_line": 758, "end_line": 775, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 73, "parameters": [ "m1" ], "start_line": 781, "end_line": 793, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_Scalar", "long_name": "PyArray_Scalar( char * data , int type_num , int itemsize , int swap)", "filename": "arrayobject.c", "nloc": 48, "complexity": 8, "token_count": 289, "parameters": [ "data", "type_num", "itemsize", "swap" ], "start_line": 799, "end_line": 848, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyArray_ToScalar", "long_name": "PyArray_ToScalar( char * data , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 51, "parameters": [ "data", "arr" ], "start_line": 855, "end_line": 862, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_Return", "long_name": "PyArray_Return( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 85, "parameters": [ "mp" ], "start_line": 868, "end_line": 887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 27, "complexity": 5, "token_count": 158, "parameters": [ "type" ], "start_line": 898, "end_line": 926, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 936, "end_line": 979, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 87, "complexity": 16, "token_count": 571, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 983, "end_line": 1072, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "PyArray_ToList", "long_name": "PyArray_ToList( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 24, "complexity": 5, "token_count": 151, "parameters": [ "self" ], "start_line": 1075, "end_line": 1103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_ToString", "long_name": "PyArray_ToString( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 191, "parameters": [ "self" ], "start_line": 1106, "end_line": 1141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_dealloc", "long_name": "array_dealloc( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 20, "complexity": 7, "token_count": 144, "parameters": [ "self" ], "start_line": 1150, "end_line": 1187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_length", "long_name": "array_length( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 1194, "end_line": 1202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 146, "parameters": [ "self", "i" ], "start_line": 1206, "end_line": 1230, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_item_nice", "long_name": "array_item_nice( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "i" ], "start_line": 1233, "end_line": 1236, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_ass_item", "long_name": "array_ass_item( PyArrayObject * self , int i , PyObject * v)", "filename": "arrayobject.c", "nloc": 27, "complexity": 8, "token_count": 177, "parameters": [ "self", "i", "v" ], "start_line": 1240, "end_line": 1270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "slice_coerce_index", "long_name": "slice_coerce_index( PyObject * o , int * v)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "o", "v" ], "start_line": 1274, "end_line": 1282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "slice_GetIndices", "long_name": "slice_GetIndices( PySliceObject * r , int length , int * start , int * stop , int * step , intp * slicelength)", "filename": "arrayobject.c", "nloc": 45, "complexity": 24, "token_count": 376, "parameters": [ "r", "length", "start", "stop", "step", "slicelength" ], "start_line": 1288, "end_line": 1338, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "parse_subindex", "long_name": "parse_subindex( PyObject * op , int * step_size , intp * n_steps , int max)", "filename": "arrayobject.c", "nloc": 45, "complexity": 11, "token_count": 223, "parameters": [ "op", "step_size", "n_steps", "max" ], "start_line": 1345, "end_line": 1390, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "parse_index", "long_name": "parse_index( PyArrayObject * self , PyObject * op , intp * dimensions , intp * strides , intp * offset_ptr)", "filename": "arrayobject.c", "nloc": 89, "complexity": 20, "token_count": 540, "parameters": [ "self", "op", "dimensions", "strides", "offset_ptr" ], "start_line": 1394, "end_line": 1489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "_swap_axes", "long_name": "_swap_axes( PyArrayMapIterObject * mit , PyArrayObject ** ret)", "filename": "arrayobject.c", "nloc": 24, "complexity": 4, "token_count": 187, "parameters": [ "mit", "ret" ], "start_line": 1492, "end_line": 1526, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 248, "parameters": [ "mit" ], "start_line": 1531, "end_line": 1581, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "PyArray_SetMap", "long_name": "PyArray_SetMap( PyArrayMapIterObject * mit , PyObject * op)", "filename": "arrayobject.c", "nloc": 50, "complexity": 12, "token_count": 392, "parameters": [ "mit", "op" ], "start_line": 1584, "end_line": 1643, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 421, "parameters": [ "self", "op" ], "start_line": 1664, "end_line": 1739, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "array_ass_sub", "long_name": "array_ass_sub( PyArrayObject * self , PyObject * index , PyObject * op)", "filename": "arrayobject.c", "nloc": 43, "complexity": 9, "token_count": 251, "parameters": [ "self", "index", "op" ], "start_line": 1752, "end_line": 1804, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "array_subscript_nice", "long_name": "array_subscript_nice( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "self", "op" ], "start_line": 1812, "end_line": 1815, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_getsegcount", "long_name": "array_getsegcount( PyArrayObject * self , int * lenp)", "filename": "arrayobject.c", "nloc": 11, "complexity": 4, "token_count": 48, "parameters": [ "self", "lenp" ], "start_line": 1834, "end_line": 1846, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_getreadbuf", "long_name": "array_getreadbuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 72, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1849, "end_line": 1864, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_getwritebuf", "long_name": "array_getwritebuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1868, "end_line": 1877, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_getcharbuf", "long_name": "array_getcharbuf( PyArrayObject * self , int segment , const char ** ptrptr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 3, "token_count": 65, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1880, "end_line": 1891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_SetNumericOps", "long_name": "PyArray_SetNumericOps( PyObject * dict)", "filename": "arrayobject.c", "nloc": 34, "complexity": 1, "token_count": 162, "parameters": [ "dict" ], "start_line": 1959, "end_line": 1992, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_GetNumericOps", "long_name": "PyArray_GetNumericOps()", "filename": "arrayobject.c", "nloc": 39, "complexity": 2, "token_count": 183, "parameters": [], "start_line": 1998, "end_line": 2037, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_GenericReduceFunction", "long_name": "PyArray_GenericReduceFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2040, "end_line": 2059, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericAccumulateFunction", "long_name": "PyArray_GenericAccumulateFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2063, "end_line": 2082, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericBinaryFunction", "long_name": "PyArray_GenericBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 69, "parameters": [ "m1", "m2", "op" ], "start_line": 2086, "end_line": 2097, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericUnaryFunction", "long_name": "PyArray_GenericUnaryFunction( PyArrayObject * m1 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 63, "parameters": [ "m1", "op" ], "start_line": 2100, "end_line": 2111, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericInplaceBinaryFunction", "long_name": "PyArray_GenericInplaceBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 13, "complexity": 2, "token_count": 71, "parameters": [ "m1", "m2", "op" ], "start_line": 2114, "end_line": 2126, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_add", "long_name": "array_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2129, "end_line": 2132, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_subtract", "long_name": "array_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2135, "end_line": 2138, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_multiply", "long_name": "array_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2141, "end_line": 2144, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_divide", "long_name": "array_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2147, "end_line": 2150, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_remainder", "long_name": "array_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2153, "end_line": 2156, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_power", "long_name": "array_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2159, "end_line": 2162, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_negative", "long_name": "array_negative( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2165, "end_line": 2168, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_absolute", "long_name": "array_absolute( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2171, "end_line": 2174, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_invert", "long_name": "array_invert( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2177, "end_line": 2180, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_left_shift", "long_name": "array_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2183, "end_line": 2186, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_right_shift", "long_name": "array_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2189, "end_line": 2192, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_and", "long_name": "array_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2195, "end_line": 2198, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_or", "long_name": "array_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2201, "end_line": 2204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_xor", "long_name": "array_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2207, "end_line": 2210, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_add", "long_name": "array_inplace_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2213, "end_line": 2216, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_subtract", "long_name": "array_inplace_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2219, "end_line": 2222, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_multiply", "long_name": "array_inplace_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2225, "end_line": 2228, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_divide", "long_name": "array_inplace_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2231, "end_line": 2234, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_remainder", "long_name": "array_inplace_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2237, "end_line": 2240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_power", "long_name": "array_inplace_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2243, "end_line": 2246, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_left_shift", "long_name": "array_inplace_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2249, "end_line": 2252, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_right_shift", "long_name": "array_inplace_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2255, "end_line": 2258, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_and", "long_name": "array_inplace_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2261, "end_line": 2264, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_or", "long_name": "array_inplace_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2267, "end_line": 2270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_xor", "long_name": "array_inplace_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2273, "end_line": 2276, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_floor_divide", "long_name": "array_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2279, "end_line": 2282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_TRUE_divide", "long_name": "array_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2285, "end_line": 2288, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_floor_divide", "long_name": "array_inplace_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2291, "end_line": 2295, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_inplace_TRUE_divide", "long_name": "array_inplace_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2298, "end_line": 2302, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_all_nonzero", "long_name": "array_all_nonzero( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 93, "parameters": [ "mp" ], "start_line": 2306, "end_line": 2324, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_divmod", "long_name": "array_divmod( PyArrayObject * op1 , PyObject * op2)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 89, "parameters": [ "op1", "op2" ], "start_line": 2327, "end_line": 2342, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_int", "long_name": "array_int( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2346, "end_line": 2372, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_float", "long_name": "array_float( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2375, "end_line": 2400, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_long", "long_name": "array_long( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2403, "end_line": 2425, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_oct", "long_name": "array_oct( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2428, "end_line": 2450, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_hex", "long_name": "array_hex( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2453, "end_line": 2475, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "_array_copy_nice", "long_name": "_array_copy_nice( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 22, "parameters": [ "self" ], "start_line": 2478, "end_line": 2482, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 254, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2543, "end_line": 2581, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_ass_slice", "long_name": "array_ass_slice( PyArrayObject * self , int ilow , int ihigh , PyObject * v)", "filename": "arrayobject.c", "nloc": 20, "complexity": 4, "token_count": 108, "parameters": [ "self", "ilow", "ihigh", "v" ], "start_line": 2585, "end_line": 2606, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_contains", "long_name": "array_contains( PyArrayObject * self , PyObject * el)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "el" ], "start_line": 2609, "end_line": 2614, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "dump_data", "long_name": "dump_data( char ** string , int * n , int * max_n , char * data , int nd , intp * dimensions , intp * strides , PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 41, "complexity": 7, "token_count": 308, "parameters": [ "string", "n", "max_n", "data", "nd", "dimensions", "strides", "self" ], "start_line": 2635, "end_line": 2682, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "array_repr_builtin", "long_name": "array_repr_builtin( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 30, "complexity": 4, "token_count": 222, "parameters": [ "self" ], "start_line": 2685, "end_line": 2721, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_SetStringFunction", "long_name": "PyArray_SetStringFunction( PyObject * op , int repr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 48, "parameters": [ "op", "repr" ], "start_line": 2727, "end_line": 2744, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2747, "end_line": 2759, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2762, "end_line": 2774, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_richcompare", "long_name": "array_richcompare( PyArrayObject * self , PyObject * other , int cmp_op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 13, "token_count": 273, "parameters": [ "self", "other", "cmp_op" ], "start_line": 2778, "end_line": 2855, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 78, "top_nesting_level": 0 }, { "name": "_check_axis", "long_name": "_check_axis( PyArrayObject * arr , int * axis , int flags)", "filename": "arrayobject.c", "nloc": 29, "complexity": 8, "token_count": 164, "parameters": [ "arr", "axis", "flags" ], "start_line": 2858, "end_line": 2887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyArray_IntTupleFromIntp", "long_name": "PyArray_IntTupleFromIntp( int len , intp * vals)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 91, "parameters": [ "len", "vals" ], "start_line": 2893, "end_line": 2909, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_IntpFromSequence", "long_name": "PyArray_IntpFromSequence( PyObject * seq , intp * vals , int maxvals)", "filename": "arrayobject.c", "nloc": 21, "complexity": 7, "token_count": 161, "parameters": [ "seq", "vals", "maxvals" ], "start_line": 2914, "end_line": 2937, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "_IsContiguous", "long_name": "_IsContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 109, "parameters": [ "ap" ], "start_line": 2943, "end_line": 2959, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsFortranContiguous", "long_name": "_IsFortranContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 107, "parameters": [ "ap" ], "start_line": 2963, "end_line": 2979, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsAligned", "long_name": "_IsAligned( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 110, "parameters": [ "ap" ], "start_line": 2983, "end_line": 2999, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsWriteable", "long_name": "_IsWriteable( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 16, "complexity": 8, "token_count": 109, "parameters": [ "ap" ], "start_line": 3002, "end_line": 3035, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_UpdateFlags", "long_name": "PyArray_UpdateFlags( PyArrayObject * ret , int flagmask)", "filename": "arrayobject.c", "nloc": 22, "complexity": 9, "token_count": 129, "parameters": [ "ret", "flagmask" ], "start_line": 3039, "end_line": 3061, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_CheckStrides", "long_name": "PyArray_CheckStrides( int elsize , int nd , intp numbytes , intp * dims , intp * newstrides)", "filename": "arrayobject.c", "nloc": 13, "complexity": 4, "token_count": 84, "parameters": [ "elsize", "nd", "numbytes", "dims", "newstrides" ], "start_line": 3068, "end_line": 3083, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "_array_fill_strides", "long_name": "_array_fill_strides( intp * strides , intp * dims , int nd , intp itemsize , int inflag , int * objflags)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 171, "parameters": [ "strides", "dims", "nd", "itemsize", "inflag", "objflags" ], "start_line": 3103, "end_line": 3127, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyArrayObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 676, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3131, "end_line": 3275, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "PyArray_Resize", "long_name": "PyArray_Resize( PyArrayObject * self , PyArray_Dims * newshape)", "filename": "arrayobject.c", "nloc": 87, "complexity": 15, "token_count": 501, "parameters": [ "self", "newshape" ], "start_line": 3280, "end_line": 3385, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_FillObjectArray", "long_name": "PyArray_FillObjectArray( PyArrayObject * arr , PyObject * obj)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 98, "parameters": [ "arr", "obj" ], "start_line": 3389, "end_line": 3406, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_new", "long_name": "array_new( PyTypeObject * subtype , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 100, "complexity": 20, "token_count": 593, "parameters": [ "subtype", "args", "kwds" ], "start_line": 3410, "end_line": 3525, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 116, "top_nesting_level": 0 }, { "name": "array_ndim_get", "long_name": "array_ndim_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 3532, "end_line": 3535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flags_get", "long_name": "array_flags_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 10, "complexity": 3, "token_count": 55, "parameters": [ "self" ], "start_line": 3538, "end_line": 3548, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_shape_get", "long_name": "array_shape_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3621, "end_line": 3624, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_shape_set", "long_name": "array_shape_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 33, "complexity": 6, "token_count": 206, "parameters": [ "self", "val" ], "start_line": 3628, "end_line": 3662, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_strides_get", "long_name": "array_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3666, "end_line": 3669, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_strides_set", "long_name": "array_strides_set( PyArrayObject * self , PyObject * obj)", "filename": "arrayobject.c", "nloc": 32, "complexity": 7, "token_count": 209, "parameters": [ "self", "obj" ], "start_line": 3672, "end_line": 3705, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_protocol_strides_get", "long_name": "array_protocol_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 35, "parameters": [ "self" ], "start_line": 3709, "end_line": 3716, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_priority_get", "long_name": "array_priority_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 3, "token_count": 42, "parameters": [ "self" ], "start_line": 3719, "end_line": 3727, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_data_get", "long_name": "array_data_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 82, "parameters": [ "self" ], "start_line": 3731, "end_line": 3745, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_data_set", "long_name": "array_data_set( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 44, "complexity": 9, "token_count": 229, "parameters": [ "self", "op" ], "start_line": 3748, "end_line": 3792, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "array_itemsize_get", "long_name": "array_itemsize_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 3796, "end_line": 3799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_size_get", "long_name": "array_size_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "self" ], "start_line": 3802, "end_line": 3809, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typechar_get", "long_name": "array_typechar_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 47, "parameters": [ "self" ], "start_line": 3813, "end_line": 3820, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typestr_get", "long_name": "array_typestr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 7, "token_count": 141, "parameters": [ "self" ], "start_line": 3823, "end_line": 3843, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_descr_get", "long_name": "array_descr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 128, "parameters": [ "self" ], "start_line": 3846, "end_line": 3868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_typenum_get", "long_name": "array_typenum_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 3871, "end_line": 3874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_get", "long_name": "array_type_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 3878, "end_line": 3881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_set", "long_name": "array_type_set( PyArrayObject * self , PyObject * arg)", "filename": "arrayobject.c", "nloc": 41, "complexity": 10, "token_count": 294, "parameters": [ "self", "arg" ], "start_line": 3893, "end_line": 3951, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "array_base_get", "long_name": "array_base_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 41, "parameters": [ "self" ], "start_line": 3956, "end_line": 3966, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 125, "parameters": [ "self" ], "start_line": 3970, "end_line": 3995, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 173, "parameters": [ "self", "val" ], "start_line": 3999, "end_line": 4031, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 33, "complexity": 3, "token_count": 186, "parameters": [ "self" ], "start_line": 4034, "end_line": 4067, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 199, "parameters": [ "self", "val" ], "start_line": 4070, "end_line": 4107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_flat_get", "long_name": "array_flat_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 4110, "end_line": 4113, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 50, "complexity": 9, "token_count": 358, "parameters": [ "self", "val" ], "start_line": 4116, "end_line": 4168, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "discover_depth", "long_name": "discover_depth( PyObject * s , int max , int stop_at_string)", "filename": "arrayobject.c", "nloc": 23, "complexity": 14, "token_count": 169, "parameters": [ "s", "max", "stop_at_string" ], "start_line": 4344, "end_line": 4369, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "discover_itemsize", "long_name": "discover_itemsize( PyObject * s , int nd , int * itemsize)", "filename": "arrayobject.c", "nloc": 21, "complexity": 9, "token_count": 161, "parameters": [ "s", "nd", "itemsize" ], "start_line": 4372, "end_line": 4394, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "discover_dimensions", "long_name": "discover_dimensions( PyObject * s , int nd , intp * d , int check_it)", "filename": "arrayobject.c", "nloc": 24, "complexity": 10, "token_count": 188, "parameters": [ "s", "nd", "d", "check_it" ], "start_line": 4401, "end_line": 4427, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_array_small_type", "long_name": "_array_small_type( int chktype , int mintype , int chksize , int minsize , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 100, "parameters": [ "chktype", "mintype", "chksize", "minsize", "outtype" ], "start_line": 4430, "end_line": 4450, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 123, "complexity": 28, "token_count": 661, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4453, "end_line": 4591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "Assign_Array", "long_name": "Assign_Array( PyArrayObject * self , PyObject * v)", "filename": "arrayobject.c", "nloc": 21, "complexity": 6, "token_count": 121, "parameters": [ "self", "v" ], "start_line": 4594, "end_line": 4617, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromScalar", "long_name": "Array_FromScalar( PyObject * op , PyArray_Typecode * typecode)", "filename": "arrayobject.c", "nloc": 19, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode" ], "start_line": 4621, "end_line": 4644, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromSequence", "long_name": "Array_FromSequence( PyObject * s , PyArray_Typecode * typecode , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 51, "complexity": 17, "token_count": 313, "parameters": [ "s", "typecode", "min_depth", "max_depth" ], "start_line": 4648, "end_line": 4705, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_ValidType", "long_name": "PyArray_ValidType( int type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 2, "token_count": 30, "parameters": [ "type" ], "start_line": 4709, "end_line": 4716, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "_bufferedcast", "long_name": "_bufferedcast( PyArrayObject * out , PyArrayObject * in)", "filename": "arrayobject.c", "nloc": 75, "complexity": 16, "token_count": 477, "parameters": [ "out", "in" ], "start_line": 4722, "end_line": 4812, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "PyArray_Cast", "long_name": "PyArray_Cast( PyArrayObject * mp , int type_num)", "filename": "arrayobject.c", "nloc": 10, "complexity": 1, "token_count": 56, "parameters": [ "mp", "type_num" ], "start_line": 4818, "end_line": 4829, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 229, "parameters": [ "mp", "at" ], "start_line": 4832, "end_line": 4867, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_CastTo", "long_name": "PyArray_CastTo( PyArrayObject * out , PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 40, "complexity": 10, "token_count": 214, "parameters": [ "out", "mp" ], "start_line": 4874, "end_line": 4920, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 77, "complexity": 26, "token_count": 508, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4923, "end_line": 5013, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "_array_typecode_fromstr", "long_name": "_array_typecode_fromstr( char * str , int * swap , PyArray_Typecode * type)", "filename": "arrayobject.c", "nloc": 94, "complexity": 36, "token_count": 533, "parameters": [ "str", "swap", "type" ], "start_line": 5017, "end_line": 5122, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5125, "end_line": 5219, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_fromattr", "long_name": "array_fromattr( PyObject * op , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 21, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode", "flags" ], "start_line": 5222, "end_line": 5243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_fromobject", "long_name": "array_fromobject( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int flags)", "filename": "arrayobject.c", "nloc": 46, "complexity": 13, "token_count": 270, "parameters": [ "op", "typecode", "min_depth", "max_depth", "flags" ], "start_line": 5247, "end_line": 5309, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_ArrayType", "long_name": "PyArray_ArrayType( PyObject * op , PyArray_Typecode * intype , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 29, "parameters": [ "op", "intype", "outtype" ], "start_line": 5312, "end_line": 5317, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ObjectType", "long_name": "PyArray_ObjectType( PyObject * op , int minimum_type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 40, "parameters": [ "op", "minimum_type" ], "start_line": 5320, "end_line": 5326, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_FromAny", "long_name": "PyArray_FromAny( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int requires)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 165, "parameters": [ "op", "typecode", "min_depth", "max_depth", "requires" ], "start_line": 5380, "end_line": 5410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "PyArray_EnsureArray", "long_name": "PyArray_EnsureArray( PyObject * op)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 82, "parameters": [ "op" ], "start_line": 5420, "end_line": 5436, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5442, "end_line": 5447, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5450, "end_line": 5456, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5459, "end_line": 5465, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_CanCastSafely", "long_name": "PyArray_CanCastSafely( int fromtype , int totype)", "filename": "arrayobject.c", "nloc": 69, "complexity": 35, "token_count": 386, "parameters": [ "fromtype", "totype" ], "start_line": 5471, "end_line": 5542, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_CanCastTo", "long_name": "PyArray_CanCastTo( PyArray_Typecode * from , PyArray_Typecode * to)", "filename": "arrayobject.c", "nloc": 24, "complexity": 7, "token_count": 134, "parameters": [ "from", "to" ], "start_line": 5545, "end_line": 5569, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_IterNew", "long_name": "PyArray_IterNew( PyObject * obj)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 258, "parameters": [ "obj" ], "start_line": 5579, "end_line": 5616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "arrayiter_next", "long_name": "arrayiter_next( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "it" ], "start_line": 5621, "end_line": 5631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "arrayiter_dealloc", "long_name": "arrayiter_dealloc( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 25, "parameters": [ "it" ], "start_line": 5634, "end_line": 5639, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "arrayiter_traverse", "long_name": "arrayiter_traverse( PyArrayIterObject * it , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 6, "complexity": 2, "token_count": 42, "parameters": [ "it", "visit", "arg" ], "start_line": 5642, "end_line": 5647, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "iter_length", "long_name": "iter_length( PyArrayIterObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 5651, "end_line": 5654, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 268, "parameters": [ "self", "ind" ], "start_line": 5658, "end_line": 5706, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 50, "complexity": 8, "token_count": 337, "parameters": [ "self", "ind" ], "start_line": 5709, "end_line": 5761, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 585, "parameters": [ "self", "ind" ], "start_line": 5765, "end_line": 5884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "iter_ass_sub_Bool", "long_name": "iter_ass_sub_Bool( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 31, "complexity": 5, "token_count": 176, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5888, "end_line": 5920, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 41, "complexity": 8, "token_count": 283, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5923, "end_line": 5964, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_ass_subscript", "long_name": "iter_ass_subscript( PyArrayIterObject * self , PyObject * ind , PyObject * val)", "filename": "arrayobject.c", "nloc": 103, "complexity": 24, "token_count": 636, "parameters": [ "self", "ind", "val" ], "start_line": 5968, "end_line": 6090, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 29, "complexity": 5, "token_count": 213, "parameters": [ "it", "op" ], "start_line": 6103, "end_line": 6144, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_copy", "long_name": "iter_copy( PyArrayIterObject * it , PyObject * args)", "filename": "arrayobject.c", "nloc": 5, "complexity": 2, "token_count": 35, "parameters": [ "it", "args" ], "start_line": 6149, "end_line": 6153, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "fancy_indexing_check", "long_name": "fancy_indexing_check( PyObject * args)", "filename": "arrayobject.c", "nloc": 55, "complexity": 22, "token_count": 293, "parameters": [ "args" ], "start_line": 6218, "end_line": 6279, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 62, "top_nesting_level": 0 }, { "name": "_convert_obj", "long_name": "_convert_obj( PyObject * obj , PyArrayIterObject ** iter)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 105, "parameters": [ "obj", "iter" ], "start_line": 6287, "end_line": 6302, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyArray_Broadcast", "long_name": "PyArray_Broadcast( PyArrayMultiIterObject * mit)", "filename": "arrayobject.c", "nloc": 58, "complexity": 13, "token_count": 464, "parameters": [ "mit" ], "start_line": 6308, "end_line": 6377, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterReset", "long_name": "PyArray_MapIterReset( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 35, "complexity": 4, "token_count": 261, "parameters": [ "mit" ], "start_line": 6381, "end_line": 6417, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNext", "long_name": "PyArray_MapIterNext( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 41, "complexity": 6, "token_count": 296, "parameters": [ "mit" ], "start_line": 6423, "end_line": 6467, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 682, "parameters": [ "mit", "arr" ], "start_line": 6485, "end_line": 6621, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "_nonzero_indices", "long_name": "_nonzero_indices( PyObject * myBool , PyArrayIterObject ** iters)", "filename": "arrayobject.c", "nloc": 57, "complexity": 15, "token_count": 454, "parameters": [ "myBool", "iters" ], "start_line": 6627, "end_line": 6696, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNew", "long_name": "PyArray_MapIterNew( PyObject * indexobj)", "filename": "arrayobject.c", "nloc": 111, "complexity": 24, "token_count": 745, "parameters": [ "indexobj" ], "start_line": 6699, "end_line": 6832, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 134, "top_nesting_level": 0 }, { "name": "arraymapiter_new", "long_name": "arraymapiter_new( PyTypeObject * type , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 130, "parameters": [ "type", "args", "kwds" ], "start_line": 6838, "end_line": 6868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "arraymapiter_next", "long_name": "arraymapiter_next( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 12, "complexity": 4, "token_count": 70, "parameters": [ "mit" ], "start_line": 6874, "end_line": 6885, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "arraymapiter_dealloc", "long_name": "arraymapiter_dealloc( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 60, "parameters": [ "mit" ], "start_line": 6888, "end_line": 6897, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "arraymapiter_traverse", "long_name": "arraymapiter_traverse( PyArrayMapIterObject * mit , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 16, "complexity": 9, "token_count": 146, "parameters": [ "mit", "visit", "arg" ], "start_line": 6900, "end_line": 6918, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 400, "end_line": 434, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5125, "end_line": 5219, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 } ], "nloc": 5474, "complexity": 1204, "token_count": 32706, "diff_parsed": { "added": [ " intp stride=elsize;", "\tintp dims[MAX_DIMS], strides[MAX_DIMS];" ], "deleted": [ " int stride=elsize;", "\tint dims[MAX_DIMS], strides[MAX_DIMS];" ] } } ] }, { "hash": "3f0cd73d77fafad5a41748b288863ab0b37628d8", "msg": "Added some simple CAPI documentation.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T18:28:56+00:00", "author_timezone": 0, "committer_date": "2005-10-07T18:28:56+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "dfdb8689aaaed931bc8d9d42deec96d0c43a6a79" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 43, "insertions": 263, "lines": 306, "files": 8, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.0, "dmm_unit_interfacing": 0.8461538461538461, "modified_files": [ { "old_path": "COMPATIBILITY", "new_path": "COMPATIBILITY", "filename": "COMPATIBILITY", "extension": "COMPATIBILITY", "change_type": "MODIFY", "diff": "@@ -46,11 +46,11 @@ use PyArray_XXXLTR where XXX is the name of the type.\n \n \n If you used function pointers directly (why did you do that?),\n-the arguments have changed. \n+the arguments have changed. Everything that was an int is now an intp. Also, \n+arrayobjects should be passed in at the end. \n \n a->descr->cast[i](fromdata, fromstep, todata, tostep, n)\n a->descr->cast[i](fromdata, todata, n, PyArrayObject *in, PyArrayObject *out)\n anything but single-stepping is not supported by this function\n use the PyArray_CastXXXX functions.\n \n-\n", "added_lines": 2, "deleted_lines": 2, "source_code": "\n\nX.flat returns an indexable 1-D iterator (mostly similar to an array but always 1-d)\n\nlong(<>) --> pylong(<>) if from Numeric * was changed to from scipy.base import *\n\n.typecode() --> .dtypechar\n\n.iscontiguous() --> .flags['CONTIGUOUS']\n\n.byteswapped() -> .byteswap()\n\n.itemsize() -> .itemsize\n\nIf you used typecode characters:\n\n'c' -> 'S1'\n'b' -> 'B'\n'1' -> 'b'\n's' -> 'h'\n'w' -> 'H'\n'u' -> 'I'\n\n\nC -level\n\nsome API calls that used to take PyObject * now take PyArrayObject * (this should only cause warnings during compile and not actual problems). \n PyArray_Take \n\nThese commands now return a buffer that must be freed once it is used\nusing PyMemData_FREE(ptr) or PyMemData_XFREE(ptr);\n\na->descr->zero --> PyArray_Zero(a)\na->descr->one --> PyArray_One(a)\n\nNumeric/arrayobject.h --> scipy/arrayobject.h\n\n\n# These will actually work and are defines for PyArray_BYTE, \n# but you really should change it in your code\nPyArray_CHAR --> PyArray_BYTE (or PyArray_STRING which is more flexible) \nPyArray_SBYTE --> PyArray_BYTE\n\nAny uses of character codes will need adjusting....\nuse PyArray_XXXLTR where XXX is the name of the type.\n\n\nIf you used function pointers directly (why did you do that?),\nthe arguments have changed. Everything that was an int is now an intp. Also, \narrayobjects should be passed in at the end. \n\na->descr->cast[i](fromdata, fromstep, todata, tostep, n)\na->descr->cast[i](fromdata, todata, n, PyArrayObject *in, PyArrayObject *out)\n anything but single-stepping is not supported by this function\n use the PyArray_CastXXXX functions.\n\n", "source_code_before": "\n\nX.flat returns an indexable 1-D iterator (mostly similar to an array but always 1-d)\n\nlong(<>) --> pylong(<>) if from Numeric * was changed to from scipy.base import *\n\n.typecode() --> .dtypechar\n\n.iscontiguous() --> .flags['CONTIGUOUS']\n\n.byteswapped() -> .byteswap()\n\n.itemsize() -> .itemsize\n\nIf you used typecode characters:\n\n'c' -> 'S1'\n'b' -> 'B'\n'1' -> 'b'\n's' -> 'h'\n'w' -> 'H'\n'u' -> 'I'\n\n\nC -level\n\nsome API calls that used to take PyObject * now take PyArrayObject * (this should only cause warnings during compile and not actual problems). \n PyArray_Take \n\nThese commands now return a buffer that must be freed once it is used\nusing PyMemData_FREE(ptr) or PyMemData_XFREE(ptr);\n\na->descr->zero --> PyArray_Zero(a)\na->descr->one --> PyArray_One(a)\n\nNumeric/arrayobject.h --> scipy/arrayobject.h\n\n\n# These will actually work and are defines for PyArray_BYTE, \n# but you really should change it in your code\nPyArray_CHAR --> PyArray_BYTE (or PyArray_STRING which is more flexible) \nPyArray_SBYTE --> PyArray_BYTE\n\nAny uses of character codes will need adjusting....\nuse PyArray_XXXLTR where XXX is the name of the type.\n\n\nIf you used function pointers directly (why did you do that?),\nthe arguments have changed. \n\na->descr->cast[i](fromdata, fromstep, todata, tostep, n)\na->descr->cast[i](fromdata, todata, n, PyArrayObject *in, PyArrayObject *out)\n anything but single-stepping is not supported by this function\n use the PyArray_CastXXXX functions.\n\n\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ "the arguments have changed. Everything that was an int is now an intp. Also,", "arrayobjects should be passed in at the end." ], "deleted": [ "the arguments have changed.", "" ] } }, { "old_path": null, "new_path": "doc/CAPI.txt", "filename": "CAPI.txt", "extension": "txt", "change_type": "ADD", "diff": "@@ -0,0 +1,187 @@\n+\n+The CAPI of SciPy is (mostly) backward compatible with Numeric. \n+\n+There are a few non-standard API Numeric usages that will need to be changed:\n+\n+ * If you used any of the function pointers in the PyArray_Descr\n+ structure you will have to modify your usage of those. The casting functions\n+ have eliminated the strides argument (use PyArray_CastTo if you need strided casting). \n+ All functions have one or two PyArrayObject * arguments at the end. This allows\n+ the flexible arrays and mis-behaved arrays to be handled. \n+\n+ * The descr->zero and descr->one constants have been replaced with\n+ function calls, PyArray_Zero, and PyArray_One.\n+\n+ * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to get the itemsize of an\n+ object (for flexible arrays descr->elsize is 0).\n+\n+\n+The header files arrayobject.h and ufuncobject.h contain many defines\n+that you may find useful. The files __ufunc_api.h and\n+__multiarray_api.h contain the available C-API function calls with their function signatures.\n+\n+All of these headers are installed to \n+\n+/site-packages/scipy/base/include\n+\n+\n+Getting arrays in C-code\n+=========================\n+\n+All new arrays can be created using PyArray_New.\n+\n+This is a very flexible function. \n+\n+PyObject * PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type, \n+ intp *strides, char *data, int itemsize, int flags, \n+ PyObject *obj);\n+\n+\n+subtype : The subtype that should be created (either pass in\n+ &PyArray_Type, &PyBigArray_Type, or obj->ob_type,\n+ where obj is a subtype (or subclass) of PyBigArray_Type).\n+\n+nd : The number of dimensions (base member of the returned array to the Python object. You are \n+ responsible for setting the base object. Failure to do so will create a memory leak.\n+ \n+ If you pass in a data buffer, the flags argument will be the flags of the new array. \n+ If you create a new array, a non-zero flags argument indicates that you want the\n+ array to be in FORTRAN order.\n+\n+itemsize : Indicates the itemsize for the new array. This can be 0 if it is a fixed-size array type.\n+ It is only used for flexible array types and must be set in that case.\n+\n+flags : Either the flags showing how to interpret the data buffer passed in. Or if a new array \n+ is created, nonzero to indicate a FORTRAN order array.\n+\n+obj : If subtypes is &PyArray_Type or &PyBigArray_Type, this argument is ignored. Otherwise,\n+ the __array_finalize__ method of the subtype is called (if present) and passed this\n+ object. This is usually an array of the type to be created (so the __array_finalize__ \n+ method must handle an array argument. But, it can be anything...)\n+\n+Note: The returned array object will be unitialized unless the type is PyArray_OBJECT. \n+\n+\n+The PyArray_FromDims and family of functions are still available and are loose wrappers around \n+this function. \n+\n+\n+Getting an arrayobject from an arbitrary Python object: PyArray_FromAny\n+\n+This function replaces PyArray_ContiguousFromObject and friends (those\n+function calls still remain but they are loose wrappers around the\n+PyArray_FromAny call).\n+\n+static PyObject *\n+PyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n+\t\tint max_depth, int requires) \n+\n+\n+op : The Python object to \"convert\" to an array object\n+typecode : A typecode structure filled with the data type and itemsize of the desired data type.\n+ This can be NULL, if the type should be determined from the object.\n+ Unless FORCECAST is present in flags, this call will generate an error\n+ if the data type cannot be safely obtained from the object.\n+min_depth : The minimum depth of array needed or 0 if doesn't matter\n+max_depth : The maximum depth of array allowed or 0 if doesn't matter\n+requires : A flag indicating the \"requirements\" of the returned array. \n+\n+\n+From the code comments, the requires flag is explained.\n+\n+requires can be any of \n+\n+ CONTIGUOUS, \n+ FORTRAN, (or set typecode->fortran=1)\n+ ALIGNED, \n+ NOTSWAPPED, \n+ WRITEABLE, \n+ ENSURECOPY, \n+ UPDATEIFCOPY,\n+ FORCECAST,\n+\n+ or'd (|) together\n+\n+ Any of these flags present means that the returned array should \n+ guarantee that aspect of the array. Otherwise the returned array\n+ won't guarantee it -- it will depend on the object as to whether or \n+ not it has such features. \n+\n+ Note that ENSURECOPY is enough to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, \n+ and WRITEABLE and therefore it is redundant to include those as well. \n+\n+ BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n+ BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n+ CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n+ FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n+ \n+ By default, if the object is an array and requires is 0, \n+ the array will just be INCREF'd and returned. \n+ \n+ typecode->fortran can be set to request a\n+ fortran-contiguous array (or just | FORTRAN to the requires flags).\n+ Fortran arrays are always behaved (aligned, \n+ notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n+ FORTRAN in the flag or typecode->fortran = 1 is enough to request\n+ a FORTRAN-style array. \n+\n+ UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n+ made and the base argument points to the (possibly) misbehaved array.\n+ When the new array is deallocated, the original array held in base\n+ is updated with the contents of the new array. This is useful, \n+ if you don't want to deal with a possibly mis-behaved array, but want\n+ to update it easily using a local contiguous copy. \n+\n+ FORCECAST will cause a cast to occur regardless of whether or not\n+ it is safe. \n+\n+\n+PyArray_Typecode structure\n+{\n+ int type_num;\n+ int itemsize;\n+ int fortran --- used to indicate a fortran array is desired.\n+}\n+\n+\n+Passing Data Type information to C-code\n+============================================\n+\n+To get a Typecode structure from Python use the\n+PyArray_TypecodeConverter function. This will return a typecode\n+structure filled appropriately based on a wide variety of user inputs.\n+\n+See the arraymethods.c and multiarraymodule.c files for many examples of usage.\n+\n+\n+Getting at the structure of the array.\n+\n+You should use the #defines provided to access array structure portions:\n+\n+PyArray_DATA(obj)\n+PyArray_ITEMSIZE(obj)\n+PyArray_NDIM(obj)\n+PyArray_DIMS(obj)\n+PyArray_DIM(obj, n)\n+PyArray_STRIDES(obj)\n+PyArray_STRIDE(obj,n)\n+\n+\n+see more in arrayobject.h\n+\n+\n+There are more C-API enhancements which you can discover in the code, \n+ or buy the book (http://www.trelgol.com)\n+\n+\n", "added_lines": 187, "deleted_lines": 0, "source_code": "\nThe CAPI of SciPy is (mostly) backward compatible with Numeric. \n\nThere are a few non-standard API Numeric usages that will need to be changed:\n\n * If you used any of the function pointers in the PyArray_Descr\n structure you will have to modify your usage of those. The casting functions\n have eliminated the strides argument (use PyArray_CastTo if you need strided casting). \n All functions have one or two PyArrayObject * arguments at the end. This allows\n the flexible arrays and mis-behaved arrays to be handled. \n\n * The descr->zero and descr->one constants have been replaced with\n function calls, PyArray_Zero, and PyArray_One.\n\n * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to get the itemsize of an\n object (for flexible arrays descr->elsize is 0).\n\n\nThe header files arrayobject.h and ufuncobject.h contain many defines\nthat you may find useful. The files __ufunc_api.h and\n__multiarray_api.h contain the available C-API function calls with their function signatures.\n\nAll of these headers are installed to \n\n/site-packages/scipy/base/include\n\n\nGetting arrays in C-code\n=========================\n\nAll new arrays can be created using PyArray_New.\n\nThis is a very flexible function. \n\nPyObject * PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type, \n intp *strides, char *data, int itemsize, int flags, \n PyObject *obj);\n\n\nsubtype : The subtype that should be created (either pass in\n &PyArray_Type, &PyBigArray_Type, or obj->ob_type,\n where obj is a subtype (or subclass) of PyBigArray_Type).\n\nnd : The number of dimensions (base member of the returned array to the Python object. You are \n responsible for setting the base object. Failure to do so will create a memory leak.\n \n If you pass in a data buffer, the flags argument will be the flags of the new array. \n If you create a new array, a non-zero flags argument indicates that you want the\n array to be in FORTRAN order.\n\nitemsize : Indicates the itemsize for the new array. This can be 0 if it is a fixed-size array type.\n It is only used for flexible array types and must be set in that case.\n\nflags : Either the flags showing how to interpret the data buffer passed in. Or if a new array \n is created, nonzero to indicate a FORTRAN order array.\n\nobj : If subtypes is &PyArray_Type or &PyBigArray_Type, this argument is ignored. Otherwise,\n the __array_finalize__ method of the subtype is called (if present) and passed this\n object. This is usually an array of the type to be created (so the __array_finalize__ \n method must handle an array argument. But, it can be anything...)\n\nNote: The returned array object will be unitialized unless the type is PyArray_OBJECT. \n\n\nThe PyArray_FromDims and family of functions are still available and are loose wrappers around \nthis function. \n\n\nGetting an arrayobject from an arbitrary Python object: PyArray_FromAny\n\nThis function replaces PyArray_ContiguousFromObject and friends (those\nfunction calls still remain but they are loose wrappers around the\nPyArray_FromAny call).\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n\n\nop : The Python object to \"convert\" to an array object\ntypecode : A typecode structure filled with the data type and itemsize of the desired data type.\n This can be NULL, if the type should be determined from the object.\n Unless FORCECAST is present in flags, this call will generate an error\n if the data type cannot be safely obtained from the object.\nmin_depth : The minimum depth of array needed or 0 if doesn't matter\nmax_depth : The maximum depth of array allowed or 0 if doesn't matter\nrequires : A flag indicating the \"requirements\" of the returned array. \n\n\nFrom the code comments, the requires flag is explained.\n\nrequires can be any of \n\n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, \n and WRITEABLE and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, if the object is an array and requires is 0, \n the array will just be INCREF'd and returned. \n \n typecode->fortran can be set to request a\n fortran-contiguous array (or just | FORTRAN to the requires flags).\n Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. This is useful, \n if you don't want to deal with a possibly mis-behaved array, but want\n to update it easily using a local contiguous copy. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n\n\nPyArray_Typecode structure\n{\n int type_num;\n int itemsize;\n int fortran --- used to indicate a fortran array is desired.\n}\n\n\nPassing Data Type information to C-code\n============================================\n\nTo get a Typecode structure from Python use the\nPyArray_TypecodeConverter function. This will return a typecode\nstructure filled appropriately based on a wide variety of user inputs.\n\nSee the arraymethods.c and multiarraymodule.c files for many examples of usage.\n\n\nGetting at the structure of the array.\n\nYou should use the #defines provided to access array structure portions:\n\nPyArray_DATA(obj)\nPyArray_ITEMSIZE(obj)\nPyArray_NDIM(obj)\nPyArray_DIMS(obj)\nPyArray_DIM(obj, n)\nPyArray_STRIDES(obj)\nPyArray_STRIDE(obj,n)\n\n\nsee more in arrayobject.h\n\n\nThere are more C-API enhancements which you can discover in the code, \n or buy the book (http://www.trelgol.com)\n\n\n", "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ "", "The CAPI of SciPy is (mostly) backward compatible with Numeric.", "", "There are a few non-standard API Numeric usages that will need to be changed:", "", " * If you used any of the function pointers in the PyArray_Descr", " structure you will have to modify your usage of those. The casting functions", " have eliminated the strides argument (use PyArray_CastTo if you need strided casting).", " All functions have one or two PyArrayObject * arguments at the end. This allows", " the flexible arrays and mis-behaved arrays to be handled.", "", " * The descr->zero and descr->one constants have been replaced with", " function calls, PyArray_Zero, and PyArray_One.", "", " * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to get the itemsize of an", " object (for flexible arrays descr->elsize is 0).", "", "", "The header files arrayobject.h and ufuncobject.h contain many defines", "that you may find useful. The files __ufunc_api.h and", "__multiarray_api.h contain the available C-API function calls with their function signatures.", "", "All of these headers are installed to", "", "/site-packages/scipy/base/include", "", "", "Getting arrays in C-code", "=========================", "", "All new arrays can be created using PyArray_New.", "", "This is a very flexible function.", "", "PyObject * PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type,", " intp *strides, char *data, int itemsize, int flags,", " PyObject *obj);", "", "", "subtype : The subtype that should be created (either pass in", " &PyArray_Type, &PyBigArray_Type, or obj->ob_type,", " where obj is a subtype (or subclass) of PyBigArray_Type).", "", "nd : The number of dimensions (base member of the returned array to the Python object. You are", " responsible for setting the base object. Failure to do so will create a memory leak.", "", " If you pass in a data buffer, the flags argument will be the flags of the new array.", " If you create a new array, a non-zero flags argument indicates that you want the", " array to be in FORTRAN order.", "", "itemsize : Indicates the itemsize for the new array. This can be 0 if it is a fixed-size array type.", " It is only used for flexible array types and must be set in that case.", "", "flags : Either the flags showing how to interpret the data buffer passed in. Or if a new array", " is created, nonzero to indicate a FORTRAN order array.", "", "obj : If subtypes is &PyArray_Type or &PyBigArray_Type, this argument is ignored. Otherwise,", " the __array_finalize__ method of the subtype is called (if present) and passed this", " object. This is usually an array of the type to be created (so the __array_finalize__", " method must handle an array argument. But, it can be anything...)", "", "Note: The returned array object will be unitialized unless the type is PyArray_OBJECT.", "", "", "The PyArray_FromDims and family of functions are still available and are loose wrappers around", "this function.", "", "", "Getting an arrayobject from an arbitrary Python object: PyArray_FromAny", "", "This function replaces PyArray_ContiguousFromObject and friends (those", "function calls still remain but they are loose wrappers around the", "PyArray_FromAny call).", "", "static PyObject *", "PyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth,", "\t\tint max_depth, int requires)", "", "", "op : The Python object to \"convert\" to an array object", "typecode : A typecode structure filled with the data type and itemsize of the desired data type.", " This can be NULL, if the type should be determined from the object.", " Unless FORCECAST is present in flags, this call will generate an error", " if the data type cannot be safely obtained from the object.", "min_depth : The minimum depth of array needed or 0 if doesn't matter", "max_depth : The maximum depth of array allowed or 0 if doesn't matter", "requires : A flag indicating the \"requirements\" of the returned array.", "", "", "From the code comments, the requires flag is explained.", "", "requires can be any of", "", " CONTIGUOUS,", " FORTRAN, (or set typecode->fortran=1)", " ALIGNED,", " NOTSWAPPED,", " WRITEABLE,", " ENSURECOPY,", " UPDATEIFCOPY,", " FORCECAST,", "", " or'd (|) together", "", " Any of these flags present means that the returned array should", " guarantee that aspect of the array. Otherwise the returned array", " won't guarantee it -- it will depend on the object as to whether or", " not it has such features.", "", " Note that ENSURECOPY is enough to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED,", " and WRITEABLE and therefore it is redundant to include those as well.", "", " BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE", " BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED", " CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS", " FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS", "", " By default, if the object is an array and requires is 0,", " the array will just be INCREF'd and returned.", "", " typecode->fortran can be set to request a", " fortran-contiguous array (or just | FORTRAN to the requires flags).", " Fortran arrays are always behaved (aligned,", " notswapped, and writeable) and not (C) CONTIGUOUS. Note that either", " FORTRAN in the flag or typecode->fortran = 1 is enough to request", " a FORTRAN-style array.", "", " UPDATEIFCOPY flag sets this flag in the returned array if a copy is", " made and the base argument points to the (possibly) misbehaved array.", " When the new array is deallocated, the original array held in base", " is updated with the contents of the new array. This is useful,", " if you don't want to deal with a possibly mis-behaved array, but want", " to update it easily using a local contiguous copy.", "", " FORCECAST will cause a cast to occur regardless of whether or not", " it is safe.", "", "", "PyArray_Typecode structure", "{", " int type_num;", " int itemsize;", " int fortran --- used to indicate a fortran array is desired.", "}", "", "", "Passing Data Type information to C-code", "============================================", "", "To get a Typecode structure from Python use the", "PyArray_TypecodeConverter function. This will return a typecode", "structure filled appropriately based on a wide variety of user inputs.", "", "See the arraymethods.c and multiarraymodule.c files for many examples of usage.", "", "", "Getting at the structure of the array.", "", "You should use the #defines provided to access array structure portions:", "", "PyArray_DATA(obj)", "PyArray_ITEMSIZE(obj)", "PyArray_NDIM(obj)", "PyArray_DIMS(obj)", "PyArray_DIM(obj, n)", "PyArray_STRIDES(obj)", "PyArray_STRIDE(obj,n)", "", "", "see more in arrayobject.h", "", "", "There are more C-API enhancements which you can discover in the code,", " or buy the book (http://www.trelgol.com)", "", "" ], "deleted": [] } }, { "old_path": null, "new_path": "doc/README.txt", "filename": "README.txt", "extension": "txt", "change_type": "ADD", "diff": "@@ -0,0 +1,15 @@\n+Very complete documentation is available from the primary developer of\n+SciPy Core for a small fee. After a brief period, that documentation\n+will become freely available. See http://www.trelgol.com for\n+details. The fee and restriction period is intended to allow people\n+and to encourage companies to easily contribute to the development of\n+SciPy.\n+\n+This directory will contain all public documentation that becomes available. \n+\n+Very good documentation is also available using Python's (and\n+especially IPython's) own help system. Most of the functions have\n+docstrings that provide usage assistance.\n+\n+\n+\n", "added_lines": 15, "deleted_lines": 0, "source_code": "Very complete documentation is available from the primary developer of\nSciPy Core for a small fee. After a brief period, that documentation\nwill become freely available. See http://www.trelgol.com for\ndetails. The fee and restriction period is intended to allow people\nand to encourage companies to easily contribute to the development of\nSciPy.\n\nThis directory will contain all public documentation that becomes available. \n\nVery good documentation is also available using Python's (and\nespecially IPython's) own help system. Most of the functions have\ndocstrings that provide usage assistance.\n\n\n\n", "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ "Very complete documentation is available from the primary developer of", "SciPy Core for a small fee. After a brief period, that documentation", "will become freely available. See http://www.trelgol.com for", "details. The fee and restriction period is intended to allow people", "and to encourage companies to easily contribute to the development of", "SciPy.", "", "This directory will contain all public documentation that becomes available.", "", "Very good documentation is also available using Python's (and", "especially IPython's) own help system. Most of the functions have", "docstrings that provide usage assistance.", "", "", "" ], "deleted": [] } }, { "old_path": "scipy/base/code_generators/generate_array_api.py", "new_path": "scipy/base/code_generators/generate_array_api.py", "filename": "generate_array_api.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -200,7 +200,7 @@\n \n (r\"\"\"Generic new array creation routine.\n \"\"\",\n- 'New','PyTypeObject *, int nd, intp *dims, int type, intp *strides, char *data, int itemsize, int fortran, PyArrayObject *arr', 'PyObject *'),\n+ 'New','PyTypeObject *, int nd, intp *dims, int type, intp *strides, char *data, int itemsize, int fortran, PyObject *obj', 'PyObject *'),\n \n (r\"\"\"Get Priority from object\n \"\"\",\n", "added_lines": 1, "deleted_lines": 1, "source_code": "\n# doc is comment_documentation\n\n# use list so order is preserved.\nobjectapi_list = [\n (r\"\"\"Set internal structure with number functions that all\n arrays will use\n \"\"\",\n 'SetNumericOps','PyObject *dict','int'),\n\n (r\"\"\"Get dictionary showing number functions that all\n arrays will use\n \"\"\",\n 'GetNumericOps','void','PyObject *'),\n\n\n (r\"\"\"For object arrays, increment all internal references.\n \"\"\",\n 'INCREF','PyArrayObject *','int'),\n\n (r\"\"\"Decrement all internal references for object arrays.\n \"\"\", \n 'XDECREF','PyArrayObject *','int'),\n\n (r\"\"\"Set the array print function to be a Python function.\n \"\"\",\n 'SetStringFunction','PyObject *op, int repr','void'),\n\n (r\"\"\"Get the PyArray_Descr structure for a type.\n \"\"\",\n 'DescrFromType','int','PyArray_Descr *'),\n\n (r\"\"\"Get pointer to zero of correct type for array. \n \"\"\",\n 'Zero', 'PyArrayObject *', 'char *'),\n\n (r\"\"\"Get pointer to one of correct type for array\n \"\"\",\n 'One', 'PyArrayObject *', 'char *'),\n\n\n (r\"\"\"Cast an array to a different type.\n \"\"\",\n 'Cast','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Cast an array using typecode structure.\n \"\"\",\n 'CastToType','PyArrayObject *, PyArray_Typecode *','PyObject *'),\n\n (r\"\"\"Cast to an already created array.\n \"\"\",\n 'CastTo', 'PyArrayObject *, PyArrayObject *', 'int'),\n\n (r\"\"\"Check the type coercion rules.\n \"\"\",\n 'CanCastSafely','int fromtype, int totype','int'),\n\n (r\"\"\"\n \"\"\",\n 'CanCastTo','PyArray_Typecode *, PyArray_Typecode *', 'Bool'),\n\n (r\"\"\"Return the typecode of the array a Python object would be\n converted to\n \"\"\",\n 'ObjectType','PyObject *, int','int'),\n\n (r\"\"\"\n \"\"\",\n 'ArrayType','PyObject *, PyArray_Typecode *, PyArray_Typecode *','void'),\n\n (r\"\"\"Return type typecode from array scalar.\n \"\"\",\n 'TypecodeFromScalar','PyObject *, PyArray_Typecode *','void'),\n\n (r\"\"\"Compute the size of an array (in number of items)\n \"\"\",\n 'Size','PyObject *','intp'),\n\n (r\"\"\"Get scalar-equivalent to 0-d array\n \"\"\",\n 'Scalar', 'char *, int, int, int', 'PyObject *'),\n\n (r\"\"\"Get scalar-equivalent to 0-d array\n \"\"\",\n 'ToScalar', 'char *, PyArrayObject *', 'PyObject *'),\n\n (r\"\"\"Get 0-dim array from scalar\n \"\"\",\n 'FromScalar', 'PyObject *, PyArray_Typecode *', 'PyObject *'),\n\n (r\"\"\"Register Data type\n \"\"\",\n 'RegisterDataType', 'PyTypeObject *', 'int'),\n\n (r\"\"\"Insert Descr Table\n \"\"\",\n 'RegisterDescrForType', 'int, PyArray_Descr *', 'int'),\n \n (r\"\"\"Construct an empty array from dimensions and typenum\n \"\"\",\n 'FromDims','int nd, int *, int typenum','PyObject *'),\n\n (r\"\"\"Construct an array from dimensions, typenum, and a pointer\n to the data. Python will never free this (unless you later set\n the OWN_DATA flag). \n \"\"\",\n 'FromDimsAndData','int, int *, int, char *','PyObject *'),\n\n (r\"\"\"Construct an array from an arbitrary Python Object.\n Last two integers are min_dimensions, and max_dimensions.\n If max_dimensions = 0, then any number of dimensions are allowed.\n Fix the dimension by setting min_dimension == max_dimension.\n If the array is already contiguous (and aligned and not swapped)\n no copy is done, just a new reference created. \n \"\"\",\n 'ContiguousFromObject',\n 'PyObject *, int typenum, int, int',\n 'PyObject *'),\n\n (r\"\"\"Same as ContiguousFromObject except ensure a copy.\n \"\"\",\n 'CopyFromObject','PyObject *, int, int, int','PyObject *'),\n\n (r\"\"\"Can return a discontiguous array (but aligned and byteswapped)\n \"\"\",\n 'FromObject','PyObject *, int, int, int','PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'FromAny', 'PyObject *, PyArray_Typecode *, int, int, int', 'PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'EnsureArray', 'PyObject *', 'PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'FromFile', 'FILE *, PyArray_Typecode *, intp, char *','PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'FromBuffer', 'PyObject *, PyArray_Typecode *, intp, int','PyObject *'),\n\n (r\"\"\"Return either an array or the appropriate Python object if the\n array is 0d and matches a Python type.\n \"\"\",\n 'Return','PyArrayObject *','PyObject *'),\n\n (r\"\"\"Get a subset of bytes from each element of the array\n \"\"\",\n 'GetField', 'PyArrayObject *, PyArray_Typecode *, int', 'PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'Byteswap', 'PyArrayObject *, Bool', 'PyObject *'),\n\n (r\"\"\"Resize (reallocate data). Only works if nothing else is\n referencing this array and it is contiguous.\n \"\"\",\n 'Resize','PyArrayObject *ap, PyArray_Dims *newshape','PyObject *'),\n\n (r\"\"\"Copy an array.\n \"\"\",\n 'Copy','PyArrayObject *','PyObject *'),\n\n (r\"\"\"Like FromDimsAndData but uses the Descr structure instead of\n typecode as input.\n \"\"\",\n 'FromDimsAndDataAndDescr','int, int *, PyArray_Descr *, char *',\n 'PyObject *'),\n\n (r\"\"\"Copy an Array into another array.\n \"\"\",\n 'CopyInto', 'PyArrayObject *dest, PyArrayObject *src', 'int'),\n\n (r\"\"\"To List\n \"\"\",\n 'ToList','PyArrayObject *', 'PyObject *'),\n\n (r\"\"\"To File\n \"\"\",\n 'ToFile','PyArrayObject *, FILE *, char *, char *', 'int'),\n\n (r\"\"\"\n \"\"\",\n 'Dump', 'PyObject *, PyObject *, int', 'int'),\n\n (r\"\"\"\n \"\"\",\n 'Dumps', 'PyObject *, int', 'PyObject *'),\n \n \n (r\"\"\"Is the typenum valid?\n \"\"\",\n 'ValidType','int','int'), \n\n (r\"\"\"Update Several Flags at once.\n \"\"\",\n 'UpdateFlags','PyArrayObject *, int','void'),\n\n (r\"\"\"Generic new array creation routine.\n \"\"\",\n 'New','PyTypeObject *, int nd, intp *dims, int type, intp *strides, char *data, int itemsize, int fortran, PyObject *obj', 'PyObject *'),\n\n (r\"\"\"Get Priority from object\n \"\"\",\n 'GetPriority', 'PyObject *, double', 'double'),\n\n (r\"\"\"Get Iterator.\n \"\"\",\n 'IterNew','PyObject *', 'PyObject *'),\n\n (r\"\"\"Map Iterator.\n \"\"\",\n 'MapIterNew', 'PyObject *', 'PyObject *'),\n\n (r\"\"\"Bind Map Iterator\n \"\"\",\n 'MapIterBind', 'PyArrayMapIterObject *, PyArrayObject *', 'void'),\n\n (r\"\"\"Bind Map Iterator\n \"\"\",\n 'MapIterReset', 'PyArrayMapIterObject *', 'void'),\n\n (r\"\"\"\n \"\"\",\n 'MapIterNext', 'PyArrayMapIterObject *', 'void'),\n\n (r\"\"\"\n \"\"\",\n 'PyIntAsInt', 'PyObject *', 'int'),\n\n (r\"\"\"\n \"\"\",\n 'PyIntAsIntp','PyObject *', 'intp'),\n\n (r\"\"\"\n \"\"\",\n 'Broadcast', 'PyArrayMultiIterObject *', 'int'),\n\n (r\"\"\"\n \"\"\",\n 'FillObjectArray', 'PyArrayObject *, PyObject *','void'),\n\n (r\"\"\"\n \"\"\",\n 'CheckStrides', 'int, int, intp, intp *, intp *', 'Bool')\n\n ]\n\nmultiapi_list = [\n (r\"\"\"Return Transpose.\n \"\"\",\n 'Transpose','PyArrayObject *, PyObject *','PyObject *'),\n\n (r\"\"\"Take\n \"\"\",\n 'Take','PyArrayObject *, PyObject *, int axis','PyObject *'),\n\n (r\"\"\"Put values into an array\n \"\"\",\n 'Put','PyArrayObject *arr, PyObject *items, PyObject *values','PyObject *'),\n\n (r\"\"\"Put values into an array according to a mask.\n \"\"\",\n 'PutMask','PyArrayObject *arr, PyObject *mask, PyObject *values','PyObject *'),\n\n (r\"\"\"Repeat the array.\n \"\"\",\n 'Repeat','PyArrayObject *, PyObject *, int','PyObject *'),\n\n (r\"\"\"Numeric.choose()\n \"\"\",\n 'Choose','PyArrayObject *, PyObject *','PyObject *'),\n\n (r\"\"\"Sort an array\n \"\"\",\n 'Sort','PyArrayObject *, int', 'PyObject *'),\n\n (r\"\"\"ArgSort an array\n \"\"\",\n 'ArgSort','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Numeric.searchsorted(a,v)\n \"\"\",\n 'SearchSorted','PyArrayObject *, PyObject *','PyObject *'),\n\n (r\"\"\"ArgMax\n \"\"\",\n 'ArgMax','PyArrayObject *, int','PyObject *'),\n \n (r\"\"\"ArgMin\n \"\"\",\n 'ArgMin','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Reshape an array\n \"\"\",\n 'Reshape','PyArrayObject *, PyObject *','PyObject *'),\n\n (r\"\"\"New shape for an array\n \"\"\",\n 'Newshape','PyArrayObject *, PyArray_Dims *','PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'Squeeze','PyArrayObject *','PyObject *'),\n\n (r\"\"\"View\n \"\"\",\n 'View','PyArrayObject *, PyArray_Typecode *','PyObject *'),\n\n (r\"\"\"SwapAxes\n \"\"\",\n 'SwapAxes','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"Max\n \"\"\",\n 'Max','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Min\n \"\"\",\n 'Min','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Ptp\n \"\"\",\n 'Ptp','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Mean\n \"\"\",\n 'Mean','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"Trace\n \"\"\",\n 'Trace','PyArrayObject *, int, int, int, int','PyObject *'),\n\n (r\"\"\"Diagonal\n \"\"\",\n 'Diagonal','PyArrayObject *, int, int, int','PyObject *'),\n\n (r\"\"\"Clip\n \"\"\",\n 'Clip','PyArrayObject *, PyObject *, PyObject *','PyObject *'),\n\n (r\"\"\"Conjugate\n \"\"\",\n 'Conjugate','PyArrayObject *','PyObject *'),\n\n (r\"\"\"Nonzero\n \"\"\",\n 'Nonzero','PyArrayObject *','PyObject *'),\n\n (r\"\"\"Std\n \"\"\",\n 'Std','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"Sum\n \"\"\",\n 'Sum','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"CumSum\n \"\"\",\n 'CumSum','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"Prod\n \"\"\",\n 'Prod','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"CumProd\n \"\"\",\n 'CumProd','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"All\n \"\"\",\n 'All','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Any\n \"\"\",\n 'Any','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Compress\n \"\"\",\n 'Compress','PyArrayObject *, PyObject *, int','PyObject *'),\n\n (r\"\"\"Flatten\n \"\"\",\n 'Flatten','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Ravel\n \"\"\",\n 'Ravel','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Multiply a List\n \"\"\",\n 'MultiplyList','intp *lp, int n','intp'),\n\n (r\"\"\"Compare Lists\n \"\"\",\n 'CompareLists','intp *, intp *, int n','int'), \n\n (r\"\"\"Simulat a C-array\n \"\"\",\n \"AsCArray\",'PyObject **, void *ptr, intp *, int, int','int'),\n\n (r\"\"\"Convert to a 1D C-array\n \"\"\",\n 'As1D','PyObject **, char **ptr, int *d1, int typecode','int'),\n\n (r\"\"\"Convert to a 2D C-array\n \"\"\",\n 'As2D','PyObject **, char ***ptr, int *d1, int *d2, int typecode','int'),\n\n (r\"\"\"Free pointers created if As2D is called\n \"\"\",\n 'Free','PyObject *, void *','int'),\n\n (r\"\"\"Useful to pass as converter function for O& processing in\n PyArgs_ParseTuple.\n \"\"\",\n 'Converter','PyObject *, PyObject **','int'),\n\n (r\"\"\"PyArray_IntpFromSequence\n \"\"\",\n 'IntpFromSequence', 'PyObject *, intp *, int', 'int'), \n\n (r\"\"\"Concatenate an arbitrary Python sequence into\n an array.\n \"\"\",\n 'Concatenate','PyObject *, int','PyObject *'),\n\n (r\"\"\"Numeric.innerproduct(a,v)\n \"\"\",\n 'InnerProduct','PyObject *, PyObject *','PyObject *'),\n\n (r\"\"\"Numeric.matrixproduct(a,v)\n \"\"\",\n 'MatrixProduct','PyObject *, PyObject *','PyObject *'),\n\n (r\"\"\"Fast Copy and Transpose\n \"\"\",\n 'CopyAndTranspose','PyObject *','PyObject *'),\n\n (r\"\"\"Numeric.correlate(a1,a2,mode)\n \"\"\",\n 'Correlate','PyObject *, PyObject *, int mode','PyObject *'),\n \n (r\"\"\"Typestr converter\n \"\"\",\n 'TypestrConvert', 'int, int', 'int'),\n\n (r\"\"\"Get typenum from an object -- a converter function\n \"\"\",\n 'TypecodeConverter','PyObject *, PyArray_Typecode *', 'int'),\n\n (r\"\"\"Get intp chunk from sequence\n \"\"\",\n 'IntpConverter', 'PyObject *, PyArray_Dims *', 'int'),\n\n (r\"\"\"Get buffer chunk from object\n \"\"\",\n 'BufferConverter', 'PyObject *, PyArray_Chunk *', 'int'),\n\n (r\"\"\"Get axis from an object (possibly None) -- a converter function,\n \"\"\",\n 'AxisConverter','PyObject *, int *', 'int'),\n\n (r\"\"\"Convert an object to true / false\n \"\"\",\n 'BoolConverter','PyObject *, Bool *', 'int'),\n\n (r\"\"\"\n \"\"\",\n 'EquivalentTypes', 'PyArray_Typecode *, PyArray_Typecode *', 'Bool'),\n\n (r\"\"\"\n \"\"\",\n 'EquivArrTypes', 'PyArrayObject *, PyArrayObject *', 'Bool'),\n\n (r\"\"\"Zeros\n \"\"\",\n 'Zeros', 'int, intp *, PyArray_Typecode *', 'PyObject *'),\n\n (r\"\"\"Empty\n \"\"\",\n 'Empty', 'int, intp *, PyArray_Typecode *', 'PyObject *'),\n\n\n (r\"\"\"Where\n \"\"\",\n 'Where', 'PyObject *, PyObject *, PyObject *', 'PyObject *'),\n\n (r\"\"\"Arange\n \"\"\",\n 'Arange', 'double, double, double, int', 'PyObject *')\n \n ]\n\n\ntypes = ['Generic','Numeric','Integer','SignedInteger','UnsignedInteger', 'Inexact',\n 'Floating', 'Complex', 'Flexible', 'Character',\n 'Bool','Byte','Short','Int', 'Long', 'LongLong', 'UByte', 'UShort',\n 'UInt', 'ULong', 'ULongLong', 'Float', 'Double', 'LongDouble',\n 'CFloat', 'CDouble', 'CLongDouble', 'Object', 'String', 'Unicode',\n 'Void']\n\n# API fixes for __arrayobject_api.h\n\nfixed = 5\nnumtypes = len(types) + fixed\nnumobject = len(objectapi_list) + numtypes\nnummulti = len(multiapi_list) \nnumtotal = numobject + nummulti\n\n\nmodule_list = []\nextension_list = []\ninit_list = []\n\n# setup types\nfor k, atype in enumerate(types):\n num = fixed + k\n astr = \" (void *) &Py%sArrType_Type,\" % types[k]\n init_list.append(astr)\n astr = \"static PyTypeObject Py%sArrType_Type;\" % types[k]\n module_list.append(astr)\n astr = \"#define Py%sArrType_Type (*(PyTypeObject *)PyArray_API[%d])\" % \\\n (types[k], num)\n extension_list.append(astr)\n\n\n#setup object API\nfor k, item in enumerate(objectapi_list):\n num = numtypes + k\n astr = \"static %s PyArray_%s \\\\\\n (%s);\" % \\\n (item[3],item[1],item[2])\n module_list.append(astr)\n astr = \"#define PyArray_%s \\\\\\n (*(%s (*)(%s)) \\\\\\n\"\\\n \" PyArray_API[%d])\" % (item[1],item[3],item[2],num)\n extension_list.append(astr)\n astr = \" (void *) PyArray_%s,\" % item[1]\n init_list.append(astr)\n\n \n##outstr = r\"\"\"\n###ifdef _ARRAYOBJECT\n\n##static PyTypeObject PyArray_Type;\n##static PyTypeObject PyArrayIter_Type;\n\n##%s\n\n\n###else\n\n###define PyArray_Type (*(PyTypeObject *)PyArray_API[0])\n###define PyArrayIter_Type (*(PyTypeObject *)PyArray_API[1])\n\n##%s\n\n###endif\n##\"\"\" % ('\\n'.join(module_list), '\\n'.join(extension_list))\n\n### Write out to header\n##fid = open('__arrayobject_api.h','w')\n##fid.write(outstr)\n##fid.close()\n\n\n##outstr = r\"\"\"\n##/* Export only these pointers */\n\n##void *arrayobject_API[] = {\n## (void *) &PyArray_Type,\n## (void *) &PyArrayIter_Type,\n##%s\n##};\n##\"\"\" % '\\n'.join(init_list)\n\n###Write out to c-code\n##fid = open('__arrayobject_api.c','w')\n##fid.write(outstr)\n##fid.close()\n\n\n#module_list = []\n#extension_list = []\n#init_list = []\n\n# setup multiarray module API\nfor k, item in enumerate(multiapi_list):\n num = numobject + k\n astr = \"static %s PyArray_%s \\\\\\n (%s);\" % \\\n (item[3],item[1],item[2])\n module_list.append(astr)\n astr = \"#define PyArray_%s \\\\\\n (*(%s (*)(%s)) \\\\\\n\"\\\n \" PyArray_API[%d])\" % (item[1],item[3],item[2],num)\n extension_list.append(astr)\n astr = \" (void *) PyArray_%s,\" % item[1]\n init_list.append(astr)\n\n\noutstr = r\"\"\"\n#ifdef _MULTIARRAYMODULE\n\nstatic PyTypeObject PyBigArray_Type;\nstatic PyTypeObject PyArray_Type;\nstatic PyTypeObject PyArrayIter_Type;\nstatic PyTypeObject PyArrayMapIter_Type;\nstatic int PyArray_NUMUSERTYPES=0;\n\n%s\n\n#else\n\nstatic void **PyArray_API=NULL;\n\n#define PyBigArray_Type (*(PyTypeObject *)PyArray_API[0])\n#define PyArray_Type (*(PyTypeObject *)PyArray_API[1])\n#define PyArrayIter_Type (*(PyTypeObject *)PyArray_API[2])\n#define PyArrayMapIter_Type (*(PyTypeObject *)PyArray_API[3])\n#define PyArray_NUMUSERTYPES (*(int *)PyArray_API[4])\n\n%s\n\nstatic int\nimport_array(void) \n{ \n PyObject *numpy = PyImport_ImportModule(\"scipy.base.multiarray\");\n PyObject *c_api = NULL;\n if (numpy == NULL) return -1;\n c_api = PyObject_GetAttrString(numpy, \"_ARRAY_API\");\n if (c_api == NULL) {Py_DECREF(numpy); return -1;}\n if (PyCObject_Check(c_api)) { \n PyArray_API = (void **)PyCObject_AsVoidPtr(c_api); \n }\n Py_DECREF(c_api);\n Py_DECREF(numpy);\n if (PyArray_API == NULL) return -1;\n return 0;\n}\n\n#endif\n\n\"\"\" % ('\\n'.join(module_list), \n '\\n'.join(extension_list))\n\n# Write to header\nfid = open('__multiarray_api.h','w')\nfid.write(outstr)\nfid.close()\n\n\noutstr = r\"\"\"\n/* These pointers will be stored in the C-object for use in other\n extension modules\n*/\n\nvoid *PyArray_API[] = {\n (void *) &PyBigArray_Type,\n (void *) &PyArray_Type,\n (void *) &PyArrayIter_Type,\n (void *) &PyArrayMapIter_Type,\n (int *) &PyArray_NUMUSERTYPES,\n%s\n};\n\"\"\" % '\\n'.join(init_list)\n\n# Write to c-code\nfid = open('__multiarray_api.c','w')\nfid.write(outstr)\nfid.close()\n\n\n\n\n", "source_code_before": "\n# doc is comment_documentation\n\n# use list so order is preserved.\nobjectapi_list = [\n (r\"\"\"Set internal structure with number functions that all\n arrays will use\n \"\"\",\n 'SetNumericOps','PyObject *dict','int'),\n\n (r\"\"\"Get dictionary showing number functions that all\n arrays will use\n \"\"\",\n 'GetNumericOps','void','PyObject *'),\n\n\n (r\"\"\"For object arrays, increment all internal references.\n \"\"\",\n 'INCREF','PyArrayObject *','int'),\n\n (r\"\"\"Decrement all internal references for object arrays.\n \"\"\", \n 'XDECREF','PyArrayObject *','int'),\n\n (r\"\"\"Set the array print function to be a Python function.\n \"\"\",\n 'SetStringFunction','PyObject *op, int repr','void'),\n\n (r\"\"\"Get the PyArray_Descr structure for a type.\n \"\"\",\n 'DescrFromType','int','PyArray_Descr *'),\n\n (r\"\"\"Get pointer to zero of correct type for array. \n \"\"\",\n 'Zero', 'PyArrayObject *', 'char *'),\n\n (r\"\"\"Get pointer to one of correct type for array\n \"\"\",\n 'One', 'PyArrayObject *', 'char *'),\n\n\n (r\"\"\"Cast an array to a different type.\n \"\"\",\n 'Cast','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Cast an array using typecode structure.\n \"\"\",\n 'CastToType','PyArrayObject *, PyArray_Typecode *','PyObject *'),\n\n (r\"\"\"Cast to an already created array.\n \"\"\",\n 'CastTo', 'PyArrayObject *, PyArrayObject *', 'int'),\n\n (r\"\"\"Check the type coercion rules.\n \"\"\",\n 'CanCastSafely','int fromtype, int totype','int'),\n\n (r\"\"\"\n \"\"\",\n 'CanCastTo','PyArray_Typecode *, PyArray_Typecode *', 'Bool'),\n\n (r\"\"\"Return the typecode of the array a Python object would be\n converted to\n \"\"\",\n 'ObjectType','PyObject *, int','int'),\n\n (r\"\"\"\n \"\"\",\n 'ArrayType','PyObject *, PyArray_Typecode *, PyArray_Typecode *','void'),\n\n (r\"\"\"Return type typecode from array scalar.\n \"\"\",\n 'TypecodeFromScalar','PyObject *, PyArray_Typecode *','void'),\n\n (r\"\"\"Compute the size of an array (in number of items)\n \"\"\",\n 'Size','PyObject *','intp'),\n\n (r\"\"\"Get scalar-equivalent to 0-d array\n \"\"\",\n 'Scalar', 'char *, int, int, int', 'PyObject *'),\n\n (r\"\"\"Get scalar-equivalent to 0-d array\n \"\"\",\n 'ToScalar', 'char *, PyArrayObject *', 'PyObject *'),\n\n (r\"\"\"Get 0-dim array from scalar\n \"\"\",\n 'FromScalar', 'PyObject *, PyArray_Typecode *', 'PyObject *'),\n\n (r\"\"\"Register Data type\n \"\"\",\n 'RegisterDataType', 'PyTypeObject *', 'int'),\n\n (r\"\"\"Insert Descr Table\n \"\"\",\n 'RegisterDescrForType', 'int, PyArray_Descr *', 'int'),\n \n (r\"\"\"Construct an empty array from dimensions and typenum\n \"\"\",\n 'FromDims','int nd, int *, int typenum','PyObject *'),\n\n (r\"\"\"Construct an array from dimensions, typenum, and a pointer\n to the data. Python will never free this (unless you later set\n the OWN_DATA flag). \n \"\"\",\n 'FromDimsAndData','int, int *, int, char *','PyObject *'),\n\n (r\"\"\"Construct an array from an arbitrary Python Object.\n Last two integers are min_dimensions, and max_dimensions.\n If max_dimensions = 0, then any number of dimensions are allowed.\n Fix the dimension by setting min_dimension == max_dimension.\n If the array is already contiguous (and aligned and not swapped)\n no copy is done, just a new reference created. \n \"\"\",\n 'ContiguousFromObject',\n 'PyObject *, int typenum, int, int',\n 'PyObject *'),\n\n (r\"\"\"Same as ContiguousFromObject except ensure a copy.\n \"\"\",\n 'CopyFromObject','PyObject *, int, int, int','PyObject *'),\n\n (r\"\"\"Can return a discontiguous array (but aligned and byteswapped)\n \"\"\",\n 'FromObject','PyObject *, int, int, int','PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'FromAny', 'PyObject *, PyArray_Typecode *, int, int, int', 'PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'EnsureArray', 'PyObject *', 'PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'FromFile', 'FILE *, PyArray_Typecode *, intp, char *','PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'FromBuffer', 'PyObject *, PyArray_Typecode *, intp, int','PyObject *'),\n\n (r\"\"\"Return either an array or the appropriate Python object if the\n array is 0d and matches a Python type.\n \"\"\",\n 'Return','PyArrayObject *','PyObject *'),\n\n (r\"\"\"Get a subset of bytes from each element of the array\n \"\"\",\n 'GetField', 'PyArrayObject *, PyArray_Typecode *, int', 'PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'Byteswap', 'PyArrayObject *, Bool', 'PyObject *'),\n\n (r\"\"\"Resize (reallocate data). Only works if nothing else is\n referencing this array and it is contiguous.\n \"\"\",\n 'Resize','PyArrayObject *ap, PyArray_Dims *newshape','PyObject *'),\n\n (r\"\"\"Copy an array.\n \"\"\",\n 'Copy','PyArrayObject *','PyObject *'),\n\n (r\"\"\"Like FromDimsAndData but uses the Descr structure instead of\n typecode as input.\n \"\"\",\n 'FromDimsAndDataAndDescr','int, int *, PyArray_Descr *, char *',\n 'PyObject *'),\n\n (r\"\"\"Copy an Array into another array.\n \"\"\",\n 'CopyInto', 'PyArrayObject *dest, PyArrayObject *src', 'int'),\n\n (r\"\"\"To List\n \"\"\",\n 'ToList','PyArrayObject *', 'PyObject *'),\n\n (r\"\"\"To File\n \"\"\",\n 'ToFile','PyArrayObject *, FILE *, char *, char *', 'int'),\n\n (r\"\"\"\n \"\"\",\n 'Dump', 'PyObject *, PyObject *, int', 'int'),\n\n (r\"\"\"\n \"\"\",\n 'Dumps', 'PyObject *, int', 'PyObject *'),\n \n \n (r\"\"\"Is the typenum valid?\n \"\"\",\n 'ValidType','int','int'), \n\n (r\"\"\"Update Several Flags at once.\n \"\"\",\n 'UpdateFlags','PyArrayObject *, int','void'),\n\n (r\"\"\"Generic new array creation routine.\n \"\"\",\n 'New','PyTypeObject *, int nd, intp *dims, int type, intp *strides, char *data, int itemsize, int fortran, PyArrayObject *arr', 'PyObject *'),\n\n (r\"\"\"Get Priority from object\n \"\"\",\n 'GetPriority', 'PyObject *, double', 'double'),\n\n (r\"\"\"Get Iterator.\n \"\"\",\n 'IterNew','PyObject *', 'PyObject *'),\n\n (r\"\"\"Map Iterator.\n \"\"\",\n 'MapIterNew', 'PyObject *', 'PyObject *'),\n\n (r\"\"\"Bind Map Iterator\n \"\"\",\n 'MapIterBind', 'PyArrayMapIterObject *, PyArrayObject *', 'void'),\n\n (r\"\"\"Bind Map Iterator\n \"\"\",\n 'MapIterReset', 'PyArrayMapIterObject *', 'void'),\n\n (r\"\"\"\n \"\"\",\n 'MapIterNext', 'PyArrayMapIterObject *', 'void'),\n\n (r\"\"\"\n \"\"\",\n 'PyIntAsInt', 'PyObject *', 'int'),\n\n (r\"\"\"\n \"\"\",\n 'PyIntAsIntp','PyObject *', 'intp'),\n\n (r\"\"\"\n \"\"\",\n 'Broadcast', 'PyArrayMultiIterObject *', 'int'),\n\n (r\"\"\"\n \"\"\",\n 'FillObjectArray', 'PyArrayObject *, PyObject *','void'),\n\n (r\"\"\"\n \"\"\",\n 'CheckStrides', 'int, int, intp, intp *, intp *', 'Bool')\n\n ]\n\nmultiapi_list = [\n (r\"\"\"Return Transpose.\n \"\"\",\n 'Transpose','PyArrayObject *, PyObject *','PyObject *'),\n\n (r\"\"\"Take\n \"\"\",\n 'Take','PyArrayObject *, PyObject *, int axis','PyObject *'),\n\n (r\"\"\"Put values into an array\n \"\"\",\n 'Put','PyArrayObject *arr, PyObject *items, PyObject *values','PyObject *'),\n\n (r\"\"\"Put values into an array according to a mask.\n \"\"\",\n 'PutMask','PyArrayObject *arr, PyObject *mask, PyObject *values','PyObject *'),\n\n (r\"\"\"Repeat the array.\n \"\"\",\n 'Repeat','PyArrayObject *, PyObject *, int','PyObject *'),\n\n (r\"\"\"Numeric.choose()\n \"\"\",\n 'Choose','PyArrayObject *, PyObject *','PyObject *'),\n\n (r\"\"\"Sort an array\n \"\"\",\n 'Sort','PyArrayObject *, int', 'PyObject *'),\n\n (r\"\"\"ArgSort an array\n \"\"\",\n 'ArgSort','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Numeric.searchsorted(a,v)\n \"\"\",\n 'SearchSorted','PyArrayObject *, PyObject *','PyObject *'),\n\n (r\"\"\"ArgMax\n \"\"\",\n 'ArgMax','PyArrayObject *, int','PyObject *'),\n \n (r\"\"\"ArgMin\n \"\"\",\n 'ArgMin','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Reshape an array\n \"\"\",\n 'Reshape','PyArrayObject *, PyObject *','PyObject *'),\n\n (r\"\"\"New shape for an array\n \"\"\",\n 'Newshape','PyArrayObject *, PyArray_Dims *','PyObject *'),\n\n (r\"\"\"\n \"\"\",\n 'Squeeze','PyArrayObject *','PyObject *'),\n\n (r\"\"\"View\n \"\"\",\n 'View','PyArrayObject *, PyArray_Typecode *','PyObject *'),\n\n (r\"\"\"SwapAxes\n \"\"\",\n 'SwapAxes','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"Max\n \"\"\",\n 'Max','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Min\n \"\"\",\n 'Min','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Ptp\n \"\"\",\n 'Ptp','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Mean\n \"\"\",\n 'Mean','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"Trace\n \"\"\",\n 'Trace','PyArrayObject *, int, int, int, int','PyObject *'),\n\n (r\"\"\"Diagonal\n \"\"\",\n 'Diagonal','PyArrayObject *, int, int, int','PyObject *'),\n\n (r\"\"\"Clip\n \"\"\",\n 'Clip','PyArrayObject *, PyObject *, PyObject *','PyObject *'),\n\n (r\"\"\"Conjugate\n \"\"\",\n 'Conjugate','PyArrayObject *','PyObject *'),\n\n (r\"\"\"Nonzero\n \"\"\",\n 'Nonzero','PyArrayObject *','PyObject *'),\n\n (r\"\"\"Std\n \"\"\",\n 'Std','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"Sum\n \"\"\",\n 'Sum','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"CumSum\n \"\"\",\n 'CumSum','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"Prod\n \"\"\",\n 'Prod','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"CumProd\n \"\"\",\n 'CumProd','PyArrayObject *, int, int','PyObject *'),\n\n (r\"\"\"All\n \"\"\",\n 'All','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Any\n \"\"\",\n 'Any','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Compress\n \"\"\",\n 'Compress','PyArrayObject *, PyObject *, int','PyObject *'),\n\n (r\"\"\"Flatten\n \"\"\",\n 'Flatten','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Ravel\n \"\"\",\n 'Ravel','PyArrayObject *, int','PyObject *'),\n\n (r\"\"\"Multiply a List\n \"\"\",\n 'MultiplyList','intp *lp, int n','intp'),\n\n (r\"\"\"Compare Lists\n \"\"\",\n 'CompareLists','intp *, intp *, int n','int'), \n\n (r\"\"\"Simulat a C-array\n \"\"\",\n \"AsCArray\",'PyObject **, void *ptr, intp *, int, int','int'),\n\n (r\"\"\"Convert to a 1D C-array\n \"\"\",\n 'As1D','PyObject **, char **ptr, int *d1, int typecode','int'),\n\n (r\"\"\"Convert to a 2D C-array\n \"\"\",\n 'As2D','PyObject **, char ***ptr, int *d1, int *d2, int typecode','int'),\n\n (r\"\"\"Free pointers created if As2D is called\n \"\"\",\n 'Free','PyObject *, void *','int'),\n\n (r\"\"\"Useful to pass as converter function for O& processing in\n PyArgs_ParseTuple.\n \"\"\",\n 'Converter','PyObject *, PyObject **','int'),\n\n (r\"\"\"PyArray_IntpFromSequence\n \"\"\",\n 'IntpFromSequence', 'PyObject *, intp *, int', 'int'), \n\n (r\"\"\"Concatenate an arbitrary Python sequence into\n an array.\n \"\"\",\n 'Concatenate','PyObject *, int','PyObject *'),\n\n (r\"\"\"Numeric.innerproduct(a,v)\n \"\"\",\n 'InnerProduct','PyObject *, PyObject *','PyObject *'),\n\n (r\"\"\"Numeric.matrixproduct(a,v)\n \"\"\",\n 'MatrixProduct','PyObject *, PyObject *','PyObject *'),\n\n (r\"\"\"Fast Copy and Transpose\n \"\"\",\n 'CopyAndTranspose','PyObject *','PyObject *'),\n\n (r\"\"\"Numeric.correlate(a1,a2,mode)\n \"\"\",\n 'Correlate','PyObject *, PyObject *, int mode','PyObject *'),\n \n (r\"\"\"Typestr converter\n \"\"\",\n 'TypestrConvert', 'int, int', 'int'),\n\n (r\"\"\"Get typenum from an object -- a converter function\n \"\"\",\n 'TypecodeConverter','PyObject *, PyArray_Typecode *', 'int'),\n\n (r\"\"\"Get intp chunk from sequence\n \"\"\",\n 'IntpConverter', 'PyObject *, PyArray_Dims *', 'int'),\n\n (r\"\"\"Get buffer chunk from object\n \"\"\",\n 'BufferConverter', 'PyObject *, PyArray_Chunk *', 'int'),\n\n (r\"\"\"Get axis from an object (possibly None) -- a converter function,\n \"\"\",\n 'AxisConverter','PyObject *, int *', 'int'),\n\n (r\"\"\"Convert an object to true / false\n \"\"\",\n 'BoolConverter','PyObject *, Bool *', 'int'),\n\n (r\"\"\"\n \"\"\",\n 'EquivalentTypes', 'PyArray_Typecode *, PyArray_Typecode *', 'Bool'),\n\n (r\"\"\"\n \"\"\",\n 'EquivArrTypes', 'PyArrayObject *, PyArrayObject *', 'Bool'),\n\n (r\"\"\"Zeros\n \"\"\",\n 'Zeros', 'int, intp *, PyArray_Typecode *', 'PyObject *'),\n\n (r\"\"\"Empty\n \"\"\",\n 'Empty', 'int, intp *, PyArray_Typecode *', 'PyObject *'),\n\n\n (r\"\"\"Where\n \"\"\",\n 'Where', 'PyObject *, PyObject *, PyObject *', 'PyObject *'),\n\n (r\"\"\"Arange\n \"\"\",\n 'Arange', 'double, double, double, int', 'PyObject *')\n \n ]\n\n\ntypes = ['Generic','Numeric','Integer','SignedInteger','UnsignedInteger', 'Inexact',\n 'Floating', 'Complex', 'Flexible', 'Character',\n 'Bool','Byte','Short','Int', 'Long', 'LongLong', 'UByte', 'UShort',\n 'UInt', 'ULong', 'ULongLong', 'Float', 'Double', 'LongDouble',\n 'CFloat', 'CDouble', 'CLongDouble', 'Object', 'String', 'Unicode',\n 'Void']\n\n# API fixes for __arrayobject_api.h\n\nfixed = 5\nnumtypes = len(types) + fixed\nnumobject = len(objectapi_list) + numtypes\nnummulti = len(multiapi_list) \nnumtotal = numobject + nummulti\n\n\nmodule_list = []\nextension_list = []\ninit_list = []\n\n# setup types\nfor k, atype in enumerate(types):\n num = fixed + k\n astr = \" (void *) &Py%sArrType_Type,\" % types[k]\n init_list.append(astr)\n astr = \"static PyTypeObject Py%sArrType_Type;\" % types[k]\n module_list.append(astr)\n astr = \"#define Py%sArrType_Type (*(PyTypeObject *)PyArray_API[%d])\" % \\\n (types[k], num)\n extension_list.append(astr)\n\n\n#setup object API\nfor k, item in enumerate(objectapi_list):\n num = numtypes + k\n astr = \"static %s PyArray_%s \\\\\\n (%s);\" % \\\n (item[3],item[1],item[2])\n module_list.append(astr)\n astr = \"#define PyArray_%s \\\\\\n (*(%s (*)(%s)) \\\\\\n\"\\\n \" PyArray_API[%d])\" % (item[1],item[3],item[2],num)\n extension_list.append(astr)\n astr = \" (void *) PyArray_%s,\" % item[1]\n init_list.append(astr)\n\n \n##outstr = r\"\"\"\n###ifdef _ARRAYOBJECT\n\n##static PyTypeObject PyArray_Type;\n##static PyTypeObject PyArrayIter_Type;\n\n##%s\n\n\n###else\n\n###define PyArray_Type (*(PyTypeObject *)PyArray_API[0])\n###define PyArrayIter_Type (*(PyTypeObject *)PyArray_API[1])\n\n##%s\n\n###endif\n##\"\"\" % ('\\n'.join(module_list), '\\n'.join(extension_list))\n\n### Write out to header\n##fid = open('__arrayobject_api.h','w')\n##fid.write(outstr)\n##fid.close()\n\n\n##outstr = r\"\"\"\n##/* Export only these pointers */\n\n##void *arrayobject_API[] = {\n## (void *) &PyArray_Type,\n## (void *) &PyArrayIter_Type,\n##%s\n##};\n##\"\"\" % '\\n'.join(init_list)\n\n###Write out to c-code\n##fid = open('__arrayobject_api.c','w')\n##fid.write(outstr)\n##fid.close()\n\n\n#module_list = []\n#extension_list = []\n#init_list = []\n\n# setup multiarray module API\nfor k, item in enumerate(multiapi_list):\n num = numobject + k\n astr = \"static %s PyArray_%s \\\\\\n (%s);\" % \\\n (item[3],item[1],item[2])\n module_list.append(astr)\n astr = \"#define PyArray_%s \\\\\\n (*(%s (*)(%s)) \\\\\\n\"\\\n \" PyArray_API[%d])\" % (item[1],item[3],item[2],num)\n extension_list.append(astr)\n astr = \" (void *) PyArray_%s,\" % item[1]\n init_list.append(astr)\n\n\noutstr = r\"\"\"\n#ifdef _MULTIARRAYMODULE\n\nstatic PyTypeObject PyBigArray_Type;\nstatic PyTypeObject PyArray_Type;\nstatic PyTypeObject PyArrayIter_Type;\nstatic PyTypeObject PyArrayMapIter_Type;\nstatic int PyArray_NUMUSERTYPES=0;\n\n%s\n\n#else\n\nstatic void **PyArray_API=NULL;\n\n#define PyBigArray_Type (*(PyTypeObject *)PyArray_API[0])\n#define PyArray_Type (*(PyTypeObject *)PyArray_API[1])\n#define PyArrayIter_Type (*(PyTypeObject *)PyArray_API[2])\n#define PyArrayMapIter_Type (*(PyTypeObject *)PyArray_API[3])\n#define PyArray_NUMUSERTYPES (*(int *)PyArray_API[4])\n\n%s\n\nstatic int\nimport_array(void) \n{ \n PyObject *numpy = PyImport_ImportModule(\"scipy.base.multiarray\");\n PyObject *c_api = NULL;\n if (numpy == NULL) return -1;\n c_api = PyObject_GetAttrString(numpy, \"_ARRAY_API\");\n if (c_api == NULL) {Py_DECREF(numpy); return -1;}\n if (PyCObject_Check(c_api)) { \n PyArray_API = (void **)PyCObject_AsVoidPtr(c_api); \n }\n Py_DECREF(c_api);\n Py_DECREF(numpy);\n if (PyArray_API == NULL) return -1;\n return 0;\n}\n\n#endif\n\n\"\"\" % ('\\n'.join(module_list), \n '\\n'.join(extension_list))\n\n# Write to header\nfid = open('__multiarray_api.h','w')\nfid.write(outstr)\nfid.close()\n\n\noutstr = r\"\"\"\n/* These pointers will be stored in the C-object for use in other\n extension modules\n*/\n\nvoid *PyArray_API[] = {\n (void *) &PyBigArray_Type,\n (void *) &PyArray_Type,\n (void *) &PyArrayIter_Type,\n (void *) &PyArrayMapIter_Type,\n (int *) &PyArray_NUMUSERTYPES,\n%s\n};\n\"\"\" % '\\n'.join(init_list)\n\n# Write to c-code\nfid = open('__multiarray_api.c','w')\nfid.write(outstr)\nfid.close()\n\n\n\n\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": 477, "complexity": 0, "token_count": 1692, "diff_parsed": { "added": [ " 'New','PyTypeObject *, int nd, intp *dims, int type, intp *strides, char *data, int itemsize, int fortran, PyObject *obj', 'PyObject *')," ], "deleted": [ " 'New','PyTypeObject *, int nd, intp *dims, int type, intp *strides, char *data, int itemsize, int fortran, PyArrayObject *arr', 'PyObject *')," ] } }, { "old_path": "scipy/base/include/scipy/arrayobject.h", "new_path": "scipy/base/include/scipy/arrayobject.h", "filename": "arrayobject.h", "extension": "h", "change_type": "MODIFY", "diff": "@@ -641,6 +641,8 @@ enum PyArray_TYPECHAR { PyArray_BOOLLTR = '?',\n typedef Py_intptr_t intp;\n typedef Py_uintptr_t uintp;\n \n+#define INTP_STRFORMAT \"%d\"\n+\n #if SIZEOF_PY_INTPTR_T == SIZEOF_INT \n \t#define PyArray_INTP PyArray_INT\n \t#define PyArray_UINTP PyArray_UINT\n@@ -665,6 +667,8 @@ typedef Py_uintptr_t uintp;\n \t#define MAX_INTP MAX_LONGLONG\n \t#define MIN_INTP MIN_LONGLONG\n \t#define MAX_UINTP MAX_ULONGLONG\n+ #undef INTP_STRFORMAT\n+ #define INTP_STRFORMAT \"%Ld\"\n #endif\n \n #define ERR(str) fprintf(stderr, #str); fflush(stderr);\n", "added_lines": 4, "deleted_lines": 0, "source_code": "\n/* This expects the following variables to be defined (besides\n the usual ones from pyconfig.h\n\n SIZEOF_LONG_DOUBLE -- sizeof(long double) or sizeof(double) if no\n long double is present on platform.\n CHAR_BIT -- number of bits in a char (usually 8)\n (should be in limits.h)\n*/\n\n#ifndef Py_ARRAYOBJECT_H\n#define Py_ARRAYOBJECT_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"config.h\"\n\n/* There are several places in the code where an array of dimensions is */\n/* allocated statically. This is the size of that static allocation. */\n\n#define MAX_DIMS 40\n\n/* Used for Converter Functions \"O&\" code in ParseTuple */\n#define PY_FAIL 0\n#define PY_SUCCEED 1\n\n#define NDARRAY_VERSION 0x0400\n\n\t/* Some platforms don't define bool, long long, or long double.\n\t Handle that here.\n\t */\n\n#ifdef PY_LONG_LONG\ntypedef PY_LONG_LONG longlong;\ntypedef unsigned PY_LONG_LONG ulonglong;\n# ifdef _MSC_VER\n# define LONGLONG_FMT \"%I64d\"\n# define ULONGLONG_FMT \"%I64u\"\n# define LONGLONG_SUFFIX(x) (x##i64)\n# define ULONGLONG_SUFFIX(x) (x##Ui64)\n# else\n\t/* #define LONGLONG_FMT \"%lld\" Another possible variant\n #define ULONGLONG_FMT \"%llu\"\n\n\t #define LONGLONG_FMT \"%qd\" -- BSD perhaps?\n\t #define ULONGLONG_FMT \"%qu\"\n\t*/\n# define LONGLONG_FMT \"%Ld\"\n# define ULONGLONG_FMT \"%Lu\"\n# define LONGLONG_SUFFIX(x) (x##LL)\n# define ULONGLONG_SUFFIX(x) (x##ULL)\n# endif\n#else\ntypedef long longlong;\ntypedef unsigned long ulonglong;\n# define LONGLONG_SUFFIX(x) (x##L)\n# define ULONGLONG_SUFFIX(x) (x##UL)\n#endif\n\ntypedef unsigned char Bool;\n#ifndef FALSE\n#define FALSE 0\n#endif\n#ifndef TRUE\n#define TRUE 1\n#endif\n\n#if SIZEOF_LONG_DOUBLE==SIZEOF_DOUBLE\n\ttypedef double longdouble;\n #define LONGDOUBLE_FMT \"g\"\n#else\n\ttypedef long double longdouble;\n #define LONGDOUBLE_FMT \"Lg\"\n#endif\n\n#ifndef Py_USING_UNICODE\n#define Py_UNICODE char\n#endif\n\n\ntypedef signed char byte;\ntypedef unsigned char ubyte;\ntypedef unsigned short ushort;\ntypedef unsigned int uint;\ntypedef unsigned long ulong;\n\ntypedef struct { float real, imag; } cfloat;\ntypedef struct { double real, imag; } cdouble;\ntypedef struct {longdouble real, imag;} clongdouble;\n\nenum PyArray_TYPES { PyArray_BOOL=0,\n PyArray_BYTE, PyArray_UBYTE,\n\t\t PyArray_SHORT, PyArray_USHORT,\n\t\t PyArray_INT, PyArray_UINT,\n\t\t\tPyArray_LONG, PyArray_ULONG,\n PyArray_LONGLONG, PyArray_ULONGLONG,\n\t\t\tPyArray_FLOAT, PyArray_DOUBLE, PyArray_LONGDOUBLE,\n\t\t\tPyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CLONGDOUBLE,\n\t\t\tPyArray_OBJECT=17,\n PyArray_STRING, PyArray_UNICODE,\n\t\t\tPyArray_VOID,\n\t\t\tPyArray_NTYPES,\n\t\t\tPyArray_NOTYPE,\n\t\t\tPyArray_USERDEF=256 /* leave room for characters */\n};\n\n\t/* basetype array priority */\n#define PyArray_PRIORITY 0.0\n#define PyArray_BIG_PRIORITY 0.1\n\t/* default subtype priority */\n#define PyArray_SUBTYPE_PRIORITY 1.0\n\n\t/* How many floating point types are there */\n#define PyArray_NUM_FLOATTYPE 3\n\n\n\t/* We need to match intp to a signed integer of the same size as\n\t a pointer variable. uintp to the equivalent unsigned integer\n\t*/\n\n\n\t/* These characters correspond to the array type and the\n\t struct module */\n\n\t/* except 'p' -- signed integer for pointer type */\n\nenum PyArray_TYPECHAR { PyArray_BOOLLTR = '?',\n\t\t\tPyArray_BYTELTR = 'b',\n\t\t\tPyArray_UBYTELTR = 'B',\n\t\t\tPyArray_SHORTLTR = 'h',\n\t\t\tPyArray_USHORTLTR = 'H',\n\t\t\tPyArray_INTLTR = 'i',\n\t\t\tPyArray_UINTLTR = 'I',\n\t\t\tPyArray_LONGLTR = 'l',\n\t\t\tPyArray_ULONGLTR = 'L', \n\t\t\tPyArray_LONGLONGLTR = 'q', \n\t\t\tPyArray_ULONGLONGLTR = 'Q',\n\t\t\tPyArray_FLOATLTR = 'f',\n\t\t\tPyArray_DOUBLELTR = 'd',\n\t\t\tPyArray_LONGDOUBLELTR = 'g',\n\t\t\tPyArray_CFLOATLTR = 'F',\n\t\t\tPyArray_CDOUBLELTR = 'D',\n\t\t\tPyArray_CLONGDOUBLELTR = 'G',\n\t\t\tPyArray_OBJECTLTR = 'O',\n\t\t\tPyArray_STRINGLTR = 'S',\n\t\t\tPyArray_UNICODELTR = 'U',\n\t\t PyArray_VOIDLTR = 'V',\n\n\t\t\t/* No Descriptor, just a define -- this let's\n\t\t\t Python users specify an array of integers\n\t\t\t large enough to hold a pointer on the platform*/\n\t\t\tPyArray_INTPLTR = 'p',\n\t\t\tPyArray_UINTPLTR = 'P',\n\n\t\t\tPyArray_GENBOOLLTR ='b',\n\t\t\tPyArray_SIGNEDLTR = 'i',\n\t\t\tPyArray_UNSIGNEDLTR = 'u',\n\t\t\tPyArray_FLOATINGLTR = 'f',\n\t\t\tPyArray_COMPLEXLTR = 'c'\n};\n\n\t/* Define bit-width array types and typedefs */\n\n#define MAKEFLOAT(x) x.\n\n#define MAX_INT8 127\n#define MIN_INT8 -128\n#define MAX_UINT8 255\n#define MAX_INT16 32767\n#define MIN_INT16 -32768\n#define MAX_UINT16 65535\n#define MAX_INT32 2147483647\n#define MIN_INT32 (-MAX_INT32 - 1)\n#define MAX_UINT32 4294967295U\n#define MAX_INT64 LONGLONG_SUFFIX(9223372036854775807)\n#define MIN_INT64 (-MAX_INT64 - LONGLONG_SUFFIX(1))\n#define MAX_UINT64 ULONGLONG_SUFFIX(18446744073709551615)\n#define MAX_INT128 LONGLONG_SUFFIX(85070591730234615865843651857942052864)\n#define MIN_INT128 (-MAX_INT128 - LONGLONG_SUFFIX(1))\n#define MAX_UINT128 ULONGLONG_SUFFIX(170141183460469231731687303715884105728)\n#define MAX_INT256 LONGLONG_SUFFIX(57896044618658097711785492504343953926634992332820282019728792003956564819967)\n#define MIN_INT256 (-MAX_INT256 - LONGLONG_SUFFIX(1))\n#define MAX_UINT256 ULONGLONG_SUFFIX(115792089237316195423570985008687907853269984665640564039457584007913129639935)\n\n\t/* Need to find the number of bits for each type and \n\t make definitions accordingly. \n\n\t C states that sizeof(char) == 1 by definition \n\t \n\t So, just using the sizeof keyword won't help. \n\n\t It also looks like Python itself uses sizeof(char) quite a\n\t bit, which by definition should be 1 all the time.\n\n\t Idea: Make Use of CHAR_BIT which should tell us how many\n\t BITS per CHARACTER\n\t*/\n\n\t/* Include platform definitions -- These are in the C89/90 standard */\n#include \n#define MAX_BYTE SCHAR_MAX\n#define MIN_BYTE SCHAR_MIN\n#define MAX_UBYTE UCHAR_MAX\n#define MAX_SHORT SHRT_MAX\n#define MIN_SHORT SHRT_MIN\n#define MAX_USHORT USHRT_MAX\n#define MAX_INT INT_MAX\n#ifndef INT_MIN\n#define INT_MIN (-INT_MAX - 1)\n#endif\n#define MIN_INT INT_MIN\n#define MAX_UINT UINT_MAX\n#define MAX_LONG LONG_MAX\n#define MIN_LONG LONG_MIN\n#define MAX_ULONG ULONG_MAX\n\n#define SIZEOF_LONGDOUBLE SIZEOF_LONG_DOUBLE\n#define SIZEOF_LONGLONG SIZEOF_LONG_LONG\n#define BITSOF_BOOL sizeof(Bool)*CHAR_BIT\n#define BITSOF_CHAR CHAR_BIT\n#define BITSOF_SHORT (SIZEOF_SHORT*CHAR_BIT)\n#define BITSOF_INT (SIZEOF_INT*CHAR_BIT)\n#define BITSOF_LONG (SIZEOF_LONG*CHAR_BIT)\n#define BITSOF_LONGLONG (SIZEOF_LONGLONG*CHAR_BIT)\n#define BITSOF_FLOAT (SIZEOF_FLOAT*CHAR_BIT)\n#define BITSOF_DOUBLE (SIZEOF_DOUBLE*CHAR_BIT)\n#define BITSOF_LONGDOUBLE (SIZEOF_LONGDOUBLE*CHAR_BIT)\n\n\n#if BITSOF_LONG == 8\n#define PyArray_INT8 PyArray_LONG\n#define PyArray_UINT8 PyArray_ULONG\n\ttypedef long Int8;\n\ttypedef unsigned long UInt8;\n#define STRBITSOF_LONG \"8\"\n#elif BITSOF_LONG == 16\n#define PyArray_INT16 PyArray_LONG\n#define PyArray_UINT16 PyArray_ULONG\n\ttypedef long Int16;\n\ttypedef unsigned long UInt16;\n#define STRBITSOF_LONG \"16\"\n#elif BITSOF_LONG == 32\n#define PyArray_INT32 PyArray_LONG\n#define PyArray_UINT32 PyArray_ULONG\n\ttypedef long Int32;\n\ttypedef unsigned long UInt32;\n#define STRBITSOF_LONG \"32\"\n#elif BITSOF_LONG == 64\n#define PyArray_INT64 PyArray_LONG\n#define PyArray_UINT64 PyArray_ULONG\n\ttypedef long Int64;\n\ttypedef unsigned long UInt64;\n#define STRBITSOF_LONG \"64\"\n#elif BITSOF_LONG == 128\n#define PyArray_INT128 PyArray_LONG\n#define PyArray_UINT128 PyArray_ULONG\n\ttypedef long Int128;\n\ttypedef unsigned long UInt128;\n#define STRBITSOF_LONG \"128\"\n#endif\n\n#if BITSOF_LONGLONG == 8\n# ifndef PyArray_INT8\n# define PyArray_INT8 PyArray_LONGLONG\n# define PyArray_UINT8 PyArray_ULONGLONG\n\ttypedef longlong Int8;\n\ttypedef ulonglong UInt8;\n# endif\n# define MAX_LONGLONG MAX_INT8\n# define MIN_LONGLONG MIN_INT8\n# define MAX_ULONGLONG MAX_UINT8\n#define STRBITSOF_LONGLONG \"8\"\n#elif BITSOF_LONGLONG == 16\n# ifndef PyArray_INT16\n# define PyArray_INT16 PyArray_LONGLONG\n# define PyArray_UINT16 PyArray_ULONGLONG\n\ttypedef longlong Int16;\n\ttypedef ulonglong UInt16;\n# endif\n# define MAX_LONGLONG MAX_INT16\n# define MIN_LONGLONG MIN_INT16\n# define MAX_ULONGLONG MAX_UINT16\n#define STRBITSOF_LONGLONG \"16\"\n#elif BITSOF_LONGLONG == 32\n# ifndef PyArray_INT32\n# define PyArray_INT32 PyArray_LONGLONG\n# define PyArray_UINT32 PyArray_ULONGLONG\n\ttypedef longlong Int32;\n\ttypedef ulonglong UInt32;\n# endif\n# define MAX_LONGLONG MAX_INT32\n# define MIN_LONGLONG MIN_INT32\n# define MAX_ULONGLONG MAX_UINT32\n#define STRBITSOF_LONGLONG \"32\"\n#elif BITSOF_LONGLONG == 64\n# ifndef PyArray_INT64\n# define PyArray_INT64 PyArray_LONGLONG\n# define PyArray_UINT64 PyArray_ULONGLONG\n\ttypedef longlong Int64;\n\ttypedef ulonglong UInt64;\n# endif\n# define MAX_LONGLONG MAX_INT64\n# define MIN_LONGLONG MIN_INT64\n# define MAX_ULONGLONG MAX_UINT64\n#define STRBITSOF_LONGLONG \"64\"\n#elif BITSOF_LONGLONG == 128\n# ifndef PyArray_INT128\n# define PyArray_INT128 PyArray_LONGLONG\n# define PyArray_UINT128 PyArray_ULONGLONG\n\ttypedef longlong Int128;\n\ttypedef ulonglong UInt128;\n# endif\n# define MAX_LONGLONG MAX_INT128\n# define MIN_LONGLONG MIN_INT128\n# define MAX_ULONGLONG MAX_UINT128\n#define STRBITSOF_LONGLONG \"128\"\n#elif BITSOF_LONGLONG == 256\n# define PyArray_INT256 PyArray_LONGLONG\n# define PyArray_UINT256 PyArray_ULONGLONG\n\ttypedef longlong Int256;\n\ttypedef ulonglong UInt256;\n# define MAX_LONGLONG MAX_INT256\n# define MIN_LONGLONG MIN_INT256\n# define MAX_ULONGLONG MAX_UINT256\n#define STRBITSOF_LONGLONG \"256\"\n#endif\n\n#if BITSOF_INT == 8\n#ifndef PyArray_INT8\n#define PyArray_INT8 PyArray_INT\n#define PyArray_UINT8 PyArray_UINT\n\ttypedef int Int8;\n\ttypedef unsigned int UInt8;\n#endif\n#define STRBITSOF_INT \"8\"\n#elif BITSOF_INT == 16\n#ifndef PyArray_INT16\n#define PyArray_INT16 PyArray_INT\n#define PyArray_UINT16 PyArray_UINT\n\ttypedef int Int16;\n\ttypedef unsigned int UInt16;\n#endif\n#define STRBITSOF_INT \"16\"\n#elif BITSOF_INT == 32\n#ifndef PyArray_INT32\n#define PyArray_INT32 PyArray_INT\n#define PyArray_UINT32 PyArray_UINT\n\ttypedef int Int32;\n\ttypedef unsigned int UInt32;\n#endif\n#define STRBITSOF_INT \"32\"\n#elif BITSOF_INT == 64\n#ifndef PyArray_INT64\n#define PyArray_INT64 PyArray_INT\n#define PyArray_UINT64 PyArray_UINT\n\ttypedef int Int64;\n\ttypedef unsigned int UInt64;\n#endif\n#define STRBITSOF_INT \"64\"\n#elif BITSOF_INT == 128\n#ifndef PyArray_INT128\n#define PyArray_INT128 PyArray_INT\n#define PyArray_UINT128 PyArray_UINT\n\ttypedef int Int128;\n\ttypedef unsigned int UInt128;\n#endif\n#define STRBITSOF_INT \"128\"\n#endif\n\n#if BITSOF_SHORT == 8\n#ifndef PyArray_INT8\n#define PyArray_INT8 PyArray_SHORT\n#define PyArray_UINT8 PyArray_USHORT\n\ttypedef short Int8;\n\ttypedef unsigned short UInt8;\n#endif\n#define STRBITSOF_SHORT \"8\"\n#elif BITSOF_SHORT == 16\n#ifndef PyArray_INT16\n#define PyArray_INT16 PyArray_SHORT\n#define PyArray_UINT16 PyArray_USHORT\n\ttypedef short Int16;\n\ttypedef unsigned short UInt16;\n#endif\n#define STRBITSOF_SHORT \"16\"\n#elif BITSOF_SHORT == 32\n#ifndef PyArray_INT32\n#define PyArray_INT32 PyArray_SHORT\n#define PyArray_UINT32 PyArray_USHORT\n\ttypedef short Int32;\n\ttypedef unsigned short UInt32;\n#endif\n#define STRBITSOF_SHORT \"32\"\n#elif BITSOF_SHORT == 64\n#ifndef PyArray_INT64\n#define PyArray_INT64 PyArray_SHORT\n#define PyArray_UINT64 PyArray_USHORT\n\ttypedef short Int64;\n\ttypedef unsigned short UInt64;\n#endif\n#define STRBITSOF_SHORT \"64\"\n#elif BITSOF_SHORT == 128\n#ifndef PyArray_INT128\n#define PyArray_INT128 PyArray_SHORT\n#define PyArray_UINT128 PyArray_USHORT\n\ttypedef short Int128;\n\ttypedef unsigned short UInt128;\n#endif\n#define STRBITSOF_SHORT \"128\"\n#endif\n\n\n#if BITSOF_CHAR == 8\n#ifndef PyArray_INT8\n#define PyArray_INT8 PyArray_BYTE\n#define PyArray_UINT8 PyArray_UBYTE\n\ttypedef signed char Int8;\n\ttypedef unsigned char UInt8;\n#endif\n#define STRBITSOF_CHAR \"8\"\n#elif BITSOF_CHAR == 16\n#ifndef PyArray_INT16\n#define PyArray_INT16 PyArray_BYTE\n#define PyArray_UINT16 PyArray_UBYTE\n\ttypedef signed char Int16;\n\ttypedef unsigned char UInt16;\n#endif\n#define STRBITSOF_CHAR \"16\"\n#elif BITSOF_CHAR == 32\n#ifndef PyArray_INT32\n#define PyArray_INT32 PyArray_BYTE\n#define PyArray_UINT32 PyArray_UBYTE\n\ttypedef signed char Int32;\n\ttypedef unsigned char UInt32;\n#endif\n#define STRBITSOF_CHAR \"32\"\n#elif BITSOF_CHAR == 64\n#ifndef PyArray_INT64\n#define PyArray_INT64 PyArray_BYTE\n#define PyArray_UINT64 PyArray_UBYTE\n\ttypedef signed char Int64;\n\ttypedef unsigned char UInt64;\n#endif\n#define STRBITSOF_CHAR \"64\"\n#elif BITSOF_CHAR == 128\n#ifndef PyArray_INT128\n#define PyArray_INT128 PyArray_BYTE\n#define PyArray_UINT128 PyArray_UBYTE\n\ttypedef signed char Int128;\n\ttypedef unsigned char UInt128;\n#endif\n#define STRBITSOF_CHAR \"128\"\n#endif\n\n\n\n#if BITSOF_DOUBLE == 16\n#define STRBITSOF_DOUBLE \"16\"\n#define STRBITSOF_CDOUBLE \"32\"\n#ifndef PyArray_FLOAT16\n#define PyArray_FLOAT16 PyArray_DOUBLE\n#define PyArray_COMPLEX32 PyArray_CDOUBLE\n\ttypedef double Float16;\n\ttypedef cdouble Complex32;\n#endif\n#elif BITSOF_DOUBLE == 32\n#define STRBITSOF_DOUBLE \"32\"\n#define STRBITSOF_CDOUBLE \"64\"\n#ifndef PyArray_FLOAT32\n#define PyArray_FLOAT32 PyArray_DOUBLE\n#define PyArray_COMPLEX64 PyArray_CDOUBLE\n\ttypedef double Float32;\n\ttypedef cdouble Complex64;\n#endif\n#elif BITSOF_DOUBLE == 64\n#define STRBITSOF_DOUBLE \"64\"\n#define STRBITSOF_CDOUBLE \"128\"\n#ifndef PyArray_FLOAT64\n#define PyArray_FLOAT64 PyArray_DOUBLE\n#define PyArray_COMPLEX128 PyArray_CDOUBLE\n\ttypedef double Float64;\n\ttypedef cdouble Complex128;\n#endif\n#elif BITSOF_DOUBLE == 80\n#define STRBITSOF_DOUBLE \"80\"\n#define STRBITSOF_CDOUBLE \"160\"\n#ifndef PyArray_FLOAT80\n#define PyArray_FLOAT80 PyArray_DOUBLE\n#define PyArray_COMPLEX160 PyArray_CDOUBLE\n\ttypedef double Float80\n\ttypedef cdouble Complex160\n#endif\n#elif BITSOF_DOUBLE == 96\n#define STRBITSOF_DOUBLE \"96\"\n#define STRBITSOF_CDOUBLE \"192\"\n#ifndef PyArray_FLOAT96\n#define PyArray_FLOAT96 PyArray_DOUBLE\n#define PyArray_COMPLEX192 PyArray_CDOUBLE\n\ttypedef double Float96;\n\ttypedef cdouble Complex192;\n#endif\n#elif BITSOF_DOUBLE == 128\n#define STRBITSOF_DOUBLE \"128\"\n#define STRBITSOF_CDOUBLE \"256\"\n#ifndef PyArray_FLOAT128\n#define PyArray_FLOAT128 PyArray_DOUBLE\n#define PyArray_COMPLEX256 PyArray_CDOUBLE\n\ttypedef double Float128;\n\ttypedef cdouble Complex256;\n#endif\n#endif\n\n\n\n#if BITSOF_FLOAT == 16\n#define STRBITSOF_FLOAT \"16\"\n#define STRBITSOF_CFLOAT \"32\"\n#ifndef PyArray_FLOAT16\n#define PyArray_FLOAT16 PyArray_FLOAT\n#define PyArray_COMPLEX32 PyArray_CFLOAT\n\ttypedef float Float16;\n\ttypedef cfloat Complex32;\n#endif\n#elif BITSOF_FLOAT == 32\n#define STRBITSOF_FLOAT \"32\"\n#define STRBITSOF_CFLOAT \"64\"\n#ifndef PyArray_FLOAT32\n#define PyArray_FLOAT32 PyArray_FLOAT\n#define PyArray_COMPLEX64 PyArray_CFLOAT\n\ttypedef float Float32;\n\ttypedef cfloat Complex64;\n#endif\n#elif BITSOF_FLOAT == 64\n#define STRBITSOF_FLOAT \"64\"\n#define STRBITSOF_CFLOAT \"128\"\n#ifndef PyArray_FLOAT64\n#define PyArray_FLOAT64 PyArray_FLOAT\n#define PyArray_COMPLEX128 PyArray_CFLOAT\n\ttypedef float Float64;\n\ttypedef cfloat Complex128;\n#endif\n#elif BITSOF_FLOAT == 80\n#define STRBITSOF_FLOAT \"80\"\n#define STRBITSOF_CFLOAT \"160\"\n#ifndef PyArray_FLOAT80\n#define PyArray_FLOAT80 PyArray_FLOAT\n#define PyArray_COMPLEX160 PyArray_CFLOAT\n\ttypedef float Float80\n\ttypedef cfloat Complex160\n#endif\n#elif BITSOF_FLOAT == 96\n#define STRBITSOF_FLOAT \"96\"\n#define STRBITSOF_CFLOAT \"192\"\n#ifndef PyArray_FLOAT96\n#define PyArray_FLOAT96 PyArray_FLOAT\n#define PyArray_COMPLEX192 PyArray_CFLOAT\n\ttypedef float Float96;\n\ttypedef cfloat Complex192;\n#endif\n#elif BITSOF_FLOAT == 128\n#define STRBITSOF_FLOAT \"128\"\n#define STRBITSOF_CFLOAT \"256\"\n#ifndef PyArray_FLOAT128\n#define PyArray_FLOAT128 PyArray_FLOAT\n#define PyArray_COMPLEX256 PyArray_CFLOAT\n\ttypedef float Float128;\n\ttypedef cfloat Complex256;\n#endif\n#endif\n\n\n#if BITSOF_LONGDOUBLE == 16\n#define STRBITSOF_LONGDOUBLE \"16\"\n#define STRBITSOF_CLONGDOUBLE \"32\"\n#ifndef PyArray_FLOAT16\n#define PyArray_FLOAT16 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX32 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float16;\n\ttypedef clongdouble Complex32;\n#endif\n#elif BITSOF_LONGDOUBLE == 32\n#define STRBITSOF_LONGDOUBLE \"32\"\n#define STRBITSOF_CLONGDOUBLE \"64\"\n#ifndef PyArray_FLOAT32\n#define PyArray_FLOAT32 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX64 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float32;\n\ttypedef clongdouble Complex64;\n#endif\n#elif BITSOF_LONGDOUBLE == 64\n#define STRBITSOF_LONGDOUBLE \"64\"\n#define STRBITSOF_CLONGDOUBLE \"128\"\n#ifndef PyArray_FLOAT64\n#define PyArray_FLOAT64 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX128 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float64;\n\ttypedef clongdouble Complex128;\n#endif\n#elif BITSOF_LONGDOUBLE == 80\n#define STRBITSOF_LONGDOUBLE \"80\"\n#define STRBITSOF_CLONGDOUBLE \"160\" \n#ifndef PyArray_FLOAT80\n#define PyArray_FLOAT80 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX160 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float80\n\ttypedef clongdouble Complex160\n#endif\n#elif BITSOF_LONGDOUBLE == 96\n#define STRBITSOF_LONGDOUBLE \"96\"\n#define STRBITSOF_CLONGDOUBLE \"192\"\n#ifndef PyArray_FLOAT96\n#define PyArray_FLOAT96 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX192 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float96;\n\ttypedef clongdouble Complex192;\n#endif\n#elif BITSOF_LONGDOUBLE == 128\n#define STRBITSOF_LONGDOUBLE \"128\"\n#define STRBITSOF_CLONGDOUBLE \"256\"\n#ifndef PyArray_FLOAT128\n#define PyArray_FLOAT128 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX256 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float128;\n\ttypedef clongdouble Complex256;\n#endif\n#elif BITSOF_LONGDOUBLE == 256\n#define STRBITSOF_LONGDOUBLE \"256\"\n#define STRBITSOF_CLONGDOUBLE \"512\"\n#define PyArray_FLOAT256 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX512 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float256;\n\ttypedef clongdouble Complex512;\n#endif\n\n\n\t/* End of typedefs for numarray style bit-width names */\n\n/* This is to typedef Intp to the appropriate pointer size for this platform.\n * Py_intptr_t, Py_uintptr_t are defined in pyport.h. */\ntypedef Py_intptr_t intp;\ntypedef Py_uintptr_t uintp;\n\n#define INTP_STRFORMAT \"%d\"\n\n#if SIZEOF_PY_INTPTR_T == SIZEOF_INT \n\t#define PyArray_INTP PyArray_INT\n\t#define PyArray_UINTP PyArray_UINT\n #define PyIntpArrType_Type PyIntArrType_Type\n #define PyUIntpArrType_Type PyUIntArrType_Type\n\t#define MAX_INTP MAX_INT\n\t#define MIN_INTP MIN_INT\n\t#define MAX_UINTP MAX_UINT\n#elif SIZEOF_PY_INTPTR_T == SIZEOF_LONG\n\t#define PyArray_INTP PyArray_LONG\n\t#define PyArray_UINTP PyArray_ULONG\n #define PyIntpArrType_Type PyLongArrType_Type\n #define PyUIntpArrType_Type PyULongArrType_Type\n\t#define MAX_INTP MAX_LONG\n\t#define MIN_INTP MIN_LONG\n\t#define MAX_UINTP MAX_ULONG\n#elif defined(PY_LONG_LONG) && (SIZEOF_PY_INTPTR_T == SIZEOF_LONG_LONG)\n\t#define PyArray_INTP PyArray_LONGLONG\n\t#define PyArray_UINTP PyArray_ULONGLONG\n #define PyIntpArrType_Type PyLongLongArrType_Type\n #define PyUIntpArrType_Type PyULongLongArrType_Type\n\t#define MAX_INTP MAX_LONGLONG\n\t#define MIN_INTP MIN_LONGLONG\n\t#define MAX_UINTP MAX_ULONGLONG\n #undef INTP_STRFORMAT\n #define INTP_STRFORMAT \"%Ld\"\n#endif\n\n#define ERR(str) fprintf(stderr, #str); fflush(stderr);\n#define ERR2(str) fprintf(stderr, str); fflush(stderr);\n\n /* Macros to define how array, and dimension/strides data is\n allocated. \n */\n\n /* Data buffer */\n#define PyDataMem_NEW(size) ((char *)malloc(size))\n /* #define PyArrayMem_NEW(size) PyMem_NEW(char, size)*/\n#define PyDataMem_FREE(ptr) free(ptr)\n /* #define PyArrayMem_FREE(ptr) PyMem_Free(ptr) */\n#define PyDataMem_RENEW(ptr,size) ((char *)realloc(ptr,size))\n\n /* Dimensions and strides */\n#define PyDimMem_NEW(size) ((intp *)malloc(size*sizeof(intp)))\n#define PyDimMem_FREE(ptr) free(ptr)\n#define PyDimMem_RENEW(ptr,size) ((intp *)realloc(ptr,size*sizeof(intp)))\n\n\n /* These must deal with unaligned and unbyteswapped data if necessary */\ntypedef PyObject * (PyArray_GetItemFunc) (char *, void *);\ntypedef int (PyArray_SetItemFunc)(PyObject *, char *, void *);\n\ntypedef int (PyArray_CompareFunc)(const void *, const void *, void *);\ntypedef void (PyArray_CopySwapNFunc)(void *, void *, intp, int, int);\ntypedef void (PyArray_CopySwapFunc)(void *, void *, int, int);\ntypedef Bool (PyArray_NonzeroFunc)(void *, void *);\n\n\n /* These assume aligned and byteswapped data -- a buffer will be\n used before or contiguous data will be obtained\n */\ntypedef int (PyArray_ArgFunc)(void*, intp, intp*, void *);\ntypedef void (PyArray_DotFunc)(char *, intp, char *, intp, char *, intp, \n\t\t\t void *);\ntypedef void (PyArray_VectorUnaryFunc)(void *, void *, intp, void *, void *);\ntypedef int (PyArray_ScanFunc)(FILE *, void *, int, char *, void *);\n\n\ntypedef struct {\n \tPyTypeObject *typeobj; /* the type object for this type */\n\tchar kind; /* kind for this type */\n\tchar type; /* character representing this type */\n\tint type_num; /* number representing this type */\n\tint elsize; /* element size for this type -- \n\t\t\t\t or 0 if variable */\n \tint alignment; /* alignment needed for this type */\n\n\t/* Functions to cast to all other standard types*/\n\tPyArray_VectorUnaryFunc *cast[PyArray_NTYPES];\n\n\t/* Functions to get and set items with standard\n\t Python types -- not array scalars */\n\tPyArray_GetItemFunc *getitem;\n\tPyArray_SetItemFunc *setitem;\n\n\t/* Function to compare items */\n\tPyArray_CompareFunc *compare;\n\n \t/* Function to select largest */\n\tPyArray_ArgFunc *argmax;\n\n\t/* Function to compute dot product */\n\tPyArray_DotFunc\t*dotfunc;\t \n\t\n\t/* Function to scan an ASCII file and \n\t place a single value plus possible separator */\n\tPyArray_ScanFunc *scanfunc;\n\n\t/* Copy and/or swap data. Memory areas may not overlap */\n\t/* Use memmove first if they might */\n\tPyArray_CopySwapNFunc *copyswapn;\n PyArray_CopySwapFunc *copyswap;\n\t\n\t/* Function to determine if data is zero or not */\n\tPyArray_NonzeroFunc *nonzero;\n\n} PyArray_Descr;\n\n\ntypedef struct PyArrayObject {\n\tPyObject_HEAD\n\tchar *data; /* pointer to raw data buffer */\n\tint nd; /* number of dimensions, also called ndim */ \n\tintp *dimensions; /* size in each dimension */\n intp *strides; /* bytes to jump to get to the \n\t\t\t\t next element in each dimension */\n\tPyObject *base; /* This object should be decref'd\n\t\t\t\t upon deletion of array */\n\t /* For views it points to the original array */\n\t /* For creation from buffer object it points \n\t\t\t\t to an object that shold be decref'd on \n\t\t\t\t deletion */\n\t /* For UPDATEIFCOPY flag this is an array \n\t\t\t\t to-be-updated upon deletion of this one */\n\tPyArray_Descr *descr; /* Pointer to type structure */\n\tint flags; /* Flags describing array -- see below*/\n\tint itemsize; /* needed for Flexible size arrays:\n CHAR, UNICODE, and VOID arrays\n \t\t\t */ \n\tPyObject *weakreflist; /* For weakreferences */\n\n} PyArrayObject;\n\n#define fortran fortran_ /* For some compilers */\n\ntypedef struct { /* Just the type_num and itemsize variables \n\t\t for use in the TypeNum Converter function */\n\tint type_num;\n\tint itemsize;\n\tint fortran; /* Set to 1 if fortran-defined strides is desired */\n} PyArray_Typecode;\n\ntypedef struct {\n intp *ptr;\n int len;\n} PyArray_Dims;\n\n\n/* Mirrors buffer object to ptr */\n\ntypedef struct {\n PyObject_HEAD\n PyObject *base;\n void *ptr;\n intp len;\n int flags; \n} PyArray_Chunk;\n\n/* Array flags */\n#define CONTIGUOUS 1 /* means c-style contiguous (last index\n\t\t\t varies the fastest) data elements right\n\t\t\t after each other. */\n\n\t /* All 0-d arrays are CONTIGUOUS and FORTRAN\n\t\t\t\t contiguous. If a 1-d array is CONTIGUOUS\n\t\t\t\t it is also FORTRAN contiguous \n\t\t\t */\n\n\t/* Not used -- always assumed \n#define OWN_DIMENSIONS 2 \n#define OWN_STRIDES 4 \n\t*/\n\n#define OWNDATA 8\n#define OWN_DATA OWNDATA\n\n#define FORTRAN 0x020 /* set if array is a contiguous Fortran array */\n\t /* first index varies the fastest in memory\n\t\t\t (strides array is reverse of C-contiguous\n\t\t\t array)*/\n\n\t/* array never has these two set -- FromAny flags only */\n#define FORCECAST 0x040 \n#define ENSURECOPY 0x080 \t\n\n#define ALIGNED 0x100\n#define NOTSWAPPED 0x200\n#define WRITEABLE 0x400\n\n /* Flag used in creating a new array, not set in the array */\n\n\t/* If this flags is set, then base contains a pointer to \n\t an array of the same size that should be updated with the \n\t current contents of this array when this array is deallocated\n\t*/\n#define UPDATEIFCOPY 0x1000\n\n\n/* Size of internal buffers used for alignment */\n#define PyArray_BUFSIZE 10000\n#define PyArray_MIN_BUFSIZE 5\n#define PyArray_MAX_BUFSIZE MAX_INT32\n#define MAXBUFNUM 1024\n\n\n#define BEHAVED_FLAGS ALIGNED | NOTSWAPPED | WRITEABLE\n#define BEHAVED_FLAGS_RO ALIGNED | NOTSWAPPED\n#define CARRAY_FLAGS CONTIGUOUS | BEHAVED_FLAGS\n#define FARRAY_FLAGS FORTRAN | BEHAVED_FLAGS\n#define DEFAULT_FLAGS CARRAY_FLAGS\n\n#define UPDATE_ALL_FLAGS CONTIGUOUS | FORTRAN | ALIGNED\n\n\n/*\n * C API: consists of Macros and functions. The MACROS are defined here. \n */\n\n\n#define PyArray_CHKFLAGS(m, FLAGS) \\\n\t((((PyArrayObject *)(m))->flags & (FLAGS)) == (FLAGS))\n#define PyArray_ISCONTIGUOUS(m) PyArray_CHKFLAGS(m, CONTIGUOUS)\n#define PyArray_ISWRITEABLE(m) PyArray_CHKFLAGS(m, WRITEABLE)\n\n#define PyArray_ISCARRAY(m) PyArray_CHKFLAGS(m, CARRAY_FLAGS)\n#define PyArray_ISFARRAY(m) PyArray_CHKFLAGS(m, FARRAY_FLAGS)\n#define PyArray_ISBEHAVED(m) PyArray_CHKFLAGS(m, BEHAVED_FLAGS)\n#define PyArray_ISBEHAVED_RO(m) PyArray_CHKFLAGS(m, BEHAVED_FLAGS_RO)\n\n\n#ifndef MAX\n#define MAX(a,b) (((a)>(b))?(a):(b))\n#endif\n#ifndef MIN\n#define MIN(a,b) (((a)<(b))?(a):(b))\n#endif\n\n /* Useful if a and b have to be evaluated. */\n\n#define tMAX(a,b,typ) {typ _x_=(a); typ _y_=(b); _x_>_y_ ? _x_ : _y_}\n#define tMIN(a,b,typ) {typ _x_=(a); typ _y_=(b); _x_<_y_ ? _x_ : _y_}\n\n#if defined(ALLOW_THREADS)\n#define BEGIN_THREADS_DEF PyThreadState *_save;\n#define BEGIN_THREADS _save = PyEval_SaveThread();\n#define END_THREADS PyEval_RestoreThread(_save);\n#define ALLOW_C_API_DEF PyGILState_STATE __save__;\n#define ALLOW_C_API __save__ = PyGILState_Ensure();\n#define DISABLE_C_API PyGILState_Release(__save__);\n#else\n#define BEGIN_THREADS_DEF\n#define BEGIN_THREADS\n#define END_THREADS\n#define ALLOW_C_API_DEF\n#define\tALLOW_C_API \n#define\tDISABLE_C_API \n#endif\n\ntypedef struct {\n PyObject_HEAD\n\tint nd_m1; /* number of dimensions - 1 */\n intp\t\t index, size;\n\tintp coordinates[MAX_DIMS];/* N-dimensional loop */\n intp dims_m1[MAX_DIMS]; /* ao->dimensions - 1 */\n\tintp strides[MAX_DIMS]; /* ao->strides or fake */\n\tintp backstrides[MAX_DIMS];/* how far to jump back */\n\tintp factors[MAX_DIMS]; /* shape factors */\n\tPyArrayObject *ao;\n\tchar *dataptr; /* pointer to current item*/\n unsigned char contiguous;\n} PyArrayIterObject;\n\n\n/* Iterator API */ \n#define PyArrayIter_Check(op) PyObject_TypeCheck(op, &PyArrayIter_Type)\n\t\n#define PyArray_ITER_RESET(it) {\t\t\t\t\t\\\n\tit->index = 0;\t\t\t\t\t\t \\\n\tit->dataptr = it->ao->data;\t\t\t\t\t\\\n\tmemset(it->coordinates, 0, (it->nd_m1+1)*sizeof(intp));\t\t\\\n}\n\n\n#define PyArray_ITER_NEXT(it) {\t\t\t\t\\\n\tit->index++;\t\t\t\t\t\\\n\tif (it->contiguous) it->dataptr += it->ao->itemsize;\t \\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tint _i_;\t\t\t\t\t\t\\\n\t\tfor (_i_ = it->nd_m1; _i_ >= 0; _i_--) {\t\t\\\n\t\t\tif (it->coordinates[_i_] <\t\t\t\\\n\t\t\t it->dims_m1[_i_]) {\t\t\t\t\\\n\t\t\t\tit->coordinates[_i_]++;\t\t\t\\\n\t\t\t\tit->dataptr += it->strides[_i_];\t\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\telse {\t\t\t\t\t\t\\\n\t\t\t\tit->coordinates[_i_] = 0;\t\t\\\n\t\t\t\tit->dataptr -= it->backstrides[_i_];\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n}\n\n#define PyArray_ITER_GOTO(it, destination) {\t\t\t\t\\\n\t\tint _i_;\t\t\t\t\t\t\\\n\t\tit->index = 0;\t\t\t\t\t\t\\\n\t\tit->dataptr = it->ao->data;\t\t\t\t\\\n\t\tfor (_i_ = it->nd_m1; _i_>=0; _i_--) {\t\t\t\\\n\t\t\tit->dataptr += destination[_i_] *\t\t\\\n\t\t\t\tit->strides[_i_];\t\t\t\\\n\t\t\tit->coordinates[_i_] = destination[_i_];\t\\\n\t\t\tit->index += destination[_i_] *\t\t\t\\\n\t\t\t\t( _i_==it->nd_m1 ? 1 :\t\t\t\\\n\t\t\t\t it->dims_m1[i+1]+1) ;\t \t \\\n\t\t}\t\t\t\t\t\t\t\\\n\t} \n\n#define PyArray_ITER_GOTO1D(it, ind) { \\\n\t\tint _i_;\t\t\t\t\t\t\\\n\t\tintp _lind_ = (intp) (ind);\t\t\t\t\\\n\t\tit->index = _lind_;\t\t\t\t\t\\\n\t\tif (it->contiguous)\t\t\t\t\t\\\n\t\t\tit->dataptr = it->ao->data + (ind) *\t\t\\\n\t\t\t\tit->ao->itemsize;\t\t\t\\\n\t\telse {\t\t\t\t\t\t\t\\\n\t\t\tit->dataptr = it->ao->data;\t\t\t\\\n\t\t\tfor (_i_ = 0; _i_<=it->nd_m1; _i_++) {\t\t\\\n\t\t\t\tit->dataptr += (_lind_ / it->factors[_i_]) \\\n\t\t\t\t\t* it->strides[_i_];\t\t\\\n\t\t\t\t_lind_ %= it->factors[_i_];\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n}\n\n/* Not constructed anywhere. Just serves as a standard type that\n PyArray_Broadcast expects.\n\n Any object passed to PyArray_Broadcast must be binary compatible with \n this structure. \n*/\n\n\ntypedef struct {\n\tPyObject_HEAD\n\n\tint numiter; /* number of iters */\n\tintp size; /* broadcasted size */\n\tintp index; /* current index */\n\tint nd; /* number of dims */\n\tintp dimensions[MAX_DIMS]; /* dimensions */\n\tPyArrayIterObject *iters[MAX_DIMS]; /* iterators */\n} PyArrayMultiIterObject; \n\t\n\n/* Store the information needed for fancy-indexing over an array */\n\ntypedef struct {\n\tPyObject_HEAD\n\t/* Multi-iterator portion --- needs to be present in this order to \n\t work with PyArray_Broadcast */\n\n\tint numiter; /* number of index-array\n\t\t\t\t\t\t\t iterators */\n\tintp size; /* size of broadcasted \n\t\t\t\t\t\t\t result */\n\tintp index; /* current index */\n\tint nd; /* number of dims */\n\tintp dimensions[MAX_DIMS]; /* dimensions */\n\tPyArrayIterObject *iters[MAX_DIMS]; /* index object \n\t\t\t\t\t\t\t iterators */\n\tPyArrayIterObject *ait; /* flat Iterator for \n\t\t\t\t\t\t\t underlying array */\n\n\t/* flat iterator for subspace (when numiter < nd) */\n\tPyArrayIterObject *subspace;\n\n\t/* if subspace iteration, then this is the array of \n\t axes in the underlying array represented by the\n\t index objects */\n\tint iteraxes[MAX_DIMS];\n\t/* if subspace iteration, the these are the coordinates\n\t to the start of the subspace.\n\t*/\n\tintp bscoord[MAX_DIMS];\n\n\t\n\tPyObject *indexobj; /* reference to \n\t\t\t\t\t\t\t creating obj */\n\tint view;\n\tint consec;\n\tchar *dataptr;\n\n} PyArrayMapIterObject;\n\n\n/* Map Iterator API */ \n#define PyArrayMapIter_Check(op) PyObject_TypeCheck(op, &PyArrayMapIter_Type)\n\n\n#define PyArray_NDIM(obj) (((PyArrayObject *)(obj))->nd)\n#define PyArray_ISONESEGMENT(m) (PyArray_NDIM(m) == 0 || PyArray_CHKFLAGS(m, CONTIGUOUS) || \\\n\t\t\t\t PyArray_CHKFLAGS(m, FORTRAN))\n#define PyArray_ISFORTRAN(m) (PyArray_CHKFLAGS(m, FORTRAN) && (PyArray_NDIM(m) > 1))\n#define PyArray_DATA(obj) (((PyArrayObject *)(obj))->data)\n#define PyArray_DIMS(obj) (((PyArrayObject *)(obj))->dimensions)\n#define PyArray_STRIDES(obj) (((PyArrayObject *)(obj))->strides)\n#define PyArray_DIM(obj,n) (((PyArrayObject *)(obj))->dimensions[n])\n#define PyArray_STRIDE(obj,n) (((PyArrayObject *)(obj))->strides[n])\n#define PyArray_BASE(obj) (((PyArrayObject *)(obj))->base)\n#define PyArray_DESCR(obj) (((PyArrayObject *)(obj))->descr)\n#define PyArray_FLAGS(obj) (((PyArrayObject *)(obj))->flags)\n#define PyArray_ITEMSIZE(obj) (((PyArrayObject *)(obj))->itemsize)\n#define PyArray_TYPE(obj) (((PyArrayObject *)(obj))->descr->type_num)\n#define PyArray_GETITEM(obj,itemptr)\t\t\t\\\n\t((PyArrayObject *)(obj))->descr->getitem((char *)itemptr,\t\\\n\t\t\t\t\t\t (PyArrayObject *)obj);\n#define PyArray_SETITEM(obj,itemptr,v)\t\t\t\t\t\\\n\t(obj)->descr->setitem((PyObject *)v,(char *)(itemptr),\t\t\\\n\t\t\t (PyArrayObject *)(obj));\n\n\n#define PyTypeNum_ISBOOL(type) (type == PyArray_BOOL)\n#define PyTypeNum_ISUNSIGNED(type) ((type == PyArray_UBYTE) || \\\n\t\t\t\t (type == PyArray_USHORT) || \\\n\t\t\t\t (type == PyArray_UINT) ||\t\\\n\t\t\t\t (type == PyArray_ULONG) || \\\n\t\t\t\t (type == PyArray_ULONGLONG))\n\n#define PyTypeNum_ISSIGNED(type) ((type == PyArray_BYTE) ||\t\\\n\t\t\t (type == PyArray_SHORT) ||\t\\\n\t\t\t (type == PyArray_INT) ||\t\\\n\t\t\t (type == PyArray_LONG) ||\t\\\n\t\t\t (type == PyArray_LONGLONG))\n\n#define PyTypeNum_ISINTEGER(type) ((type >= PyArray_BYTE) &&\t\\\n\t\t\t\t(type <= PyArray_ULONGLONG))\n \n#define PyTypeNum_ISFLOAT(type) ((type >= PyArray_FLOAT) && \\\n\t\t\t (type <= PyArray_LONGDOUBLE))\n\n#define PyTypeNum_ISNUMBER(type) (type <= PyArray_CLONGDOUBLE)\n\n#define PyTypeNum_ISSTRING(type) ((type == PyArray_UCHAR) || \\\n\t\t\t (type == PyArray_UNICODE))\n\n#define PyTypeNum_ISCOMPLEX(type) ((type >= PyArray_CFLOAT) && \\\n\t\t\t\t(type <= PyArray_CLONGDOUBLE))\n\t\n#define PyTypeNum_ISPYTHON(type) ((type == PyArray_LONG) || \\\n\t\t\t\t (type == PyArray_DOUBLE) ||\t\\\n\t\t\t\t (type == PyArray_CDOUBLE) ||\t\\\n\t\t\t\t (type == PyArray_OBJECT ))\n\n#define PyTypeNum_ISFLEXIBLE(type) ((type==PyArray_STRING) || \\\n\t\t\t\t (type==PyArray_UNICODE) ||\t\\\n\t\t\t\t (type==PyArray_VOID))\n\n#define PyTypeNum_ISUSERDEF(type) ((type >= PyArray_USERDEF) && \\\n\t\t\t\t (type < PyArray_USERDEF+\\\n\t\t\t\t PyArray_NUMUSERTYPES))\n\n#define PyTypeNum_ISEXTENDED(type) (((type >= PyArray_STRING) && \\\n\t\t\t\t (type <= PyArray_VOID)) ||\t \\\n\t\t\t\t (type >= PyArray_USERDEF))\n\t\t\t\t \n#define PyTypeNum_ISOBJECT(type) ((type) == PyArray_OBJECT)\n\n#define PyArray_ISBOOL(obj) PyTypeNum_ISBOOL(PyArray_TYPE(obj))\n#define PyArray_ISUNSIGNED(obj) PyTypeNum_ISUNSIGNED(PyArray_TYPE(obj))\n#define PyArray_ISSIGNED(obj) PyTypeNum_ISSIGNED(PyArray_TYPE(obj))\n#define PyArray_ISINTEGER(obj) PyTypeNum_ISINTEGER(PyArray_TYPE(obj))\n#define PyArray_ISFLOAT(obj) PyTypeNum_ISFLOAT(PyArray_TYPE(obj))\n#define PyArray_ISNUMBER(obj) PyTypeNum_ISNUMBER(PyArray_TYPE(obj))\n#define PyArray_ISSTRING(obj) PyTypeNum_ISSTRING(PyArray_TYPE(obj))\n#define PyArray_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(PyArray_TYPE(obj))\n#define PyArray_ISPYTHONTYPE(obj) PyTypeNum_ISPYTHONTYPE(PyArray_TYPE(obj))\n#define PyArray_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj))\n#define PyArray_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(PyArray_TYPE(obj))\n#define PyArray_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(PyArray_TYPE(obj))\n#define PyArray_ISOBJECT(obj) PyTypeNum_ISOBJECT(PyArray_TYPE(obj))\n\n/* Object arrays ignore notswapped flag */\n#define PyArray_ISNOTSWAPPED(m) (PyArray_CHKFLAGS(m, NOTSWAPPED) || \\\n\t\t\t\t PyArray_ISOBJECT(m))\n\n\n /* Often, rather than always convert to an array, \n we may want to delegate behavior for other objects passed in\n */\n\n\t/* \n\n#define Py_DELEGATE(op, name) \\\n\tif (PyObject_HasAttrString(op, #name)) { \\\n\t\tPyObject *ret=NULL;\t\t\t\t \\\n\t\tPyObject *meth=PyObject_GetAttrString(op, #name); \\\n\t\tif (PyCallable_Check(meth)) {\t\t\t \\\n\t\t\tret = PyObject_CallObject(meth, NULL);\t \\\n\t\t}\t\t\t\t\t\t \\\n\t\tPy_XDECREF(meth);\t\t\t\t \\\n\t\treturn ret;\t\t\t\t\t \\\n\t}\n\n#define Py_DELEGATE_ARGS(op, name, args)\t\t\t \\\n\tif (PyObject_HasAttrString(op, #name)) { \\\n\t\tPyObject *ret=NULL;\t\t\t\t \\\n\t\tPyObject *meth=PyObject_GetAttrString(op, #name); \\\n\t\tif (PyCallable_Check(meth)) {\t\t\t \\\n\t\t\tret = PyObject_CallObject(meth, args);\t \\\n\t\t}\t\t\t\t\t\t \\\n Py_XDECREF(args); \\\n\t\tPy_XDECREF(meth);\t\t\t\t \\\n\t\treturn ret;\t\t\t\t\t \\\n\t}\n\n#define Py_DELEGATE_ARGS_KWDS(op, name, args, kwds)\t \\\n\tif (PyObject_HasAttrString(op, #name)) { \\\n\t\tPyObject *ret=NULL;\t\t\t\t \\\n\t\tPyObject *meth=PyObject_GetAttrString(op, #name); \\\n\t\tif (PyCallable_Check(meth)) {\t\t\t \\\n\t\t\tret = PyObject_Call(meth, args, kwds);\t \\\n\t\t}\t\t\t\t\t\t \\\n Py_XDECREF(args); \\\n\t\tPy_XDECREF(meth);\t\t\t\t \\\n\t\treturn ret;\t\t\t\t\t \\\n\t}\n\t*/\n\n\n /* Includes the \"function\" C-API -- these are all stored in a \n\t list of pointers --- one for each file\n\t The two lists are concatenated into one in multiarray.\n\t \n\t They are available as import_array()\n */\n\n#include \"__multiarray_api.h\"\n\n\n /* C-API that requries previous API to be defined */\n\n#define PyArray_Check(op) (PyObject_TypeCheck((op), &PyBigArray_Type))\n#define PyBigArray_CheckExact(op) ((op)->ob_type == &PyBigArray_Type)\n#define PyArray_CheckExact(op) ((op)->ob_type == &PyArray_Type)\n\n#define PyArray_CheckScalar(m) (PyObject_TypeCheck((m),\t\t\t\\\n\t\t\t\t\t\t &PyGenericArrType_Type) \\\n\t\t\t\t|| ((PyArray_Check((m))) &&\t\t\\\n\t\t\t\t (((PyArrayObject *)(m))->nd == 0)))\n#define PyArray_IsScalar(obj, cls)\t\t\t\t\\\n\t(PyObject_TypeCheck((obj), &Py##cls##ArrType_Type))\n#define PyArray_IsPythonScalar(obj) \\\n\t(PyInt_Check(obj) || PyFloat_Check(obj) || PyComplex_Check(obj) || \\\n\t PyLong_Check(obj) || PyBool_Check(obj) || PyString_Check(obj) || \\\n\t PyUnicode_Check(obj))\n#define PyArray_IsAnyScalar(obj) \\\n\t(PyArray_IsScalar(obj, Generic) || PyArray_IsPythonScalar(obj))\n\n#define PyArray_GETCONTIGUOUS(m) (PyArray_ISCONTIGUOUS(m) ? Py_INCREF(m), m : \\\n\t (PyArrayObject *)(PyArray_ContiguousFromObject((PyObject *)(m), \\\n\t\t PyArray_TYPE(m), 0, 0))) \n\n#define PyArray_SIZE(m) PyArray_MultiplyList(PyArray_DIMS(m), PyArray_NDIM(m))\n#define PyArray_NBYTES(m) (PyArray_ITEMSIZE(m) * PyArray_SIZE(m))\n#define PyArray_FROM_O(m) PyArray_FromAny(m, NULL, 0, 0, 0)\n#define PyArray_FROM_OF(m,flags) PyArray_FromAny(m, NULL, 0, 0, flags)\n\n#define REFCOUNT(obj) (((PyObject *)(obj))->ob_refcnt)\n#define MAX_ELSIZE 2*SIZEOF_LONGDOUBLE\n\n /*Compatibility with old Numeric stuff -- don't use in new code */\n\n#define PyArray_UNSIGNED_TYPES\n#define PyArray_SBYTE PyArray_BYTE\n#define PyArray_CHAR PyArray_BYTE\n#define PyArray_CopyArray PyArray_CopyInto\n#define _PyArray_multiply_list PyArray_MultiplyList\n#define PyArray_ISSPACESAVER(m) TRUE\n#define PyScalarArray_Check PyArray_CheckScalar\n\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !Py_ARRAYOBJECT_H */\n", "source_code_before": "\n/* This expects the following variables to be defined (besides\n the usual ones from pyconfig.h\n\n SIZEOF_LONG_DOUBLE -- sizeof(long double) or sizeof(double) if no\n long double is present on platform.\n CHAR_BIT -- number of bits in a char (usually 8)\n (should be in limits.h)\n*/\n\n#ifndef Py_ARRAYOBJECT_H\n#define Py_ARRAYOBJECT_H\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"config.h\"\n\n/* There are several places in the code where an array of dimensions is */\n/* allocated statically. This is the size of that static allocation. */\n\n#define MAX_DIMS 40\n\n/* Used for Converter Functions \"O&\" code in ParseTuple */\n#define PY_FAIL 0\n#define PY_SUCCEED 1\n\n#define NDARRAY_VERSION 0x0400\n\n\t/* Some platforms don't define bool, long long, or long double.\n\t Handle that here.\n\t */\n\n#ifdef PY_LONG_LONG\ntypedef PY_LONG_LONG longlong;\ntypedef unsigned PY_LONG_LONG ulonglong;\n# ifdef _MSC_VER\n# define LONGLONG_FMT \"%I64d\"\n# define ULONGLONG_FMT \"%I64u\"\n# define LONGLONG_SUFFIX(x) (x##i64)\n# define ULONGLONG_SUFFIX(x) (x##Ui64)\n# else\n\t/* #define LONGLONG_FMT \"%lld\" Another possible variant\n #define ULONGLONG_FMT \"%llu\"\n\n\t #define LONGLONG_FMT \"%qd\" -- BSD perhaps?\n\t #define ULONGLONG_FMT \"%qu\"\n\t*/\n# define LONGLONG_FMT \"%Ld\"\n# define ULONGLONG_FMT \"%Lu\"\n# define LONGLONG_SUFFIX(x) (x##LL)\n# define ULONGLONG_SUFFIX(x) (x##ULL)\n# endif\n#else\ntypedef long longlong;\ntypedef unsigned long ulonglong;\n# define LONGLONG_SUFFIX(x) (x##L)\n# define ULONGLONG_SUFFIX(x) (x##UL)\n#endif\n\ntypedef unsigned char Bool;\n#ifndef FALSE\n#define FALSE 0\n#endif\n#ifndef TRUE\n#define TRUE 1\n#endif\n\n#if SIZEOF_LONG_DOUBLE==SIZEOF_DOUBLE\n\ttypedef double longdouble;\n #define LONGDOUBLE_FMT \"g\"\n#else\n\ttypedef long double longdouble;\n #define LONGDOUBLE_FMT \"Lg\"\n#endif\n\n#ifndef Py_USING_UNICODE\n#define Py_UNICODE char\n#endif\n\n\ntypedef signed char byte;\ntypedef unsigned char ubyte;\ntypedef unsigned short ushort;\ntypedef unsigned int uint;\ntypedef unsigned long ulong;\n\ntypedef struct { float real, imag; } cfloat;\ntypedef struct { double real, imag; } cdouble;\ntypedef struct {longdouble real, imag;} clongdouble;\n\nenum PyArray_TYPES { PyArray_BOOL=0,\n PyArray_BYTE, PyArray_UBYTE,\n\t\t PyArray_SHORT, PyArray_USHORT,\n\t\t PyArray_INT, PyArray_UINT,\n\t\t\tPyArray_LONG, PyArray_ULONG,\n PyArray_LONGLONG, PyArray_ULONGLONG,\n\t\t\tPyArray_FLOAT, PyArray_DOUBLE, PyArray_LONGDOUBLE,\n\t\t\tPyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CLONGDOUBLE,\n\t\t\tPyArray_OBJECT=17,\n PyArray_STRING, PyArray_UNICODE,\n\t\t\tPyArray_VOID,\n\t\t\tPyArray_NTYPES,\n\t\t\tPyArray_NOTYPE,\n\t\t\tPyArray_USERDEF=256 /* leave room for characters */\n};\n\n\t/* basetype array priority */\n#define PyArray_PRIORITY 0.0\n#define PyArray_BIG_PRIORITY 0.1\n\t/* default subtype priority */\n#define PyArray_SUBTYPE_PRIORITY 1.0\n\n\t/* How many floating point types are there */\n#define PyArray_NUM_FLOATTYPE 3\n\n\n\t/* We need to match intp to a signed integer of the same size as\n\t a pointer variable. uintp to the equivalent unsigned integer\n\t*/\n\n\n\t/* These characters correspond to the array type and the\n\t struct module */\n\n\t/* except 'p' -- signed integer for pointer type */\n\nenum PyArray_TYPECHAR { PyArray_BOOLLTR = '?',\n\t\t\tPyArray_BYTELTR = 'b',\n\t\t\tPyArray_UBYTELTR = 'B',\n\t\t\tPyArray_SHORTLTR = 'h',\n\t\t\tPyArray_USHORTLTR = 'H',\n\t\t\tPyArray_INTLTR = 'i',\n\t\t\tPyArray_UINTLTR = 'I',\n\t\t\tPyArray_LONGLTR = 'l',\n\t\t\tPyArray_ULONGLTR = 'L', \n\t\t\tPyArray_LONGLONGLTR = 'q', \n\t\t\tPyArray_ULONGLONGLTR = 'Q',\n\t\t\tPyArray_FLOATLTR = 'f',\n\t\t\tPyArray_DOUBLELTR = 'd',\n\t\t\tPyArray_LONGDOUBLELTR = 'g',\n\t\t\tPyArray_CFLOATLTR = 'F',\n\t\t\tPyArray_CDOUBLELTR = 'D',\n\t\t\tPyArray_CLONGDOUBLELTR = 'G',\n\t\t\tPyArray_OBJECTLTR = 'O',\n\t\t\tPyArray_STRINGLTR = 'S',\n\t\t\tPyArray_UNICODELTR = 'U',\n\t\t PyArray_VOIDLTR = 'V',\n\n\t\t\t/* No Descriptor, just a define -- this let's\n\t\t\t Python users specify an array of integers\n\t\t\t large enough to hold a pointer on the platform*/\n\t\t\tPyArray_INTPLTR = 'p',\n\t\t\tPyArray_UINTPLTR = 'P',\n\n\t\t\tPyArray_GENBOOLLTR ='b',\n\t\t\tPyArray_SIGNEDLTR = 'i',\n\t\t\tPyArray_UNSIGNEDLTR = 'u',\n\t\t\tPyArray_FLOATINGLTR = 'f',\n\t\t\tPyArray_COMPLEXLTR = 'c'\n};\n\n\t/* Define bit-width array types and typedefs */\n\n#define MAKEFLOAT(x) x.\n\n#define MAX_INT8 127\n#define MIN_INT8 -128\n#define MAX_UINT8 255\n#define MAX_INT16 32767\n#define MIN_INT16 -32768\n#define MAX_UINT16 65535\n#define MAX_INT32 2147483647\n#define MIN_INT32 (-MAX_INT32 - 1)\n#define MAX_UINT32 4294967295U\n#define MAX_INT64 LONGLONG_SUFFIX(9223372036854775807)\n#define MIN_INT64 (-MAX_INT64 - LONGLONG_SUFFIX(1))\n#define MAX_UINT64 ULONGLONG_SUFFIX(18446744073709551615)\n#define MAX_INT128 LONGLONG_SUFFIX(85070591730234615865843651857942052864)\n#define MIN_INT128 (-MAX_INT128 - LONGLONG_SUFFIX(1))\n#define MAX_UINT128 ULONGLONG_SUFFIX(170141183460469231731687303715884105728)\n#define MAX_INT256 LONGLONG_SUFFIX(57896044618658097711785492504343953926634992332820282019728792003956564819967)\n#define MIN_INT256 (-MAX_INT256 - LONGLONG_SUFFIX(1))\n#define MAX_UINT256 ULONGLONG_SUFFIX(115792089237316195423570985008687907853269984665640564039457584007913129639935)\n\n\t/* Need to find the number of bits for each type and \n\t make definitions accordingly. \n\n\t C states that sizeof(char) == 1 by definition \n\t \n\t So, just using the sizeof keyword won't help. \n\n\t It also looks like Python itself uses sizeof(char) quite a\n\t bit, which by definition should be 1 all the time.\n\n\t Idea: Make Use of CHAR_BIT which should tell us how many\n\t BITS per CHARACTER\n\t*/\n\n\t/* Include platform definitions -- These are in the C89/90 standard */\n#include \n#define MAX_BYTE SCHAR_MAX\n#define MIN_BYTE SCHAR_MIN\n#define MAX_UBYTE UCHAR_MAX\n#define MAX_SHORT SHRT_MAX\n#define MIN_SHORT SHRT_MIN\n#define MAX_USHORT USHRT_MAX\n#define MAX_INT INT_MAX\n#ifndef INT_MIN\n#define INT_MIN (-INT_MAX - 1)\n#endif\n#define MIN_INT INT_MIN\n#define MAX_UINT UINT_MAX\n#define MAX_LONG LONG_MAX\n#define MIN_LONG LONG_MIN\n#define MAX_ULONG ULONG_MAX\n\n#define SIZEOF_LONGDOUBLE SIZEOF_LONG_DOUBLE\n#define SIZEOF_LONGLONG SIZEOF_LONG_LONG\n#define BITSOF_BOOL sizeof(Bool)*CHAR_BIT\n#define BITSOF_CHAR CHAR_BIT\n#define BITSOF_SHORT (SIZEOF_SHORT*CHAR_BIT)\n#define BITSOF_INT (SIZEOF_INT*CHAR_BIT)\n#define BITSOF_LONG (SIZEOF_LONG*CHAR_BIT)\n#define BITSOF_LONGLONG (SIZEOF_LONGLONG*CHAR_BIT)\n#define BITSOF_FLOAT (SIZEOF_FLOAT*CHAR_BIT)\n#define BITSOF_DOUBLE (SIZEOF_DOUBLE*CHAR_BIT)\n#define BITSOF_LONGDOUBLE (SIZEOF_LONGDOUBLE*CHAR_BIT)\n\n\n#if BITSOF_LONG == 8\n#define PyArray_INT8 PyArray_LONG\n#define PyArray_UINT8 PyArray_ULONG\n\ttypedef long Int8;\n\ttypedef unsigned long UInt8;\n#define STRBITSOF_LONG \"8\"\n#elif BITSOF_LONG == 16\n#define PyArray_INT16 PyArray_LONG\n#define PyArray_UINT16 PyArray_ULONG\n\ttypedef long Int16;\n\ttypedef unsigned long UInt16;\n#define STRBITSOF_LONG \"16\"\n#elif BITSOF_LONG == 32\n#define PyArray_INT32 PyArray_LONG\n#define PyArray_UINT32 PyArray_ULONG\n\ttypedef long Int32;\n\ttypedef unsigned long UInt32;\n#define STRBITSOF_LONG \"32\"\n#elif BITSOF_LONG == 64\n#define PyArray_INT64 PyArray_LONG\n#define PyArray_UINT64 PyArray_ULONG\n\ttypedef long Int64;\n\ttypedef unsigned long UInt64;\n#define STRBITSOF_LONG \"64\"\n#elif BITSOF_LONG == 128\n#define PyArray_INT128 PyArray_LONG\n#define PyArray_UINT128 PyArray_ULONG\n\ttypedef long Int128;\n\ttypedef unsigned long UInt128;\n#define STRBITSOF_LONG \"128\"\n#endif\n\n#if BITSOF_LONGLONG == 8\n# ifndef PyArray_INT8\n# define PyArray_INT8 PyArray_LONGLONG\n# define PyArray_UINT8 PyArray_ULONGLONG\n\ttypedef longlong Int8;\n\ttypedef ulonglong UInt8;\n# endif\n# define MAX_LONGLONG MAX_INT8\n# define MIN_LONGLONG MIN_INT8\n# define MAX_ULONGLONG MAX_UINT8\n#define STRBITSOF_LONGLONG \"8\"\n#elif BITSOF_LONGLONG == 16\n# ifndef PyArray_INT16\n# define PyArray_INT16 PyArray_LONGLONG\n# define PyArray_UINT16 PyArray_ULONGLONG\n\ttypedef longlong Int16;\n\ttypedef ulonglong UInt16;\n# endif\n# define MAX_LONGLONG MAX_INT16\n# define MIN_LONGLONG MIN_INT16\n# define MAX_ULONGLONG MAX_UINT16\n#define STRBITSOF_LONGLONG \"16\"\n#elif BITSOF_LONGLONG == 32\n# ifndef PyArray_INT32\n# define PyArray_INT32 PyArray_LONGLONG\n# define PyArray_UINT32 PyArray_ULONGLONG\n\ttypedef longlong Int32;\n\ttypedef ulonglong UInt32;\n# endif\n# define MAX_LONGLONG MAX_INT32\n# define MIN_LONGLONG MIN_INT32\n# define MAX_ULONGLONG MAX_UINT32\n#define STRBITSOF_LONGLONG \"32\"\n#elif BITSOF_LONGLONG == 64\n# ifndef PyArray_INT64\n# define PyArray_INT64 PyArray_LONGLONG\n# define PyArray_UINT64 PyArray_ULONGLONG\n\ttypedef longlong Int64;\n\ttypedef ulonglong UInt64;\n# endif\n# define MAX_LONGLONG MAX_INT64\n# define MIN_LONGLONG MIN_INT64\n# define MAX_ULONGLONG MAX_UINT64\n#define STRBITSOF_LONGLONG \"64\"\n#elif BITSOF_LONGLONG == 128\n# ifndef PyArray_INT128\n# define PyArray_INT128 PyArray_LONGLONG\n# define PyArray_UINT128 PyArray_ULONGLONG\n\ttypedef longlong Int128;\n\ttypedef ulonglong UInt128;\n# endif\n# define MAX_LONGLONG MAX_INT128\n# define MIN_LONGLONG MIN_INT128\n# define MAX_ULONGLONG MAX_UINT128\n#define STRBITSOF_LONGLONG \"128\"\n#elif BITSOF_LONGLONG == 256\n# define PyArray_INT256 PyArray_LONGLONG\n# define PyArray_UINT256 PyArray_ULONGLONG\n\ttypedef longlong Int256;\n\ttypedef ulonglong UInt256;\n# define MAX_LONGLONG MAX_INT256\n# define MIN_LONGLONG MIN_INT256\n# define MAX_ULONGLONG MAX_UINT256\n#define STRBITSOF_LONGLONG \"256\"\n#endif\n\n#if BITSOF_INT == 8\n#ifndef PyArray_INT8\n#define PyArray_INT8 PyArray_INT\n#define PyArray_UINT8 PyArray_UINT\n\ttypedef int Int8;\n\ttypedef unsigned int UInt8;\n#endif\n#define STRBITSOF_INT \"8\"\n#elif BITSOF_INT == 16\n#ifndef PyArray_INT16\n#define PyArray_INT16 PyArray_INT\n#define PyArray_UINT16 PyArray_UINT\n\ttypedef int Int16;\n\ttypedef unsigned int UInt16;\n#endif\n#define STRBITSOF_INT \"16\"\n#elif BITSOF_INT == 32\n#ifndef PyArray_INT32\n#define PyArray_INT32 PyArray_INT\n#define PyArray_UINT32 PyArray_UINT\n\ttypedef int Int32;\n\ttypedef unsigned int UInt32;\n#endif\n#define STRBITSOF_INT \"32\"\n#elif BITSOF_INT == 64\n#ifndef PyArray_INT64\n#define PyArray_INT64 PyArray_INT\n#define PyArray_UINT64 PyArray_UINT\n\ttypedef int Int64;\n\ttypedef unsigned int UInt64;\n#endif\n#define STRBITSOF_INT \"64\"\n#elif BITSOF_INT == 128\n#ifndef PyArray_INT128\n#define PyArray_INT128 PyArray_INT\n#define PyArray_UINT128 PyArray_UINT\n\ttypedef int Int128;\n\ttypedef unsigned int UInt128;\n#endif\n#define STRBITSOF_INT \"128\"\n#endif\n\n#if BITSOF_SHORT == 8\n#ifndef PyArray_INT8\n#define PyArray_INT8 PyArray_SHORT\n#define PyArray_UINT8 PyArray_USHORT\n\ttypedef short Int8;\n\ttypedef unsigned short UInt8;\n#endif\n#define STRBITSOF_SHORT \"8\"\n#elif BITSOF_SHORT == 16\n#ifndef PyArray_INT16\n#define PyArray_INT16 PyArray_SHORT\n#define PyArray_UINT16 PyArray_USHORT\n\ttypedef short Int16;\n\ttypedef unsigned short UInt16;\n#endif\n#define STRBITSOF_SHORT \"16\"\n#elif BITSOF_SHORT == 32\n#ifndef PyArray_INT32\n#define PyArray_INT32 PyArray_SHORT\n#define PyArray_UINT32 PyArray_USHORT\n\ttypedef short Int32;\n\ttypedef unsigned short UInt32;\n#endif\n#define STRBITSOF_SHORT \"32\"\n#elif BITSOF_SHORT == 64\n#ifndef PyArray_INT64\n#define PyArray_INT64 PyArray_SHORT\n#define PyArray_UINT64 PyArray_USHORT\n\ttypedef short Int64;\n\ttypedef unsigned short UInt64;\n#endif\n#define STRBITSOF_SHORT \"64\"\n#elif BITSOF_SHORT == 128\n#ifndef PyArray_INT128\n#define PyArray_INT128 PyArray_SHORT\n#define PyArray_UINT128 PyArray_USHORT\n\ttypedef short Int128;\n\ttypedef unsigned short UInt128;\n#endif\n#define STRBITSOF_SHORT \"128\"\n#endif\n\n\n#if BITSOF_CHAR == 8\n#ifndef PyArray_INT8\n#define PyArray_INT8 PyArray_BYTE\n#define PyArray_UINT8 PyArray_UBYTE\n\ttypedef signed char Int8;\n\ttypedef unsigned char UInt8;\n#endif\n#define STRBITSOF_CHAR \"8\"\n#elif BITSOF_CHAR == 16\n#ifndef PyArray_INT16\n#define PyArray_INT16 PyArray_BYTE\n#define PyArray_UINT16 PyArray_UBYTE\n\ttypedef signed char Int16;\n\ttypedef unsigned char UInt16;\n#endif\n#define STRBITSOF_CHAR \"16\"\n#elif BITSOF_CHAR == 32\n#ifndef PyArray_INT32\n#define PyArray_INT32 PyArray_BYTE\n#define PyArray_UINT32 PyArray_UBYTE\n\ttypedef signed char Int32;\n\ttypedef unsigned char UInt32;\n#endif\n#define STRBITSOF_CHAR \"32\"\n#elif BITSOF_CHAR == 64\n#ifndef PyArray_INT64\n#define PyArray_INT64 PyArray_BYTE\n#define PyArray_UINT64 PyArray_UBYTE\n\ttypedef signed char Int64;\n\ttypedef unsigned char UInt64;\n#endif\n#define STRBITSOF_CHAR \"64\"\n#elif BITSOF_CHAR == 128\n#ifndef PyArray_INT128\n#define PyArray_INT128 PyArray_BYTE\n#define PyArray_UINT128 PyArray_UBYTE\n\ttypedef signed char Int128;\n\ttypedef unsigned char UInt128;\n#endif\n#define STRBITSOF_CHAR \"128\"\n#endif\n\n\n\n#if BITSOF_DOUBLE == 16\n#define STRBITSOF_DOUBLE \"16\"\n#define STRBITSOF_CDOUBLE \"32\"\n#ifndef PyArray_FLOAT16\n#define PyArray_FLOAT16 PyArray_DOUBLE\n#define PyArray_COMPLEX32 PyArray_CDOUBLE\n\ttypedef double Float16;\n\ttypedef cdouble Complex32;\n#endif\n#elif BITSOF_DOUBLE == 32\n#define STRBITSOF_DOUBLE \"32\"\n#define STRBITSOF_CDOUBLE \"64\"\n#ifndef PyArray_FLOAT32\n#define PyArray_FLOAT32 PyArray_DOUBLE\n#define PyArray_COMPLEX64 PyArray_CDOUBLE\n\ttypedef double Float32;\n\ttypedef cdouble Complex64;\n#endif\n#elif BITSOF_DOUBLE == 64\n#define STRBITSOF_DOUBLE \"64\"\n#define STRBITSOF_CDOUBLE \"128\"\n#ifndef PyArray_FLOAT64\n#define PyArray_FLOAT64 PyArray_DOUBLE\n#define PyArray_COMPLEX128 PyArray_CDOUBLE\n\ttypedef double Float64;\n\ttypedef cdouble Complex128;\n#endif\n#elif BITSOF_DOUBLE == 80\n#define STRBITSOF_DOUBLE \"80\"\n#define STRBITSOF_CDOUBLE \"160\"\n#ifndef PyArray_FLOAT80\n#define PyArray_FLOAT80 PyArray_DOUBLE\n#define PyArray_COMPLEX160 PyArray_CDOUBLE\n\ttypedef double Float80\n\ttypedef cdouble Complex160\n#endif\n#elif BITSOF_DOUBLE == 96\n#define STRBITSOF_DOUBLE \"96\"\n#define STRBITSOF_CDOUBLE \"192\"\n#ifndef PyArray_FLOAT96\n#define PyArray_FLOAT96 PyArray_DOUBLE\n#define PyArray_COMPLEX192 PyArray_CDOUBLE\n\ttypedef double Float96;\n\ttypedef cdouble Complex192;\n#endif\n#elif BITSOF_DOUBLE == 128\n#define STRBITSOF_DOUBLE \"128\"\n#define STRBITSOF_CDOUBLE \"256\"\n#ifndef PyArray_FLOAT128\n#define PyArray_FLOAT128 PyArray_DOUBLE\n#define PyArray_COMPLEX256 PyArray_CDOUBLE\n\ttypedef double Float128;\n\ttypedef cdouble Complex256;\n#endif\n#endif\n\n\n\n#if BITSOF_FLOAT == 16\n#define STRBITSOF_FLOAT \"16\"\n#define STRBITSOF_CFLOAT \"32\"\n#ifndef PyArray_FLOAT16\n#define PyArray_FLOAT16 PyArray_FLOAT\n#define PyArray_COMPLEX32 PyArray_CFLOAT\n\ttypedef float Float16;\n\ttypedef cfloat Complex32;\n#endif\n#elif BITSOF_FLOAT == 32\n#define STRBITSOF_FLOAT \"32\"\n#define STRBITSOF_CFLOAT \"64\"\n#ifndef PyArray_FLOAT32\n#define PyArray_FLOAT32 PyArray_FLOAT\n#define PyArray_COMPLEX64 PyArray_CFLOAT\n\ttypedef float Float32;\n\ttypedef cfloat Complex64;\n#endif\n#elif BITSOF_FLOAT == 64\n#define STRBITSOF_FLOAT \"64\"\n#define STRBITSOF_CFLOAT \"128\"\n#ifndef PyArray_FLOAT64\n#define PyArray_FLOAT64 PyArray_FLOAT\n#define PyArray_COMPLEX128 PyArray_CFLOAT\n\ttypedef float Float64;\n\ttypedef cfloat Complex128;\n#endif\n#elif BITSOF_FLOAT == 80\n#define STRBITSOF_FLOAT \"80\"\n#define STRBITSOF_CFLOAT \"160\"\n#ifndef PyArray_FLOAT80\n#define PyArray_FLOAT80 PyArray_FLOAT\n#define PyArray_COMPLEX160 PyArray_CFLOAT\n\ttypedef float Float80\n\ttypedef cfloat Complex160\n#endif\n#elif BITSOF_FLOAT == 96\n#define STRBITSOF_FLOAT \"96\"\n#define STRBITSOF_CFLOAT \"192\"\n#ifndef PyArray_FLOAT96\n#define PyArray_FLOAT96 PyArray_FLOAT\n#define PyArray_COMPLEX192 PyArray_CFLOAT\n\ttypedef float Float96;\n\ttypedef cfloat Complex192;\n#endif\n#elif BITSOF_FLOAT == 128\n#define STRBITSOF_FLOAT \"128\"\n#define STRBITSOF_CFLOAT \"256\"\n#ifndef PyArray_FLOAT128\n#define PyArray_FLOAT128 PyArray_FLOAT\n#define PyArray_COMPLEX256 PyArray_CFLOAT\n\ttypedef float Float128;\n\ttypedef cfloat Complex256;\n#endif\n#endif\n\n\n#if BITSOF_LONGDOUBLE == 16\n#define STRBITSOF_LONGDOUBLE \"16\"\n#define STRBITSOF_CLONGDOUBLE \"32\"\n#ifndef PyArray_FLOAT16\n#define PyArray_FLOAT16 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX32 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float16;\n\ttypedef clongdouble Complex32;\n#endif\n#elif BITSOF_LONGDOUBLE == 32\n#define STRBITSOF_LONGDOUBLE \"32\"\n#define STRBITSOF_CLONGDOUBLE \"64\"\n#ifndef PyArray_FLOAT32\n#define PyArray_FLOAT32 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX64 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float32;\n\ttypedef clongdouble Complex64;\n#endif\n#elif BITSOF_LONGDOUBLE == 64\n#define STRBITSOF_LONGDOUBLE \"64\"\n#define STRBITSOF_CLONGDOUBLE \"128\"\n#ifndef PyArray_FLOAT64\n#define PyArray_FLOAT64 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX128 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float64;\n\ttypedef clongdouble Complex128;\n#endif\n#elif BITSOF_LONGDOUBLE == 80\n#define STRBITSOF_LONGDOUBLE \"80\"\n#define STRBITSOF_CLONGDOUBLE \"160\" \n#ifndef PyArray_FLOAT80\n#define PyArray_FLOAT80 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX160 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float80\n\ttypedef clongdouble Complex160\n#endif\n#elif BITSOF_LONGDOUBLE == 96\n#define STRBITSOF_LONGDOUBLE \"96\"\n#define STRBITSOF_CLONGDOUBLE \"192\"\n#ifndef PyArray_FLOAT96\n#define PyArray_FLOAT96 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX192 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float96;\n\ttypedef clongdouble Complex192;\n#endif\n#elif BITSOF_LONGDOUBLE == 128\n#define STRBITSOF_LONGDOUBLE \"128\"\n#define STRBITSOF_CLONGDOUBLE \"256\"\n#ifndef PyArray_FLOAT128\n#define PyArray_FLOAT128 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX256 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float128;\n\ttypedef clongdouble Complex256;\n#endif\n#elif BITSOF_LONGDOUBLE == 256\n#define STRBITSOF_LONGDOUBLE \"256\"\n#define STRBITSOF_CLONGDOUBLE \"512\"\n#define PyArray_FLOAT256 PyArray_LONGDOUBLE\n#define PyArray_COMPLEX512 PyArray_CLONGDOUBLE\n\ttypedef longdouble Float256;\n\ttypedef clongdouble Complex512;\n#endif\n\n\n\t/* End of typedefs for numarray style bit-width names */\n\n/* This is to typedef Intp to the appropriate pointer size for this platform.\n * Py_intptr_t, Py_uintptr_t are defined in pyport.h. */\ntypedef Py_intptr_t intp;\ntypedef Py_uintptr_t uintp;\n\n#if SIZEOF_PY_INTPTR_T == SIZEOF_INT \n\t#define PyArray_INTP PyArray_INT\n\t#define PyArray_UINTP PyArray_UINT\n #define PyIntpArrType_Type PyIntArrType_Type\n #define PyUIntpArrType_Type PyUIntArrType_Type\n\t#define MAX_INTP MAX_INT\n\t#define MIN_INTP MIN_INT\n\t#define MAX_UINTP MAX_UINT\n#elif SIZEOF_PY_INTPTR_T == SIZEOF_LONG\n\t#define PyArray_INTP PyArray_LONG\n\t#define PyArray_UINTP PyArray_ULONG\n #define PyIntpArrType_Type PyLongArrType_Type\n #define PyUIntpArrType_Type PyULongArrType_Type\n\t#define MAX_INTP MAX_LONG\n\t#define MIN_INTP MIN_LONG\n\t#define MAX_UINTP MAX_ULONG\n#elif defined(PY_LONG_LONG) && (SIZEOF_PY_INTPTR_T == SIZEOF_LONG_LONG)\n\t#define PyArray_INTP PyArray_LONGLONG\n\t#define PyArray_UINTP PyArray_ULONGLONG\n #define PyIntpArrType_Type PyLongLongArrType_Type\n #define PyUIntpArrType_Type PyULongLongArrType_Type\n\t#define MAX_INTP MAX_LONGLONG\n\t#define MIN_INTP MIN_LONGLONG\n\t#define MAX_UINTP MAX_ULONGLONG\n#endif\n\n#define ERR(str) fprintf(stderr, #str); fflush(stderr);\n#define ERR2(str) fprintf(stderr, str); fflush(stderr);\n\n /* Macros to define how array, and dimension/strides data is\n allocated. \n */\n\n /* Data buffer */\n#define PyDataMem_NEW(size) ((char *)malloc(size))\n /* #define PyArrayMem_NEW(size) PyMem_NEW(char, size)*/\n#define PyDataMem_FREE(ptr) free(ptr)\n /* #define PyArrayMem_FREE(ptr) PyMem_Free(ptr) */\n#define PyDataMem_RENEW(ptr,size) ((char *)realloc(ptr,size))\n\n /* Dimensions and strides */\n#define PyDimMem_NEW(size) ((intp *)malloc(size*sizeof(intp)))\n#define PyDimMem_FREE(ptr) free(ptr)\n#define PyDimMem_RENEW(ptr,size) ((intp *)realloc(ptr,size*sizeof(intp)))\n\n\n /* These must deal with unaligned and unbyteswapped data if necessary */\ntypedef PyObject * (PyArray_GetItemFunc) (char *, void *);\ntypedef int (PyArray_SetItemFunc)(PyObject *, char *, void *);\n\ntypedef int (PyArray_CompareFunc)(const void *, const void *, void *);\ntypedef void (PyArray_CopySwapNFunc)(void *, void *, intp, int, int);\ntypedef void (PyArray_CopySwapFunc)(void *, void *, int, int);\ntypedef Bool (PyArray_NonzeroFunc)(void *, void *);\n\n\n /* These assume aligned and byteswapped data -- a buffer will be\n used before or contiguous data will be obtained\n */\ntypedef int (PyArray_ArgFunc)(void*, intp, intp*, void *);\ntypedef void (PyArray_DotFunc)(char *, intp, char *, intp, char *, intp, \n\t\t\t void *);\ntypedef void (PyArray_VectorUnaryFunc)(void *, void *, intp, void *, void *);\ntypedef int (PyArray_ScanFunc)(FILE *, void *, int, char *, void *);\n\n\ntypedef struct {\n \tPyTypeObject *typeobj; /* the type object for this type */\n\tchar kind; /* kind for this type */\n\tchar type; /* character representing this type */\n\tint type_num; /* number representing this type */\n\tint elsize; /* element size for this type -- \n\t\t\t\t or 0 if variable */\n \tint alignment; /* alignment needed for this type */\n\n\t/* Functions to cast to all other standard types*/\n\tPyArray_VectorUnaryFunc *cast[PyArray_NTYPES];\n\n\t/* Functions to get and set items with standard\n\t Python types -- not array scalars */\n\tPyArray_GetItemFunc *getitem;\n\tPyArray_SetItemFunc *setitem;\n\n\t/* Function to compare items */\n\tPyArray_CompareFunc *compare;\n\n \t/* Function to select largest */\n\tPyArray_ArgFunc *argmax;\n\n\t/* Function to compute dot product */\n\tPyArray_DotFunc\t*dotfunc;\t \n\t\n\t/* Function to scan an ASCII file and \n\t place a single value plus possible separator */\n\tPyArray_ScanFunc *scanfunc;\n\n\t/* Copy and/or swap data. Memory areas may not overlap */\n\t/* Use memmove first if they might */\n\tPyArray_CopySwapNFunc *copyswapn;\n PyArray_CopySwapFunc *copyswap;\n\t\n\t/* Function to determine if data is zero or not */\n\tPyArray_NonzeroFunc *nonzero;\n\n} PyArray_Descr;\n\n\ntypedef struct PyArrayObject {\n\tPyObject_HEAD\n\tchar *data; /* pointer to raw data buffer */\n\tint nd; /* number of dimensions, also called ndim */ \n\tintp *dimensions; /* size in each dimension */\n intp *strides; /* bytes to jump to get to the \n\t\t\t\t next element in each dimension */\n\tPyObject *base; /* This object should be decref'd\n\t\t\t\t upon deletion of array */\n\t /* For views it points to the original array */\n\t /* For creation from buffer object it points \n\t\t\t\t to an object that shold be decref'd on \n\t\t\t\t deletion */\n\t /* For UPDATEIFCOPY flag this is an array \n\t\t\t\t to-be-updated upon deletion of this one */\n\tPyArray_Descr *descr; /* Pointer to type structure */\n\tint flags; /* Flags describing array -- see below*/\n\tint itemsize; /* needed for Flexible size arrays:\n CHAR, UNICODE, and VOID arrays\n \t\t\t */ \n\tPyObject *weakreflist; /* For weakreferences */\n\n} PyArrayObject;\n\n#define fortran fortran_ /* For some compilers */\n\ntypedef struct { /* Just the type_num and itemsize variables \n\t\t for use in the TypeNum Converter function */\n\tint type_num;\n\tint itemsize;\n\tint fortran; /* Set to 1 if fortran-defined strides is desired */\n} PyArray_Typecode;\n\ntypedef struct {\n intp *ptr;\n int len;\n} PyArray_Dims;\n\n\n/* Mirrors buffer object to ptr */\n\ntypedef struct {\n PyObject_HEAD\n PyObject *base;\n void *ptr;\n intp len;\n int flags; \n} PyArray_Chunk;\n\n/* Array flags */\n#define CONTIGUOUS 1 /* means c-style contiguous (last index\n\t\t\t varies the fastest) data elements right\n\t\t\t after each other. */\n\n\t /* All 0-d arrays are CONTIGUOUS and FORTRAN\n\t\t\t\t contiguous. If a 1-d array is CONTIGUOUS\n\t\t\t\t it is also FORTRAN contiguous \n\t\t\t */\n\n\t/* Not used -- always assumed \n#define OWN_DIMENSIONS 2 \n#define OWN_STRIDES 4 \n\t*/\n\n#define OWNDATA 8\n#define OWN_DATA OWNDATA\n\n#define FORTRAN 0x020 /* set if array is a contiguous Fortran array */\n\t /* first index varies the fastest in memory\n\t\t\t (strides array is reverse of C-contiguous\n\t\t\t array)*/\n\n\t/* array never has these two set -- FromAny flags only */\n#define FORCECAST 0x040 \n#define ENSURECOPY 0x080 \t\n\n#define ALIGNED 0x100\n#define NOTSWAPPED 0x200\n#define WRITEABLE 0x400\n\n /* Flag used in creating a new array, not set in the array */\n\n\t/* If this flags is set, then base contains a pointer to \n\t an array of the same size that should be updated with the \n\t current contents of this array when this array is deallocated\n\t*/\n#define UPDATEIFCOPY 0x1000\n\n\n/* Size of internal buffers used for alignment */\n#define PyArray_BUFSIZE 10000\n#define PyArray_MIN_BUFSIZE 5\n#define PyArray_MAX_BUFSIZE MAX_INT32\n#define MAXBUFNUM 1024\n\n\n#define BEHAVED_FLAGS ALIGNED | NOTSWAPPED | WRITEABLE\n#define BEHAVED_FLAGS_RO ALIGNED | NOTSWAPPED\n#define CARRAY_FLAGS CONTIGUOUS | BEHAVED_FLAGS\n#define FARRAY_FLAGS FORTRAN | BEHAVED_FLAGS\n#define DEFAULT_FLAGS CARRAY_FLAGS\n\n#define UPDATE_ALL_FLAGS CONTIGUOUS | FORTRAN | ALIGNED\n\n\n/*\n * C API: consists of Macros and functions. The MACROS are defined here. \n */\n\n\n#define PyArray_CHKFLAGS(m, FLAGS) \\\n\t((((PyArrayObject *)(m))->flags & (FLAGS)) == (FLAGS))\n#define PyArray_ISCONTIGUOUS(m) PyArray_CHKFLAGS(m, CONTIGUOUS)\n#define PyArray_ISWRITEABLE(m) PyArray_CHKFLAGS(m, WRITEABLE)\n\n#define PyArray_ISCARRAY(m) PyArray_CHKFLAGS(m, CARRAY_FLAGS)\n#define PyArray_ISFARRAY(m) PyArray_CHKFLAGS(m, FARRAY_FLAGS)\n#define PyArray_ISBEHAVED(m) PyArray_CHKFLAGS(m, BEHAVED_FLAGS)\n#define PyArray_ISBEHAVED_RO(m) PyArray_CHKFLAGS(m, BEHAVED_FLAGS_RO)\n\n\n#ifndef MAX\n#define MAX(a,b) (((a)>(b))?(a):(b))\n#endif\n#ifndef MIN\n#define MIN(a,b) (((a)<(b))?(a):(b))\n#endif\n\n /* Useful if a and b have to be evaluated. */\n\n#define tMAX(a,b,typ) {typ _x_=(a); typ _y_=(b); _x_>_y_ ? _x_ : _y_}\n#define tMIN(a,b,typ) {typ _x_=(a); typ _y_=(b); _x_<_y_ ? _x_ : _y_}\n\n#if defined(ALLOW_THREADS)\n#define BEGIN_THREADS_DEF PyThreadState *_save;\n#define BEGIN_THREADS _save = PyEval_SaveThread();\n#define END_THREADS PyEval_RestoreThread(_save);\n#define ALLOW_C_API_DEF PyGILState_STATE __save__;\n#define ALLOW_C_API __save__ = PyGILState_Ensure();\n#define DISABLE_C_API PyGILState_Release(__save__);\n#else\n#define BEGIN_THREADS_DEF\n#define BEGIN_THREADS\n#define END_THREADS\n#define ALLOW_C_API_DEF\n#define\tALLOW_C_API \n#define\tDISABLE_C_API \n#endif\n\ntypedef struct {\n PyObject_HEAD\n\tint nd_m1; /* number of dimensions - 1 */\n intp\t\t index, size;\n\tintp coordinates[MAX_DIMS];/* N-dimensional loop */\n intp dims_m1[MAX_DIMS]; /* ao->dimensions - 1 */\n\tintp strides[MAX_DIMS]; /* ao->strides or fake */\n\tintp backstrides[MAX_DIMS];/* how far to jump back */\n\tintp factors[MAX_DIMS]; /* shape factors */\n\tPyArrayObject *ao;\n\tchar *dataptr; /* pointer to current item*/\n unsigned char contiguous;\n} PyArrayIterObject;\n\n\n/* Iterator API */ \n#define PyArrayIter_Check(op) PyObject_TypeCheck(op, &PyArrayIter_Type)\n\t\n#define PyArray_ITER_RESET(it) {\t\t\t\t\t\\\n\tit->index = 0;\t\t\t\t\t\t \\\n\tit->dataptr = it->ao->data;\t\t\t\t\t\\\n\tmemset(it->coordinates, 0, (it->nd_m1+1)*sizeof(intp));\t\t\\\n}\n\n\n#define PyArray_ITER_NEXT(it) {\t\t\t\t\\\n\tit->index++;\t\t\t\t\t\\\n\tif (it->contiguous) it->dataptr += it->ao->itemsize;\t \\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tint _i_;\t\t\t\t\t\t\\\n\t\tfor (_i_ = it->nd_m1; _i_ >= 0; _i_--) {\t\t\\\n\t\t\tif (it->coordinates[_i_] <\t\t\t\\\n\t\t\t it->dims_m1[_i_]) {\t\t\t\t\\\n\t\t\t\tit->coordinates[_i_]++;\t\t\t\\\n\t\t\t\tit->dataptr += it->strides[_i_];\t\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\telse {\t\t\t\t\t\t\\\n\t\t\t\tit->coordinates[_i_] = 0;\t\t\\\n\t\t\t\tit->dataptr -= it->backstrides[_i_];\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n}\n\n#define PyArray_ITER_GOTO(it, destination) {\t\t\t\t\\\n\t\tint _i_;\t\t\t\t\t\t\\\n\t\tit->index = 0;\t\t\t\t\t\t\\\n\t\tit->dataptr = it->ao->data;\t\t\t\t\\\n\t\tfor (_i_ = it->nd_m1; _i_>=0; _i_--) {\t\t\t\\\n\t\t\tit->dataptr += destination[_i_] *\t\t\\\n\t\t\t\tit->strides[_i_];\t\t\t\\\n\t\t\tit->coordinates[_i_] = destination[_i_];\t\\\n\t\t\tit->index += destination[_i_] *\t\t\t\\\n\t\t\t\t( _i_==it->nd_m1 ? 1 :\t\t\t\\\n\t\t\t\t it->dims_m1[i+1]+1) ;\t \t \\\n\t\t}\t\t\t\t\t\t\t\\\n\t} \n\n#define PyArray_ITER_GOTO1D(it, ind) { \\\n\t\tint _i_;\t\t\t\t\t\t\\\n\t\tintp _lind_ = (intp) (ind);\t\t\t\t\\\n\t\tit->index = _lind_;\t\t\t\t\t\\\n\t\tif (it->contiguous)\t\t\t\t\t\\\n\t\t\tit->dataptr = it->ao->data + (ind) *\t\t\\\n\t\t\t\tit->ao->itemsize;\t\t\t\\\n\t\telse {\t\t\t\t\t\t\t\\\n\t\t\tit->dataptr = it->ao->data;\t\t\t\\\n\t\t\tfor (_i_ = 0; _i_<=it->nd_m1; _i_++) {\t\t\\\n\t\t\t\tit->dataptr += (_lind_ / it->factors[_i_]) \\\n\t\t\t\t\t* it->strides[_i_];\t\t\\\n\t\t\t\t_lind_ %= it->factors[_i_];\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n}\n\n/* Not constructed anywhere. Just serves as a standard type that\n PyArray_Broadcast expects.\n\n Any object passed to PyArray_Broadcast must be binary compatible with \n this structure. \n*/\n\n\ntypedef struct {\n\tPyObject_HEAD\n\n\tint numiter; /* number of iters */\n\tintp size; /* broadcasted size */\n\tintp index; /* current index */\n\tint nd; /* number of dims */\n\tintp dimensions[MAX_DIMS]; /* dimensions */\n\tPyArrayIterObject *iters[MAX_DIMS]; /* iterators */\n} PyArrayMultiIterObject; \n\t\n\n/* Store the information needed for fancy-indexing over an array */\n\ntypedef struct {\n\tPyObject_HEAD\n\t/* Multi-iterator portion --- needs to be present in this order to \n\t work with PyArray_Broadcast */\n\n\tint numiter; /* number of index-array\n\t\t\t\t\t\t\t iterators */\n\tintp size; /* size of broadcasted \n\t\t\t\t\t\t\t result */\n\tintp index; /* current index */\n\tint nd; /* number of dims */\n\tintp dimensions[MAX_DIMS]; /* dimensions */\n\tPyArrayIterObject *iters[MAX_DIMS]; /* index object \n\t\t\t\t\t\t\t iterators */\n\tPyArrayIterObject *ait; /* flat Iterator for \n\t\t\t\t\t\t\t underlying array */\n\n\t/* flat iterator for subspace (when numiter < nd) */\n\tPyArrayIterObject *subspace;\n\n\t/* if subspace iteration, then this is the array of \n\t axes in the underlying array represented by the\n\t index objects */\n\tint iteraxes[MAX_DIMS];\n\t/* if subspace iteration, the these are the coordinates\n\t to the start of the subspace.\n\t*/\n\tintp bscoord[MAX_DIMS];\n\n\t\n\tPyObject *indexobj; /* reference to \n\t\t\t\t\t\t\t creating obj */\n\tint view;\n\tint consec;\n\tchar *dataptr;\n\n} PyArrayMapIterObject;\n\n\n/* Map Iterator API */ \n#define PyArrayMapIter_Check(op) PyObject_TypeCheck(op, &PyArrayMapIter_Type)\n\n\n#define PyArray_NDIM(obj) (((PyArrayObject *)(obj))->nd)\n#define PyArray_ISONESEGMENT(m) (PyArray_NDIM(m) == 0 || PyArray_CHKFLAGS(m, CONTIGUOUS) || \\\n\t\t\t\t PyArray_CHKFLAGS(m, FORTRAN))\n#define PyArray_ISFORTRAN(m) (PyArray_CHKFLAGS(m, FORTRAN) && (PyArray_NDIM(m) > 1))\n#define PyArray_DATA(obj) (((PyArrayObject *)(obj))->data)\n#define PyArray_DIMS(obj) (((PyArrayObject *)(obj))->dimensions)\n#define PyArray_STRIDES(obj) (((PyArrayObject *)(obj))->strides)\n#define PyArray_DIM(obj,n) (((PyArrayObject *)(obj))->dimensions[n])\n#define PyArray_STRIDE(obj,n) (((PyArrayObject *)(obj))->strides[n])\n#define PyArray_BASE(obj) (((PyArrayObject *)(obj))->base)\n#define PyArray_DESCR(obj) (((PyArrayObject *)(obj))->descr)\n#define PyArray_FLAGS(obj) (((PyArrayObject *)(obj))->flags)\n#define PyArray_ITEMSIZE(obj) (((PyArrayObject *)(obj))->itemsize)\n#define PyArray_TYPE(obj) (((PyArrayObject *)(obj))->descr->type_num)\n#define PyArray_GETITEM(obj,itemptr)\t\t\t\\\n\t((PyArrayObject *)(obj))->descr->getitem((char *)itemptr,\t\\\n\t\t\t\t\t\t (PyArrayObject *)obj);\n#define PyArray_SETITEM(obj,itemptr,v)\t\t\t\t\t\\\n\t(obj)->descr->setitem((PyObject *)v,(char *)(itemptr),\t\t\\\n\t\t\t (PyArrayObject *)(obj));\n\n\n#define PyTypeNum_ISBOOL(type) (type == PyArray_BOOL)\n#define PyTypeNum_ISUNSIGNED(type) ((type == PyArray_UBYTE) || \\\n\t\t\t\t (type == PyArray_USHORT) || \\\n\t\t\t\t (type == PyArray_UINT) ||\t\\\n\t\t\t\t (type == PyArray_ULONG) || \\\n\t\t\t\t (type == PyArray_ULONGLONG))\n\n#define PyTypeNum_ISSIGNED(type) ((type == PyArray_BYTE) ||\t\\\n\t\t\t (type == PyArray_SHORT) ||\t\\\n\t\t\t (type == PyArray_INT) ||\t\\\n\t\t\t (type == PyArray_LONG) ||\t\\\n\t\t\t (type == PyArray_LONGLONG))\n\n#define PyTypeNum_ISINTEGER(type) ((type >= PyArray_BYTE) &&\t\\\n\t\t\t\t(type <= PyArray_ULONGLONG))\n \n#define PyTypeNum_ISFLOAT(type) ((type >= PyArray_FLOAT) && \\\n\t\t\t (type <= PyArray_LONGDOUBLE))\n\n#define PyTypeNum_ISNUMBER(type) (type <= PyArray_CLONGDOUBLE)\n\n#define PyTypeNum_ISSTRING(type) ((type == PyArray_UCHAR) || \\\n\t\t\t (type == PyArray_UNICODE))\n\n#define PyTypeNum_ISCOMPLEX(type) ((type >= PyArray_CFLOAT) && \\\n\t\t\t\t(type <= PyArray_CLONGDOUBLE))\n\t\n#define PyTypeNum_ISPYTHON(type) ((type == PyArray_LONG) || \\\n\t\t\t\t (type == PyArray_DOUBLE) ||\t\\\n\t\t\t\t (type == PyArray_CDOUBLE) ||\t\\\n\t\t\t\t (type == PyArray_OBJECT ))\n\n#define PyTypeNum_ISFLEXIBLE(type) ((type==PyArray_STRING) || \\\n\t\t\t\t (type==PyArray_UNICODE) ||\t\\\n\t\t\t\t (type==PyArray_VOID))\n\n#define PyTypeNum_ISUSERDEF(type) ((type >= PyArray_USERDEF) && \\\n\t\t\t\t (type < PyArray_USERDEF+\\\n\t\t\t\t PyArray_NUMUSERTYPES))\n\n#define PyTypeNum_ISEXTENDED(type) (((type >= PyArray_STRING) && \\\n\t\t\t\t (type <= PyArray_VOID)) ||\t \\\n\t\t\t\t (type >= PyArray_USERDEF))\n\t\t\t\t \n#define PyTypeNum_ISOBJECT(type) ((type) == PyArray_OBJECT)\n\n#define PyArray_ISBOOL(obj) PyTypeNum_ISBOOL(PyArray_TYPE(obj))\n#define PyArray_ISUNSIGNED(obj) PyTypeNum_ISUNSIGNED(PyArray_TYPE(obj))\n#define PyArray_ISSIGNED(obj) PyTypeNum_ISSIGNED(PyArray_TYPE(obj))\n#define PyArray_ISINTEGER(obj) PyTypeNum_ISINTEGER(PyArray_TYPE(obj))\n#define PyArray_ISFLOAT(obj) PyTypeNum_ISFLOAT(PyArray_TYPE(obj))\n#define PyArray_ISNUMBER(obj) PyTypeNum_ISNUMBER(PyArray_TYPE(obj))\n#define PyArray_ISSTRING(obj) PyTypeNum_ISSTRING(PyArray_TYPE(obj))\n#define PyArray_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(PyArray_TYPE(obj))\n#define PyArray_ISPYTHONTYPE(obj) PyTypeNum_ISPYTHONTYPE(PyArray_TYPE(obj))\n#define PyArray_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj))\n#define PyArray_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(PyArray_TYPE(obj))\n#define PyArray_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(PyArray_TYPE(obj))\n#define PyArray_ISOBJECT(obj) PyTypeNum_ISOBJECT(PyArray_TYPE(obj))\n\n/* Object arrays ignore notswapped flag */\n#define PyArray_ISNOTSWAPPED(m) (PyArray_CHKFLAGS(m, NOTSWAPPED) || \\\n\t\t\t\t PyArray_ISOBJECT(m))\n\n\n /* Often, rather than always convert to an array, \n we may want to delegate behavior for other objects passed in\n */\n\n\t/* \n\n#define Py_DELEGATE(op, name) \\\n\tif (PyObject_HasAttrString(op, #name)) { \\\n\t\tPyObject *ret=NULL;\t\t\t\t \\\n\t\tPyObject *meth=PyObject_GetAttrString(op, #name); \\\n\t\tif (PyCallable_Check(meth)) {\t\t\t \\\n\t\t\tret = PyObject_CallObject(meth, NULL);\t \\\n\t\t}\t\t\t\t\t\t \\\n\t\tPy_XDECREF(meth);\t\t\t\t \\\n\t\treturn ret;\t\t\t\t\t \\\n\t}\n\n#define Py_DELEGATE_ARGS(op, name, args)\t\t\t \\\n\tif (PyObject_HasAttrString(op, #name)) { \\\n\t\tPyObject *ret=NULL;\t\t\t\t \\\n\t\tPyObject *meth=PyObject_GetAttrString(op, #name); \\\n\t\tif (PyCallable_Check(meth)) {\t\t\t \\\n\t\t\tret = PyObject_CallObject(meth, args);\t \\\n\t\t}\t\t\t\t\t\t \\\n Py_XDECREF(args); \\\n\t\tPy_XDECREF(meth);\t\t\t\t \\\n\t\treturn ret;\t\t\t\t\t \\\n\t}\n\n#define Py_DELEGATE_ARGS_KWDS(op, name, args, kwds)\t \\\n\tif (PyObject_HasAttrString(op, #name)) { \\\n\t\tPyObject *ret=NULL;\t\t\t\t \\\n\t\tPyObject *meth=PyObject_GetAttrString(op, #name); \\\n\t\tif (PyCallable_Check(meth)) {\t\t\t \\\n\t\t\tret = PyObject_Call(meth, args, kwds);\t \\\n\t\t}\t\t\t\t\t\t \\\n Py_XDECREF(args); \\\n\t\tPy_XDECREF(meth);\t\t\t\t \\\n\t\treturn ret;\t\t\t\t\t \\\n\t}\n\t*/\n\n\n /* Includes the \"function\" C-API -- these are all stored in a \n\t list of pointers --- one for each file\n\t The two lists are concatenated into one in multiarray.\n\t \n\t They are available as import_array()\n */\n\n#include \"__multiarray_api.h\"\n\n\n /* C-API that requries previous API to be defined */\n\n#define PyArray_Check(op) (PyObject_TypeCheck((op), &PyBigArray_Type))\n#define PyBigArray_CheckExact(op) ((op)->ob_type == &PyBigArray_Type)\n#define PyArray_CheckExact(op) ((op)->ob_type == &PyArray_Type)\n\n#define PyArray_CheckScalar(m) (PyObject_TypeCheck((m),\t\t\t\\\n\t\t\t\t\t\t &PyGenericArrType_Type) \\\n\t\t\t\t|| ((PyArray_Check((m))) &&\t\t\\\n\t\t\t\t (((PyArrayObject *)(m))->nd == 0)))\n#define PyArray_IsScalar(obj, cls)\t\t\t\t\\\n\t(PyObject_TypeCheck((obj), &Py##cls##ArrType_Type))\n#define PyArray_IsPythonScalar(obj) \\\n\t(PyInt_Check(obj) || PyFloat_Check(obj) || PyComplex_Check(obj) || \\\n\t PyLong_Check(obj) || PyBool_Check(obj) || PyString_Check(obj) || \\\n\t PyUnicode_Check(obj))\n#define PyArray_IsAnyScalar(obj) \\\n\t(PyArray_IsScalar(obj, Generic) || PyArray_IsPythonScalar(obj))\n\n#define PyArray_GETCONTIGUOUS(m) (PyArray_ISCONTIGUOUS(m) ? Py_INCREF(m), m : \\\n\t (PyArrayObject *)(PyArray_ContiguousFromObject((PyObject *)(m), \\\n\t\t PyArray_TYPE(m), 0, 0))) \n\n#define PyArray_SIZE(m) PyArray_MultiplyList(PyArray_DIMS(m), PyArray_NDIM(m))\n#define PyArray_NBYTES(m) (PyArray_ITEMSIZE(m) * PyArray_SIZE(m))\n#define PyArray_FROM_O(m) PyArray_FromAny(m, NULL, 0, 0, 0)\n#define PyArray_FROM_OF(m,flags) PyArray_FromAny(m, NULL, 0, 0, flags)\n\n#define REFCOUNT(obj) (((PyObject *)(obj))->ob_refcnt)\n#define MAX_ELSIZE 2*SIZEOF_LONGDOUBLE\n\n /*Compatibility with old Numeric stuff -- don't use in new code */\n\n#define PyArray_UNSIGNED_TYPES\n#define PyArray_SBYTE PyArray_BYTE\n#define PyArray_CHAR PyArray_BYTE\n#define PyArray_CopyArray PyArray_CopyInto\n#define _PyArray_multiply_list PyArray_MultiplyList\n#define PyArray_ISSPACESAVER(m) TRUE\n#define PyScalarArray_Check PyArray_CheckScalar\n\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !Py_ARRAYOBJECT_H */\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": 252, "complexity": 0, "token_count": 1156, "diff_parsed": { "added": [ "#define INTP_STRFORMAT \"%d\"", "", " #undef INTP_STRFORMAT", " #define INTP_STRFORMAT \"%Ld\"" ], "deleted": [] } }, { "old_path": "scipy/base/src/arraymethods.c", "new_path": "scipy/base/src/arraymethods.c", "filename": "arraymethods.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -242,7 +242,7 @@ PyArray_GetField(PyArrayObject *self, PyArray_Typecode *type,\n \tret = PyArray_New(self->ob_type, self->nd, self->dimensions,\n \t\t\t type->type_num, self->strides, \n \t\t\t self->data + offset,\n-\t\t\t type->itemsize, self->flags, self);\n+\t\t\t type->itemsize, self->flags, (PyObject *)self);\n \tif (ret == NULL) return NULL;\n \tPy_INCREF(self);\n \t((PyArrayObject *)ret)->base = (PyObject *)self;\n", "added_lines": 1, "deleted_lines": 1, "source_code": "\n#define _ARET(x) PyArray_Return((PyArrayObject *)(x))\nstatic char doc_take[] = \"a.take(indices, axis=None). Selects the elements \"\\\n\t\"in indices from array a along the given axis.\";\n\nstatic PyObject *\narray_take(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint dimension=MAX_DIMS;\n\tPyObject *indices;\n\tstatic char *kwlist[] = {\"indices\", \"axis\", NULL};\n\t\n\tdimension=0;\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist, \n\t\t\t\t\t &indices, PyArray_AxisConverter,\n\t\t\t\t\t &dimension))\n\t\treturn NULL;\n\t\n\treturn _ARET(PyArray_Take(self, indices, dimension));\n}\n\nstatic char doc_put[] = \"a.put(indices, values) sets a.flat[n] = v[n] \"\\\n\t\"for each n in indices. v can be scalar or shorter than indices, \"\\\n\t\"will repeat.\";\n\nstatic PyObject *\narray_put(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *indices, *values;\n\tstatic char *kwlist[] = {\"indices\", \"values\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO\", kwlist,\n\t\t\t\t\t &indices, &values))\n\t\treturn NULL;\n\treturn PyArray_Put(self, indices, values);\n}\n\nstatic char doc_putmask[] = \"a.putmask(mask, values) sets a.flat[n] = v[n] \"\\\n\t\"for each n where mask.flat[n] is TRUE. v can be scalar.\";\n\nstatic PyObject *\narray_putmask(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *mask, *values;\n\n\tstatic char *kwlist[] = {\"mask\", \"values\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO\", kwlist,\n\t\t\t\t\t &mask, &values))\n\t\treturn NULL;\n\treturn PyArray_PutMask(self, mask, values);\n}\n\n/* Used to reshape a Fortran Array */\nstatic void\n_reverse_shape(PyArray_Dims *newshape)\n{\n\tint i, n = newshape->len;\n\tintp *ptr = newshape->ptr;\n\tintp *eptr;\n\tintp tmp;\n\tint len = n >> 1;\n\n\teptr = ptr+n-1;\n\tfor(i=0; i) return a new view of array with same data.\";\n\nstatic PyObject *\narray_view(PyArrayObject *self, PyObject *args)\n{\n PyArray_Typecode type = {PyArray_NOTYPE, 0, 0};\n\tif (!PyArg_ParseTuple(args, \"|O&\",\n PyArray_TypecodeConverter, &type)) \n return NULL;\n\n\treturn _ARET(PyArray_View(self, &type));\n}\n\nstatic char doc_argmax[] = \"a.argmax(axis=None)\";\n\nstatic PyObject *\narray_argmax(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn _ARET(PyArray_ArgMax(self, axis));\n}\n\nstatic char doc_argmin[] = \"a.argmin(axis=None)\";\n\nstatic PyObject *\narray_argmin(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn _ARET(PyArray_ArgMin(self, axis));\n}\n\nstatic char doc_max[] = \"a.max(axis=None)\";\n\nstatic PyObject *\narray_max(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_Max(self, axis);\n}\n\nstatic char doc_ptp[] = \"a.ptp(axis=None) a.max(axis)-a.min(axis)\";\n\nstatic PyObject *\narray_ptp(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_Ptp(self, axis);\n}\n\n\nstatic char doc_min[] = \"a.min(axis=None)\";\n\nstatic PyObject *\narray_min(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_Min(self, axis);\n}\n\n\nstatic char doc_swapaxes[] = \"a.swapaxes(axis1, axis2) returns new view with axes swapped.\";\n\nstatic PyObject *\narray_swapaxes(PyArrayObject *self, PyObject *args)\n{\n\tint axis1, axis2;\n\n\tif (!PyArg_ParseTuple(args, \"ii\", &axis1, &axis2)) return NULL;\n\n\treturn PyArray_SwapAxes(self, axis1, axis2);\n}\n\nstatic char doc_getfield[] = \"m.field(type, offset) returns a field \"\\\n\t\" of the given array as a certain type. A field is a view of \"\\\n\t\" the array's data with each itemsize determined by the given type\"\\\n\t\" and the offset into the current array items given.\";\n\nstatic PyObject *\nPyArray_GetField(PyArrayObject *self, PyArray_Typecode *type, \n\t\t\t\t int offset)\n{\n\tPyObject *ret=NULL;\n\tret = PyArray_New(self->ob_type, self->nd, self->dimensions,\n\t\t\t type->type_num, self->strides, \n\t\t\t self->data + offset,\n\t\t\t type->itemsize, self->flags, (PyObject *)self);\n\tif (ret == NULL) return NULL;\n\tPy_INCREF(self);\n\t((PyArrayObject *)ret)->base = (PyObject *)self;\n\tPyArray_UpdateFlags((PyArrayObject *)ret, UPDATE_ALL_FLAGS);\n\treturn ret;\t\n}\n\nstatic PyObject *\narray_getfield(PyArrayObject *self, PyObject *args, PyObject *kwds)\n{\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n\tint offset = 0;\n\tstatic char *kwlist[] = {\"dtype\", \"offset\", 0};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|i\", kwlist,\n\t\t\t\t\t PyArray_TypecodeConverter, \n\t\t\t\t\t &typecode, &offset)) return NULL;\n\n\t\n\tif (typecode.itemsize > self->itemsize) {\n\t\tPyErr_SetString(PyExc_TypeError, \"Field itemsize must be <=\"\\\n\t\t\t\t\"array itemsize.\");\n\t\treturn NULL;\n\t}\n\treturn _ARET(PyArray_GetField(self, &typecode, offset));\n}\n\nstatic PyObject *\nPyArray_Byteswap(PyArrayObject *self, Bool inplace)\n{\n PyArrayObject *ret;\n\tintp size;\n\tPyArray_CopySwapNFunc *copyswapn;\n\tPyArrayIterObject *it;\n\n\tif (inplace) {\n\t\tcopyswapn = self->descr->copyswapn;\n\t\t\n\t\tsize = PyArray_SIZE(self);\n\t\tif (PyArray_ISONESEGMENT(self)) {\n\t\t\tcopyswapn(self->data, NULL, size, 1, self->itemsize);\n\t\t}\n\t\telse { /* Use iterator */\n\t\t\t\n\t\t\tit = (PyArrayIterObject *)\\\n\t\t\t\tPyArray_IterNew((PyObject *)self);\n\t\t\t\n\t\t\twhile (it->index < it->size) {\n\t\t\t\tcopyswapn(it->dataptr, NULL, 1, 1, \n\t\t\t\t\t self->itemsize);\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t}\n\t\t\tPy_DECREF(it);\n\t\t}\n\n\t\tif (self->flags & NOTSWAPPED) self->flags &= ~NOTSWAPPED;\n\t\telse self->flags |= NOTSWAPPED;\n\t\t\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n\telse {\n\t\tif ((ret = (PyArrayObject *)PyArray_Copy(self)) == NULL) \n\t\t\treturn NULL;\n\t\t\n\t\tsize = PyArray_SIZE(self);\n\t\t\n\t\t/* set the NOTSWAPPED flag to opposite self */\n\t\t/* ret is always notswapped, \n\t\t PyArray_Copy has already swapped if self was swapped */\n\n\t\tif (self->flags & NOTSWAPPED) {\n\t\t\tret->descr->copyswapn(ret->data, NULL, size, 1, ret->itemsize);\n\t\t\tret->flags &= ~NOTSWAPPED;\n\t\t}\n\t\telse { /* self was swapped, so now ret isn't */\n\t\t\tret->flags |= NOTSWAPPED;\n\t\t}\n\t\t\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic char doc_byteswap[] = \"m.byteswap(False) Swap the bytes in\"\\\n\t\" the array. Return the byteswapped array. If the first argument\"\\\n\t\" is TRUE, byteswap in-place and return a reference to self.\";\n\nstatic PyObject *\narray_byteswap(PyArrayObject *self, PyObject *args) \n{\n\tBool inplace=FALSE;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_BoolConverter, &inplace))\n\t\treturn NULL;\n\t\n\treturn PyArray_Byteswap(self, inplace);\n}\n\nstatic char doc_tolist[] = \"m.tolist().\t Copy the data portion of the array\"\\\n\t\" to a hierarchical python list and return that list.\";\n\nstatic PyObject *\narray_tolist(PyArrayObject *self, PyObject *args) \n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n if (self->nd <= 0) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can't convert a 0d array to a list\");\n return NULL;\n }\n\t\n return PyArray_ToList(self);\n}\n\nstatic char doc_tostring[] = \"m.tostring() Construct a Python string \"\\\n \"containing the raw bytes in the array\";\n\nstatic PyObject *\narray_tostring(PyArrayObject *self, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n return PyArray_ToString(self);\n}\n\nstatic char doc_tofile[] = \"m.tofile(fid, sep=\"\") write the data to a file.\";\n\nstatic PyObject *\narray_tofile(PyArrayObject *self, PyObject *args, PyObject *kwds)\n{\n\tint ret;\n PyObject *file;\n\tFILE *fd;\n char *sep=\"\";\n\tchar *format=\"\";\n\tchar *mode;\n\tstatic char *kwlist[] = {\"file\", \"sep\", \"format\", NULL};\n \n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|ss\", kwlist, \n &file, &sep, &format)) return NULL;\n\n\tif (PyString_Check(file)) {\n\t\tif (sep == \"\") mode=\"wb\";\n\t\telse mode=\"w\";\n\t\tfile = PyFile_FromString(PyString_AS_STRING(file), mode);\n\t\tif (file==NULL) return NULL;\n\t}\n\telse {\n\t\tPy_INCREF(file);\n\t}\n\tfd = PyFile_AsFile(file);\n\tif (fd == NULL) {\n\t\tPyErr_SetString(PyExc_IOError, \"First argument must be a \" \\\n\t\t\t\t\"string or open file\");\n\t\tPy_DECREF(file);\n\t\treturn NULL;\n\t}\n\tret = PyArray_ToFile(self, fd, sep, format);\n\tPy_DECREF(file);\n\tif (ret < 0) return NULL;\n Py_INCREF(Py_None);\n return Py_None;\n}\n\nstatic char doc_toscalar[] = \"m.toscalar(). Copy the first data point of \"\\\n\t\"the array to a standard Python scalar and return it.\";\n\nstatic PyObject *\narray_toscalar(PyArrayObject *self, PyObject *args) {\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n return self->descr->getitem(self->data, self);\n}\n\nstatic char doc_cast[] = \"m.astype(t).\tCast array m to type t.\t \\n\\n\"\\\n\t\"t can be either a string representing a typecode, or a python type\"\\\n\t\" object of type int, float, or complex.\";\n\nstatic PyObject *\narray_cast(PyArrayObject *self, PyObject *args) \n{\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n\t\n if (!PyArg_ParseTuple(args, \"O&\", PyArray_TypecodeConverter,\n\t\t\t &typecode)) return NULL;\n\n\tif (typecode.type_num == PyArray_NOTYPE ||\t\\\n\t typecode.type_num == PyArray_TYPE(self)) {\n\t\treturn _ARET(PyArray_Copy(self));\n\t}\n\treturn _ARET(PyArray_CastToType(self, &typecode));\n}\t \n\n/* default sub-type implementation */\n\nstatic char doc_wraparray[] = \"m.__array_wrap__(obj) returns an object of type m\"\\\n\t\" from the ndarray object obj\";\n\nstatic PyObject *\narray_wraparray(PyArrayObject *self, PyObject *args)\n{\n\tPyObject *arr;\n\tPyObject *ret;\n\t\n\tif (PyTuple_Size(args) < 1) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"only accepts 1 argument.\");\n\t\treturn NULL;\n\t}\n\tarr = PyTuple_GET_ITEM(args, 0);\n\tif (!PyArray_Check(arr)) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"can only be called with ndarray object\");\n\t\treturn NULL;\n\t}\t\n\n\tret = PyArray_New(self->ob_type, PyArray_NDIM(arr),\n\t\t\t PyArray_DIMS(arr), PyArray_TYPE(arr),\n\t\t\t PyArray_STRIDES(arr), PyArray_DATA(arr),\n\t\t\t PyArray_ITEMSIZE(arr), \n\t\t\t PyArray_FLAGS(arr), NULL);\n\tif (ret == NULL) return NULL;\n\tPy_INCREF(arr);\n\tPyArray_BASE(ret) = arr;\n\treturn ret;\n}\n\n/* NO-OP --- just so all subclasses will have one by default. */\nstatic PyObject *\narray_finalize(PyArrayObject *self, PyObject *args)\n{\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\n\nstatic char doc_array_getarray[] = \"m.__array__(|type) just returns either a new reference to self if type is not given or a new array of type if type is different from the current type of the array.\";\n\nstatic PyObject *\narray_getarray(PyArrayObject *self, PyObject *args) \n{\n\tPyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode oldtype = {PyArray_TYPE(self),\n\t\t\t\t PyArray_ITEMSIZE(self),\n\t\t\t\t 0};\n\tPyObject *ret;\n\n\tif (!PyArg_ParseTuple(args, \"|O&\", &PyArray_TypecodeConverter,\n\t\t\t &newtype)) return NULL;\n\n\t/* convert to PyArray_Type or PyBigArray_Type */\n\tif (!PyArray_CheckExact(self) || !PyBigArray_CheckExact(self)) {\n\t\tPyObject *new;\n\t\tPyTypeObject *subtype = &PyArray_Type;\n\n\t\tif (!PyType_IsSubtype(self->ob_type, &PyArray_Type)) {\n\t\t\tsubtype = &PyBigArray_Type;\n\t\t}\n\t\t\n\t\tnew = PyArray_New(subtype, PyArray_NDIM(self),\n\t\t\t\t PyArray_DIMS(self), PyArray_TYPE(self),\n\t\t\t\t PyArray_STRIDES(self), PyArray_DATA(self),\n\t\t\t\t PyArray_ITEMSIZE(self), \n\t\t\t\t PyArray_FLAGS(self), NULL);\n\t\tif (new == NULL) return NULL;\n\t\tPy_INCREF(self);\n\t\tPyArray_BASE(new) = (PyObject *)self;\n\t\tself = (PyArrayObject *)new;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t}\n\t\t\n\tif (newtype.type_num == PyArray_NOTYPE ||\n\t PyArray_EquivalentTypes(&oldtype, &newtype)) {\n\t\treturn (PyObject *)self;\n\t}\n\telse {\n\t\tret = PyArray_CastToType(self, &newtype);\n\t\tPy_DECREF(self);\n\t\treturn ret;\n\t}\n}\n\nstatic char doc_copy[] = \"m.copy(). Return a copy of the array.\";\n\nstatic PyObject *\narray_copy(PyArrayObject *self, PyObject *args) \n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n\t\n return _ARET(PyArray_Copy(self));\n}\n\nstatic char doc_resize[] = \"self.resize(new_shape). \"\\\n\t\"Change size and shape of self inplace.\\n\"\\\n\t\"\\n Array must own its own memory and not be referenced by other \" \\\n\t\"arrays\\n Returns None.\";\n\nstatic PyObject *\narray_resize(PyArrayObject *self, PyObject *args) \n{\n PyArray_Dims newshape;\n PyObject *ret;\n\tint n;\n\t\n\tn = PyTuple_Size(args);\n\tif (n <= 1) {\n\t\tif (!PyArg_ParseTuple(args, \"O&\", PyArray_IntpConverter, \n\t\t\t\t &newshape)) return NULL;\n\t}\n else {\n\t\tif (!PyArray_IntpConverter(args, &newshape)) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\t\"invalid shape.\");\n\t\t\t} \n\t\t\treturn NULL;\t\t\t\n\t\t}\n\t}\n\tret = PyArray_Resize(self, &newshape);\n PyDimMem_FREE(newshape.ptr);\n\tPy_DECREF(ret);\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char doc_repeat[] = \"a.repeat(repeats=, axis=None)\";\n\nstatic PyObject *\narray_repeat(PyArrayObject *self, PyObject *args, PyObject *kwds) {\n\tPyObject *repeats;\n\tint axis=MAX_DIMS;\n\tstatic char *kwlist[] = {\"repeats\", \"axis\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist, \n\t\t\t\t\t &repeats, PyArray_AxisConverter,\n\t\t\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_Repeat(self, repeats, axis);\n}\n\nstatic char doc_choose[] = \"a.choose(b1,b2,...)\";\n\nstatic PyObject *\narray_choose(PyArrayObject *self, PyObject *args) \n{\n\tPyObject *choices;\n\tint n;\n\t\n\tn = PyTuple_Size(args);\n\tif (n <= 1) {\n\t\tif (!PyArg_ParseTuple(args, \"O\", &choices))\n\t\t\treturn NULL;\n\t}\n else {\n\t\tchoices = args;\n\t}\n\t\n\treturn _ARET(PyArray_Choose(self, choices));\n}\n\nstatic char doc_sort[] = \"a.sort()\";\n\nstatic PyObject *\narray_sort(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn _ARET(PyArray_Sort(self, axis));\n}\n\nstatic char doc_argsort[] = \"a.argsort()\";\n\nstatic PyObject *\narray_argsort(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn _ARET(PyArray_ArgSort(self, axis));\n}\n\nstatic char doc_searchsorted[] = \"a.searchsorted(v)\";\n\nstatic PyObject *\narray_searchsorted(PyArrayObject *self, PyObject *args) \n{\n\tPyObject *values;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &values)) return NULL;\n\t\n\treturn _ARET(PyArray_SearchSorted(self, values));\n}\n\nstatic char doc_deepcopy[] = \"Used if copy.deepcopy is called on an array.\";\n\nstatic PyObject *\narray_deepcopy(PyArrayObject *self, PyObject *args) \n{\n PyObject* visit;\n PyObject **optr;\n PyArrayIterObject *it;\n PyObject *copy, *ret, *deepcopy, *temp, *res;\n\n if (!PyArg_ParseTuple(args, \"O\", &visit)) return NULL;\n ret = PyArray_Copy(self);\n if (PyArray_ISOBJECT(self)) {\n copy = PyImport_ImportModule(\"copy\");\n if (copy == NULL) return NULL;\n deepcopy = PyObject_GetAttrString(copy, \"deepcopy\");\n if (deepcopy == NULL) return NULL;\n Py_DECREF(copy);\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it == NULL) {Py_DECREF(deepcopy); return NULL;}\n optr = (PyObject **)PyArray_DATA(ret);\n while(it->index < it->size) {\n temp = *((PyObject **)it->dataptr);\n Py_INCREF(temp);\n /* call deepcopy on this argument */\n res = PyObject_CallFunctionObjArgs(deepcopy, \n temp, visit, NULL);\n Py_DECREF(temp);\n Py_DECREF(*optr);\n *optr++ = res;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(deepcopy);\n Py_DECREF(it);\n }\n return _ARET(ret);\n}\n\n/* Convert Object Array to flat list and pickle the flat list string */\nstatic PyObject *\n_getobject_pkl(PyArrayObject *self)\n{\n\tPyObject *theobject;\n\tPyArrayIterObject *iter=NULL;\n\tPyObject *list;\n\n\t\n\titer = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (iter == NULL) return NULL;\n\tlist = PyList_New(iter->size);\n\tif (list == NULL) {Py_DECREF(iter); return NULL;}\n\twhile (iter->index < iter->size) {\n\t\ttheobject = *((PyObject **)iter->dataptr);\n\t\tPy_INCREF(theobject);\n\t\tPyList_SET_ITEM(list, (int) iter->index, theobject);\n\t\tPyArray_ITER_NEXT(iter);\n\t}\n\tPy_DECREF(iter);\n\treturn list;\n}\n\nstatic int\n_setobject_pkl(PyArrayObject *self, PyObject *list)\n{\n\tPyObject *theobject;\n\tPyArrayIterObject *iter=NULL;\n\tint size;\n\n\tsize = self->itemsize;\n\t\n\titer = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (iter == NULL) return -1;\n\twhile(iter->index < iter->size) {\n\t\ttheobject = PyList_GET_ITEM(list,(int) iter->index);\n\t\tPy_INCREF(theobject);\n\t\t*((PyObject **)iter->dataptr) = theobject;\n\t\tPyArray_ITER_NEXT(iter);\n\t}\n\tPy_XDECREF(iter);\n\treturn 0;\n}\n\n\nstatic char doc_reduce[] = \"a.__reduce__() for pickling.\";\n\nstatic PyObject *\narray_reduce(PyArrayObject *self, PyObject *args)\n{\n\tPyObject *ret=NULL, *state=NULL, *obj=NULL, *mod=NULL;\n\tPyObject *Bool, *thestr=NULL;\n\n\t/* Return a tuple of (callable object, arguments, object's state) */\n\t/* We will put everything in the object's state, so that on UnPickle\n\t it can use the string object as memory without a copy */\n\n\tret = PyTuple_New(3);\n\tif (ret == NULL) return NULL;\n\tmod = PyImport_ImportModule(\"scipy.base.multiarray\");\n\tif (mod == NULL) return NULL;\n\tobj = PyObject_GetAttrString(mod, \"empty\");\n\tPy_DECREF(mod);\n\tif (obj == NULL) return NULL;\n\tPyTuple_SET_ITEM(ret, 0, obj);\n\tPyTuple_SET_ITEM(ret, 1, \n\t\t\t Py_BuildValue(\"NNN\",\n\t\t\t\t Py_BuildValue(\"(N)\",\n\t\t\t\t\t\t PyInt_FromLong(0)),\n\t\t\t\t PyObject_GetAttrString((PyObject *)self,\n\t\t\t\t\t\t\t \"dtypechar\"),\n\t\t\t\t PyInt_FromLong((long) 0)));\n\t\n\t/* Now fill in object's state. This is a tuple with \n\t 4 arguments\n\n\t 1) a Tuple giving the shape\n\t 2) a string giving the typestr (> or < indicates byte order\n\t if swap is possibly needed)\n\t 3) a Bool stating if Fortran or not\n\t 4) a binary string with the data (or a list for Object arrays)\n\n\t Notice because Python does not describe a mechanism to write \n\t raw data to the pickle, this performs a copy to a string first\n\t*/\n\n\tstate = PyTuple_New(4);\n\tif (state == NULL) {\n\t\tPy_DECREF(ret); return NULL;\n\t}\n\tPyTuple_SET_ITEM(state, 0, PyObject_GetAttrString((PyObject *)self, \n\t\t\t\t\t\t\t \"shape\"));\t\n\tPyTuple_SET_ITEM(state, 1, PyObject_GetAttrString((PyObject *)self, \n\t\t\t\t\t\t\t \"dtypestr\"));\n\tBool = (PyArray_ISFORTRAN(self) ? Py_True : Py_False);\n\tPy_INCREF(Bool);\n\tPyTuple_SET_ITEM(state, 2, Bool);\n\tif (PyArray_ISOBJECT(self)) {\n\t\tthestr = _getobject_pkl(self);\n\t}\n\telse {\n thestr = PyArray_ToString(self);\n\t}\n\tif (thestr == NULL) {\n\t\tPy_DECREF(ret);\n\t\tPy_DECREF(state);\n\t\treturn NULL;\n\t}\n\tPyTuple_SET_ITEM(state, 3, thestr);\n\tPyTuple_SET_ITEM(ret, 2, state);\n\treturn ret;\n}\n\nstatic char doc_setstate[] = \"a.__setstate__(tuple) for unpickling.\";\n\n/*\n\t 1) a Tuple giving the shape\n\t 2) a string giving the typestr (> or < indicates byte order\n\t if swap is possibly needed)\n\t 3) a Bool stating if Fortran or not\n\t 4) a binary string with the data (or a list if Object array) \n*/\n\nstatic intp _array_fill_strides(intp *, intp *, int, intp, int, int *);\n\nstatic PyObject *\narray_setstate(PyArrayObject *self, PyObject *args)\n{\n\tPyObject *shape;\n\tPyArray_Typecode typecode;\n\tlong fortran;\n\tPyObject *rawdata;\n\tchar *datastr;\n\tconst char *typestr;\n\tint len, typestrlen;\n\tint swap;\n\tintp dimensions[MAX_DIMS];\n\tint nd;\n\t\n\t/* This will free any memory associated with a and\n\t use the string in setstate as the (writeable) memory.\n\t*/\n\tif (!PyArg_ParseTuple(args, \"(O!z#iO)\", &PyTuple_Type,\n\t\t\t &shape, &typestr, &typestrlen,\n\t\t\t &fortran, &rawdata))\n\t\treturn NULL;\n\n\tif (_array_typecode_fromstr((char *)typestr, &swap, &typecode) < 0)\n\t\treturn NULL;\n\n\tself->descr = PyArray_DescrFromType(typecode.type_num);\n\tself->itemsize = typecode.itemsize;\n\tnd = PyArray_IntpFromSequence(shape, dimensions, MAX_DIMS);\n\tif (typecode.type_num == PyArray_OBJECT) {\n\t\tif (!PyList_Check(rawdata)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Object pickle not returning list\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\telse {\n\t\tif (!PyString_Check(rawdata)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Pickle not returning string\");\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (PyString_AsStringAndSize(rawdata, &datastr, &len))\n\t\t\treturn NULL;\n\n\t\tif ((len != (self->itemsize *\t\t\t\t\\\n\t\t\t (int) PyArray_MultiplyList(dimensions, nd)))) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"Buffer size does not\"\t\\\n\t\t\t\t\t\" match array size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n if ((self->flags & OWN_DATA)) {\n\t\tif (self->data != NULL)\n\t\t\tPyDataMem_FREE(self->data);\n\t\tself->flags &= ~OWN_DATA;\n }\n\tPy_XDECREF(self->base);\n\n\tself->flags &= ~UPDATEIFCOPY;\n\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t\tself->dimensions = NULL;\n\t}\n\n\tself->flags = DEFAULT_FLAGS;\n\n\tself->nd = nd;\n\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(nd * 2);\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dimensions, sizeof(intp)*nd);\n\t\t(void) _array_fill_strides(self->strides, dimensions, nd,\n\t\t\t\t\t self->itemsize, fortran, \n\t\t\t\t\t &(self->flags));\n\t}\n\n\tif (typecode.type_num != PyArray_OBJECT) {\n\t\tself->data = datastr;\n\t\tself->base = rawdata;\n\t\tPy_INCREF(self->base);\n\t}\n\telse {\n\t\tself->data = PyDataMem_NEW(PyArray_NBYTES(self));\n\t\tif (self->data == NULL) { \n\t\t\tself->nd = 0;\n\t\t\tself->data = PyDataMem_NEW(self->itemsize);\n\t\t\tif (self->dimensions) PyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\t\tself->base = NULL;\n\t\tif (_setobject_pkl(self, rawdata) < 0) \n\t\t\treturn NULL;\n\t}\n\n\tPyArray_UpdateFlags(self, UPDATE_ALL_FLAGS);\n\n\tif (swap) self->flags &= ~NOTSWAPPED;\n\t\n\tPy_INCREF(Py_None);\n\treturn Py_None;\t\n}\n\nstatic int\nPyArray_Dump(PyObject *self, PyObject *file, int protocol)\n{\n\tPyObject *cpick=NULL;\n\tPyObject *ret;\n\tif (protocol < 0) protocol = 2;\n\n\tcpick = PyImport_ImportModule(\"cPickle\");\n\tif (cpick==NULL) return -1;\n\n\tif PyString_Check(file) {\n\t\tfile = PyFile_FromString(PyString_AS_STRING(file), \"rb\");\n\t\tif (file==NULL) return -1;\n\t}\n\telse Py_INCREF(file);\n\tret = PyObject_CallMethod(cpick, \"dump\", \"OOi\", self, \n\t\t\t\t file, protocol);\n\tPy_XDECREF(ret);\n\tPy_DECREF(file);\n\tPy_DECREF(cpick);\n\tif (PyErr_Occurred()) return -1;\n\treturn 0;\n}\n\nstatic PyObject *\nPyArray_Dumps(PyObject *self, int protocol)\n{\n\tPyObject *cpick=NULL;\n\tPyObject *ret;\n\tif (protocol < 0) protocol = 2;\n\n\tcpick = PyImport_ImportModule(\"cPickle\");\n\tif (cpick==NULL) return NULL;\n\tret = PyObject_CallMethod(cpick, \"dumps\", \"Oi\", self, protocol);\n\tPy_DECREF(cpick);\n\treturn ret;\n}\n\n\nstatic char doc_dump[] = \"m.dump(file)\";\n\nstatic PyObject *\narray_dump(PyArrayObject *self, PyObject *args)\n{\n\tPyObject *file=NULL;\n\tint ret;\n\n\tif (!PyArg_ParseTuple(args, \"O\", &file))\n\t\treturn NULL;\n\tret = PyArray_Dump((PyObject *)self, file, 2);\n\tif (ret < 0) return NULL;\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char doc_dumps[] = \"m.dumps()\";\n\nstatic PyObject *\narray_dumps(PyArrayObject *self, PyObject *args)\n{\n\tif (!PyArg_ParseTuple(args, \"\"))\n\t\treturn NULL;\n\treturn PyArray_Dumps((PyObject *)self, 2);\n}\n\n\nstatic char doc_transpose[] = \"m.transpose()\";\n\nstatic PyObject *\narray_transpose(PyArrayObject *self, PyObject *args) \n{\n\tPyObject *shape=Py_None;\n\tint n;\n\n\tn = PyTuple_Size(args);\n\tif (n > 1) shape = args;\n\telse if (n == 1) shape = PyTuple_GET_ITEM(args, 0);\n\t\n\treturn _ARET(PyArray_Transpose(self, shape));\n}\n\nstatic char doc_mean[] = \"a.mean(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_mean(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist,\n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\n\treturn _ARET(PyArray_Mean(self, axis, rtype.type_num));\n}\n\nstatic char doc_sum[] = \"a.sum(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_sum(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\t\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist, \n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\t\n\treturn PyArray_Sum(self, axis, rtype.type_num);\n}\n\n\nstatic char doc_cumsum[] = \"a.cumsum(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_cumsum(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist, \n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\t\n\treturn PyArray_CumSum(self, axis, rtype.type_num);\n}\n\nstatic char doc_prod[] = \"a.prod(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_prod(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist, \n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\t\n\treturn PyArray_Prod(self, axis, rtype.type_num);\n}\n\n\nstatic char doc_cumprod[] = \"a.cumprod(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_cumprod(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist, \n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\t\n\treturn PyArray_CumProd(self, axis, rtype.type_num);\n}\n\n\nstatic char doc_any[] = \"a.any(axis=None)\";\n\nstatic PyObject *\narray_any(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_Any(self, axis);\n}\n\nstatic char doc_all[] = \"a.all(axis=None)\";\n\nstatic PyObject *\narray_all(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_All(self, axis);\n}\n\n\nstatic char doc_stddev[] = \"a.std(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_stddev(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist, \n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\t\n\treturn PyArray_Std(self, axis, rtype.type_num);\n}\n\nstatic char doc_compress[] = \"a.compress(condition=, axis=None)\";\n\nstatic PyObject *\narray_compress(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyObject *condition;\t\n\tstatic char *kwlist[] = {\"condition\", \"axis\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist, \n\t\t\t\t\t &condition, PyArray_AxisConverter,\n\t\t\t\t\t &axis)) return NULL;\n\n\treturn _ARET(PyArray_Compress(self, condition, axis));\n}\n\nstatic char doc_nonzero[] = \"a.nonzero() return a tuple of indices referencing\"\\\n\t\"the elements of a that are nonzero.\";\n\nstatic PyObject *\narray_nonzero(PyArrayObject *self, PyObject *args)\n{\n\tif (!PyArg_ParseTuple(args, \"\")) return NULL;\n\n\treturn _ARET(PyArray_Nonzero(self));\n}\n\n\nstatic char doc_trace[] = \"a.trace(offset=0, axis1=0, axis2=1, rtype=None)\";\n\nstatic PyObject *\narray_trace(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis1=0, axis2=1, offset=0;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"offset\", \"axis1\", \"axis2\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|iiiO&\", kwlist, \n\t\t\t\t\t &offset, &axis1, &axis2,\n\t\t\t\t\t PyArray_TypecodeConverter, &rtype))\n\t\treturn NULL;\n\t\n\treturn _ARET(PyArray_Trace(self, offset, axis1, axis2, rtype.type_num));\n}\n\n\nstatic char doc_clip[] = \"a.clip(min=, max=)\";\n\nstatic PyObject *\narray_clip(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *min, *max;\n\tstatic char *kwlist[] = {\"min\", \"max\", NULL};\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO\", kwlist,\n\t\t\t\t\t &min, &max)) \n\t\treturn NULL;\n\t\n\treturn _ARET(PyArray_Clip(self, min, max));\n}\n\nstatic char doc_conj[] = \"a.conj()\";\n\nstatic char doc_conjugate[] = \"a.conjugate()\";\n\nstatic PyObject *\narray_conjugate(PyArrayObject *self, PyObject *args) \n{\n\n\tif (!PyArg_ParseTuple(args, \"\")) return NULL;\n\t\n\treturn PyArray_Conjugate(self);\n}\n\n\nstatic char doc_diagonal[] = \"a.diagonal(offset=0, axis1=0, axis2=1)\";\n\nstatic PyObject *\narray_diagonal(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis1=0, axis2=1, offset=0;\n\tstatic char *kwlist[] = {\"offset\", \"axis1\", \"axis2\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|iii\", kwlist, \n\t\t\t\t\t &offset, &axis1, &axis2))\n\t\treturn NULL;\n\t\n\treturn _ARET(PyArray_Diagonal(self, offset, axis1, axis2));\n}\n\nstatic char doc_flatten[] = \"a.flatten([fortran]) return a 1-d array (always copy)\";\n\nstatic PyObject *\narray_flatten(PyArrayObject *self, PyObject *args)\n{\n\tBool fortran=FALSE;\n\n\tif (!PyArg_ParseTuple(args, \"|O&\",\n\t\t\t PyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\n\treturn PyArray_Flatten(self, (int) fortran);\n}\n\nstatic char doc_ravel[] = \"a.ravel([fortran]) return a 1-d array (copy only if needed)\";\n\nstatic PyObject *\narray_ravel(PyArrayObject *self, PyObject *args)\n{\n\tBool fortran=FALSE;\n\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_BoolConverter,\n\t\t\t &fortran)) return NULL;\n\n\treturn PyArray_Ravel(self, (int) fortran);\n}\n\n\n\nstatic char doc_setflags[] = \"a.setflags(write=None, swap=None, align=None, uic=None)\";\n\nstatic int _IsAligned(PyArrayObject *);\nstatic Bool _IsWriteable(PyArrayObject *);\n\nstatic PyObject *\narray_setflags(PyArrayObject *self, PyObject *args, PyObject *kwds)\n{\n\tstatic char *kwlist[] = {\"write\", \"swap\", \"align\", \"uic\", NULL};\n\tPyObject *write=Py_None;\n\tPyObject *swap=Py_None;\n\tPyObject *align=Py_None;\n\tPyObject *uic=Py_None;\n\tint flagback = self->flags;\n\t\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|OOOO\", kwlist,\n\t\t\t\t\t &write, &swap, &align, &uic))\n\t\treturn NULL;\n\n\tif (align != Py_None) {\n\t\tif (PyObject_Not(align)) self->flags &= ~ALIGNED;\n\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot set aligned flag of mis-\"\\\n\t\t\t\t\t\"aligned array to True\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tif (uic != Py_None) {\n if (PyObject_IsTrue(uic)) {\n\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return NULL;\n }\n else {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n }\n \n if (write != Py_None) {\n if (PyObject_IsTrue(write)) \n\t\t\tif (_IsWriteable(self)) {\n\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tself->flags = flagback;\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"cannot set WRITEABLE \"\t\\\n\t\t\t\t\t\t\"flag to True of this \"\t\\\n\t\t\t\t\t\t\"array.\");\t\t\\\n\t\t\t\treturn NULL;\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n \n if (swap != Py_None) {\n if (PyObject_IsTrue(swap))\n self->flags &= ~NOTSWAPPED;\n else \n self->flags |= NOTSWAPPED;\n }\n Py_INCREF(Py_None);\n return Py_None;\n}\n\nstatic PyMethodDef array_methods[] = {\n {\"tolist\",\t (PyCFunction)array_tolist,\t1, doc_tolist},\n {\"toscalar\", (PyCFunction)array_toscalar, METH_VARARGS, doc_toscalar},\n\t{\"tofile\", (PyCFunction)array_tofile, \n METH_VARARGS | METH_KEYWORDS, doc_tofile},\n {\"tostring\", (PyCFunction)array_tostring, METH_VARARGS, doc_tostring},\n {\"byteswap\", (PyCFunction)array_byteswap,\t1, doc_byteswap},\n {\"astype\", (PyCFunction)array_cast, 1, doc_cast},\n\t{\"getfield\", (PyCFunction)array_getfield, \n\t METH_VARARGS | METH_KEYWORDS, doc_getfield},\n {\"copy\", (PyCFunction)array_copy, 1, doc_copy}, \n {\"resize\", (PyCFunction)array_resize, 1, doc_resize}, \n\n\t/* for subtypes */\n\t{\"__array__\", (PyCFunction)array_getarray, 1, doc_array_getarray},\n\t{\"__array_wrap__\", (PyCFunction)array_wraparray, 1, doc_wraparray},\n\t/* default version so it is found... -- only used for subclasses */\n\t{\"__array_finalize__\", (PyCFunction)array_finalize, 1, NULL},\n\t\n\t\n\t/* for the copy module */\n {\"__copy__\", (PyCFunction)array_copy, 1, doc_copy},\t \n {\"__deepcopy__\", (PyCFunction)array_deepcopy, 1, doc_deepcopy}, \n\t\n /* for Pickling */\n {\"__reduce__\", (PyCFunction) array_reduce, 1, doc_reduce},\t\n\t{\"__setstate__\", (PyCFunction) array_setstate, 1, doc_setstate},\n\t{\"dumps\", (PyCFunction) array_dumps, 1, doc_dumps},\n\t{\"dump\", (PyCFunction) array_dump, 1, doc_dump},\n\n\t/* Extended methods added 2005 */\n\t{\"transpose\",\t(PyCFunction)array_transpose, \n\t METH_VARARGS, doc_transpose},\n\t{\"take\",\t(PyCFunction)array_take, \n\t METH_VARARGS|METH_KEYWORDS, doc_take},\n\t{\"put\",\t(PyCFunction)array_put, \n\t METH_VARARGS|METH_KEYWORDS, doc_put},\n\t{\"putmask\",\t(PyCFunction)array_putmask, \n\t METH_VARARGS|METH_KEYWORDS, doc_putmask},\n\t{\"repeat\",\t(PyCFunction)array_repeat, \n\t METH_VARARGS|METH_KEYWORDS, doc_repeat},\n\t{\"choose\",\t(PyCFunction)array_choose, \n\t METH_VARARGS, doc_choose},\t\n\t{\"sort\",\t(PyCFunction)array_sort, \n\t METH_VARARGS, doc_sort},\n\t{\"argsort\",\t(PyCFunction)array_argsort, \n\t METH_VARARGS, doc_argsort},\n\t{\"searchsorted\", (PyCFunction)array_searchsorted, \n\t METH_VARARGS, doc_searchsorted},\t\n\t{\"argmax\",\t(PyCFunction)array_argmax, \n\t METH_VARARGS, doc_argmax},\n\t{\"argmin\", (PyCFunction)array_argmin,\n\t METH_VARARGS, doc_argmin},\n\t{\"reshape\",\t(PyCFunction)array_reshape, \n\t METH_VARARGS, doc_reshape},\n\t{\"squeeze\",\t(PyCFunction)array_squeeze,\n\t METH_VARARGS, doc_squeeze},\n\t{\"view\", (PyCFunction)array_view, \n\t METH_VARARGS, doc_view},\n\t{\"swapaxes\", (PyCFunction)array_swapaxes,\n\t METH_VARARGS, doc_swapaxes},\n\t{\"max\", (PyCFunction)array_max,\n\t METH_VARARGS, doc_max},\n\t{\"min\", (PyCFunction)array_min,\n\t METH_VARARGS, doc_min},\n\t{\"ptp\", (PyCFunction)array_ptp,\n\t METH_VARARGS, doc_ptp},\n\t{\"mean\", (PyCFunction)array_mean,\n\t METH_VARARGS|METH_KEYWORDS, doc_mean},\n\t{\"trace\", (PyCFunction)array_trace,\n\t METH_VARARGS|METH_KEYWORDS, doc_trace},\n\t{\"diagonal\", (PyCFunction)array_diagonal,\n\t METH_VARARGS|METH_KEYWORDS, doc_diagonal},\n\t{\"clip\", (PyCFunction)array_clip,\n\t METH_VARARGS|METH_KEYWORDS, doc_clip},\n\t{\"conj\", (PyCFunction)array_conjugate,\n\t METH_VARARGS, doc_conj},\n\t{\"conjugate\", (PyCFunction)array_conjugate,\n\t METH_VARARGS, doc_conjugate},\n\t{\"nonzero\", (PyCFunction)array_nonzero,\n\t METH_VARARGS, doc_nonzero},\n\t{\"std\", (PyCFunction)array_stddev,\n\t METH_VARARGS|METH_KEYWORDS, doc_stddev},\n\t{\"sum\", (PyCFunction)array_sum,\n\t METH_VARARGS|METH_KEYWORDS, doc_sum},\n\t{\"cumsum\", (PyCFunction)array_cumsum,\n\t METH_VARARGS|METH_KEYWORDS, doc_cumsum},\n\t{\"prod\", (PyCFunction)array_prod,\n\t METH_VARARGS|METH_KEYWORDS, doc_prod},\n\t{\"cumprod\", (PyCFunction)array_cumprod,\n\t METH_VARARGS|METH_KEYWORDS, doc_cumprod},\n\t{\"all\", (PyCFunction)array_all,\n\t METH_VARARGS, doc_all},\n\t{\"any\", (PyCFunction)array_any,\n\t METH_VARARGS, doc_any},\n\t{\"compress\", (PyCFunction)array_compress,\n\t METH_VARARGS|METH_KEYWORDS, doc_compress},\n\t{\"flatten\", (PyCFunction)array_flatten,\n\t METH_VARARGS, doc_flatten},\n\t{\"ravel\", (PyCFunction)array_ravel,\n\t METH_VARARGS, doc_ravel},\n\t{\"setflags\", (PyCFunction)array_setflags,\n\t METH_VARARGS|METH_KEYWORDS, doc_setflags},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n#undef _ARET\n\n\n", "source_code_before": "\n#define _ARET(x) PyArray_Return((PyArrayObject *)(x))\nstatic char doc_take[] = \"a.take(indices, axis=None). Selects the elements \"\\\n\t\"in indices from array a along the given axis.\";\n\nstatic PyObject *\narray_take(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint dimension=MAX_DIMS;\n\tPyObject *indices;\n\tstatic char *kwlist[] = {\"indices\", \"axis\", NULL};\n\t\n\tdimension=0;\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist, \n\t\t\t\t\t &indices, PyArray_AxisConverter,\n\t\t\t\t\t &dimension))\n\t\treturn NULL;\n\t\n\treturn _ARET(PyArray_Take(self, indices, dimension));\n}\n\nstatic char doc_put[] = \"a.put(indices, values) sets a.flat[n] = v[n] \"\\\n\t\"for each n in indices. v can be scalar or shorter than indices, \"\\\n\t\"will repeat.\";\n\nstatic PyObject *\narray_put(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *indices, *values;\n\tstatic char *kwlist[] = {\"indices\", \"values\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO\", kwlist,\n\t\t\t\t\t &indices, &values))\n\t\treturn NULL;\n\treturn PyArray_Put(self, indices, values);\n}\n\nstatic char doc_putmask[] = \"a.putmask(mask, values) sets a.flat[n] = v[n] \"\\\n\t\"for each n where mask.flat[n] is TRUE. v can be scalar.\";\n\nstatic PyObject *\narray_putmask(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *mask, *values;\n\n\tstatic char *kwlist[] = {\"mask\", \"values\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO\", kwlist,\n\t\t\t\t\t &mask, &values))\n\t\treturn NULL;\n\treturn PyArray_PutMask(self, mask, values);\n}\n\n/* Used to reshape a Fortran Array */\nstatic void\n_reverse_shape(PyArray_Dims *newshape)\n{\n\tint i, n = newshape->len;\n\tintp *ptr = newshape->ptr;\n\tintp *eptr;\n\tintp tmp;\n\tint len = n >> 1;\n\n\teptr = ptr+n-1;\n\tfor(i=0; i) return a new view of array with same data.\";\n\nstatic PyObject *\narray_view(PyArrayObject *self, PyObject *args)\n{\n PyArray_Typecode type = {PyArray_NOTYPE, 0, 0};\n\tif (!PyArg_ParseTuple(args, \"|O&\",\n PyArray_TypecodeConverter, &type)) \n return NULL;\n\n\treturn _ARET(PyArray_View(self, &type));\n}\n\nstatic char doc_argmax[] = \"a.argmax(axis=None)\";\n\nstatic PyObject *\narray_argmax(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn _ARET(PyArray_ArgMax(self, axis));\n}\n\nstatic char doc_argmin[] = \"a.argmin(axis=None)\";\n\nstatic PyObject *\narray_argmin(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn _ARET(PyArray_ArgMin(self, axis));\n}\n\nstatic char doc_max[] = \"a.max(axis=None)\";\n\nstatic PyObject *\narray_max(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_Max(self, axis);\n}\n\nstatic char doc_ptp[] = \"a.ptp(axis=None) a.max(axis)-a.min(axis)\";\n\nstatic PyObject *\narray_ptp(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_Ptp(self, axis);\n}\n\n\nstatic char doc_min[] = \"a.min(axis=None)\";\n\nstatic PyObject *\narray_min(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_Min(self, axis);\n}\n\n\nstatic char doc_swapaxes[] = \"a.swapaxes(axis1, axis2) returns new view with axes swapped.\";\n\nstatic PyObject *\narray_swapaxes(PyArrayObject *self, PyObject *args)\n{\n\tint axis1, axis2;\n\n\tif (!PyArg_ParseTuple(args, \"ii\", &axis1, &axis2)) return NULL;\n\n\treturn PyArray_SwapAxes(self, axis1, axis2);\n}\n\nstatic char doc_getfield[] = \"m.field(type, offset) returns a field \"\\\n\t\" of the given array as a certain type. A field is a view of \"\\\n\t\" the array's data with each itemsize determined by the given type\"\\\n\t\" and the offset into the current array items given.\";\n\nstatic PyObject *\nPyArray_GetField(PyArrayObject *self, PyArray_Typecode *type, \n\t\t\t\t int offset)\n{\n\tPyObject *ret=NULL;\n\tret = PyArray_New(self->ob_type, self->nd, self->dimensions,\n\t\t\t type->type_num, self->strides, \n\t\t\t self->data + offset,\n\t\t\t type->itemsize, self->flags, self);\n\tif (ret == NULL) return NULL;\n\tPy_INCREF(self);\n\t((PyArrayObject *)ret)->base = (PyObject *)self;\n\tPyArray_UpdateFlags((PyArrayObject *)ret, UPDATE_ALL_FLAGS);\n\treturn ret;\t\n}\n\nstatic PyObject *\narray_getfield(PyArrayObject *self, PyObject *args, PyObject *kwds)\n{\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n\tint offset = 0;\n\tstatic char *kwlist[] = {\"dtype\", \"offset\", 0};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|i\", kwlist,\n\t\t\t\t\t PyArray_TypecodeConverter, \n\t\t\t\t\t &typecode, &offset)) return NULL;\n\n\t\n\tif (typecode.itemsize > self->itemsize) {\n\t\tPyErr_SetString(PyExc_TypeError, \"Field itemsize must be <=\"\\\n\t\t\t\t\"array itemsize.\");\n\t\treturn NULL;\n\t}\n\treturn _ARET(PyArray_GetField(self, &typecode, offset));\n}\n\nstatic PyObject *\nPyArray_Byteswap(PyArrayObject *self, Bool inplace)\n{\n PyArrayObject *ret;\n\tintp size;\n\tPyArray_CopySwapNFunc *copyswapn;\n\tPyArrayIterObject *it;\n\n\tif (inplace) {\n\t\tcopyswapn = self->descr->copyswapn;\n\t\t\n\t\tsize = PyArray_SIZE(self);\n\t\tif (PyArray_ISONESEGMENT(self)) {\n\t\t\tcopyswapn(self->data, NULL, size, 1, self->itemsize);\n\t\t}\n\t\telse { /* Use iterator */\n\t\t\t\n\t\t\tit = (PyArrayIterObject *)\\\n\t\t\t\tPyArray_IterNew((PyObject *)self);\n\t\t\t\n\t\t\twhile (it->index < it->size) {\n\t\t\t\tcopyswapn(it->dataptr, NULL, 1, 1, \n\t\t\t\t\t self->itemsize);\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t}\n\t\t\tPy_DECREF(it);\n\t\t}\n\n\t\tif (self->flags & NOTSWAPPED) self->flags &= ~NOTSWAPPED;\n\t\telse self->flags |= NOTSWAPPED;\n\t\t\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n\telse {\n\t\tif ((ret = (PyArrayObject *)PyArray_Copy(self)) == NULL) \n\t\t\treturn NULL;\n\t\t\n\t\tsize = PyArray_SIZE(self);\n\t\t\n\t\t/* set the NOTSWAPPED flag to opposite self */\n\t\t/* ret is always notswapped, \n\t\t PyArray_Copy has already swapped if self was swapped */\n\n\t\tif (self->flags & NOTSWAPPED) {\n\t\t\tret->descr->copyswapn(ret->data, NULL, size, 1, ret->itemsize);\n\t\t\tret->flags &= ~NOTSWAPPED;\n\t\t}\n\t\telse { /* self was swapped, so now ret isn't */\n\t\t\tret->flags |= NOTSWAPPED;\n\t\t}\n\t\t\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic char doc_byteswap[] = \"m.byteswap(False) Swap the bytes in\"\\\n\t\" the array. Return the byteswapped array. If the first argument\"\\\n\t\" is TRUE, byteswap in-place and return a reference to self.\";\n\nstatic PyObject *\narray_byteswap(PyArrayObject *self, PyObject *args) \n{\n\tBool inplace=FALSE;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_BoolConverter, &inplace))\n\t\treturn NULL;\n\t\n\treturn PyArray_Byteswap(self, inplace);\n}\n\nstatic char doc_tolist[] = \"m.tolist().\t Copy the data portion of the array\"\\\n\t\" to a hierarchical python list and return that list.\";\n\nstatic PyObject *\narray_tolist(PyArrayObject *self, PyObject *args) \n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n if (self->nd <= 0) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can't convert a 0d array to a list\");\n return NULL;\n }\n\t\n return PyArray_ToList(self);\n}\n\nstatic char doc_tostring[] = \"m.tostring() Construct a Python string \"\\\n \"containing the raw bytes in the array\";\n\nstatic PyObject *\narray_tostring(PyArrayObject *self, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n return PyArray_ToString(self);\n}\n\nstatic char doc_tofile[] = \"m.tofile(fid, sep=\"\") write the data to a file.\";\n\nstatic PyObject *\narray_tofile(PyArrayObject *self, PyObject *args, PyObject *kwds)\n{\n\tint ret;\n PyObject *file;\n\tFILE *fd;\n char *sep=\"\";\n\tchar *format=\"\";\n\tchar *mode;\n\tstatic char *kwlist[] = {\"file\", \"sep\", \"format\", NULL};\n \n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|ss\", kwlist, \n &file, &sep, &format)) return NULL;\n\n\tif (PyString_Check(file)) {\n\t\tif (sep == \"\") mode=\"wb\";\n\t\telse mode=\"w\";\n\t\tfile = PyFile_FromString(PyString_AS_STRING(file), mode);\n\t\tif (file==NULL) return NULL;\n\t}\n\telse {\n\t\tPy_INCREF(file);\n\t}\n\tfd = PyFile_AsFile(file);\n\tif (fd == NULL) {\n\t\tPyErr_SetString(PyExc_IOError, \"First argument must be a \" \\\n\t\t\t\t\"string or open file\");\n\t\tPy_DECREF(file);\n\t\treturn NULL;\n\t}\n\tret = PyArray_ToFile(self, fd, sep, format);\n\tPy_DECREF(file);\n\tif (ret < 0) return NULL;\n Py_INCREF(Py_None);\n return Py_None;\n}\n\nstatic char doc_toscalar[] = \"m.toscalar(). Copy the first data point of \"\\\n\t\"the array to a standard Python scalar and return it.\";\n\nstatic PyObject *\narray_toscalar(PyArrayObject *self, PyObject *args) {\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n return self->descr->getitem(self->data, self);\n}\n\nstatic char doc_cast[] = \"m.astype(t).\tCast array m to type t.\t \\n\\n\"\\\n\t\"t can be either a string representing a typecode, or a python type\"\\\n\t\" object of type int, float, or complex.\";\n\nstatic PyObject *\narray_cast(PyArrayObject *self, PyObject *args) \n{\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n\t\n if (!PyArg_ParseTuple(args, \"O&\", PyArray_TypecodeConverter,\n\t\t\t &typecode)) return NULL;\n\n\tif (typecode.type_num == PyArray_NOTYPE ||\t\\\n\t typecode.type_num == PyArray_TYPE(self)) {\n\t\treturn _ARET(PyArray_Copy(self));\n\t}\n\treturn _ARET(PyArray_CastToType(self, &typecode));\n}\t \n\n/* default sub-type implementation */\n\nstatic char doc_wraparray[] = \"m.__array_wrap__(obj) returns an object of type m\"\\\n\t\" from the ndarray object obj\";\n\nstatic PyObject *\narray_wraparray(PyArrayObject *self, PyObject *args)\n{\n\tPyObject *arr;\n\tPyObject *ret;\n\t\n\tif (PyTuple_Size(args) < 1) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"only accepts 1 argument.\");\n\t\treturn NULL;\n\t}\n\tarr = PyTuple_GET_ITEM(args, 0);\n\tif (!PyArray_Check(arr)) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"can only be called with ndarray object\");\n\t\treturn NULL;\n\t}\t\n\n\tret = PyArray_New(self->ob_type, PyArray_NDIM(arr),\n\t\t\t PyArray_DIMS(arr), PyArray_TYPE(arr),\n\t\t\t PyArray_STRIDES(arr), PyArray_DATA(arr),\n\t\t\t PyArray_ITEMSIZE(arr), \n\t\t\t PyArray_FLAGS(arr), NULL);\n\tif (ret == NULL) return NULL;\n\tPy_INCREF(arr);\n\tPyArray_BASE(ret) = arr;\n\treturn ret;\n}\n\n/* NO-OP --- just so all subclasses will have one by default. */\nstatic PyObject *\narray_finalize(PyArrayObject *self, PyObject *args)\n{\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\n\nstatic char doc_array_getarray[] = \"m.__array__(|type) just returns either a new reference to self if type is not given or a new array of type if type is different from the current type of the array.\";\n\nstatic PyObject *\narray_getarray(PyArrayObject *self, PyObject *args) \n{\n\tPyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode oldtype = {PyArray_TYPE(self),\n\t\t\t\t PyArray_ITEMSIZE(self),\n\t\t\t\t 0};\n\tPyObject *ret;\n\n\tif (!PyArg_ParseTuple(args, \"|O&\", &PyArray_TypecodeConverter,\n\t\t\t &newtype)) return NULL;\n\n\t/* convert to PyArray_Type or PyBigArray_Type */\n\tif (!PyArray_CheckExact(self) || !PyBigArray_CheckExact(self)) {\n\t\tPyObject *new;\n\t\tPyTypeObject *subtype = &PyArray_Type;\n\n\t\tif (!PyType_IsSubtype(self->ob_type, &PyArray_Type)) {\n\t\t\tsubtype = &PyBigArray_Type;\n\t\t}\n\t\t\n\t\tnew = PyArray_New(subtype, PyArray_NDIM(self),\n\t\t\t\t PyArray_DIMS(self), PyArray_TYPE(self),\n\t\t\t\t PyArray_STRIDES(self), PyArray_DATA(self),\n\t\t\t\t PyArray_ITEMSIZE(self), \n\t\t\t\t PyArray_FLAGS(self), NULL);\n\t\tif (new == NULL) return NULL;\n\t\tPy_INCREF(self);\n\t\tPyArray_BASE(new) = (PyObject *)self;\n\t\tself = (PyArrayObject *)new;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t}\n\t\t\n\tif (newtype.type_num == PyArray_NOTYPE ||\n\t PyArray_EquivalentTypes(&oldtype, &newtype)) {\n\t\treturn (PyObject *)self;\n\t}\n\telse {\n\t\tret = PyArray_CastToType(self, &newtype);\n\t\tPy_DECREF(self);\n\t\treturn ret;\n\t}\n}\n\nstatic char doc_copy[] = \"m.copy(). Return a copy of the array.\";\n\nstatic PyObject *\narray_copy(PyArrayObject *self, PyObject *args) \n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n\t\n return _ARET(PyArray_Copy(self));\n}\n\nstatic char doc_resize[] = \"self.resize(new_shape). \"\\\n\t\"Change size and shape of self inplace.\\n\"\\\n\t\"\\n Array must own its own memory and not be referenced by other \" \\\n\t\"arrays\\n Returns None.\";\n\nstatic PyObject *\narray_resize(PyArrayObject *self, PyObject *args) \n{\n PyArray_Dims newshape;\n PyObject *ret;\n\tint n;\n\t\n\tn = PyTuple_Size(args);\n\tif (n <= 1) {\n\t\tif (!PyArg_ParseTuple(args, \"O&\", PyArray_IntpConverter, \n\t\t\t\t &newshape)) return NULL;\n\t}\n else {\n\t\tif (!PyArray_IntpConverter(args, &newshape)) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\t\"invalid shape.\");\n\t\t\t} \n\t\t\treturn NULL;\t\t\t\n\t\t}\n\t}\n\tret = PyArray_Resize(self, &newshape);\n PyDimMem_FREE(newshape.ptr);\n\tPy_DECREF(ret);\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char doc_repeat[] = \"a.repeat(repeats=, axis=None)\";\n\nstatic PyObject *\narray_repeat(PyArrayObject *self, PyObject *args, PyObject *kwds) {\n\tPyObject *repeats;\n\tint axis=MAX_DIMS;\n\tstatic char *kwlist[] = {\"repeats\", \"axis\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist, \n\t\t\t\t\t &repeats, PyArray_AxisConverter,\n\t\t\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_Repeat(self, repeats, axis);\n}\n\nstatic char doc_choose[] = \"a.choose(b1,b2,...)\";\n\nstatic PyObject *\narray_choose(PyArrayObject *self, PyObject *args) \n{\n\tPyObject *choices;\n\tint n;\n\t\n\tn = PyTuple_Size(args);\n\tif (n <= 1) {\n\t\tif (!PyArg_ParseTuple(args, \"O\", &choices))\n\t\t\treturn NULL;\n\t}\n else {\n\t\tchoices = args;\n\t}\n\t\n\treturn _ARET(PyArray_Choose(self, choices));\n}\n\nstatic char doc_sort[] = \"a.sort()\";\n\nstatic PyObject *\narray_sort(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn _ARET(PyArray_Sort(self, axis));\n}\n\nstatic char doc_argsort[] = \"a.argsort()\";\n\nstatic PyObject *\narray_argsort(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn _ARET(PyArray_ArgSort(self, axis));\n}\n\nstatic char doc_searchsorted[] = \"a.searchsorted(v)\";\n\nstatic PyObject *\narray_searchsorted(PyArrayObject *self, PyObject *args) \n{\n\tPyObject *values;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &values)) return NULL;\n\t\n\treturn _ARET(PyArray_SearchSorted(self, values));\n}\n\nstatic char doc_deepcopy[] = \"Used if copy.deepcopy is called on an array.\";\n\nstatic PyObject *\narray_deepcopy(PyArrayObject *self, PyObject *args) \n{\n PyObject* visit;\n PyObject **optr;\n PyArrayIterObject *it;\n PyObject *copy, *ret, *deepcopy, *temp, *res;\n\n if (!PyArg_ParseTuple(args, \"O\", &visit)) return NULL;\n ret = PyArray_Copy(self);\n if (PyArray_ISOBJECT(self)) {\n copy = PyImport_ImportModule(\"copy\");\n if (copy == NULL) return NULL;\n deepcopy = PyObject_GetAttrString(copy, \"deepcopy\");\n if (deepcopy == NULL) return NULL;\n Py_DECREF(copy);\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it == NULL) {Py_DECREF(deepcopy); return NULL;}\n optr = (PyObject **)PyArray_DATA(ret);\n while(it->index < it->size) {\n temp = *((PyObject **)it->dataptr);\n Py_INCREF(temp);\n /* call deepcopy on this argument */\n res = PyObject_CallFunctionObjArgs(deepcopy, \n temp, visit, NULL);\n Py_DECREF(temp);\n Py_DECREF(*optr);\n *optr++ = res;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(deepcopy);\n Py_DECREF(it);\n }\n return _ARET(ret);\n}\n\n/* Convert Object Array to flat list and pickle the flat list string */\nstatic PyObject *\n_getobject_pkl(PyArrayObject *self)\n{\n\tPyObject *theobject;\n\tPyArrayIterObject *iter=NULL;\n\tPyObject *list;\n\n\t\n\titer = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (iter == NULL) return NULL;\n\tlist = PyList_New(iter->size);\n\tif (list == NULL) {Py_DECREF(iter); return NULL;}\n\twhile (iter->index < iter->size) {\n\t\ttheobject = *((PyObject **)iter->dataptr);\n\t\tPy_INCREF(theobject);\n\t\tPyList_SET_ITEM(list, (int) iter->index, theobject);\n\t\tPyArray_ITER_NEXT(iter);\n\t}\n\tPy_DECREF(iter);\n\treturn list;\n}\n\nstatic int\n_setobject_pkl(PyArrayObject *self, PyObject *list)\n{\n\tPyObject *theobject;\n\tPyArrayIterObject *iter=NULL;\n\tint size;\n\n\tsize = self->itemsize;\n\t\n\titer = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (iter == NULL) return -1;\n\twhile(iter->index < iter->size) {\n\t\ttheobject = PyList_GET_ITEM(list,(int) iter->index);\n\t\tPy_INCREF(theobject);\n\t\t*((PyObject **)iter->dataptr) = theobject;\n\t\tPyArray_ITER_NEXT(iter);\n\t}\n\tPy_XDECREF(iter);\n\treturn 0;\n}\n\n\nstatic char doc_reduce[] = \"a.__reduce__() for pickling.\";\n\nstatic PyObject *\narray_reduce(PyArrayObject *self, PyObject *args)\n{\n\tPyObject *ret=NULL, *state=NULL, *obj=NULL, *mod=NULL;\n\tPyObject *Bool, *thestr=NULL;\n\n\t/* Return a tuple of (callable object, arguments, object's state) */\n\t/* We will put everything in the object's state, so that on UnPickle\n\t it can use the string object as memory without a copy */\n\n\tret = PyTuple_New(3);\n\tif (ret == NULL) return NULL;\n\tmod = PyImport_ImportModule(\"scipy.base.multiarray\");\n\tif (mod == NULL) return NULL;\n\tobj = PyObject_GetAttrString(mod, \"empty\");\n\tPy_DECREF(mod);\n\tif (obj == NULL) return NULL;\n\tPyTuple_SET_ITEM(ret, 0, obj);\n\tPyTuple_SET_ITEM(ret, 1, \n\t\t\t Py_BuildValue(\"NNN\",\n\t\t\t\t Py_BuildValue(\"(N)\",\n\t\t\t\t\t\t PyInt_FromLong(0)),\n\t\t\t\t PyObject_GetAttrString((PyObject *)self,\n\t\t\t\t\t\t\t \"dtypechar\"),\n\t\t\t\t PyInt_FromLong((long) 0)));\n\t\n\t/* Now fill in object's state. This is a tuple with \n\t 4 arguments\n\n\t 1) a Tuple giving the shape\n\t 2) a string giving the typestr (> or < indicates byte order\n\t if swap is possibly needed)\n\t 3) a Bool stating if Fortran or not\n\t 4) a binary string with the data (or a list for Object arrays)\n\n\t Notice because Python does not describe a mechanism to write \n\t raw data to the pickle, this performs a copy to a string first\n\t*/\n\n\tstate = PyTuple_New(4);\n\tif (state == NULL) {\n\t\tPy_DECREF(ret); return NULL;\n\t}\n\tPyTuple_SET_ITEM(state, 0, PyObject_GetAttrString((PyObject *)self, \n\t\t\t\t\t\t\t \"shape\"));\t\n\tPyTuple_SET_ITEM(state, 1, PyObject_GetAttrString((PyObject *)self, \n\t\t\t\t\t\t\t \"dtypestr\"));\n\tBool = (PyArray_ISFORTRAN(self) ? Py_True : Py_False);\n\tPy_INCREF(Bool);\n\tPyTuple_SET_ITEM(state, 2, Bool);\n\tif (PyArray_ISOBJECT(self)) {\n\t\tthestr = _getobject_pkl(self);\n\t}\n\telse {\n thestr = PyArray_ToString(self);\n\t}\n\tif (thestr == NULL) {\n\t\tPy_DECREF(ret);\n\t\tPy_DECREF(state);\n\t\treturn NULL;\n\t}\n\tPyTuple_SET_ITEM(state, 3, thestr);\n\tPyTuple_SET_ITEM(ret, 2, state);\n\treturn ret;\n}\n\nstatic char doc_setstate[] = \"a.__setstate__(tuple) for unpickling.\";\n\n/*\n\t 1) a Tuple giving the shape\n\t 2) a string giving the typestr (> or < indicates byte order\n\t if swap is possibly needed)\n\t 3) a Bool stating if Fortran or not\n\t 4) a binary string with the data (or a list if Object array) \n*/\n\nstatic intp _array_fill_strides(intp *, intp *, int, intp, int, int *);\n\nstatic PyObject *\narray_setstate(PyArrayObject *self, PyObject *args)\n{\n\tPyObject *shape;\n\tPyArray_Typecode typecode;\n\tlong fortran;\n\tPyObject *rawdata;\n\tchar *datastr;\n\tconst char *typestr;\n\tint len, typestrlen;\n\tint swap;\n\tintp dimensions[MAX_DIMS];\n\tint nd;\n\t\n\t/* This will free any memory associated with a and\n\t use the string in setstate as the (writeable) memory.\n\t*/\n\tif (!PyArg_ParseTuple(args, \"(O!z#iO)\", &PyTuple_Type,\n\t\t\t &shape, &typestr, &typestrlen,\n\t\t\t &fortran, &rawdata))\n\t\treturn NULL;\n\n\tif (_array_typecode_fromstr((char *)typestr, &swap, &typecode) < 0)\n\t\treturn NULL;\n\n\tself->descr = PyArray_DescrFromType(typecode.type_num);\n\tself->itemsize = typecode.itemsize;\n\tnd = PyArray_IntpFromSequence(shape, dimensions, MAX_DIMS);\n\tif (typecode.type_num == PyArray_OBJECT) {\n\t\tif (!PyList_Check(rawdata)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Object pickle not returning list\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\telse {\n\t\tif (!PyString_Check(rawdata)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Pickle not returning string\");\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (PyString_AsStringAndSize(rawdata, &datastr, &len))\n\t\t\treturn NULL;\n\n\t\tif ((len != (self->itemsize *\t\t\t\t\\\n\t\t\t (int) PyArray_MultiplyList(dimensions, nd)))) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"Buffer size does not\"\t\\\n\t\t\t\t\t\" match array size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n if ((self->flags & OWN_DATA)) {\n\t\tif (self->data != NULL)\n\t\t\tPyDataMem_FREE(self->data);\n\t\tself->flags &= ~OWN_DATA;\n }\n\tPy_XDECREF(self->base);\n\n\tself->flags &= ~UPDATEIFCOPY;\n\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t\tself->dimensions = NULL;\n\t}\n\n\tself->flags = DEFAULT_FLAGS;\n\n\tself->nd = nd;\n\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(nd * 2);\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dimensions, sizeof(intp)*nd);\n\t\t(void) _array_fill_strides(self->strides, dimensions, nd,\n\t\t\t\t\t self->itemsize, fortran, \n\t\t\t\t\t &(self->flags));\n\t}\n\n\tif (typecode.type_num != PyArray_OBJECT) {\n\t\tself->data = datastr;\n\t\tself->base = rawdata;\n\t\tPy_INCREF(self->base);\n\t}\n\telse {\n\t\tself->data = PyDataMem_NEW(PyArray_NBYTES(self));\n\t\tif (self->data == NULL) { \n\t\t\tself->nd = 0;\n\t\t\tself->data = PyDataMem_NEW(self->itemsize);\n\t\t\tif (self->dimensions) PyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\t\tself->base = NULL;\n\t\tif (_setobject_pkl(self, rawdata) < 0) \n\t\t\treturn NULL;\n\t}\n\n\tPyArray_UpdateFlags(self, UPDATE_ALL_FLAGS);\n\n\tif (swap) self->flags &= ~NOTSWAPPED;\n\t\n\tPy_INCREF(Py_None);\n\treturn Py_None;\t\n}\n\nstatic int\nPyArray_Dump(PyObject *self, PyObject *file, int protocol)\n{\n\tPyObject *cpick=NULL;\n\tPyObject *ret;\n\tif (protocol < 0) protocol = 2;\n\n\tcpick = PyImport_ImportModule(\"cPickle\");\n\tif (cpick==NULL) return -1;\n\n\tif PyString_Check(file) {\n\t\tfile = PyFile_FromString(PyString_AS_STRING(file), \"rb\");\n\t\tif (file==NULL) return -1;\n\t}\n\telse Py_INCREF(file);\n\tret = PyObject_CallMethod(cpick, \"dump\", \"OOi\", self, \n\t\t\t\t file, protocol);\n\tPy_XDECREF(ret);\n\tPy_DECREF(file);\n\tPy_DECREF(cpick);\n\tif (PyErr_Occurred()) return -1;\n\treturn 0;\n}\n\nstatic PyObject *\nPyArray_Dumps(PyObject *self, int protocol)\n{\n\tPyObject *cpick=NULL;\n\tPyObject *ret;\n\tif (protocol < 0) protocol = 2;\n\n\tcpick = PyImport_ImportModule(\"cPickle\");\n\tif (cpick==NULL) return NULL;\n\tret = PyObject_CallMethod(cpick, \"dumps\", \"Oi\", self, protocol);\n\tPy_DECREF(cpick);\n\treturn ret;\n}\n\n\nstatic char doc_dump[] = \"m.dump(file)\";\n\nstatic PyObject *\narray_dump(PyArrayObject *self, PyObject *args)\n{\n\tPyObject *file=NULL;\n\tint ret;\n\n\tif (!PyArg_ParseTuple(args, \"O\", &file))\n\t\treturn NULL;\n\tret = PyArray_Dump((PyObject *)self, file, 2);\n\tif (ret < 0) return NULL;\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char doc_dumps[] = \"m.dumps()\";\n\nstatic PyObject *\narray_dumps(PyArrayObject *self, PyObject *args)\n{\n\tif (!PyArg_ParseTuple(args, \"\"))\n\t\treturn NULL;\n\treturn PyArray_Dumps((PyObject *)self, 2);\n}\n\n\nstatic char doc_transpose[] = \"m.transpose()\";\n\nstatic PyObject *\narray_transpose(PyArrayObject *self, PyObject *args) \n{\n\tPyObject *shape=Py_None;\n\tint n;\n\n\tn = PyTuple_Size(args);\n\tif (n > 1) shape = args;\n\telse if (n == 1) shape = PyTuple_GET_ITEM(args, 0);\n\t\n\treturn _ARET(PyArray_Transpose(self, shape));\n}\n\nstatic char doc_mean[] = \"a.mean(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_mean(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist,\n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\n\treturn _ARET(PyArray_Mean(self, axis, rtype.type_num));\n}\n\nstatic char doc_sum[] = \"a.sum(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_sum(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\t\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist, \n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\t\n\treturn PyArray_Sum(self, axis, rtype.type_num);\n}\n\n\nstatic char doc_cumsum[] = \"a.cumsum(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_cumsum(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist, \n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\t\n\treturn PyArray_CumSum(self, axis, rtype.type_num);\n}\n\nstatic char doc_prod[] = \"a.prod(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_prod(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist, \n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\t\n\treturn PyArray_Prod(self, axis, rtype.type_num);\n}\n\n\nstatic char doc_cumprod[] = \"a.cumprod(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_cumprod(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist, \n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\t\n\treturn PyArray_CumProd(self, axis, rtype.type_num);\n}\n\n\nstatic char doc_any[] = \"a.any(axis=None)\";\n\nstatic PyObject *\narray_any(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_Any(self, axis);\n}\n\nstatic char doc_all[] = \"a.all(axis=None)\";\n\nstatic PyObject *\narray_all(PyArrayObject *self, PyObject *args) \n{\n\tint axis=MAX_DIMS;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_AxisConverter, \n\t\t\t &axis)) return NULL;\n\t\n\treturn PyArray_All(self, axis);\n}\n\n\nstatic char doc_stddev[] = \"a.std(axis=None, rtype=None)\";\n\nstatic PyObject *\narray_stddev(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"axis\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&O&\", kwlist, \n\t\t\t\t\t PyArray_AxisConverter, \n\t\t\t\t\t &axis, PyArray_TypecodeConverter,\n\t\t\t\t\t &rtype)) return NULL;\n\t\n\treturn PyArray_Std(self, axis, rtype.type_num);\n}\n\nstatic char doc_compress[] = \"a.compress(condition=, axis=None)\";\n\nstatic PyObject *\narray_compress(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis=MAX_DIMS;\n\tPyObject *condition;\t\n\tstatic char *kwlist[] = {\"condition\", \"axis\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist, \n\t\t\t\t\t &condition, PyArray_AxisConverter,\n\t\t\t\t\t &axis)) return NULL;\n\n\treturn _ARET(PyArray_Compress(self, condition, axis));\n}\n\nstatic char doc_nonzero[] = \"a.nonzero() return a tuple of indices referencing\"\\\n\t\"the elements of a that are nonzero.\";\n\nstatic PyObject *\narray_nonzero(PyArrayObject *self, PyObject *args)\n{\n\tif (!PyArg_ParseTuple(args, \"\")) return NULL;\n\n\treturn _ARET(PyArray_Nonzero(self));\n}\n\n\nstatic char doc_trace[] = \"a.trace(offset=0, axis1=0, axis2=1, rtype=None)\";\n\nstatic PyObject *\narray_trace(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis1=0, axis2=1, offset=0;\n\tPyArray_Typecode rtype = {PyArray_NOTYPE, 0, 0};\n\tstatic char *kwlist[] = {\"offset\", \"axis1\", \"axis2\", \"rtype\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|iiiO&\", kwlist, \n\t\t\t\t\t &offset, &axis1, &axis2,\n\t\t\t\t\t PyArray_TypecodeConverter, &rtype))\n\t\treturn NULL;\n\t\n\treturn _ARET(PyArray_Trace(self, offset, axis1, axis2, rtype.type_num));\n}\n\n\nstatic char doc_clip[] = \"a.clip(min=, max=)\";\n\nstatic PyObject *\narray_clip(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *min, *max;\n\tstatic char *kwlist[] = {\"min\", \"max\", NULL};\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO\", kwlist,\n\t\t\t\t\t &min, &max)) \n\t\treturn NULL;\n\t\n\treturn _ARET(PyArray_Clip(self, min, max));\n}\n\nstatic char doc_conj[] = \"a.conj()\";\n\nstatic char doc_conjugate[] = \"a.conjugate()\";\n\nstatic PyObject *\narray_conjugate(PyArrayObject *self, PyObject *args) \n{\n\n\tif (!PyArg_ParseTuple(args, \"\")) return NULL;\n\t\n\treturn PyArray_Conjugate(self);\n}\n\n\nstatic char doc_diagonal[] = \"a.diagonal(offset=0, axis1=0, axis2=1)\";\n\nstatic PyObject *\narray_diagonal(PyArrayObject *self, PyObject *args, PyObject *kwds) \n{\n\tint axis1=0, axis2=1, offset=0;\n\tstatic char *kwlist[] = {\"offset\", \"axis1\", \"axis2\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|iii\", kwlist, \n\t\t\t\t\t &offset, &axis1, &axis2))\n\t\treturn NULL;\n\t\n\treturn _ARET(PyArray_Diagonal(self, offset, axis1, axis2));\n}\n\nstatic char doc_flatten[] = \"a.flatten([fortran]) return a 1-d array (always copy)\";\n\nstatic PyObject *\narray_flatten(PyArrayObject *self, PyObject *args)\n{\n\tBool fortran=FALSE;\n\n\tif (!PyArg_ParseTuple(args, \"|O&\",\n\t\t\t PyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\n\treturn PyArray_Flatten(self, (int) fortran);\n}\n\nstatic char doc_ravel[] = \"a.ravel([fortran]) return a 1-d array (copy only if needed)\";\n\nstatic PyObject *\narray_ravel(PyArrayObject *self, PyObject *args)\n{\n\tBool fortran=FALSE;\n\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_BoolConverter,\n\t\t\t &fortran)) return NULL;\n\n\treturn PyArray_Ravel(self, (int) fortran);\n}\n\n\n\nstatic char doc_setflags[] = \"a.setflags(write=None, swap=None, align=None, uic=None)\";\n\nstatic int _IsAligned(PyArrayObject *);\nstatic Bool _IsWriteable(PyArrayObject *);\n\nstatic PyObject *\narray_setflags(PyArrayObject *self, PyObject *args, PyObject *kwds)\n{\n\tstatic char *kwlist[] = {\"write\", \"swap\", \"align\", \"uic\", NULL};\n\tPyObject *write=Py_None;\n\tPyObject *swap=Py_None;\n\tPyObject *align=Py_None;\n\tPyObject *uic=Py_None;\n\tint flagback = self->flags;\n\t\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"|OOOO\", kwlist,\n\t\t\t\t\t &write, &swap, &align, &uic))\n\t\treturn NULL;\n\n\tif (align != Py_None) {\n\t\tif (PyObject_Not(align)) self->flags &= ~ALIGNED;\n\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot set aligned flag of mis-\"\\\n\t\t\t\t\t\"aligned array to True\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tif (uic != Py_None) {\n if (PyObject_IsTrue(uic)) {\n\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return NULL;\n }\n else {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n }\n \n if (write != Py_None) {\n if (PyObject_IsTrue(write)) \n\t\t\tif (_IsWriteable(self)) {\n\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tself->flags = flagback;\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"cannot set WRITEABLE \"\t\\\n\t\t\t\t\t\t\"flag to True of this \"\t\\\n\t\t\t\t\t\t\"array.\");\t\t\\\n\t\t\t\treturn NULL;\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n \n if (swap != Py_None) {\n if (PyObject_IsTrue(swap))\n self->flags &= ~NOTSWAPPED;\n else \n self->flags |= NOTSWAPPED;\n }\n Py_INCREF(Py_None);\n return Py_None;\n}\n\nstatic PyMethodDef array_methods[] = {\n {\"tolist\",\t (PyCFunction)array_tolist,\t1, doc_tolist},\n {\"toscalar\", (PyCFunction)array_toscalar, METH_VARARGS, doc_toscalar},\n\t{\"tofile\", (PyCFunction)array_tofile, \n METH_VARARGS | METH_KEYWORDS, doc_tofile},\n {\"tostring\", (PyCFunction)array_tostring, METH_VARARGS, doc_tostring},\n {\"byteswap\", (PyCFunction)array_byteswap,\t1, doc_byteswap},\n {\"astype\", (PyCFunction)array_cast, 1, doc_cast},\n\t{\"getfield\", (PyCFunction)array_getfield, \n\t METH_VARARGS | METH_KEYWORDS, doc_getfield},\n {\"copy\", (PyCFunction)array_copy, 1, doc_copy}, \n {\"resize\", (PyCFunction)array_resize, 1, doc_resize}, \n\n\t/* for subtypes */\n\t{\"__array__\", (PyCFunction)array_getarray, 1, doc_array_getarray},\n\t{\"__array_wrap__\", (PyCFunction)array_wraparray, 1, doc_wraparray},\n\t/* default version so it is found... -- only used for subclasses */\n\t{\"__array_finalize__\", (PyCFunction)array_finalize, 1, NULL},\n\t\n\t\n\t/* for the copy module */\n {\"__copy__\", (PyCFunction)array_copy, 1, doc_copy},\t \n {\"__deepcopy__\", (PyCFunction)array_deepcopy, 1, doc_deepcopy}, \n\t\n /* for Pickling */\n {\"__reduce__\", (PyCFunction) array_reduce, 1, doc_reduce},\t\n\t{\"__setstate__\", (PyCFunction) array_setstate, 1, doc_setstate},\n\t{\"dumps\", (PyCFunction) array_dumps, 1, doc_dumps},\n\t{\"dump\", (PyCFunction) array_dump, 1, doc_dump},\n\n\t/* Extended methods added 2005 */\n\t{\"transpose\",\t(PyCFunction)array_transpose, \n\t METH_VARARGS, doc_transpose},\n\t{\"take\",\t(PyCFunction)array_take, \n\t METH_VARARGS|METH_KEYWORDS, doc_take},\n\t{\"put\",\t(PyCFunction)array_put, \n\t METH_VARARGS|METH_KEYWORDS, doc_put},\n\t{\"putmask\",\t(PyCFunction)array_putmask, \n\t METH_VARARGS|METH_KEYWORDS, doc_putmask},\n\t{\"repeat\",\t(PyCFunction)array_repeat, \n\t METH_VARARGS|METH_KEYWORDS, doc_repeat},\n\t{\"choose\",\t(PyCFunction)array_choose, \n\t METH_VARARGS, doc_choose},\t\n\t{\"sort\",\t(PyCFunction)array_sort, \n\t METH_VARARGS, doc_sort},\n\t{\"argsort\",\t(PyCFunction)array_argsort, \n\t METH_VARARGS, doc_argsort},\n\t{\"searchsorted\", (PyCFunction)array_searchsorted, \n\t METH_VARARGS, doc_searchsorted},\t\n\t{\"argmax\",\t(PyCFunction)array_argmax, \n\t METH_VARARGS, doc_argmax},\n\t{\"argmin\", (PyCFunction)array_argmin,\n\t METH_VARARGS, doc_argmin},\n\t{\"reshape\",\t(PyCFunction)array_reshape, \n\t METH_VARARGS, doc_reshape},\n\t{\"squeeze\",\t(PyCFunction)array_squeeze,\n\t METH_VARARGS, doc_squeeze},\n\t{\"view\", (PyCFunction)array_view, \n\t METH_VARARGS, doc_view},\n\t{\"swapaxes\", (PyCFunction)array_swapaxes,\n\t METH_VARARGS, doc_swapaxes},\n\t{\"max\", (PyCFunction)array_max,\n\t METH_VARARGS, doc_max},\n\t{\"min\", (PyCFunction)array_min,\n\t METH_VARARGS, doc_min},\n\t{\"ptp\", (PyCFunction)array_ptp,\n\t METH_VARARGS, doc_ptp},\n\t{\"mean\", (PyCFunction)array_mean,\n\t METH_VARARGS|METH_KEYWORDS, doc_mean},\n\t{\"trace\", (PyCFunction)array_trace,\n\t METH_VARARGS|METH_KEYWORDS, doc_trace},\n\t{\"diagonal\", (PyCFunction)array_diagonal,\n\t METH_VARARGS|METH_KEYWORDS, doc_diagonal},\n\t{\"clip\", (PyCFunction)array_clip,\n\t METH_VARARGS|METH_KEYWORDS, doc_clip},\n\t{\"conj\", (PyCFunction)array_conjugate,\n\t METH_VARARGS, doc_conj},\n\t{\"conjugate\", (PyCFunction)array_conjugate,\n\t METH_VARARGS, doc_conjugate},\n\t{\"nonzero\", (PyCFunction)array_nonzero,\n\t METH_VARARGS, doc_nonzero},\n\t{\"std\", (PyCFunction)array_stddev,\n\t METH_VARARGS|METH_KEYWORDS, doc_stddev},\n\t{\"sum\", (PyCFunction)array_sum,\n\t METH_VARARGS|METH_KEYWORDS, doc_sum},\n\t{\"cumsum\", (PyCFunction)array_cumsum,\n\t METH_VARARGS|METH_KEYWORDS, doc_cumsum},\n\t{\"prod\", (PyCFunction)array_prod,\n\t METH_VARARGS|METH_KEYWORDS, doc_prod},\n\t{\"cumprod\", (PyCFunction)array_cumprod,\n\t METH_VARARGS|METH_KEYWORDS, doc_cumprod},\n\t{\"all\", (PyCFunction)array_all,\n\t METH_VARARGS, doc_all},\n\t{\"any\", (PyCFunction)array_any,\n\t METH_VARARGS, doc_any},\n\t{\"compress\", (PyCFunction)array_compress,\n\t METH_VARARGS|METH_KEYWORDS, doc_compress},\n\t{\"flatten\", (PyCFunction)array_flatten,\n\t METH_VARARGS, doc_flatten},\n\t{\"ravel\", (PyCFunction)array_ravel,\n\t METH_VARARGS, doc_ravel},\n\t{\"setflags\", (PyCFunction)array_setflags,\n\t METH_VARARGS|METH_KEYWORDS, doc_setflags},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n#undef _ARET\n\n\n", "methods": [ { "name": "array_take", "long_name": "array_take( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 12, "complexity": 2, "token_count": 82, "parameters": [ "self", "args", "kwds" ], "start_line": 7, "end_line": 20, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "array_put", "long_name": "array_put( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 9, "complexity": 2, "token_count": 71, "parameters": [ "self", "args", "kwds" ], "start_line": 27, "end_line": 36, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_putmask", "long_name": "array_putmask( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 9, "complexity": 2, "token_count": 71, "parameters": [ "self", "args", "kwds" ], "start_line": 42, "end_line": 52, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "_reverse_shape", "long_name": "_reverse_shape( PyArray_Dims * newshape)", "filename": "arraymethods.c", "nloc": 14, "complexity": 2, "token_count": 81, "parameters": [ "newshape" ], "start_line": 56, "end_line": 70, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_reshape", "long_name": "array_reshape( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 47, "complexity": 13, "token_count": 290, "parameters": [ "self", "args" ], "start_line": 78, "end_line": 127, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "array_squeeze", "long_name": "array_squeeze( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 2, "token_count": 34, "parameters": [ "self", "args" ], "start_line": 132, "end_line": 136, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_view", "long_name": "array_view( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 8, "complexity": 2, "token_count": 53, "parameters": [ "self", "args" ], "start_line": 143, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_argmax", "long_name": "array_argmax( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 156, "end_line": 164, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_argmin", "long_name": "array_argmin( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 169, "end_line": 177, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_max", "long_name": "array_max( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 182, "end_line": 190, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_ptp", "long_name": "array_ptp( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 195, "end_line": 203, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_min", "long_name": "array_min( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 209, "end_line": 217, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_swapaxes", "long_name": "array_swapaxes( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 6, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 223, "end_line": 230, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_GetField", "long_name": "PyArray_GetField( PyArrayObject * self , PyArray_Typecode * type , int offset)", "filename": "arraymethods.c", "nloc": 14, "complexity": 2, "token_count": 110, "parameters": [ "self", "type", "offset" ], "start_line": 238, "end_line": 251, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "array_getfield", "long_name": "array_getfield( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 15, "complexity": 3, "token_count": 110, "parameters": [ "self", "args", "kwds" ], "start_line": 254, "end_line": 271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Byteswap", "long_name": "PyArray_Byteswap( PyArrayObject * self , Bool inplace)", "filename": "arraymethods.c", "nloc": 41, "complexity": 7, "token_count": 247, "parameters": [ "self", "inplace" ], "start_line": 274, "end_line": 327, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 54, "top_nesting_level": 0 }, { "name": "array_byteswap", "long_name": "array_byteswap( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 334, "end_line": 342, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_tolist", "long_name": "array_tolist( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 10, "complexity": 3, "token_count": 51, "parameters": [ "self", "args" ], "start_line": 348, "end_line": 358, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_tostring", "long_name": "array_tostring( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 2, "token_count": 31, "parameters": [ "self", "args" ], "start_line": 364, "end_line": 368, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_tofile", "long_name": "array_tofile( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 33, "complexity": 7, "token_count": 206, "parameters": [ "self", "args", "kwds" ], "start_line": 373, "end_line": 407, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_toscalar", "long_name": "array_toscalar( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 4, "complexity": 2, "token_count": 39, "parameters": [ "self", "args" ], "start_line": 413, "end_line": 416, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_cast", "long_name": "array_cast( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 11, "complexity": 4, "token_count": 82, "parameters": [ "self", "args" ], "start_line": 423, "end_line": 435, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_wraparray", "long_name": "array_wraparray( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 25, "complexity": 4, "token_count": 140, "parameters": [ "self", "args" ], "start_line": 443, "end_line": 469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_finalize", "long_name": "array_finalize( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 1, "token_count": 20, "parameters": [ "self", "args" ], "start_line": 473, "end_line": 477, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_getarray", "long_name": "array_getarray( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 38, "complexity": 8, "token_count": 242, "parameters": [ "self", "args" ], "start_line": 483, "end_line": 526, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "array_copy", "long_name": "array_copy( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 2, "token_count": 34, "parameters": [ "self", "args" ], "start_line": 531, "end_line": 536, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "array_resize", "long_name": "array_resize( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 25, "complexity": 5, "token_count": 120, "parameters": [ "self", "args" ], "start_line": 544, "end_line": 569, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_repeat", "long_name": "array_repeat( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 9, "complexity": 2, "token_count": 75, "parameters": [ "self", "args", "kwds" ], "start_line": 574, "end_line": 584, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_choose", "long_name": "array_choose( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 14, "complexity": 3, "token_count": 68, "parameters": [ "self", "args" ], "start_line": 589, "end_line": 604, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_sort", "long_name": "array_sort( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 609, "end_line": 617, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_argsort", "long_name": "array_argsort( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 622, "end_line": 630, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_searchsorted", "long_name": "array_searchsorted( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 6, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 635, "end_line": 642, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_deepcopy", "long_name": "array_deepcopy( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 32, "complexity": 7, "token_count": 234, "parameters": [ "self", "args" ], "start_line": 647, "end_line": 680, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "_getobject_pkl", "long_name": "_getobject_pkl( PyArrayObject * self)", "filename": "arraymethods.c", "nloc": 18, "complexity": 4, "token_count": 128, "parameters": [ "self" ], "start_line": 684, "end_line": 703, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "_setobject_pkl", "long_name": "_setobject_pkl( PyArrayObject * self , PyObject * list)", "filename": "arraymethods.c", "nloc": 17, "complexity": 3, "token_count": 113, "parameters": [ "self", "list" ], "start_line": 706, "end_line": 724, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_reduce", "long_name": "array_reduce( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 45, "complexity": 8, "token_count": 301, "parameters": [ "self", "args" ], "start_line": 730, "end_line": 793, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "array_setstate", "long_name": "array_setstate( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 88, "complexity": 17, "token_count": 534, "parameters": [ "self", "args" ], "start_line": 808, "end_line": 913, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_Dump", "long_name": "PyArray_Dump( PyObject * self , PyObject * file , int protocol)", "filename": "arraymethods.c", "nloc": 20, "complexity": 6, "token_count": 132, "parameters": [ "self", "file", "protocol" ], "start_line": 916, "end_line": 937, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_Dumps", "long_name": "PyArray_Dumps( PyObject * self , int protocol)", "filename": "arraymethods.c", "nloc": 11, "complexity": 3, "token_count": 70, "parameters": [ "self", "protocol" ], "start_line": 940, "end_line": 951, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_dump", "long_name": "array_dump( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 11, "complexity": 3, "token_count": 69, "parameters": [ "self", "args" ], "start_line": 957, "end_line": 968, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_dumps", "long_name": "array_dumps( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 6, "complexity": 2, "token_count": 37, "parameters": [ "self", "args" ], "start_line": 973, "end_line": 978, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "array_transpose", "long_name": "array_transpose( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 9, "complexity": 3, "token_count": 65, "parameters": [ "self", "args" ], "start_line": 984, "end_line": 994, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_mean", "long_name": "array_mean( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 89, "parameters": [ "self", "args", "kwds" ], "start_line": 999, "end_line": 1011, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_sum", "long_name": "array_sum( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 86, "parameters": [ "self", "args", "kwds" ], "start_line": 1016, "end_line": 1028, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_cumsum", "long_name": "array_cumsum( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 86, "parameters": [ "self", "args", "kwds" ], "start_line": 1034, "end_line": 1046, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_prod", "long_name": "array_prod( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 86, "parameters": [ "self", "args", "kwds" ], "start_line": 1051, "end_line": 1063, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_cumprod", "long_name": "array_cumprod( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 86, "parameters": [ "self", "args", "kwds" ], "start_line": 1069, "end_line": 1081, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_any", "long_name": "array_any( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 1087, "end_line": 1095, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_all", "long_name": "array_all( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 1100, "end_line": 1108, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_stddev", "long_name": "array_stddev( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 86, "parameters": [ "self", "args", "kwds" ], "start_line": 1114, "end_line": 1126, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_compress", "long_name": "array_compress( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 10, "complexity": 2, "token_count": 78, "parameters": [ "self", "args", "kwds" ], "start_line": 1131, "end_line": 1142, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_nonzero", "long_name": "array_nonzero( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 2, "token_count": 34, "parameters": [ "self", "args" ], "start_line": 1148, "end_line": 1153, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "array_trace", "long_name": "array_trace( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 109, "parameters": [ "self", "args", "kwds" ], "start_line": 1159, "end_line": 1171, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_clip", "long_name": "array_clip( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 9, "complexity": 2, "token_count": 74, "parameters": [ "self", "args", "kwds" ], "start_line": 1177, "end_line": 1187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_conjugate", "long_name": "array_conjugate( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 2, "token_count": 31, "parameters": [ "self", "args" ], "start_line": 1194, "end_line": 1200, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_diagonal", "long_name": "array_diagonal( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 9, "complexity": 2, "token_count": 87, "parameters": [ "self", "args", "kwds" ], "start_line": 1206, "end_line": 1216, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_flatten", "long_name": "array_flatten( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 8, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 1221, "end_line": 1230, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_ravel", "long_name": "array_ravel( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 1235, "end_line": 1243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_setflags", "long_name": "array_setflags( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 60, "complexity": 12, "token_count": 299, "parameters": [ "self", "args", "kwds" ], "start_line": 1253, "end_line": 1317, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 65, "top_nesting_level": 0 } ], "methods_before": [ { "name": "array_take", "long_name": "array_take( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 12, "complexity": 2, "token_count": 82, "parameters": [ "self", "args", "kwds" ], "start_line": 7, "end_line": 20, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "array_put", "long_name": "array_put( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 9, "complexity": 2, "token_count": 71, "parameters": [ "self", "args", "kwds" ], "start_line": 27, "end_line": 36, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_putmask", "long_name": "array_putmask( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 9, "complexity": 2, "token_count": 71, "parameters": [ "self", "args", "kwds" ], "start_line": 42, "end_line": 52, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "_reverse_shape", "long_name": "_reverse_shape( PyArray_Dims * newshape)", "filename": "arraymethods.c", "nloc": 14, "complexity": 2, "token_count": 81, "parameters": [ "newshape" ], "start_line": 56, "end_line": 70, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_reshape", "long_name": "array_reshape( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 47, "complexity": 13, "token_count": 290, "parameters": [ "self", "args" ], "start_line": 78, "end_line": 127, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "array_squeeze", "long_name": "array_squeeze( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 2, "token_count": 34, "parameters": [ "self", "args" ], "start_line": 132, "end_line": 136, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_view", "long_name": "array_view( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 8, "complexity": 2, "token_count": 53, "parameters": [ "self", "args" ], "start_line": 143, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_argmax", "long_name": "array_argmax( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 156, "end_line": 164, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_argmin", "long_name": "array_argmin( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 169, "end_line": 177, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_max", "long_name": "array_max( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 182, "end_line": 190, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_ptp", "long_name": "array_ptp( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 195, "end_line": 203, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_min", "long_name": "array_min( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 209, "end_line": 217, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_swapaxes", "long_name": "array_swapaxes( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 6, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 223, "end_line": 230, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_GetField", "long_name": "PyArray_GetField( PyArrayObject * self , PyArray_Typecode * type , int offset)", "filename": "arraymethods.c", "nloc": 14, "complexity": 2, "token_count": 106, "parameters": [ "self", "type", "offset" ], "start_line": 238, "end_line": 251, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "array_getfield", "long_name": "array_getfield( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 15, "complexity": 3, "token_count": 110, "parameters": [ "self", "args", "kwds" ], "start_line": 254, "end_line": 271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Byteswap", "long_name": "PyArray_Byteswap( PyArrayObject * self , Bool inplace)", "filename": "arraymethods.c", "nloc": 41, "complexity": 7, "token_count": 247, "parameters": [ "self", "inplace" ], "start_line": 274, "end_line": 327, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 54, "top_nesting_level": 0 }, { "name": "array_byteswap", "long_name": "array_byteswap( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 334, "end_line": 342, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_tolist", "long_name": "array_tolist( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 10, "complexity": 3, "token_count": 51, "parameters": [ "self", "args" ], "start_line": 348, "end_line": 358, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_tostring", "long_name": "array_tostring( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 2, "token_count": 31, "parameters": [ "self", "args" ], "start_line": 364, "end_line": 368, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_tofile", "long_name": "array_tofile( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 33, "complexity": 7, "token_count": 206, "parameters": [ "self", "args", "kwds" ], "start_line": 373, "end_line": 407, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_toscalar", "long_name": "array_toscalar( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 4, "complexity": 2, "token_count": 39, "parameters": [ "self", "args" ], "start_line": 413, "end_line": 416, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_cast", "long_name": "array_cast( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 11, "complexity": 4, "token_count": 82, "parameters": [ "self", "args" ], "start_line": 423, "end_line": 435, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_wraparray", "long_name": "array_wraparray( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 25, "complexity": 4, "token_count": 140, "parameters": [ "self", "args" ], "start_line": 443, "end_line": 469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_finalize", "long_name": "array_finalize( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 1, "token_count": 20, "parameters": [ "self", "args" ], "start_line": 473, "end_line": 477, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_getarray", "long_name": "array_getarray( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 38, "complexity": 8, "token_count": 242, "parameters": [ "self", "args" ], "start_line": 483, "end_line": 526, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "array_copy", "long_name": "array_copy( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 2, "token_count": 34, "parameters": [ "self", "args" ], "start_line": 531, "end_line": 536, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "array_resize", "long_name": "array_resize( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 25, "complexity": 5, "token_count": 120, "parameters": [ "self", "args" ], "start_line": 544, "end_line": 569, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_repeat", "long_name": "array_repeat( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 9, "complexity": 2, "token_count": 75, "parameters": [ "self", "args", "kwds" ], "start_line": 574, "end_line": 584, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_choose", "long_name": "array_choose( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 14, "complexity": 3, "token_count": 68, "parameters": [ "self", "args" ], "start_line": 589, "end_line": 604, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_sort", "long_name": "array_sort( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 609, "end_line": 617, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_argsort", "long_name": "array_argsort( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 622, "end_line": 630, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_searchsorted", "long_name": "array_searchsorted( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 6, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 635, "end_line": 642, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_deepcopy", "long_name": "array_deepcopy( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 32, "complexity": 7, "token_count": 234, "parameters": [ "self", "args" ], "start_line": 647, "end_line": 680, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "_getobject_pkl", "long_name": "_getobject_pkl( PyArrayObject * self)", "filename": "arraymethods.c", "nloc": 18, "complexity": 4, "token_count": 128, "parameters": [ "self" ], "start_line": 684, "end_line": 703, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "_setobject_pkl", "long_name": "_setobject_pkl( PyArrayObject * self , PyObject * list)", "filename": "arraymethods.c", "nloc": 17, "complexity": 3, "token_count": 113, "parameters": [ "self", "list" ], "start_line": 706, "end_line": 724, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_reduce", "long_name": "array_reduce( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 45, "complexity": 8, "token_count": 301, "parameters": [ "self", "args" ], "start_line": 730, "end_line": 793, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "array_setstate", "long_name": "array_setstate( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 88, "complexity": 17, "token_count": 534, "parameters": [ "self", "args" ], "start_line": 808, "end_line": 913, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_Dump", "long_name": "PyArray_Dump( PyObject * self , PyObject * file , int protocol)", "filename": "arraymethods.c", "nloc": 20, "complexity": 6, "token_count": 132, "parameters": [ "self", "file", "protocol" ], "start_line": 916, "end_line": 937, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_Dumps", "long_name": "PyArray_Dumps( PyObject * self , int protocol)", "filename": "arraymethods.c", "nloc": 11, "complexity": 3, "token_count": 70, "parameters": [ "self", "protocol" ], "start_line": 940, "end_line": 951, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_dump", "long_name": "array_dump( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 11, "complexity": 3, "token_count": 69, "parameters": [ "self", "args" ], "start_line": 957, "end_line": 968, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_dumps", "long_name": "array_dumps( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 6, "complexity": 2, "token_count": 37, "parameters": [ "self", "args" ], "start_line": 973, "end_line": 978, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "array_transpose", "long_name": "array_transpose( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 9, "complexity": 3, "token_count": 65, "parameters": [ "self", "args" ], "start_line": 984, "end_line": 994, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_mean", "long_name": "array_mean( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 89, "parameters": [ "self", "args", "kwds" ], "start_line": 999, "end_line": 1011, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_sum", "long_name": "array_sum( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 86, "parameters": [ "self", "args", "kwds" ], "start_line": 1016, "end_line": 1028, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_cumsum", "long_name": "array_cumsum( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 86, "parameters": [ "self", "args", "kwds" ], "start_line": 1034, "end_line": 1046, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_prod", "long_name": "array_prod( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 86, "parameters": [ "self", "args", "kwds" ], "start_line": 1051, "end_line": 1063, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_cumprod", "long_name": "array_cumprod( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 86, "parameters": [ "self", "args", "kwds" ], "start_line": 1069, "end_line": 1081, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_any", "long_name": "array_any( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 1087, "end_line": 1095, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_all", "long_name": "array_all( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 43, "parameters": [ "self", "args" ], "start_line": 1100, "end_line": 1108, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_stddev", "long_name": "array_stddev( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 86, "parameters": [ "self", "args", "kwds" ], "start_line": 1114, "end_line": 1126, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_compress", "long_name": "array_compress( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 10, "complexity": 2, "token_count": 78, "parameters": [ "self", "args", "kwds" ], "start_line": 1131, "end_line": 1142, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_nonzero", "long_name": "array_nonzero( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 2, "token_count": 34, "parameters": [ "self", "args" ], "start_line": 1148, "end_line": 1153, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "array_trace", "long_name": "array_trace( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 11, "complexity": 2, "token_count": 109, "parameters": [ "self", "args", "kwds" ], "start_line": 1159, "end_line": 1171, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_clip", "long_name": "array_clip( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 9, "complexity": 2, "token_count": 74, "parameters": [ "self", "args", "kwds" ], "start_line": 1177, "end_line": 1187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_conjugate", "long_name": "array_conjugate( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 5, "complexity": 2, "token_count": 31, "parameters": [ "self", "args" ], "start_line": 1194, "end_line": 1200, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_diagonal", "long_name": "array_diagonal( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 9, "complexity": 2, "token_count": 87, "parameters": [ "self", "args", "kwds" ], "start_line": 1206, "end_line": 1216, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_flatten", "long_name": "array_flatten( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 8, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 1221, "end_line": 1230, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_ravel", "long_name": "array_ravel( PyArrayObject * self , PyObject * args)", "filename": "arraymethods.c", "nloc": 7, "complexity": 2, "token_count": 46, "parameters": [ "self", "args" ], "start_line": 1235, "end_line": 1243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_setflags", "long_name": "array_setflags( PyArrayObject * self , PyObject * args , PyObject * kwds)", "filename": "arraymethods.c", "nloc": 60, "complexity": 12, "token_count": 299, "parameters": [ "self", "args", "kwds" ], "start_line": 1253, "end_line": 1317, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 65, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "PyArray_GetField", "long_name": "PyArray_GetField( PyArrayObject * self , PyArray_Typecode * type , int offset)", "filename": "arraymethods.c", "nloc": 14, "complexity": 2, "token_count": 110, "parameters": [ "self", "type", "offset" ], "start_line": 238, "end_line": 251, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "nloc": 1118, "complexity": 200, "token_count": 7214, "diff_parsed": { "added": [ "\t\t\t type->itemsize, self->flags, (PyObject *)self);" ], "deleted": [ "\t\t\t type->itemsize, self->flags, self);" ] } }, { "old_path": "scipy/base/src/arrayobject.c", "new_path": "scipy/base/src/arrayobject.c", "filename": "arrayobject.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -175,8 +175,10 @@ PyArray_GetPriority(PyObject *obj, double default_)\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n \n-\tif (PyArray_CheckExact(obj) || PyBigArray_CheckExact(obj)) \n+\tif (PyArray_CheckExact(obj))\n \t\treturn priority;\n+ if (PyBigArray_CheckExact(obj)) \n+ return PyArray_BIG_PRIORITY;\n \n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n@@ -437,7 +439,7 @@ contiguous_data(PyArrayObject *src)\n \n \n static PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n- int, intp *, char *, int, int, PyArrayObject *);\n+ int, intp *, char *, int, int, PyObject *);\n \n /* C-API functions */\n \n@@ -748,7 +750,8 @@ PyArray_FromDimsAndData(int nd, int *d, int type, char *data)\n \t\t\t type, NULL, data, 0, \n \t\t\t CARRAY_FLAGS, NULL);\n #endif\n-\tif (type != PyArray_OBJECT) \n+\tif (type != PyArray_OBJECT && type != PyArray_OBJECTLTR) \n+ /* already done*/\n \t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n \treturn ret;\n }\n@@ -769,7 +772,7 @@ PyArray_FromDims(int nd, int *d, int type)\n \tret = PyArray_New(&PyArray_Type, nd, (intp *)d, type,\n \t\t\t NULL, NULL, 0, CARRAY_FLAGS, NULL);\n #endif\n-\tif (type != PyArray_OBJECT) \n+\tif (type != PyArray_OBJECT && type != PyArray_OBJECTLTR) \n \t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n \treturn ret;\n }\n@@ -785,7 +788,7 @@ PyArray_Copy(PyArrayObject *m1)\n \t\t\t\t\t m1->dimensions,\n \t\t\t\t\t m1->descr->type_num,\n \t\t\t\t\t NULL, NULL, m1->itemsize,\n-\t\t\t\t\t 0, m1);\n+\t\t\t\t\t 0, (PyObject *)m1);\n \t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n \t\n@@ -921,6 +924,10 @@ PyArray_RegisterDataType(PyTypeObject *type)\n \tdescr->typeobj = type;\n \tuserdescrs = realloc(userdescrs, \n \t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n+ if (userdescrs == NULL) {\n+ PyErr_SetString(PyExc_MemoryError, \"RegisterDataType\");\n+ return -1;\n+ }\n \tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n \treturn typenum;\n }\n@@ -1221,7 +1228,7 @@ array_item(PyArrayObject *self, int i)\n \t\t\t\t\t self->descr->type_num, \n \t\t\t\t\t self->strides+1, item, \n \t\t\t\t\t self->itemsize, self->flags,\n-\t\t\t\t\t self);\n+\t\t\t\t\t (PyObject *)self);\n \tif (r == NULL) return NULL;\n \tPy_INCREF(self);\n \tr->base = (PyObject *)self;\n@@ -1550,7 +1557,7 @@ PyArray_GetMap(PyArrayMapIterObject *mit)\n \t\t\t temp->descr->type_num, NULL, NULL, \n \t\t\t temp->itemsize, \n \t\t\t PyArray_ISFORTRAN(temp),\n-\t\t\t temp);\n+\t\t\t (PyObject *)temp);\n \tif (ret == NULL) return NULL;\n \n \t/* Now just iterate through the new array filling it in\n@@ -1726,7 +1733,7 @@ array_subscript(PyArrayObject *self, PyObject *op)\n \t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n \t\t\t strides, self->data+offset, \n \t\t\t self->itemsize, self->flags,\n-\t\t\t self)) == NULL) \n+\t\t\t (PyObject *)self)) == NULL) \n \t\treturn NULL;\n \n \n@@ -2571,7 +2578,7 @@ array_slice(PyArrayObject *self, int ilow, int ihigh)\n r = (PyArrayObject *)\\\n \t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n \t\t\t self->descr->type_num, self->strides, data,\n-\t\t\t self->itemsize, self->flags, self);\n+\t\t\t self->itemsize, self->flags, (PyObject *)self);\n \n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n@@ -3130,7 +3137,7 @@ _array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize,\n static PyObject *\n PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n-\t PyArrayObject *obj)\n+\t PyObject *obj)\n {\n \tPyArrayObject *self;\n \tPyArray_Descr *descr;\n@@ -3266,7 +3273,7 @@ PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n \t\tPyObject *res;\n \t\tres = PyObject_CallMethod((PyObject *)self, \n \t\t\t\t\t \"__array_finalize__\",\n-\t\t\t\t\t \"O\", (PyObject *)obj);\n+\t\t\t\t\t \"O\", obj);\n \t\tif (res == NULL) PyErr_Clear();\n \t\telse Py_DECREF(res);\n \t}\n@@ -3980,7 +3987,7 @@ array_real_get(PyArrayObject *self)\n \t\t\t\t\t\t self->strides,\n \t\t\t\t\t\t self->data,\n \t\t\t\t\t\t 0,\n-\t\t\t\t\t\t self->flags, self);\n+\t\t\t\t\t\t self->flags, (PyObject *)self);\n \t\tif (ret == NULL) return NULL;\n \t\tret->flags &= ~CONTIGUOUS;\n \t\tret->flags &= ~FORTRAN;\n@@ -4014,7 +4021,7 @@ array_real_set(PyArrayObject *self, PyObject *val)\n \t\t\t\t\t\t self->strides,\n \t\t\t\t\t\t self->data,\n \t\t\t\t\t\t 0,\n-\t\t\t\t\t\t self->flags, self);\n+\t\t\t\t\t\t self->flags, (PyObject *)self);\n \t\tif (ret == NULL) return -1;\n \t\tret->flags &= ~CONTIGUOUS;\n \t\tret->flags &= ~FORTRAN;\n@@ -4050,7 +4057,7 @@ array_imag_get(PyArrayObject *self)\n \t\t\t\t\t\t self->strides,\n \t\t\t\t\t\t self->data + itemsize,\n \t\t\t\t\t\t 0,\n-\t\t\t\t\t\t self->flags, self);\n+\t\t\t\t\t\t self->flags, (PyObject *)self);\n \t\tif (ret == NULL) return NULL;\n \t\tret->flags &= ~CONTIGUOUS;\n \t\tret->flags &= ~FORTRAN;\n@@ -4085,7 +4092,7 @@ array_imag_set(PyArrayObject *self, PyObject *val)\n \t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n \t\t\t\t\t\t 0,\n-\t\t\t\t\t\t self->flags, self);\n+\t\t\t\t\t\t self->flags, (PyObject *)self);\n \t\tif (ret == NULL) {\n \t\t\tPy_DECREF(new); \n \t\t\treturn -1;\n@@ -4856,7 +4863,7 @@ PyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at)\n \t\t\t mp->dimensions, \n \t\t\t at->type_num,\n \t\t\t NULL, NULL, at->itemsize, \n-\t\t\t at->fortran, mp);\n+\t\t\t at->fortran, (PyObject *)mp);\n \tif (out == NULL) return NULL;\n \tret = PyArray_CastTo((PyArrayObject *)out, mp);\n \tif (ret != -1) return out;\n@@ -4963,7 +4970,7 @@ array_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags)\n \t\t\t\t\t NULL, NULL, \n \t\t\t\t\t itemsize,\n \t\t\t\t\t flags & FORTRAN,\n-\t\t\t\t\t arr);\n+\t\t\t\t\t (PyObject *)arr);\n \t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n \t\t\tif (flags & UPDATEIFCOPY) {\n \t\t\t\tret->flags |= UPDATEIFCOPY;\n@@ -5682,7 +5689,7 @@ iter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n \titemsize = self->ao->itemsize;\n \tr = PyArray_New(self->ao->ob_type, 1, &count, \n \t\t\tself->ao->descr->type_num, NULL, NULL,\n-\t\t\titemsize, 0, self->ao);\n+\t\t\titemsize, 0, (PyObject *)self->ao);\n \tif (r==NULL) return NULL;\n \n \t/* Set up loop */\n@@ -5729,7 +5736,7 @@ iter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n \tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n \t\t\tself->ao->descr->type_num, NULL, \n \t\t\tNULL, self->ao->itemsize, \n-\t\t\t0, self->ao);\n+\t\t\t0, (PyObject *)self->ao);\n \tif (r==NULL) return NULL;\n \n \toptr = PyArray_DATA(r);\n@@ -5800,7 +5807,7 @@ iter_subscript(PyArrayIterObject *self, PyObject *ind)\n \t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n \t\t\t\t\tself->ao->descr->type_num, NULL, \n \t\t\t\t\tNULL, self->ao->itemsize, 0,\n-\t\t\t\t\tself->ao);\n+\t\t\t\t\t(PyObject *)self->ao);\n \t\t\treturn r;\t\t\t\n \t\t}\n \t}\n@@ -5827,7 +5834,7 @@ iter_subscript(PyArrayIterObject *self, PyObject *ind)\n \t\tsize = self->ao->itemsize;\n \t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n \t\t\t\tself->ao->descr->type_num, NULL, NULL,\n-\t\t\t\tsize, 0, self->ao);\n+\t\t\t\tsize, 0, (PyObject *)self->ao);\n \t\tif (r==NULL) goto fail; \n \t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n@@ -6122,13 +6129,14 @@ iter_array(PyArrayIterObject *it, PyObject *op)\n \t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n \t\t\t\tit->ao->flags,\n- it->ao); \n+ (PyObject *)it->ao); \n \t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n \t\t\t\tit->ao->descr->type_num,\n- NULL, NULL, it->ao->itemsize, 0, it->ao);\n+ NULL, NULL, it->ao->itemsize, 0, \n+ (PyObject *)it->ao);\n \t\tif (r==NULL) return NULL;\n \t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n \t\t\tPy_DECREF(r); \n", "added_lines": 31, "deleted_lines": 23, "source_code": " /*\n Provide multidimensional arrays as a basic object type in python. \n\nBased on Original Numeric implementation\nCopyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\nwith contributions from many Numeric Python developers 1995-2004 *\n\nHeavily modified in 2005 with inspiration from Numarray \n\nby\n\nTravis Oliphant\nAssistant Professor at\nBrigham Young University \n\nmaintainer email: oliphant.travis@ieee.org\n\nNumarray design (which provided guidance) by \nSpace Science Telescope Institute \n (J. Todd Miller, Perry Greenfield, Rick White)\n\n*/\n\n/* $Id: arrayobject.c,v 1.59 2005/09/14 00:14:00 teoliphant Exp $ */\n\n/*\n#include \"Python.h\"\n#include \"structmember.h\"\n\n#define _MULTIARRAYMODULE\n#include \"Numeric3/arrayobject.h\"\n*/\n\n/* Helper functions */\n\n#define error_converting(x) (((x) == -1) && PyErr_Occurred())\n\nstatic intp\nPyArray_PyIntAsIntp(PyObject *o)\n{\n\tlonglong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INTP, 0, 0};\n\tintp ret;\n\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((intp *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (longlong) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (longlong) PyLong_AsLongLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\t\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONGLONG != SIZEOF_PY_INTPTR_T)\n\tif ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C intp\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (intp) long_value;\n}\n\n\nstatic PyObject *array_int(PyArrayObject *v);\n\nstatic int\nPyArray_PyIntAsInt(PyObject *o)\n{\n\tlong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INT, 0, 0};\n\tint ret;\n\t\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((int *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (long) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (long) PyLong_AsLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONG != SIZEOF_INT)\n\tif ((long_value < INT_MIN) || (long_value > INT_MAX)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C int\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (int) long_value;\n}\n\n\nstatic double\nPyArray_GetPriority(PyObject *obj, double default_) \n{\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n\n\tif (PyArray_CheckExact(obj))\n\t\treturn priority;\n if (PyBigArray_CheckExact(obj)) \n return PyArray_BIG_PRIORITY;\n\n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n if (PyErr_Occurred()) {\n PyErr_Clear(); \n priority = default_;\n }\n Py_XDECREF(ret);\n return priority; \n}\n\n/* Backward compatibility only */\n/* In both Zero and One\n\n ***You must free the memory once you are done with it\n using PyDataMem_FREE(ptr) or you create a memory leak***\n\n If arr is an Object array you are getting a \n BORROWED reference to Zero or One.\n Do not DECREF.\n Please INCREF if you will be hanging on to it.\n\n The memory for the ptr still must be freed in any case;\n*/\n\nstatic char *\nPyArray_Zero(PyArrayObject *arr)\n{\n char *zeroval;\n char *buf;\n int buf_len;\n PyObject *obj, *ret;\n\n zeroval = PyDataMem_NEW(arr->itemsize);\n if (zeroval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n if (PyArray_ISOBJECT(arr)) {\n obj=PyInt_FromLong((long) 0);\n memcpy(zeroval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return zeroval;\n }\n ret = PyObject_GetAttrString((PyObject *)arr, \"_zero\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_zero not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n return NULL;\n }\n memcpy(zeroval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n memset(zeroval, 0, arr->itemsize);\n return zeroval;\n}\n\nstatic char *\nPyArray_One(PyArrayObject *arr)\n{\n char *oneval;\n char *buf;\n int buf_len, ret2;\n PyObject *obj, *ret;\n\n oneval = PyDataMem_NEW(arr->itemsize);\n if (oneval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n obj = PyInt_FromLong((long) 1);\n if (PyArray_ISOBJECT(arr)) {\n memcpy(oneval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return oneval;\n }\n \n ret = PyObject_GetAttrString((PyObject *)arr, \"_one\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_one not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n PyDataMem_FREE(oneval);\n return NULL;\n }\n memcpy(oneval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n\n ret2 = arr->descr->setitem(obj, oneval, arr);\n Py_DECREF(obj);\n if (ret < 0) {\n PyDataMem_FREE(oneval);\n return NULL;\n }\n return oneval;\n}\n\n/* End deprecated */\n\n\nstatic int \ndo_sliced_copy(char *dest, intp *dest_strides, intp *dest_dimensions,\n\t int dest_nd, char *src, intp *src_strides, \n\t intp *src_dimensions, int src_nd, int elsize, \n\t int copies) {\n intp i, j;\n\t\n if (src_nd == 0 && dest_nd == 0) {\n for(j=0; j src_nd) {\n for(i=0; i<*dest_dimensions; i++, dest += *dest_strides) {\n if (do_sliced_copy(dest, dest_strides+1, \n dest_dimensions+1, dest_nd-1,\n src, src_strides, \n src_dimensions, src_nd, \n elsize, copies) == -1) \n return -1;\n }\n return 0;\n }\n\t\n if (dest_nd == 1) {\n if (*dest_dimensions != *src_dimensions) {\n PyErr_SetString(PyExc_ValueError, \n \"matrices are not aligned for copy\");\n return -1;\n }\n for(i=0; i<*dest_dimensions; i++, src += *src_strides) {\n for(j=0; j 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize) && \n ((*src_strides)[*src_nd-1] == *elsize)) {\n if ((*dest_dimensions)[*dest_nd-1] != \n (*src_dimensions)[*src_nd-1]) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"matrices are not aligned\");\n return -1;\n }\n *elsize *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1; *src_nd-=1;\n } else {\n break;\n }\n }\n if (*src_nd == 0) {\n while (*dest_nd > 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize)) {\n *copies *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1;\n } else {\n break;\n }\n }\n }\n return 0;\n}\n\nstatic char *\ncontiguous_data(PyArrayObject *src) \n{\n intp dest_strides[MAX_DIMS], *dest_strides_ptr;\n intp *dest_dimensions=src->dimensions;\n int dest_nd=src->nd;\n intp *src_strides = src->strides;\n intp *src_dimensions=src->dimensions;\n int src_nd=src->nd;\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n intp stride=elsize;\n char *new_data;\n\t\n for(i=dest_nd-1; i>=0; i--) {\n dest_strides[i] = stride;\n stride *= dest_dimensions[i];\n }\n\t\n dest_strides_ptr = dest_strides;\n\t\n if (optimize_slices(&dest_strides_ptr, &dest_dimensions, &dest_nd,\n &src_strides, &src_dimensions, &src_nd,\n &elsize, &copies) == -1) \n return NULL;\n\t\n new_data = (char *)malloc(stride);\n\t\n ret = do_sliced_copy(new_data, dest_strides_ptr, dest_dimensions, \n dest_nd, src->data, src_strides, \n src_dimensions, src_nd, elsize, copies);\n\t\n if (ret != -1) { return new_data; }\n else { free(new_data); return NULL; }\n}\n\n/* end Helper functions */\n\n\nstatic PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n int, intp *, char *, int, int, PyObject *);\n\n/* C-API functions */\n\n/* Used for arrays of python objects to increment the reference count of */\n/* every python object in the array. */\nstatic int \nPyArray_INCREF(PyArrayObject *mp) \n{\n\tintp i, n;\n\n PyObject **data, **data2;\n\t\n if (mp->descr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data;\n for(i=0; idescr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data; \n for(i=0; i 0; n--, a += 1) {\n b = a + 1;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 4:\n for (a = (char*)p ; n > 0; n--, a += 2) {\n b = a + 3;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 8:\n for (a = (char*)p ; n > 0; n--, a += 4) {\n b = a + 7;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n default:\n m = size / 2;\n for (a = (char *)p ; n > 0; n--, a += m) {\n b = a + (size-1);\n for (j=0; j 1, then dst must be contiguous */\nstatic void\ncopy_and_swap(void *dst, void *src, int itemsize, intp numitems,\n intp srcstrides, int swap) \n{\n int i;\n char *s1 = (char *)src;\n char *d1 = (char *)dst;\n \n\n if ((numitems == 1) || (itemsize == srcstrides)) \n memcpy(d1, s1, itemsize*numitems);\n else { \n for (i = 0; i < numitems; i++) {\n memcpy(d1, s1, itemsize);\n d1 += itemsize;\n s1 += srcstrides;\n } \n }\n\n if (swap)\n byte_swap_vector(d1, numitems, itemsize);\n}\n\n\n/* Computer-generated arraytype and scalartype code */\n#include \"scalartypes.inc\"\n#include \"arraytypes.inc\"\n\nstatic char *\nindex2ptr(PyArrayObject *mp, int i) \n{\n\tif (i==0 && (mp->nd == 0 || mp->dimensions[0] > 0)) \n\t\treturn mp->data;\n\t\n if (mp->nd>0 && i>0 && i < mp->dimensions[0]) {\n return mp->data+i*mp->strides[0];\n }\n PyErr_SetString(PyExc_IndexError,\"index out of bounds\");\n return NULL;\n}\n\nstatic intp \nPyArray_Size(PyObject *op) \n{\n if (PyArray_Check(op)) {\n return PyArray_SIZE((PyArrayObject *)op);\n } \n\telse {\n return 0;\n }\n}\n\n/* If destination is not the right type, then src \n will be cast to destination. \n*/\n\n/* Does a flat iterator-based copy. \n\n The arrays are assumed to have the same number of elements\n They can be different sizes and have different types however. \n*/\n\nstatic int\nPyArray_CopyInto(PyArrayObject *dest, PyArrayObject *src)\n{\n intp dsize, ssize, sbytes;\n\tint ncopies, elsize, index;\n PyArrayIterObject *dit=NULL;\n PyArrayIterObject *sit=NULL;\n\tchar *dptr;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n PyArray_CopySwapNFunc *copyswapn;\n \n if (!PyArray_ISWRITEABLE(dest)) {\n PyErr_SetString(PyExc_RuntimeError, \n \"Cannot write to array.\");\n return -1;\n }\n\n if (!PyArray_EquivArrTypes(dest, src)) {\n return PyArray_CastTo(dest, src);\n }\n\n dsize = PyArray_SIZE(dest);\n ssize = PyArray_SIZE(src);\n\tif (ssize == 0) return 0;\n if (dsize % ssize != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Destination number of elements must be\"\\\n \"an integer multiple of the source number of\"\\\n \"elements.\");\n return -1;\n }\n ncopies = dsize / ssize;\n\n\tswap = PyArray_ISNOTSWAPPED(dest) != PyArray_ISNOTSWAPPED(src);\n\tcopyswap = dest->descr->copyswap;\n\tcopyswapn = dest->descr->copyswapn;\n\n elsize = dest->itemsize;\n\n if ((PyArray_ISCONTIGUOUS(dest) && PyArray_ISCONTIGUOUS(src)) \\\n\t || (PyArray_ISFORTRAN(dest) && PyArray_ISFORTRAN(src))) {\n \n PyArray_XDECREF(dest);\n dptr = dest->data;\n sbytes = ssize * src->itemsize;\n while(ncopies--) {\n memmove(dptr, src->data, sbytes);\n dptr += sbytes;\n }\n\t\tif (swap)\n\t\t\tcopyswapn(dest->data, NULL, dsize, 1, elsize);\n PyArray_INCREF(dest);\n return 0;\n }\n\n dit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)dest);\n sit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)src);\n\n if ((dit == NULL) || (sit == NULL)) {\n Py_XDECREF(dit);\n Py_XDECREF(sit);\n return -1;\n }\n\n PyArray_XDECREF(dest);\n while(ncopies--) {\n index = ssize;\n while(index--) {\n memmove(dit->dataptr, sit->dataptr, elsize);\n\t\t\tif (swap)\n\t\t\t\tcopyswap(dit->dataptr, NULL, 1, elsize);\n PyArray_ITER_NEXT(dit);\n PyArray_ITER_NEXT(sit);\n }\n PyArray_ITER_RESET(sit);\n } \n PyArray_INCREF(dest);\n Py_DECREF(dit);\n Py_DECREF(sit);\n\treturn 0;\n}\n\n\nstatic int \nPyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) \n{\n PyArrayObject *src;\n int ret;\n\tPyArray_Typecode typecode = {dest->descr->type_num, \n\t\t\t\t dest->itemsize, \n\t\t\t\t PyArray_ISFORTRAN(dest)};\n\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n\t\t\t\t\t &typecode, 0,\n\t\t\t\t\t dest->nd, 0);\n if (src == NULL) return -1;\n\n ret = PyArray_CopyInto(dest, src);\n Py_DECREF(src);\n return ret;\n}\n\n\n/* These are also old calls (should use PyArray_New) */\n\n/* They all zero-out the memory as previously done */\n\nstatic PyObject *\nPyArray_FromDimsAndDataAndDescr(int nd, int *d, \n PyArray_Descr *descr,\n char *data) {\n\tPyObject *ret;\n\n#if SIZEOF_INTP != SIZEOF_INT\n\tint i;\n\tintp newd[MAX_DIMS];\n\t\n\tfor (i=0; itype_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#else\n\tret = PyArray_New(&PyArray_Type, nd, (intp *)d, \n descr->type_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#endif\n\tif (descr->type_num != PyArray_OBJECT)\n\t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_FromDimsAndData(int nd, int *d, int type, char *data) \n{\n\tPyObject *ret;\n#if SIZEOF_INTP != SIZEOF_INT\n\tintp newd[MAX_DIMS];\n\tint i;\t\n\tfor (i=0; iob_type, m1->nd, \n\t\t\t\t\t m1->dimensions,\n\t\t\t\t\t m1->descr->type_num,\n\t\t\t\t\t NULL, NULL, m1->itemsize,\n\t\t\t\t\t 0, (PyObject *)m1);\n\t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n\t\n return (PyObject *)ret;\n}\n\n\nstatic PyObject *array_item(PyArrayObject *, int);\n\nstatic PyObject *\nPyArray_Scalar(char *data, int type_num, int itemsize, int swap)\n{\n PyArray_Descr *descr;\n\tPyTypeObject *type;\n\tPyObject *obj;\t\n\tchar *destptr;\n PyArray_CopySwapFunc *copyswap;\n\n descr = PyArray_DescrFromType(type_num);\n if (descr == NULL) return NULL;\n type = descr->typeobj;\n copyswap = descr->copyswap;\n\tif (type_num == PyArray_STRING) \n\t\tobj = type->tp_alloc(type, itemsize);\n\telse\n\t\tobj = type->tp_alloc(type, 0);\n\tif (obj == NULL) return NULL;\n\tif PyTypeNum_ISFLEXIBLE(type_num) { \n\t\tif (type_num == PyArray_STRING) {\n\t\t\tdestptr = PyString_AS_STRING(obj);\n\t\t\t((PyStringObject *)obj)->ob_shash = -1;\n\t\t\t((PyStringObject *)obj)->ob_sstate =\t\\\n\t\t\t\tSSTATE_NOT_INTERNED; \n\t\t}\n\t\telse {\n\t\t\tdestptr = PyDataMem_NEW(itemsize);\n\t\t\tif (destptr == NULL) {\n\t\t\t\tPyObject_Del(obj);\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tif (type_num == PyArray_UNICODE) {\n\t\t\t\tPyUnicode_AS_UNICODE(obj) = \\\n\t\t\t\t\t(Py_UNICODE *)destptr;\n\t\t\t\t((PyUnicodeObject*)obj)->length = itemsize / \\\n\t\t\t\t\tsizeof(Py_UNICODE);\n\t\t\t\t((PyUnicodeObject*)obj)->hash = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t((PyVoidScalarObject *)obj)->obval = destptr;\n\t\t\t\t((PyVoidScalarObject *)obj)->ob_size = itemsize;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tdestptr = &(((PyScalarObject*)obj)->obval);\n\t}\n\t/* copyswap for OBJECT increments the reference count */\n copyswap(destptr, data, swap, itemsize);\n\treturn obj;\n}\n\n/* returns an Array-Scalar Object of the type of arr\n from the given pointer to memory -- main Scalar creation function\n default new method calls this. \n*/\nstatic PyObject *\nPyArray_ToScalar(char *data, PyArrayObject *arr)\n{\n\tint type_num = arr->descr->type_num;\n\tint itemsize = arr->itemsize;\n int swap = !(PyArray_ISNOTSWAPPED(arr));\n\n\treturn PyArray_Scalar(data, type_num, itemsize, swap);\n}\n\n\n/* Return Python scalar if 0-d array object is encountered */\n\nstatic PyObject *\nPyArray_Return(PyArrayObject *mp) \n{\n \n\tif (mp == NULL) return NULL;\n\n if (PyErr_Occurred()) {\n Py_XDECREF(mp);\n return NULL;\n }\n\n\tif (PyArray_Check((PyObject *)mp) && mp->nd == 0) {\n\t\tPyObject *ret;\n\t\tret = PyArray_ToScalar(mp->data, mp);\n\t\tPy_DECREF(mp);\n\t\treturn ret;\n\t}\n\telse {\n\t\treturn (PyObject *)mp;\n\t}\n}\n\n/*\n returns typenum to associate with this type >=PyArray_USERDEF.\n Also creates a copy of the VOID_DESCR table inserting it's typeobject in\n and it's typenum in the appropriate place.\n \n needs the userdecrs table and PyArray_NUMUSER variables\n defined in arratypes.inc\n*/\nstatic int \nPyArray_RegisterDataType(PyTypeObject *type)\n{\n\tPyArray_Descr *descr;\n\tint typenum;\n\tint i;\n\t\n\tif ((type == &PyVoidArrType_Type) ||\t\t\t\\\n\t !PyType_IsSubtype(type, &PyVoidArrType_Type)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can only register void subtypes.\");\n\t\treturn -1;\n\t}\n\t/* See if this type is already registered */\n\tfor (i=0; itypeobj == type)\n\t\t\treturn descr->type_num;\n\t}\n\tdescr = malloc(sizeof(PyArray_Descr));\n\tmemcpy(descr, PyArray_DescrFromType(PyArray_VOID), \n\t sizeof(PyArray_Descr));\n\ttypenum = PyArray_USERDEF + PyArray_NUMUSERTYPES;\n\tdescr->type_num = typenum;\n\tdescr->typeobj = type;\n\tuserdescrs = realloc(userdescrs, \n\t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n if (userdescrs == NULL) {\n PyErr_SetString(PyExc_MemoryError, \"RegisterDataType\");\n return -1;\n }\n\tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n\treturn typenum;\n}\n\n\n/* \n copyies over from the old descr table for anything\n NULL or zero in what is given. \n frees the copy of the Descr_table already there.\n places a pointer to the new one into the slot.\n*/\nstatic int\nPyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n{\n\tPyArray_Descr *old;\n\tint i;\n\n\tif (!PyArray_ISUSERDEF(typenum)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Data type not registered.\");\n\t\treturn -1;\n\t}\n\told = userdescrs[typenum-PyArray_USERDEF];\n\tdescr->typeobj = old->typeobj;\n\tdescr->type_num = typenum;\n\n#define _NULL_CHECK(member) \\\n\tif (descr->member == NULL) descr->member = old->member\n\n\tfor (i=0; imember == 0) descr->member = old->member\n\n\t_ZERO_CHECK(kind);\n\t_ZERO_CHECK(type);\n\t_ZERO_CHECK(elsize);\n\t_ZERO_CHECK(alignment);\n#undef _ZERO_CHECK\n\n\tfree(old);\n\tuserdescrs[typenum-PyArray_USERDEF] = descr;\n\treturn 0;\n}\n\n\nstatic int\nPyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) \n{\n intp size;\n intp n, n2;\n int n3, n4;\n PyArrayIterObject *it;\n PyObject *obj, *strobj, *tupobj;\n\n n3 = strlen((const char *)sep);\n if (n3 == 0) { /* binary data */\n if (PyArray_ISOBJECT(self)) {\n PyErr_SetString(PyExc_ValueError, \"Cannot write \"\\\n\t\t\t\t\t\"object arrays to a file in \"\\\n\t\t\t\t\t\"binary mode.\");\n return -1;\n }\n\n if (PyArray_ISCONTIGUOUS(self)) {\n size = PyArray_SIZE(self);\n if ((n=fwrite((const void *)self->data, \n (size_t) self->itemsize,\n (size_t) size, fp)) < size) {\n PyErr_Format(PyExc_ValueError, \n \"%ld requested and %ld written\",\n (long) size, (long) n);\n return -1;\n }\n }\n else {\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n while(it->index < it->size) {\n if (fwrite((const void *)it->dataptr, \n (size_t) self->itemsize,\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n \" %d to file\", it->index);\n Py_DECREF(it);\n return -1;\n }\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n } \n }\n else { /* text data */\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n\t\tn4 = strlen((const char *)format);\n while(it->index < it->size) {\n obj = self->descr->getitem(it->dataptr, self);\n if (obj == NULL) {Py_DECREF(it); return -1;}\n\t\t\tif (n4 == 0) { /* standard writing */\n\t\t\t\tstrobj = PyObject_Str(obj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n\t\t\telse { /* use format string */\n\t\t\t\ttupobj = PyTuple_New(1);\n\t\t\t\tif (tupobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t\tPyTuple_SET_ITEM(tupobj,0,obj);\n\t\t\t\tobj = PyString_FromString((const char *)format);\n\t\t\t\tif (obj == NULL) {Py_DECREF(tupobj); \n\t\t\t\t\tPy_DECREF(it); return -1;}\n\t\t\t\tstrobj = PyString_Format(obj, tupobj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tPy_DECREF(tupobj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n if ((n=fwrite(PyString_AS_STRING(strobj), \n 1, n2=PyString_GET_SIZE(strobj),\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n \" to file\", it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n }\n /* write separator for all but last one */\n if (it->index != it->size-1) \n fwrite(sep, 1, n3, fp);\n Py_DECREF(strobj);\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n return 0;\n}\n\nstatic PyObject *\nPyArray_ToList(PyArrayObject *self) \n{\n PyObject *lp;\n PyArrayObject *v;\n intp sz, i;\n\t\n if (!PyArray_Check(self)) return (PyObject *)self;\n\n if (self->nd == 0) \n\t\treturn self->descr->getitem(self->data,self);\n\t\n sz = self->dimensions[0];\n lp = PyList_New(sz);\n\t\n for (i=0; ind >= self->nd) {\n\t\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\t\"array_item not returning smaller\" \\\n\t\t\t\t\t\" dimensional array\");\n\t\t\tPy_DECREF(lp);\n\t\t\treturn NULL;\n\t\t}\n PyList_SetItem(lp, i, PyArray_ToList(v));\n\t\tPy_DECREF(v);\n }\n\t\n return lp;\n}\n\nstatic PyObject *\nPyArray_ToString(PyArrayObject *self)\n{\n intp numbytes;\n intp index;\n char *dptr;\n int elsize;\n PyObject *ret;\n PyArrayIterObject *it;\n \n if (PyArray_TYPE(self) == PyArray_OBJECT) {\n PyErr_SetString(PyExc_ValueError, \"a string for the data\"\\\n\t\t\t\t\"in an object array is not appropriate.\");\n return NULL;\n }\n\n numbytes = PyArray_NBYTES(self);\n if (PyArray_ISONESEGMENT(self)) {\n ret = PyString_FromStringAndSize(self->data, (int) numbytes);\n }\n else {\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it==NULL) return NULL;\n ret = PyString_FromStringAndSize(NULL, (int) numbytes);\n if (ret == NULL) {Py_DECREF(it); return NULL;}\n dptr = PyString_AS_STRING(ret);\n index = it->size;\n elsize = self->itemsize;\n while(index--) {\n memcpy(dptr, it->dataptr, elsize);\n dptr += elsize;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n\treturn ret;\n}\n\n\n/*********************** end C-API functions **********************/\n\n\n/* array object functions */\n\nstatic void \narray_dealloc(PyArrayObject *self) {\n\n if (self->weakreflist != NULL)\n PyObject_ClearWeakRefs((PyObject *)self);\n\n if(self->base) {\n\t\t/* UPDATEIFCOPY means that base points to an \n\t\t array that should be updated with the contents\n\t\t of this array upon destruction.\n self->base->flags must have been WRITEABLE \n (checked previously) and it was locked here\n thus, unlock it.\n\t\t*/\n\t\tif (self->flags & UPDATEIFCOPY) {\n ((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tPy_INCREF(self); /* hold on to self in next call */\n PyArray_CopyInto((PyArrayObject *)self->base, self);\n\t\t\t/* Don't need to DECREF -- because we are deleting\n\t\t\t self already... */\n\t\t}\n\t\t/* In any case base is pointing to something that we need\n\t\t to DECREF -- either a view or a buffer object */\n Py_DECREF(self->base);\n }\n \n if ((self->flags & OWN_DATA) && (self->data != NULL)) {\n\t\t/* Free internal references if an Object array */\n\t\tPyArray_XDECREF(self);\n\n PyDataMem_FREE(self->data);\n }\n\t\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t}\n\t\n self->ob_type->tp_free((PyObject *)self);\n}\n\n/*************************************************************************\n **************** Implement Mapping Protocol ***************************\n *************************************************************************/\n\nstatic int \narray_length(PyArrayObject *self) \n{\n if (self->nd != 0) {\n return self->dimensions[0];\n } else {\n\t\tPyErr_SetString(PyExc_TypeError, \"len() of unsized object.\");\n\t\treturn -1;\n }\n}\n\n\nstatic PyObject *\narray_item(PyArrayObject *self, int i) \n{\n char *item;\n PyArrayObject *r;\n\n\n\tif(self->nd == 0) {\n\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\"0-d arrays can't be indexed.\");\n\t\treturn NULL;\n\t}\n if ((item = index2ptr(self, i)) == NULL) return NULL;\n\n\tr = (PyArrayObject *)PyArray_New(self->ob_type, \n\t\t\t\t\t self->nd-1, self->dimensions+1, \n\t\t\t\t\t self->descr->type_num, \n\t\t\t\t\t self->strides+1, item, \n\t\t\t\t\t self->itemsize, self->flags,\n\t\t\t\t\t (PyObject *)self);\n\tif (r == NULL) return NULL;\n\tPy_INCREF(self);\n\tr->base = (PyObject *)self;\n PyArray_UpdateFlags(r, CONTIGUOUS | FORTRAN);\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_item_nice(PyArrayObject *self, int i) \n{\n\treturn PyArray_Return((PyArrayObject *)array_item(self, i));\n}\n\n\nstatic int \narray_ass_item(PyArrayObject *self, int i, PyObject *v) \n{\n PyArrayObject *tmp;\n char *item;\n int ret;\n\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n if (i < 0) i = i+self->dimensions[0];\n\n if (self->nd > 1) {\n if((tmp = (PyArrayObject *)array_item(self, i)) == NULL)\n return -1;\n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n return ret; \n }\n\t\n if ((item = index2ptr(self, i)) == NULL) return -1;\n if (self->descr->setitem(v, item, self) == -1) return -1;\n return 0;\n}\n\n/* -------------------------------------------------------------- */\nstatic int\nslice_coerce_index(PyObject *o, int *v)\n{\n\t*v = PyArray_PyIntAsInt(o);\n\tif (error_converting(*v)) {\n\t\tPyErr_Clear();\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\n/* This is basically PySlice_GetIndicesEx, but with our coercion\n * of indices to integers (plus, that function is new in Python 2.3) */\nstatic int\nslice_GetIndices(PySliceObject *r, int length,\n int *start, int *stop, int *step,\n intp *slicelength)\n{\n\tint defstart, defstop;\n\t\n\tif (r->step == Py_None) {\n\t\t*step = 1;\n\t} else {\n\t\tif (!slice_coerce_index(r->step, step)) return -1;\n\t\tif (*step == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"slice step can not be zero\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tdefstart = *step < 0 ? length - 1 : 0;\n\tdefstop = *step < 0 ? -1 : length;\n\t\n\tif (r->start == Py_None) {\n\t\t*start = *step < 0 ? length-1 : 0;\n\t} else {\n\t\tif (!slice_coerce_index(r->start, start)) return -1;\n\t\tif (*start < 0) *start += length;\n\t\tif (*start < 0) *start = (*step < 0) ? -1 : 0;\n\t\tif (*start >= length) {\n\t\t\t*start = (*step < 0) ? length - 1 : length;\n\t\t}\n\t}\n\t\n\tif (r->stop == Py_None) {\n\t\t*stop = defstop;\n\t} else {\n\t\tif (!slice_coerce_index(r->stop, stop)) return -1;\n\t\tif (*stop < 0) *stop += length;\n if (*stop < 0) *stop = -1;\n if (*stop > length) *stop = length;\n\t}\n\t\n\tif ((*step < 0 && *stop >= *start) || \\\n\t (*step > 0 && *start >= *stop)) {\n\t\t*slicelength = 0;\n\t} else if (*step < 0) {\n\t\t*slicelength = (*stop - *start + 1) / (*step) + 1;\n\t} else {\n\t\t*slicelength = (*stop - *start - 1) / (*step) + 1;\n\t}\n\t\n\treturn 0;\n}\n\n#define PseudoIndex -1\n#define RubberIndex -2\n#define SingleIndex -3\n\nstatic int\nparse_subindex(PyObject *op, int *step_size, intp *n_steps, int max)\n{\n\tint index;\n\t\n\tif (op == Py_None) {\n\t\t*n_steps = PseudoIndex;\n\t\tindex = 0;\n\t} else if (op == Py_Ellipsis) {\n\t\t*n_steps = RubberIndex;\n\t\tindex = 0;\n\t} else if (PySlice_Check(op)) {\n\t\tint stop;\n\t\tif (slice_GetIndices((PySliceObject *)op, max,\n\t\t\t\t &index, &stop, step_size, n_steps) < 0) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"invalid slice\");\n\t\t\t}\n\t\t\tgoto fail;\n\t\t}\n\t\tif (*n_steps <= 0) {\n\t\t\t*n_steps = 0;\n\t\t\t*step_size = 1;\n\t\t\tindex = 0;\n\t\t}\n\t} else {\n\t\tindex = PyArray_PyIntAsInt(op);\n\t\tif (error_converting(index)) {\n\t\t\tPyErr_SetString(PyExc_IndexError,\n\t\t\t\t\t\"each subindex must be either a \"\\\n\t\t\t\t\t\"slice, an integer, Ellipsis, or \"\\\n\t\t\t\t\t\"newaxis\");\n\t\t\tgoto fail;\n\t\t}\n\t\t*n_steps = SingleIndex;\n\t\t*step_size = 0;\n\t\tif (index < 0) index += max;\n\t\tif (index >= max || index < 0) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \"invalid index\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn index;\n fail:\n\treturn -1;\n}\n\n\nstatic int \nparse_index(PyArrayObject *self, PyObject *op, \n intp *dimensions, intp *strides, intp *offset_ptr)\n{\n int i, j, n;\n int nd_old, nd_new, start, offset, n_add, n_pseudo;\n int step_size;\n\tintp n_steps;\n PyObject *op1=NULL;\n int is_slice;\n\n\n if (PySlice_Check(op) || op == Py_Ellipsis || op == Py_None) {\n n = 1;\n op1 = op;\n Py_INCREF(op);\t\n /* this relies on the fact that n==1 for loop below */\n is_slice = 1;\n }\n else {\n if (!PySequence_Check(op)) {\n PyErr_SetString(PyExc_IndexError, \n \"index must be either an int \"\\\n \"or a sequence\");\n return -1;\n }\n n = PySequence_Length(op);\n is_slice = 0;\n }\n\t\n nd_old = nd_new = 0;\n\t\n offset = 0;\n for(i=0; ind ? \\\n self->dimensions[nd_old] : 0);\n Py_DECREF(op1);\n if (start == -1) break;\n\t\t\n if (n_steps == PseudoIndex) {\n dimensions[nd_new] = 1; strides[nd_new] = 0; nd_new++;\n } else {\n if (n_steps == RubberIndex) {\n for(j=i+1, n_pseudo=0; jnd-(n-i-n_pseudo-1+nd_old);\n if (n_add < 0) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = \\\n self->strides[nd_old];\n nd_new++; nd_old++;\n }\n } else {\n if (nd_old >= self->nd) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n offset += self->strides[nd_old]*start;\n nd_old++;\n if (n_steps != SingleIndex) {\n dimensions[nd_new] = n_steps;\n strides[nd_new] = step_size * \\\n self->strides[nd_old-1];\n nd_new++;\n }\n }\n }\n }\n if (i < n) return -1;\n n_add = self->nd-nd_old;\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = self->strides[nd_old];\n nd_new++; nd_old++;\n }\t \n *offset_ptr = offset;\n return nd_new;\n}\n\nstatic void\n_swap_axes(PyArrayMapIterObject *mit, PyArrayObject **ret)\n{\n\tPyObject *new, *tup;\n\tint n1, n2, n3, val;\n\tint i;\n\n\ttup = PyTuple_New(mit->nd);\n\t/* tuple for transpose is \n\t (n1,..,n1+n2-1,0,..,n1-1,n1+n2,...,n3-1)\n\t n1 is the number of dimensions of \n\t the broadcasted index array \n\t n2 is the number of dimensions skipped at the\n\t start\n\t n3 is the number of dimensions of the \n\t result \n\t*/\n\tn1 = mit->iters[0]->nd_m1 + 1;\n\tn2 = mit->iteraxes[0];\n\tn3 = mit->nd;\n\tval = n1;\n\ti = 0;\n\twhile(val < n1+n2) \n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = 0;\n\twhile(val < n1)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = n1+n2;\n\twhile(val < n3)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\n\tnew = PyArray_Transpose(*ret, tup);\n\tPy_DECREF(tup);\n\tPy_DECREF(*ret);\n\t*ret = (PyArrayObject *)new;\n}\n\n\n\nstatic PyObject *\nPyArray_GetMap(PyArrayMapIterObject *mit)\n{\n\n\tPyArrayObject *ret, *temp;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\t/* Unbound map iterator --- Bind should have been called */\n\tif (mit->ait == NULL) return NULL;\n\n\t/* This relies on the map iterator object telling us the shape\n\t of the new array in nd and dimensions.\n\t*/\n\ttemp = mit->ait->ao;\n\tret = (PyArrayObject *)\\\n\t\tPyArray_New(temp->ob_type, mit->nd, mit->dimensions, \n\t\t\t temp->descr->type_num, NULL, NULL, \n\t\t\t temp->itemsize, \n\t\t\t PyArray_ISFORTRAN(temp),\n\t\t\t (PyObject *)temp);\n\tif (ret == NULL) return NULL;\n\n\t/* Now just iterate through the new array filling it in\n\t with the next object from the original array as\n\t defined by the mapping iterator */\n\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ret)) \n\t == NULL) \n\t\treturn NULL;\n\tindex = it->size;\n\tswap = ((temp->flags & NOTSWAPPED) != (ret->flags & NOTSWAPPED));\n copyswap = ret->descr->copyswap;\n\tPyArray_MapIterReset(mit);\n\twhile (index--) {\n copyswap(it->dataptr, mit->dataptr, swap, ret->itemsize);\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\t\n\t/* check for consecutive axes */\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, &ret);\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\nstatic int\nPyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)\n{\n\tPyObject *arr=NULL;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n\tPyArray_Typecode typecode = {0, 0, 0};\n PyArray_CopySwapFunc *copyswap;\n\n\t/* Unbound Map Iterator */\n\tif (mit->ait == NULL) return -1;\n\n\ttypecode.type_num = mit->ait->ao->descr->type_num;\n\ttypecode.itemsize = mit->ait->ao->itemsize;\n\n\tarr = PyArray_FromAny(op, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, (PyArrayObject **)&arr);\n\t\t}\n\t}\n\t\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) \n\t\treturn -1;\n\n\tindex = mit->size;\n\tswap = ((mit->ait->ao->flags & NOTSWAPPED) != \\\n\t\t(PyArray_FLAGS(arr) & NOTSWAPPED));\n\n copyswap = PyArray_DESCR(arr)->copyswap;\n\tPyArray_MapIterReset(mit);\n /* Need to decref OBJECT arrays */\n if (PyTypeNum_ISOBJECT(typecode.type_num)) {\n while (index--) {\n Py_XDECREF(*((PyObject **)mit->dataptr));\n Py_INCREF(*((PyObject **)it->dataptr));\n memmove(mit->dataptr, it->dataptr, sizeof(PyObject *));\n copyswap(mit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_MapIterNext(mit);\n PyArray_ITER_NEXT(it);\n if (it->index == it->size)\n PyArray_ITER_RESET(it);\n }\n return 0;\n }\n\n\twhile(index--) {\n\t\tmemmove(mit->dataptr, it->dataptr, PyArray_ITEMSIZE(arr));\n copyswap(mit->dataptr, NULL, swap, PyArray_ITEMSIZE(arr));\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t\tif (it->index == it->size)\n\t\t\tPyArray_ITER_RESET(it);\n\t}\t\t\n\treturn 0;\n}\n\n/* Called when treating array object like a mapping -- called first from \n Python when using a[object] unless object is a standard slice object\n (not an extended one). \n\n*/\n\n/* There are two situations: \n\n 1 - the subscript is a standard view and a reference to the \n array can be returned\n\n 2 - the subscript uses Boolean masks or integer indexing and\n therefore a new array is created and returned. \n\n*/\n\n/* Always returns 0-dimensional arrays */\n\nstatic PyObject *\narray_subscript(PyArrayObject *self, PyObject *op) \n{\n intp dimensions[MAX_DIMS], strides[MAX_DIMS];\n\tintp offset;\n int nd, i;\n PyArrayObject *other;\n\tPyArrayMapIterObject *mit;\n\n if (PyArray_IsScalar(op, Integer) || PyInt_Check(op) || \\\n PyLong_Check(op)) {\n intp value;\n value = PyArray_PyIntAsIntp(op);\n if (PyErr_Occurred())\n PyErr_Clear();\n else if (value >= 0) {\n if (value <= MAX_INT)\n return array_item(self, (int) value);\n }\n else if (value < 0) {\n if (value >= -MAX_INT) {\n if (self->nd > 0) value += self->dimensions[0];\n return array_item(self, (int) value);\n }\n }\n }\n\n\tif (PyArrayMapIter_Check(op)) {\n\t\tmit = (PyArrayMapIterObject *)op;\n\t\t/* bind to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\n\t\t/* If the mapiterator was created with standard indexing\n\t\t behavior, fall through to view-based code */\n\t\tif (!mit->view) return PyArray_GetMap(mit);\n\t\top = mit->indexobj;\n\t}\n\telse { /* wrap arguments into a mapiter object */\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(op);\n\t\tif (mit == NULL) return NULL;\n\t\tif (!mit->view) { /* fancy indexing */\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tother = (PyArrayObject *)PyArray_GetMap(mit);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn (PyObject *)other;\n\t\t}\n\t\tPy_DECREF(mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(op);\n\tif (!error_converting(i)) {\n\t\tif (i < 0 && self->nd > 0) i = i+self->dimensions[0];\n\t\treturn array_item(self, i);\n\t}\n\tPyErr_Clear();\n\n\t/* Standard (view-based) Indexing */\n if ((nd = parse_index(self, op, dimensions, strides, &offset)) \n == -1) \n return NULL;\n\n\t/* This will only work if new array will be a view */\n\tif ((other = (PyArrayObject *)\t\t\t\t\t\\\n\t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n\t\t\t strides, self->data+offset, \n\t\t\t self->itemsize, self->flags,\n\t\t\t (PyObject *)self)) == NULL) \n\t\treturn NULL;\n\n\n\tother->base = (PyObject *)self;\n\tPy_INCREF(self);\n\t\n\tPyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);\n\t\n\treturn (PyObject *)other;\n}\n\n\n/* Another assignment hacked by using CopyObject. */\n\n/* This only works if subscript returns a standard view. */\n\n/* Again there are two cases. In the first case, PyArray_CopyObject\n can be used. In the second case, a new indexing function has to be \n used.\n*/\n\nstatic int \narray_ass_sub(PyArrayObject *self, PyObject *index, PyObject *op) \n{\n int ret, i;\n PyArrayObject *tmp;\n\tPyArrayMapIterObject *mit;\n\t\n if (op == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n\tif (PyArrayMapIter_Check(index)) {\n\t\tmit = (PyArrayMapIterObject *)index;\n\t\t/* bind behavior to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\t\n\t\t/* fall through if standard view-based map iterator */\n\t\tif (!mit->view) return PyArray_SetMap(mit, op);\n\t\tindex = mit->indexobj;\n\t}\n\telse {\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(index);\n\t\tif (mit == NULL) return -1;\n\t\tif (!mit->view) {\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tret = PyArray_SetMap(mit, op);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn ret;\n\t\t}\n\t\tPy_DECREF((PyObject*)mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(index);\n\tif (!error_converting(i)) {\n\t\treturn array_ass_item(self, i, op);\n\t}\n\tPyErr_Clear();\n\t\n\t/* Rest of standard (view-based) indexing */\n\n if ((tmp = (PyArrayObject *)array_subscript(self, index)) == NULL)\n return -1; \n ret = PyArray_CopyObject(tmp, op);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\n/* There are places that require that array_subscript return a PyArrayObject\n and not possibly a scalar. Thus, this is the function exposed to \n Python so that 0-dim arrays are passed as scalars\n*/\n\nstatic PyObject *\narray_subscript_nice(PyArrayObject *self, PyObject *op) \n{\n\treturn PyArray_Return((PyArrayObject *)array_subscript(self, op));\n}\n\n\nstatic PyMappingMethods array_as_mapping = {\n (inquiry)array_length,\t\t /*mp_length*/\n (binaryfunc)array_subscript_nice,\t/*mp_subscript*/\n (objobjargproc)array_ass_sub,\t /*mp_ass_subscript*/\n};\n\n/****************** End of Mapping Protocol ******************************/\n\n\n/*************************************************************************\n **************** Implement Buffer Protocol ****************************\n *************************************************************************/\n\n/* removed multiple segment interface */\n\nstatic int \narray_getsegcount(PyArrayObject *self, int *lenp) \n{\n if (lenp)\n *lenp = PyArray_NBYTES(self);\n\n if (PyArray_ISONESEGMENT(self)) {\n return 1;\n }\n\n if (lenp)\n *lenp = 0;\n return 0;\n}\n\nstatic int \narray_getreadbuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (segment != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Accessing non-existing array segment\");\n return -1;\n }\n \n if (PyArray_ISONESEGMENT(self)) {\n *ptrptr = self->data;\n return PyArray_NBYTES(self);\n }\n PyErr_SetString(PyExc_ValueError, \"Array is not a single segment\");\n *ptrptr = NULL;\n return -1;\n}\n\n\nstatic int \narray_getwritebuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (PyArray_CHKFLAGS(self, WRITEABLE)) \n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_ValueError, \"Array cannot be \"\\\n \"accessed as a writeable buffer.\");\n return -1;\n }\n}\n\nstatic int \narray_getcharbuf(PyArrayObject *self, int segment, const char **ptrptr) \n{\n if (self->descr->type_num == PyArray_STRING || \\\n\t self->descr->type_num == PyArray_UNICODE)\n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_TypeError, \n \"Non-character array cannot be interpreted \"\\\n \"as character buffer.\");\n return -1;\n }\n}\n\nstatic PyBufferProcs array_as_buffer = {\n (getreadbufferproc)array_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)array_getwritebuf, /*bf_getwritebuffer*/\n (getsegcountproc)array_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)array_getcharbuf, /*bf_getcharbuffer*/\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Number Protocol ****************************\n *************************************************************************/\n\n\ntypedef struct {\n PyObject *add,\n *subtract,\n *multiply,\n *divide,\n *remainder,\n *power,\n\t\t*sqrt,\n *negative,\n *absolute,\n *invert,\n *left_shift,\n *right_shift,\n *bitwise_and,\n *bitwise_xor,\n *bitwise_or,\n *less,\n *less_equal,\n *equal,\n *not_equal,\n *greater,\n *greater_equal,\n *floor_divide,\n *TRUE_divide,\n\t\t*logical_or,\n\t\t*logical_and,\n\t\t*floor,\n\t\t*ceil,\n\t\t*maximum,\n\t\t*minimum;\t\n\t\n} NumericOps;\n\nstatic NumericOps n_ops = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL};\n\n/* Dictionary can contain any of the numeric operations, by name. \n Those not present will not be changed\n */\n\n#define SET(op) temp=PyDict_GetItemString(dict, #op);\t\\\n\tif (temp != NULL) {\t\t\t\t\\\n\t\tif (!(PyCallable_Check(temp))) return -1; \\\n Py_XDECREF(n_ops.op); \\\n\t\tn_ops.op = temp; \\\n\t}\n\n \nint \nPyArray_SetNumericOps(PyObject *dict) \n{\n PyObject *temp = NULL;\n SET(add);\n SET(subtract);\n SET(multiply);\n SET(divide);\n SET(remainder);\n SET(power);\n\tSET(sqrt);\n SET(negative);\n SET(absolute);\n SET(invert);\n SET(left_shift);\n SET(right_shift);\n SET(bitwise_and);\n SET(bitwise_or);\n SET(bitwise_xor);\n SET(less);\t \n SET(less_equal);\n SET(equal);\n SET(not_equal);\n SET(greater);\n SET(greater_equal);\n SET(floor_divide);\t\n SET(TRUE_divide);\t\n\tSET(logical_or);\n\tSET(logical_and);\n\tSET(floor);\n\tSET(ceil);\n\tSET(maximum);\n\tSET(minimum);\n return 0;\n}\n\n#define GET(op) if (PyDict_SetItemString(dict, #op, n_ops.op)==-1) \\\n\t\tgoto fail;\n\nstatic PyObject *\nPyArray_GetNumericOps(void) \n{\n\tPyObject *dict;\n\tif ((dict = PyDict_New())==NULL) \n\t\treturn NULL;\t\n\tGET(add);\n GET(subtract);\n GET(multiply);\n GET(divide);\n GET(remainder);\n GET(power);\n\tGET(sqrt);\n GET(negative);\n GET(absolute);\n GET(invert);\n GET(left_shift);\n GET(right_shift);\n GET(bitwise_and);\n GET(bitwise_or);\n GET(bitwise_xor);\n GET(less);\t \n GET(less_equal);\n GET(equal);\n GET(not_equal);\n GET(greater);\n GET(greater_equal);\n GET(floor_divide); \n GET(TRUE_divide); \n\tGET(logical_or);\n\tGET(logical_and);\n\tGET(floor);\n\tGET(ceil);\n\tGET(maximum);\n\tGET(minimum);\n\treturn dict;\t\n\n fail:\n\tPy_DECREF(dict);\n\treturn NULL;\t\t\n}\n\nstatic PyObject *\nPyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"reduce\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"accumulate\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OO)\", m1, m2);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(O)\", m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericInplaceBinaryFunction(PyArrayObject *m1, \n\t\t\t\t PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OOO)\", m1, m2, m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\narray_add(PyArrayObject *m1, PyObject *m2) \n{ \n return PyArray_GenericBinaryFunction(m1, m2, n_ops.add); \n}\n\nstatic PyObject *\narray_subtract(PyArrayObject *m1, PyObject *m2) \n{\n\treturn PyArray_GenericBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_negative(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.negative);\n}\n\nstatic PyObject *\narray_absolute(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.absolute);\n}\n\nstatic PyObject *\narray_invert(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.invert);\n}\n\nstatic PyObject *\narray_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_inplace_add(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.add);\n}\n\nstatic PyObject *\narray_inplace_subtract(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_inplace_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_inplace_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_inplace_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_inplace_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_inplace_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_inplace_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_inplace_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_inplace_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_inplace_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.TRUE_divide);\n}\n\nstatic PyObject *\narray_inplace_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_inplace_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.TRUE_divide);\n}\n\n/* Array evaluates as \"TRUE\" if any of the elements are non-zero */\nstatic int \narray_all_nonzero(PyArrayObject *mp) \n{\n\tintp index;\n\tPyArrayIterObject *it;\n\tBool anyTRUE = 0;\n\t\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)mp);\n\tif (it==NULL) return anyTRUE;\n\tindex = it->size;\n\twhile(index--) {\n\t\tif (mp->descr->nonzero(it->dataptr, mp)) {\n\t\t\tanyTRUE = 1;\n\t\t\tbreak;\n\t\t}\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\treturn anyTRUE;\n}\n\nstatic PyObject *\narray_divmod(PyArrayObject *op1, PyObject *op2) \n{\n PyObject *divp, *modp, *result;\n\n divp = array_divide(op1, op2);\n if (divp == NULL) return NULL;\n modp = array_remainder(op1, op2);\n if (modp == NULL) {\n Py_DECREF(divp);\n return NULL;\n }\n result = Py_BuildValue(\"OO\", divp, modp);\n Py_DECREF(divp);\n Py_DECREF(modp);\n return result;\n}\n\n\nstatic PyObject *\narray_int(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can be\"\\\n\t\t\t\t\" converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_int == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to int\");\n Py_DECREF(pv);\n return NULL;\n }\n\n pv2 = pv->ob_type->tp_as_number->nb_int(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_float(PyArrayObject *v) \n{\n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an \"\\\n\t\t\t\t\"int, scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_float == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to float\");\n Py_DECREF(pv);\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_float(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_long(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_long == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to long\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_long(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_oct(PyArrayObject *v) \n{\t \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_oct == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to oct\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_oct(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_hex(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_hex == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to hex\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_hex(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\n_array_copy_nice(PyArrayObject *self)\n{\n\treturn PyArray_Return((PyArrayObject *)\t\t\\\n\t\t\t PyArray_Copy(self));\n}\n\nstatic PyNumberMethods array_as_number = {\n (binaryfunc)array_add,\t\t /*nb_add*/\n (binaryfunc)array_subtract,\t\t /*nb_subtract*/\n (binaryfunc)array_multiply,\t\t /*nb_multiply*/\n (binaryfunc)array_divide,\t\t /*nb_divide*/\n (binaryfunc)array_remainder,\t /*nb_remainder*/\n (binaryfunc)array_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)array_power,\t\t /*nb_power*/\n (unaryfunc)array_negative, /*nb_neg*/\t\n (unaryfunc)_array_copy_nice,\t\t /*nb_pos*/ \n (unaryfunc)array_absolute,\t\t /*(unaryfunc)array_abs,*/\n (inquiry)array_all_nonzero,\t\t /*nb_nonzero*/\n (unaryfunc)array_invert,\t\t /*nb_invert*/\n (binaryfunc)array_left_shift,\t /*nb_lshift*/\n (binaryfunc)array_right_shift,\t /*nb_rshift*/\n (binaryfunc)array_bitwise_and,\t /*nb_and*/\n (binaryfunc)array_bitwise_xor,\t /*nb_xor*/\n (binaryfunc)array_bitwise_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)array_int,\t\t /*nb_int*/\n (unaryfunc)array_long,\t\t /*nb_long*/\n (unaryfunc)array_float,\t\t /*nb_float*/\n (unaryfunc)array_oct,\t\t /*nb_oct*/\n (unaryfunc)array_hex,\t\t /*nb_hex*/\n\n /*This code adds augmented assignment functionality*/\n /*that was made available in Python 2.0*/\n (binaryfunc)array_inplace_add,\t /*inplace_add*/\n (binaryfunc)array_inplace_subtract,\t /*inplace_subtract*/\n (binaryfunc)array_inplace_multiply,\t /*inplace_multiply*/\n (binaryfunc)array_inplace_divide,\t /*inplace_divide*/\n (binaryfunc)array_inplace_remainder, /*inplace_remainder*/\n (ternaryfunc)array_inplace_power,\t /*inplace_power*/\n (binaryfunc)array_inplace_left_shift, /*inplace_lshift*/\n (binaryfunc)array_inplace_right_shift, /*inplace_rshift*/\n (binaryfunc)array_inplace_bitwise_and, /*inplace_and*/\n (binaryfunc)array_inplace_bitwise_xor, /*inplace_xor*/\n (binaryfunc)array_inplace_bitwise_or, /*inplace_or*/\n\n (binaryfunc)array_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)array_TRUE_divide,\t /*nb_TRUE_divide*/\n (binaryfunc)array_inplace_floor_divide, /*nb_inplace_floor_divide*/\n (binaryfunc)array_inplace_TRUE_divide, /*nb_inplace_TRUE_divide*/\n\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Sequence Protocol **************************\n *************************************************************************/\n\n/* Some of this is repeated in the array_as_mapping protocol. But\n we fill it in here so that PySequence_XXXX calls work as expected \n*/\n\n\nstatic PyObject * \narray_slice(PyArrayObject *self, int ilow, int ihigh) \n{\n PyArrayObject *r;\n int l;\n char *data;\n\n if (self->nd == 0) {\n PyErr_SetString(PyExc_ValueError, \"can't slice a scalar\");\n return NULL;\n }\n \t\n l=self->dimensions[0];\n if (ihigh < 0) ihigh += l;\n if (ilow < 0) ilow += l;\n if (ilow < 0) ilow = 0;\n else if (ilow > l) ilow = l;\n if (ihigh < 0) ihigh = 0;\n else if (ihigh > l) ihigh = l;\n if (ihigh < ilow) ihigh = ilow;\n\n if (ihigh != ilow) {\n data = index2ptr(self, ilow);\n if (data == NULL) return NULL;\n } else {\n data = self->data;\n }\n\n self->dimensions[0] = ihigh-ilow;\n r = (PyArrayObject *)\\\n\t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n\t\t\t self->descr->type_num, self->strides, data,\n\t\t\t self->itemsize, self->flags, (PyObject *)self);\n\n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n Py_INCREF(self);\n\tPyArray_UpdateFlags(r, UPDATE_ALL_FLAGS); \n return (PyObject *)r;\n}\n\n\nstatic int \narray_ass_slice(PyArrayObject *self, int ilow, int ihigh, PyObject *v) {\n int ret;\n PyArrayObject *tmp;\n\t\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n if ((tmp = (PyArrayObject *)array_slice(self, ilow, ihigh)) \\\n == NULL) \n return -1; \n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\nstatic int\narray_contains(PyArrayObject *self, PyObject *el)\n{\n /* equivalent to any(self == el) */\n\n return PyObject_RichCompareBool((PyObject *)self, el, Py_EQ);\n}\n\n\nstatic PySequenceMethods array_as_sequence = {\n (inquiry)array_length,\t\t/*sq_length*/\n (binaryfunc)NULL, /* sq_concat is handled by nb_add*/\n (intargfunc)NULL, /* sq_repeat is handled nb_multiply*/\n (intargfunc)array_item_nice,\t\t/*sq_item*/\n (intintargfunc)array_slice,\t\t/*sq_slice*/\n (intobjargproc)array_ass_item,\t/*sq_ass_item*/\n (intintobjargproc)array_ass_slice,\t/*sq_ass_slice*/\n\t(objobjproc) array_contains, /* sq_contains */\n\t(binaryfunc) NULL, /* sg_inplace_concat */\n\t(intargfunc) NULL /* sg_inplace_repeat */\n};\n\n\n/****************** End of Sequence Protocol ****************************/\n\n\nstatic int \ndump_data(char **string, int *n, int *max_n, char *data, int nd, \n intp *dimensions, intp *strides, PyArrayObject* self) \n{\n PyArray_Descr *descr=self->descr;\n PyObject *op, *sp;\n char *ostring;\n int i, N;\n\t\n#define CHECK_MEMORY if (*n >= *max_n-16) { *max_n *= 2; \\\n\t\t*string = (char *)realloc(*string, *max_n); }\n\t\n if (nd == 0) {\n\t\t\n if ((op = descr->getitem(data, self)) == NULL) return -1;\n sp = PyObject_Repr(op);\n if (sp == NULL) {Py_DECREF(op); return -1;}\n ostring = PyString_AsString(sp);\n N = PyString_Size(sp)*sizeof(char);\n *n += N;\n CHECK_MEMORY\n memmove(*string+(*n-N), ostring, N);\n Py_DECREF(sp);\n Py_DECREF(op);\n return 0;\n } else {\n CHECK_MEMORY\n (*string)[*n] = '[';\n *n += 1;\n for(i=0; idata, \n\t\t self->nd, self->dimensions, \n self->strides, self) < 0) { \n\t\tfree(string); return NULL; \n\t}\n\t\n\tif (PyArray_ISFLEXIBLE(self)) {\n\t\tchar buf[100];\n\t\tsnprintf(buf, sizeof(buf), \"%d\", self->itemsize);\n\t\tsprintf(string+n, \", '%c%s')\", self->descr->type, buf);\n\t\tret = PyString_FromStringAndSize(string, n+6+strlen(buf));\n\t}\n\telse {\n\t\tsprintf(string+n, \", '%c')\", self->descr->type);\n\t\tret = PyString_FromStringAndSize(string, n+6);\n\t}\n\t\n\n free(string);\n return ret;\n}\n\nstatic PyObject *PyArray_StrFunction=NULL;\nstatic PyObject *PyArray_ReprFunction=NULL;\n\nstatic void \nPyArray_SetStringFunction(PyObject *op, int repr) \n{\n if (repr) {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_ReprFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_ReprFunction = op; \n } else {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_StrFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_StrFunction = op; \n }\n}\n\nstatic PyObject *\narray_repr(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_ReprFunction == NULL) {\n s = array_repr_builtin(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_ReprFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\nstatic PyObject *\narray_str(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_StrFunction == NULL) {\n s = array_repr(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_StrFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\n\nstatic PyObject *\narray_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) \n{\n PyObject *array_other, *result;\n\n switch (cmp_op) \n {\n case Py_LT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less);\n case Py_LE:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less_equal);\n case Py_EQ:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then return the integer\n\t\t\t object 0. This fixes code that used to\n\t\t\t allow equality comparisons between arrays\n\t\t\t and other objects which would give a result\n\t\t\t of 0\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.equal);\n /* If the comparison results in NULL, then the \n\t\t\t two array objects can not be compared together so \n\t\t\t return zero \n */\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n return result;\n case Py_NE:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then objects cannot be \n\t\t\t compared and cannot be equal, therefore, \n\t\t\t return True;\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.not_equal);\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n return result;\n case Py_GT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.greater);\n case Py_GE:\n return PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t other, \n\t\t\t\t\t \t n_ops.greater_equal);\n }\n return NULL;\n}\n\nstatic PyObject *\n_check_axis(PyArrayObject *arr, int *axis, int flags)\n{\n\tPyObject *temp;\n\tint n = arr->nd;\n\n\tif ((*axis >= MAX_DIMS) || (n==0)) {\n\t\ttemp = PyArray_Ravel(arr,0);\n\t\t*axis = 0;\n\t\treturn temp;\n\t}\n\telse {\n\t\tif (flags) {\n\t\t\ttemp = PyArray_FromAny((PyObject *)arr, NULL, \n\t\t\t\t\t 0, 0, flags);\n\t\t\tif (temp == NULL) return NULL;\n\t\t}\n\t\telse {\n\t\t\tPy_INCREF(arr);\n\t\t\ttemp = (PyObject *)arr;\n\t\t}\n\t}\n\tif (*axis < 0) *axis += n;\n\tif ((*axis < 0) || (*axis >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"axis(=%d) out of bounds\", *axis);\n\t\tPy_DECREF(temp);\n\t\treturn NULL;\n\t}\n\treturn temp;\n}\n\n#include \"arraymethods.c\"\n\n/* Lifted from numarray */\nstatic PyObject *\nPyArray_IntTupleFromIntp(int len, intp *vals)\n{\n\tint i;\n PyObject *intTuple = PyTuple_New(len);\n if (!intTuple) goto fail;\n for(i=0; ind == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i = ap->nd-1; i >= 0; --i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int \n_IsFortranContiguous(PyArrayObject *ap) \n{\n\tint sd;\n\tint i;\n\t\n\tif (ap->nd == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i=0; i< ap->nd; ++i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int\n_IsAligned(PyArrayObject *ap) \n{\n\tint i, alignment, aligned=1;\n\tintp ptr;\n\tint type = ap->descr->type_num;\n\n\tif ((type == PyArray_STRING) || (type == PyArray_VOID))\n\t\treturn 1;\n\n\talignment = ap->descr->alignment;\n\n\tptr = (intp) ap->data;\n aligned = (ptr % alignment) == 0;\n for (i=0; i nd; i++)\n aligned &= ((ap->strides[i] % alignment) == 0);\n return aligned != 0;\n}\n\nstatic Bool\n_IsWriteable(PyArrayObject *ap)\n{\n\tPyObject *base=ap->base;\n\tPyBufferProcs *pb;\n\n\t/* If we own our own data, then no-problem */\n\tif ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;\n\n\t/* Get to the final base object \n\t If it is a writeable array, then return TRUE\n\t If we can find an array object \n\t or a writeable buffer object as the final base object\n\t or a string object (for pickling support memory savings).\n\t - this last could be removed if a proper pickleable \n\t buffer was added to Python.\n\t*/\n\n\twhile(PyArray_Check(base)) {\n\t\tif (PyArray_CHKFLAGS(base, OWN_DATA)) \n\t\t\treturn (Bool) (PyArray_ISWRITEABLE(base));\n\t\tbase = PyArray_BASE(base);\n\t}\n\n\t/* here so pickle support works seamlessly \n\t and unpickled array can be set and reset writeable \n\t -- could be abused -- */\n\tif PyString_Check(base) return TRUE;\n\n\tpb = base->ob_type->tp_as_buffer;\n\tif (pb == NULL || pb->bf_getwritebuffer == NULL)\n\t\treturn FALSE;\n\t\n\treturn TRUE;\n}\n\n\nstatic void\nPyArray_UpdateFlags(PyArrayObject *ret, int flagmask)\n{\n\n\tif (flagmask & FORTRAN) {\n\t\tif (_IsFortranContiguous(ret)) {\n\t\t\tret->flags |= FORTRAN;\n\t\t\tif (ret->nd > 1) ret->flags &= ~CONTIGUOUS;\n\t\t}\n\t\telse ret->flags &= ~FORTRAN;\n\t}\n\tif (flagmask & CONTIGUOUS) {\n\t\tif (_IsContiguous(ret)) {\n\t\t\tret->flags |= CONTIGUOUS;\n\t\t\tif (ret->nd > 1) ret->flags &= ~FORTRAN;\n\t\t}\n\t\telse ret->flags &= ~CONTIGUOUS;\n\t}\n\tif (flagmask & ALIGNED) {\n\t\tif (_IsAligned(ret)) ret->flags |= ALIGNED;\n\t\telse ret->flags &= ~ALIGNED;\n\t}\n\treturn;\n}\n\n/* This routine checks to see if newstrides (of length nd) will not \n walk outside of the memory implied by either numbytes or\n a single segment array of the provided dimensions and element size if\n numbytes is 0 */\nstatic Bool\nPyArray_CheckStrides(int elsize, int nd, intp numbytes, \n\t\t intp *dims, intp *newstrides)\n{\n\tint i;\n\t\n\tif (numbytes == 0) \n\t\tnumbytes = PyArray_MultiplyList(dims, nd) * elsize;\n\t\n\tfor (i=0; i numbytes) {\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\treturn TRUE;\n\t\n}\n\n\n/* This is the main array creation routine. */\n\n/* Flags argument has multiple related meanings \n depending on data and strides: \n\n If data is given, then flags is flags associated with data. \n If strides is not given, then a contiguous strides array will be created\n and the CONTIGUOUS bit will be set. If the flags argument \n has the FORTRAN bit set, then a FORTRAN-style strides array will be\n created (and of course the FORTRAN flag bit will be set). \n\n If data is not given but created here, then flags will be DEFAULT_FLAGS\n and a non-zero flags argument can be used to indicate a FORTRAN style\n array is desired. \n*/\n\nstatic intp\n_array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize, \n\t\t int inflag, int *objflags) \n{\n\tint i;\n\t/* Only make Fortran strides if not contiguous as well */\n\tif ((inflag & FORTRAN) && !(inflag & CONTIGUOUS)) {\n\t\tfor (i=0; i 1) *objflags &= ~CONTIGUOUS;\n\t\telse *objflags |= CONTIGUOUS;\n\t}\n\telse {\n\t\tfor (i=nd-1;i>=0;i--) {\n\t\t\tstrides[i] = itemsize;\n\t\t\titemsize *= dims[i] ? dims[i] : 1;\n\t\t}\n\t\t*objflags |= CONTIGUOUS;\n\t\tif (nd > 1) *objflags &= ~FORTRAN;\n\t\telse *objflags |= FORTRAN;\n\t}\n\treturn itemsize;\n}\n\n\t\nstatic PyObject *\nPyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n\t PyObject *obj)\n{\n\tPyArrayObject *self;\n\tPyArray_Descr *descr;\n\tregister int i;\n\tintp sd, temp;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\tif (descr == NULL) return NULL;\n\n\tif (nd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"number of dimensions must be >=0\");\n\t\treturn NULL;\n\t}\n if (nd > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError,\n \"maximum number of dimensions is %d\", MAX_DIMS);\n return NULL;\n\t}\n\n\t/* Check dimensions */\n\tfor (i=nd-1;i>=0;i--) {\n\t\tif (dims[i] < 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"negative dimensions\"\t\\\n\t\t\t\t\t\" are not allowed.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tself = (PyArrayObject *) subtype->tp_alloc(subtype, 0);\n\tif (self == NULL) return NULL;\t\n\tself->descr = descr;\n\tself->dimensions = NULL;\n\tif (data == NULL) { /* strides is NULL too */\n\t\tself->flags = DEFAULT_FLAGS;\n\t\tif (flags) {\n\t\t\tself->flags |= FORTRAN; \n\t\t\tif (nd > 1) self->flags &= ~CONTIGUOUS;\n\t\t\tflags = FORTRAN;\n\t\t}\n\t}\n\telse self->flags = (flags & ~UPDATEIFCOPY);\n\t\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tif (itemsize < 1) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"Type must provide an itemsize.\");\n\t\t\tPyObject_Del(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tself->itemsize = itemsize;\n\t\t/* Guarantee that these kind of arrays are never byteswapped\n\t\t unknowingly. \n\t\t*/\n\t\tif (type_num != PyArray_UNICODE)\n\t\t\tself->flags |= NOTSWAPPED;\n\t}\n\telse self->itemsize = descr->elsize; \n\t\t\n\tsd = self->itemsize;\n\t\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dims, sizeof(intp)*nd);\n\t\tif (strides == NULL) { /* fill it in */\n\t\t\tsd = _array_fill_strides(self->strides, dims, nd, sd,\n\t\t\t\t\t\t flags, &(self->flags));\n\t\t}\n\t\telse {\n\t\t\tif (data == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"If strides is given in \" \\\n\t\t\t\t\t\t\"array creation, data must \" \\\n\t\t\t\t\t\t\"be given too.\");\n\t\t\t\tPyObject_Del(self);\n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\t\treturn NULL;\n\t\t\t}\t\t\t\t\t\n\t\t\tmemcpy(self->strides, strides, sizeof(intp)*nd);\n\t\t}\n\t}\n \t\n\t\t\n\tif (data == NULL) {\n\n\t\t/* Make sure we are aligned on void ptrs (without wasting\n\t\t space if we already are). But, also, allocate something \n\t\t even for zero-space arrays e.g. shape=(0,) -- otherwise\n buffer exposure (a.data) doesn't work as it should. */\n\n\t\tif (sd==0) sd = sizeof(intp);\n\t\telse if ((temp=sd%sizeof(intp))) sd += sizeof(intp) - temp;\n\n\t\tif ((data = PyDataMem_NEW(sd))==NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\tif (self->dimensions != NULL) \n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\n\t\t/* It is bad to have unitialized OBJECT pointers */\n\t\t/* We shouldn't need to check for the OBJECT Letter\n\t\t but perhaps it's best. */\n\t\tif (type_num == PyArray_OBJECT || \\\n\t\t type_num == PyArray_OBJECTLTR) {\n\t\t\tmemset(data, 0, sd);\n\t\t}\n\t}\n\telse {\n self->flags &= ~OWN_DATA; /* If data is passed in, \n\t\t\t\t\t this object won't own it \n\t\t\t\t\t by default.\n\t\t\t\t\t Caller must arrange for \n\t\t\t\t\t this to be reset if truly\n\t\t\t\t\t desired */\n }\n self->data = data;\n\tself->nd = nd;\n\tself->base = (PyObject *)NULL;\n self->weakreflist = (PyObject *)NULL;\n\n /* call the __array_finalize__\n\t method if a subtype and some object passed in */\n\tif ((obj != NULL) && (subtype != &PyArray_Type) && \n\t (subtype != &PyBigArray_Type)) {\n\t\tPyObject *res;\n\t\tres = PyObject_CallMethod((PyObject *)self, \n\t\t\t\t\t \"__array_finalize__\",\n\t\t\t\t\t \"O\", obj);\n\t\tif (res == NULL) PyErr_Clear();\n\t\telse Py_DECREF(res);\n\t}\n\n\treturn (PyObject *)self;\n}\n\n\n\nstatic PyObject * \nPyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape)\n{\n intp oldsize, newsize;\n int new_nd=newshape->len, k, n, elsize;\n int refcnt;\n intp* new_dimensions=newshape->ptr;\n intp new_strides[MAX_DIMS];\n intp sd;\n intp *dimptr;\n char *new_data;\n\t\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n \"resize only works on contiguous arrays\");\n return NULL;\n }\n\n\n newsize = PyArray_MultiplyList(new_dimensions, new_nd);\n\n if (newsize == 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Newsize is zero. Cannot delete an array \"\\\n \"in this way.\");\n return NULL;\n }\n oldsize = PyArray_SIZE(self);\n \n\tif (oldsize != newsize) {\n\t\tif (!(self->flags & OWN_DATA)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize this array: \"\t\\\n\t\t\t\t\t\"it does not own its data.\");\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\trefcnt = (((PyObject *)self)->ob_refcnt);\n\t\tif ((refcnt > 2) || (self->base != NULL) || \\\n\t\t (self->weakreflist != NULL)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize an array that has \"\\\n\t\t\t\t\t\"been referenced or is referencing\\n\"\\\n\t\t\t\t\t\"another array in this way. Use the \"\\\n\t\t\t\t\t\"resize function.\");\n\t\t\treturn NULL;\n\t\t} \n\t\t\n\t\t/* Reallocate space if needed */\n\t\tnew_data = PyDataMem_RENEW(self->data, \n\t\t\t\t\t newsize*(self->itemsize));\n\t\tif (new_data == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n\t\t\t\t\t\"can't allocate memory for array.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tself->data = new_data;\n\t}\n \n if ((newsize > oldsize) && PyArray_ISWRITEABLE(self)) { \n\t\t/* Fill new memory with zeros */\n elsize = self->itemsize;\n\t\tif ((PyArray_TYPE(self) == PyArray_OBJECT)) {\n\t\t\tPyObject *zero = PyInt_FromLong(0);\n PyObject **optr;\n\t\t\toptr = ((PyObject **)self->data) + oldsize;\n\t\t\tn = newsize - oldsize;\n\t\t\tfor (k=0; kdata+oldsize*elsize, 0, \n\t\t\t (newsize-oldsize)*elsize);\n\t\t}\n\t}\n \n if (self->nd != new_nd) { /* Different number of dimensions. */\n self->nd = new_nd;\n \n /* Need new dimensions and strides arrays */\n dimptr = PyDimMem_RENEW(self->dimensions, 2*new_nd);\n if (dimptr == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n \"can't allocate memory for array \" \\\n \"(array may be corrupted).\");\n return NULL;\n }\n self->dimensions = dimptr;\n\t\tself->strides = dimptr + new_nd;\n }\n\n /* make new_strides variable */\n sd = (intp) self->itemsize;\n sd = _array_fill_strides(new_strides, new_dimensions, new_nd, sd,\n 0, &(self->flags));\n\n \n memmove(self->dimensions, new_dimensions, new_nd*sizeof(intp));\n memmove(self->strides, new_strides, new_nd*sizeof(intp));\n\n Py_INCREF(Py_None);\t\n return Py_None;\n \n}\n\n\nstatic void\nPyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj)\n{\n PyObject **optr;\n intp i,n;\n optr = (PyObject **)(arr->data);\n n = PyArray_SIZE(arr);\n if (obj == NULL) {\n for (i=0; ibase = buffer.base;\n Py_INCREF(buffer.base); \n }\n\n PyDimMem_FREE(dims.ptr);\n if (strides.ptr) PyDimMem_FREE(strides.ptr);\n return PyArray_Return(ret);\n \n fail:\n if (dims.ptr) free(dims.ptr);\n if (strides.ptr) free(strides.ptr);\n return NULL;\n}\n\n\n\n/******************* array attribute get and set routines ******************/\n\nstatic PyObject *\narray_ndim_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong(self->nd);\n}\n\nstatic PyObject *\narray_flags_get(PyArrayObject *self)\n{\n static PyObject *module=NULL;\n\n if (module==NULL) {\n module = PyImport_ImportModule(\"scipy.base._internal\");\n if (module == NULL) return NULL;\n }\n return PyObject_CallMethod(module, \"flagsobj\", \"Oi\", \n self, self->flags);\n}\n\n/*\nstatic int\narray_flags_set(PyArrayObject *self, PyObject *obj) \n{\n\tint flagback = self->flags;\n\n if (PyDict_Check(obj)) {\n PyObject *new;\n\t\tnew = PyDict_GetItemString(obj, \"ALIGNED\");\n\t\tif (new) {\n\t\t\tif (PyObject_Not(new)) self->flags &= ~ALIGNED;\n\t\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\t\telse {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"cannot set aligned flag of \" \\\n\t\t\t\t\t\t\"mis-aligned array to True\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n new = PyDict_GetItemString(obj, \"UPDATEIFCOPY\");\n if (new) {\n if (PyObject_Not(new)) {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n else {\n\t\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return -1;\n }\n }\n new = PyDict_GetItemString(obj, \"WRITEABLE\");\n if (new) {\n\t\t\tif (PyObject_IsTrue(new)) {\n\t\t\t\tif (_IsWriteable(self)) {\n\t\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself->flags = flagback;\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\t\"cannot set \"\t\\\n\t\t\t\t\t\t\t\"WRITEABLE \"\t\\\n\t\t\t\t\t\t\t\"flag to True of \"\\\n\t\t\t\t\t\t\t\"this array \");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n new = PyDict_GetItemString(obj, \"NOTSWAPPED\");\n if (new) {\n if (PyObject_IsTrue(new))\n self->flags |= NOTSWAPPED;\n else {\n self->flags &= ~NOTSWAPPED;\n\t\t\t}\n\t\t}\n return 0;\n }\n PyErr_SetString(PyExc_ValueError, \n \"Object must be a dictionary\");\n return -1;\n}\n*/\n\n\nstatic PyObject *\narray_shape_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->dimensions);\n}\n\n\nstatic int\narray_shape_set(PyArrayObject *self, PyObject *val)\n{\n \tint nd;\n\tPyObject *ret;\n\n\tif (!PyTuple_Check(val)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"shape must be a tuple\");\n\t\treturn -1;\n\t}\n\tret = PyArray_Reshape(self, val);\n\tif (ret == NULL) return -1;\n\t\n\tif (self->nd > 0) { /* Free old dimensions and strides */\n\t\tPyDimMem_FREE(self->dimensions);\n\t}\n\tnd = PyArray_NDIM(ret);\n\tself->nd = nd;\n\tif (nd > 0) { /* create new dimensions and strides */\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\tPyErr_SetString(PyExc_MemoryError,\"\");\n\t\t\treturn -1;\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, PyArray_DIMS(ret), \n\t\t nd*sizeof(intp));\n\t\tmemcpy(self->strides, PyArray_STRIDES(ret), \n\t\t nd*sizeof(intp));\n\t}\n\telse self->dimensions=NULL;\n\tPy_DECREF(ret);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_strides_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic int\narray_strides_set(PyArrayObject *self, PyObject *obj)\n{\n\tPyArray_Dims newstrides = {NULL, 0};\n\tPyArrayObject *new;\n\tintp numbytes;\n\n\tif (!PyArray_IntpConverter(obj, &newstrides) || \\\n\t newstrides.ptr == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"invalid strides.\");\n\t\treturn -1;\n\t}\n\tif (newstrides.len != self->nd) {\n\t\tPyErr_Format(PyExc_ValueError, \"strides must be \"\t\\\n\t\t\t \" same length as shape (%d)\", self->nd);\n\t\treturn -1;\n\t}\n\tnew = self;\n\twhile(new->base != NULL) {\n\t\tif (PyArray_Check(new->base)) \n\t\t\tnew = (PyArrayObject *)new->base;\n\t}\n\tnumbytes = PyArray_MultiplyList(new->dimensions, \n\t\t\t\t\tnew->nd)*new->itemsize;\n\t\n\tif (!PyArray_CheckStrides(self->itemsize, self->nd, numbytes, \n\t\t\t\t self->dimensions, newstrides.ptr)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"strides is not \"\\\n\t\t\t\t\"compatible with available memory\");\n\t\treturn -1;\n\t}\n\tmemcpy(self->strides, newstrides.ptr, sizeof(intp)*newstrides.len);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_protocol_strides_get(PyArrayObject *self)\n{\n\tif PyArray_ISCONTIGUOUS(self) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic PyObject *\narray_priority_get(PyArrayObject *self)\n{\n\tif (PyArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_PRIORITY);\n\telse if (PyBigArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_BIG_PRIORITY);\n\telse\n\t\treturn PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY);\n}\n\n\nstatic PyObject *\narray_data_get(PyArrayObject *self)\n{\n\tintp nbytes;\n\tif (!(PyArray_ISONESEGMENT(self))) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot get single-\"\\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn NULL;\n\t}\t\t\n\tnbytes = PyArray_NBYTES(self);\n\tif PyArray_ISWRITEABLE(self) \n\t\treturn PyBuffer_FromReadWriteObject((PyObject *)self, 0, \n\t\t\t\t\t\t (int) nbytes);\n\telse\n\t\treturn PyBuffer_FromObject((PyObject *)self, 0, (int) nbytes);\n}\n\nstatic int\narray_data_set(PyArrayObject *self, PyObject *op)\n{\n\tvoid *buf;\n\tint buf_len;\n\tint writeable=1;\n\n\tif (PyObject_AsWriteBuffer(op, &buf, &buf_len) < 0) {\n\t\twriteable = 0;\n\t\tif (PyObject_AsReadBuffer(op, (const void **)&buf, \n\t\t\t\t\t &buf_len) < 0) {\n\t\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\t\"Object does not have single-segment\" \\\n\t\t\t\t\t\"buffer interface\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif (!PyArray_ISONESEGMENT(self)) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot set single-\" \\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn -1;\n\t}\n\tif (PyArray_NBYTES(self) > buf_len) {\n\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\"Not enough data for array.\");\n\t\treturn -1;\n\t}\n\tif (self->flags & OWN_DATA) {\n\t\tPyArray_XDECREF(self);\n\t\tPyDataMem_FREE(self->data);\n\t}\n\tif (self->base) {\n\t\tif (self->flags & UPDATEIFCOPY) {\n\t\t\t((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tself->flags &= ~UPDATEIFCOPY;\n\t\t}\n\t\tPy_DECREF(self->base);\n\t}\n\tPy_INCREF(op);\n\tself->base = op;\n\tself->data = buf;\n\tself->flags = CARRAY_FLAGS;\n\tif (!writeable)\n\t\tself->flags &= ~WRITEABLE;\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_itemsize_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->itemsize);\n}\n\nstatic PyObject *\narray_size_get(PyArrayObject *self)\n{\n\tlonglong size=PyArray_SIZE(self);\n\tif (size > MAX_INT || size < MIN_INT)\n\t\treturn PyLong_FromLongLong((longlong) size);\n\telse \n\t\treturn PyInt_FromLong((long) size);\n}\n\n\nstatic PyObject *\narray_typechar_get(PyArrayObject *self)\n{\n\tif PyArray_ISFLEXIBLE(self) \n\t\treturn PyString_FromFormat(\"%c%d\", (self->descr->type),\n\t\t\t\t\t self->itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(self->descr->type), 1);\n}\n\nstatic PyObject *\narray_typestr_get(PyArrayObject *self)\n{\n\tstatic char endians[] = \"<>\";\n\tchar endian;\n\tint which;\n\tunsigned long val = 1;\n\tchar *s;\n\tchar basic_=self->descr->kind;\n\n\ts = (char *)&val; /* s[0] == 0 implies big-endian */\n\twhich = (PyArray_ISNOTSWAPPED(self) ? 0 : 1);\n\tif (s[0] == 0) which = 1 - which;\n\tendian = endians[which]; \n\t\n\tif ((basic_==PyArray_VOIDLTR) || (basic_==PyArray_STRINGLTR) || \\\n\t (basic_==PyArray_OBJECTLTR) || (self->itemsize == 1))\n\t\treturn PyString_FromFormat(\"|%c%d\", basic_, self->itemsize);\n\telse\n\t\treturn PyString_FromFormat(\"%c%c%d\", endian, basic_,\n\t\t\t\t\t self->itemsize);\n}\n\nstatic PyObject *\narray_descr_get(PyArrayObject *self)\n{\n\tPyObject *res;\n\tPyObject *dobj;\n\n\t/* hand this off to the typeobject */\n\t/* or give default */\n\tif (PyArray_ISUSERDEF(self)) {\n\t\tres = PyObject_GetAttrString((PyObject *)self->descr->typeobj, \n\t\t\t\t\t \"__array_descr__\");\n\t\tif (res) return res;\n\t\tPyErr_Clear();\n\t}\n\t/* get default */\n\tdobj = PyTuple_New(2);\n\tif (dobj == NULL) return NULL;\n\tPyTuple_SET_ITEM(dobj, 0, PyString_FromString(\"\"));\n\tPyTuple_SET_ITEM(dobj, 1, array_typestr_get(self));\n\tres = PyList_New(1);\n\tif (res == NULL) {Py_DECREF(dobj); return NULL;}\n\tPyList_SET_ITEM(res, 0, dobj);\n\treturn res;\n}\n\nstatic PyObject *\narray_typenum_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->descr->type_num);\n}\n\n\nstatic PyObject *\narray_type_get(PyArrayObject *self)\n{\n\treturn PyArray_TypeObjectFromType(self->descr->type_num);\n}\n\n/* If the type is changed. \n Also needing change: strides, itemsize\n\n Either itemsize is exactly the same\n or the array is single-segment (contiguous or fortran) with\n compatibile dimensions\n\n*/\n\nstatic int\narray_type_set(PyArrayObject *self, PyObject *arg)\n{\n PyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n intp newdim;\n int index;\n char *msg = \"new type not compatible with array.\";\n\n if ((PyArray_TypecodeConverter(arg, &newtype) < 0) ||\n newtype.type_num == PyArray_NOTYPE) {\n PyErr_SetString(PyExc_TypeError, \"Invalid type for array\");\n return -1;\n }\n if (!(PyArray_ISONESEGMENT(self) ||\t\t\\\n\t (newtype.itemsize != self->itemsize))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1; \n }\n\n\tif (PyArray_ISCONTIGUOUS(self)) index = self->nd - 1;\n\telse index = 0;\n\n if (newtype.itemsize < self->itemsize) {\n /* if it is compatible increase the size of the dimension\n at end (or at the front for FORTRAN)\n */\n if (self->itemsize % newtype.itemsize != 0) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n newdim = self->itemsize / newtype.itemsize;\n\t\tself->dimensions[index] *= newdim;\n self->strides[index] = newtype.itemsize;\n\t}\n \n else if (newtype.itemsize > self->itemsize) {\n \n /* Determine if last (or first if FORTRAN) dimension\n is compatible */\n\n\t\tnewdim = self->dimensions[index] * self->itemsize;\n if ((newdim % newtype.itemsize) != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n\t\t\n self->dimensions[index] = newdim / newtype.itemsize;\n self->strides[index] = newtype.itemsize;\n\t\t\n }\n\t\n \n /* fall through -- adjust type*/\n\n self->descr = PyArray_DescrFromType(newtype.type_num);\n self->itemsize = newtype.itemsize;\n PyArray_UpdateFlags(self, ALIGNED);\n return 0;\n\n}\n\n\n\nstatic PyObject *\narray_base_get(PyArrayObject *self)\n{\n\tif (self->base == NULL) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\telse {\n\t\tPy_INCREF(self->base);\n\t\treturn self->base;\n\t}\n}\n\n\nstatic PyObject *\narray_real_get(PyArrayObject *self)\n{\n\tPyArrayObject *ret;\n\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *)ret;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n}\n\n\nstatic int\narray_real_set(PyArrayObject *self, PyObject *val)\n{\n\tPyArrayObject *ret;\n\tPyArrayObject *new;\n\tint rint;\n\n\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0);\n\tif (new == NULL) return -1;\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return -1;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\tret = self;\n\t}\t\n\trint = PyArray_CopyInto(ret, new);\n\tPy_DECREF(ret);\n\treturn rint;\n}\n\nstatic PyObject *\narray_imag_get(PyArrayObject *self)\n{\t\n\tPyArrayObject *ret;\n\tint itemsize;\n\tint typenum;\n PyArray_Typecode type = {self->descr->type_num, \n self->itemsize,\t \n PyArray_ISFORTRAN(self)};\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\titemsize = self->itemsize >> 1;\n\t\ttypenum = self->descr->type_num - PyArray_NUM_FLOATTYPE;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t typenum,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data + itemsize,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *) ret;\n\t}\n\telse {\n\t\tret = (PyArrayObject *)PyArray_Zeros(self->nd, \n\t\t\t\t\t\t self->dimensions, &type);\n\t\tret->flags &= ~WRITEABLE;\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic int\narray_imag_set(PyArrayObject *self, PyObject *val)\n{\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyArrayObject *ret;\n\t\tPyArrayObject *new;\n\t\tint rint;\n\n\t\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0); \n\t\tif (new == NULL) return -1;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides+ \\\n\t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) {\n\t\t\tPy_DECREF(new); \n\t\t\treturn -1;\n\t\t}\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\trint = PyArray_CopyInto(ret, new);\n\t\tPy_DECREF(ret);\t\t\n\t\tPy_DECREF(new);\n\t\treturn rint;\n\t}\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError, \"Does not have imaginary \" \\\n\t\t\t\t\"part to set.\");\n\t\treturn -1;\n\t}\n}\n\nstatic PyObject *\narray_flat_get(PyArrayObject *self)\n{\n return PyArray_IterNew((PyObject *)self);\n}\n\nstatic int \narray_flat_set(PyArrayObject *self, PyObject *val)\n{\n\tPyObject *arr=NULL;\n\tint retval = -1;\n\tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n\tPyArray_Typecode typecode = {self->descr->type_num,\n\t\t\t\t self->itemsize,\n\t\t\t\t PyArray_ISFORTRAN(self)};\n int swap;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tarr = PyArray_FromAny(val, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\tarrit = (PyArrayIterObject *)PyArray_IterNew(arr);\n\tif (arrit == NULL) goto exit;\n\tselfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (selfit == NULL) goto exit;\n\n swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);\n copyswap = self->descr->copyswap;\n if (PyArray_ISOBJECT(self)) {\n while(selfit->index < selfit->size) {\n Py_XDECREF(*((PyObject **)selfit->dataptr));\n Py_INCREF(*((PyObject **)arrit->dataptr)); \n memmove(selfit->dataptr, arrit->dataptr, \n sizeof(PyObject *));\n copyswap(selfit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_ITER_NEXT(selfit);\n PyArray_ITER_NEXT(arrit);\n if (arrit->index == arrit->size) \n PyArray_ITER_RESET(arrit);\n }\n retval = 0; \n goto exit;\n }\n\n\twhile(selfit->index < selfit->size) {\n\t\tmemmove(selfit->dataptr, arrit->dataptr, self->itemsize);\n copyswap(selfit->dataptr, NULL, swap, self->itemsize);\n\t\tPyArray_ITER_NEXT(selfit);\n\t\tPyArray_ITER_NEXT(arrit);\n\t\tif (arrit->index == arrit->size) \n\t\t\tPyArray_ITER_RESET(arrit);\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(selfit);\n\tPy_XDECREF(arrit);\n\tPy_XDECREF(arr);\n\treturn retval;\n}\n\nstatic PyGetSetDef array_getsetlist[] = {\n {\"ndim\", \n\t (getter)array_ndim_get, \n\t NULL, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)array_flags_get, \n NULL,\n\t \"special dictionary of flags\"},\n {\"shape\", \n\t (getter)array_shape_get, \n\t (setter)array_shape_set, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)array_strides_get, \n\t (setter)array_strides_set,\n\t \"tuple of bytes steps in each dimension\"},\n {\"data\", \n\t (getter)array_data_get, \n\t (setter)array_data_set, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)array_itemsize_get, \n\t NULL,\n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)array_size_get,\n\t NULL,\n \"number of elements in the array\"},\n\t{\"base\",\n\t (getter)array_base_get,\n\t NULL,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)array_type_get, \n\t (setter)array_type_set,\n\t \"get array type class\"},\n\t{\"dtypechar\",\n\t (getter)array_typechar_get,\n\t NULL,\n\t \"get array type character code\"},\n\t{\"dtypenum\",\n\t (getter)array_typenum_get,\n\t NULL,\n\t \"get array type number code\"},\n\t{\"dtypestr\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)array_real_get, \n\t (setter)array_real_set, \n\t \"real part of array\"},\n {\"imag\", \n\t (getter)array_imag_get, \n\t (setter)array_imag_set, \n\t \"imaginary part of array\"},\n\t{\"flat\", \n\t (getter)array_flat_get, \n\t (setter)array_flat_set, \n\t \"a 1-d view of a contiguous array\"}, \n\t{\"__array_data__\", \n\t (getter)array_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)array_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)array_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)array_protocol_strides_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t{\"__array_priority__\",\n\t (getter)array_priority_get,\n\t NULL,\n\t \"Array priority\"},\n \t{NULL, NULL, NULL, NULL}, /* Sentinel */\n};\n\n/****************** end of attribute get and set routines *******************/\n\n\n\nstatic char Arraytype__doc__[] = \n \"A array object represents a multidimensional, homogeneous array of basic values. It has the folowing data members, m.shape (the size of each dimension in the array), m.itemsize (the size (in bytes) of each element of the array), and m.typecode (a character representing the type of the array elements). Arrays are sequence, mapping and numeric objects. Sequence indexing is similar to lists, with single indices returning a reference that points to the old array data, and slices returning by copy. A array is also allowed to be indexed by a sequence of items.\t Each member of the sequence indexes the corresponding dimension of the array.\";\n\nstatic PyTypeObject PyBigArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.bigndarray\",\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n /* methods */\n (destructor)array_dealloc,\t\t /*tp_dealloc */\n (printfunc)NULL,\t\t\t /*tp_print*/\n 0,\t\t\t\t\t /*tp_getattr*/\n 0,\t\t\t\t\t /*tp_setattr*/\n (cmpfunc)0, \t\t /*tp_compare*/\n (reprfunc)array_repr,\t\t /*tp_repr*/\n &array_as_number,\t\t\t /*tp_as_number*/\n NULL, \t\t\t /*tp_as_sequence*/\n &array_as_mapping,\t\t\t /*tp_as_mapping*/\n (hashfunc)0,\t\t\t /*tp_hash*/\n (ternaryfunc)0,\t\t\t /*tp_call*/\n (reprfunc)array_str, \t /*tp_str*/\n\t\t\n (getattrofunc)0,\t\t\t /*tp_getattro*/\n (setattrofunc)0,\t\t\t /*tp_setattro*/\n NULL, \t /*tp_as_buffer*/\n (Py_TPFLAGS_DEFAULT \n | Py_TPFLAGS_BASETYPE\n | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/\n /*Documentation string */\n Arraytype__doc__,\t\t\t /*tp_doc*/\n\n (traverseproc)0,\t\t\t /*tp_traverse */\n (inquiry)0,\t\t\t /*tp_clear */\n (richcmpfunc)array_richcompare,\t \n offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */\n\n /* Iterator support (use standard) */\n\n (getiterfunc)0, \t\t /* tp_iter */\n (iternextfunc)0,\t\t\t /* tp_iternext */\n\n /* Sub-classing (new-style object) support */\n\n array_methods,\t\t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n array_getsetlist,\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0,\t /* tp_alloc */ \n (newfunc)array_new,\t\t /* tp_new */\n 0,\t \t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n};\n\n/* A standard array will subclass from the Big Array and \n add the array_as_sequence table\n and the array_as_buffer table\n */\n\nstatic PyTypeObject PyArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.ndarray\",\t\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n};\n\n\n/* The rest of this code is to build the right kind of array from a python */\n/* object. */\n\nstatic int \ndiscover_depth(PyObject *s, int max, int stop_at_string) \n{\n int d=0;\n PyObject *e;\n\t\n if(max < 1) return -1;\n\n if(! PySequence_Check(s) || PyInstance_Check(s) || \\\n\t PySequence_Length(s) < 0) {\n PyErr_Clear(); return 0;\n }\n if (PyArray_Check(s))\n\t\treturn PyArray_NDIM(s);\n if(PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))\n\t\treturn stop_at_string ? 0:1;\n if (PySequence_Length(s) == 0) \n\t\treturn 1;\n\t\n if ((e=PySequence_GetItem(s,0)) == NULL) return -1;\n if(e!=s) {\n\t\td=discover_depth(e,max-1, stop_at_string);\n\t\tif(d >= 0) d++;\n\t}\n Py_DECREF(e);\n return d;\n}\n\nstatic int\ndiscover_itemsize(PyObject *s, int nd, int *itemsize) \n{\n\tint n, r, i;\n\tPyObject *e;\n\t\n\tn = PyObject_Length(s);\n\n\tif ((nd == 0) || PyString_Check(s) ||\t\t\\\n\t PyUnicode_Check(s) || PyBuffer_Check(s)) {\n\t\tif PyUnicode_Check(s) \n\t\t\t*itemsize = MAX(*itemsize, sizeof(Py_UNICODE)*n);\n\t\telse\n\t\t\t*itemsize = MAX(*itemsize, n);\n\t\treturn 0;\n\t}\n\tfor (i=0; i n_lower) n_lower = d[1];\n }\n d[1] = n_lower;\n\t\n return 0;\n}\n\nstatic void\n_array_small_type(int chktype, int mintype, int chksize, int minsize, \n\t\t PyArray_Typecode *outtype)\n{\n\touttype->type_num = MAX(chktype, mintype);\n\tif (PyTypeNum_ISFLEXIBLE(outtype->type_num) &&\t\\\n\t PyTypeNum_ISFLEXIBLE(mintype)) {\n\t\t/* Handle string->unicode case separately \n\t\t because string itemsize is twice as large */\n\t\tif (outtype->type_num == PyArray_UNICODE && \n\t\t mintype == PyArray_STRING) {\n\t\t\touttype->itemsize = MAX(chksize, 2*minsize);\n\t\t}\n\t\telse {\n\t\t\touttype->itemsize = MAX(chksize, minsize);\n\t\t}\n\t}\n\telse {\n\t\touttype->itemsize = chksize;\n\t}\n\treturn;\t\n}\n\nstatic void\n_array_find_type(PyObject *op, PyArray_Typecode *minitype, \n\t\t PyArray_Typecode *outtype, int max)\n{\n int l;\n PyObject *ip;\n\tint chktype=0;\n\tint chksize=0;\n\tint mintype, minsize;\n\n\tif (minitype == NULL) {\n\t\tmintype = PyArray_BOOL;\n\t\tminsize = sizeof(Bool);\n\t}\n\telse {\n\t\tmintype = minitype->type_num;\n\t\tminsize = minitype->itemsize;\n\t}\n\n \n if (max < 0 || mintype == -1) goto deflt;\n\t\n if (PyArray_Check(op)) {\n\t\tchktype = PyArray_TYPE(op);\n\t\tchksize = PyArray_ITEMSIZE(op);\n\t\tgoto finish;\n\t}\n\t\n\tif (PyArray_IsScalar(op, Generic)) {\n\t\tPyArray_TypecodeFromScalar(op, outtype);\n\t\tchktype = outtype->type_num;\n\t\tchksize = outtype->itemsize;\n\t\tgoto finish;\n\t}\n\t\n\n if (PyObject_HasAttrString(op, \"__array__\")) {\n ip = PyObject_CallMethod(op, \"__array__\", NULL);\n if(ip && PyArray_Check(ip)) {\n\t\t\tchktype = PyArray_TYPE(ip);\n\t\t\tchksize = PyArray_ITEMSIZE(ip);\n\t\t\tgoto finish;\n\t\t}\n } \n\t\n\tif (PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tint swap=0, res;\n\t\tip = PyObject_GetAttrString(op, \"__array_typestr__\");\n\t\tif (ip && PyString_Check(ip)) {\n\t\t\tres = _array_typecode_fromstr(PyString_AS_STRING(ip), \n\t\t\t\t\t\t &swap, outtype); \n\t\t\tif (res >= 0) {\n\t\t\t\tPy_DECREF(ip);\n\t\t\t\tchktype = outtype->type_num;\n\t\t\t\tchksize = outtype->itemsize;\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t}\n\t\tPy_XDECREF(ip);\n\t}\n\n if (PyString_Check(op)) {\n\t\tchktype = PyArray_STRING;\n\t\tchksize = PyString_GET_SIZE(op);\n\t\tgoto finish;\n }\n\n\tif (PyUnicode_Check(op)) {\n\t\tchktype = PyArray_UNICODE;\n\t\tchksize = PyUnicode_GET_DATA_SIZE(op);\n\t\tgoto finish;\n\t}\n\n\tif (PyBuffer_Check(op)) {\n\t\tchktype = PyArray_VOID;\n\t\tchksize = op->ob_type->tp_as_sequence->sq_length(op);\n\t\tPyErr_Clear();\n\t\tgoto finish;\n\t}\n\n\tif (PyInstance_Check(op)) goto deflt;\n\t\n if (PySequence_Check(op)) {\n\t\tPyArray_Typecode newtype = {mintype, minsize, 0};\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n\t\t\tPyErr_Clear(); \n\t\t\tgoto deflt;\n\t\t}\n if (l == 0 && mintype == 0) {\n\t\t\tnewtype.type_num = PyArray_INTP;\n\t\t\tnewtype.itemsize = sizeof(intp);\n\t\t}\n while (--l >= 0) {\n ip = PySequence_GetItem(op, l);\n if (ip==NULL) {\n\t\t\t\tPyErr_Clear(); \n\t\t\t\tgoto deflt;\n\t\t\t}\n\t\t\t_array_find_type(ip, &newtype, outtype, max-1);\n\t\t\t_array_small_type(outtype->type_num,\n\t\t\t\t\t newtype.type_num, \n\t\t\t\t\t outtype->itemsize,\n\t\t\t\t\t newtype.itemsize,\n\t\t\t\t\t &newtype);\n Py_DECREF(ip);\n }\n\t\tchktype = newtype.type_num;\n\t\tchksize = newtype.itemsize;\n\t\tgoto finish;\n }\n\t\n\tif (PyBool_Check(op)) {\n\t\tchktype = PyArray_BOOL;\n\t\tchksize = sizeof(Bool);\n\t\tgoto finish;\t\t\n\t}\n else if (PyInt_Check(op)) {\n\t\tchktype = PyArray_LONG;\n\t\tchksize = sizeof(long);\n\t\tgoto finish;\n } else if (PyFloat_Check(op)) {\n\t\tchktype = PyArray_DOUBLE;\n\t\tchksize = sizeof(double);\n\t\tgoto finish;\n\t} else if (PyComplex_Check(op)) {\n\t\tchktype = PyArray_CDOUBLE;\n\t\tchksize = sizeof(cdouble);\n\t\tgoto finish;\n\t}\n\n deflt:\n\tchktype = PyArray_OBJECT;\n\tchksize = sizeof(void *);\n\n finish:\n\t_array_small_type(chktype, mintype, chksize, minsize, \n\t\t\t outtype);\n\treturn;\n}\n\nstatic int \nAssign_Array(PyArrayObject *self, PyObject *v) \n{\n PyObject *e;\n int l, r;\n\t\n if (!PySequence_Check(v)) {\n PyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"assignment from non-sequence\");\n return -1;\n }\n\t\n l=PyObject_Length(v);\n if(l < 0) return -1; \n\t\n while(--l >= 0)\n {\n e=PySequence_GetItem(v,l);\n if (e == NULL) return -1; \n\t\t\tr = PySequence_SetItem((PyObject*)self,l,e);\n Py_DECREF(e);\n if(r == -1) return -1;\n }\n return 0;\n}\n\n/* \"Array Scalars don't call this code\" */ \nstatic PyObject *\nArray_FromScalar(PyObject *op, PyArray_Typecode *typecode) \n{\n PyArrayObject *ret;\n\tint itemsize = 0;\n\tint type = typecode->type_num;\n\n\tif PyTypeNum_ISFLEXIBLE(type) {\n\t\titemsize = PyObject_Length(op);\n\t}\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,\n\t\t\t\t\t NULL, NULL, itemsize, 0, NULL);\n\n\tif (ret == NULL) return NULL;\n\n ret->descr->setitem(op, ret->data, ret);\n\t\n if (PyErr_Occurred()) {\n array_dealloc(ret);\n return NULL;\n } else {\n return (PyObject *)ret;\n }\n}\n\n\nstatic PyObject *\nArray_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth)\n{\n PyArrayObject *r;\n int nd;\n\tintp *d;\n\tint stop_at_string;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\t\n\t\n\tstop_at_string = ((type == PyArray_OBJECT) ||\t\\\n\t\t\t (type == PyArray_STRING) ||\t\\\n\t\t\t (type == PyArray_UNICODE) || \\\n\t\t\t (type == PyArray_VOID));\n\n if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string)) > 0)) {\n\t\tif (nd==0)\n\t\t\treturn Array_FromScalar(s, typecode);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid input sequence\");\n return NULL;\n }\n\t\n if ((max_depth && nd > max_depth) ||\t\\\n\t (min_depth && nd < min_depth)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of dimensions\");\n return NULL;\n }\n\t\n\tif ((d=PyDimMem_NEW(nd)) == NULL) {\n\t\treturn PyErr_NoMemory();\n }\n\tif(discover_dimensions(s,nd,d, !stop_at_string) == -1) {\n\t\tPyDimMem_FREE(d);\n\t\treturn NULL;\n\t}\n\tif (itemsize == 0 && PyTypeNum_ISFLEXIBLE(type)) {\n\t\tif (discover_itemsize(s, nd, &itemsize) == -1) {\n\t\t\tPyDimMem_FREE(d);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n r=(PyArrayObject*)PyArray_New(&PyArray_Type, nd, d, \n\t\t\t\t type, NULL, NULL,\n\t\t\t\t itemsize, \n\t\t\t\t typecode->fortran, NULL);\n\n PyDimMem_FREE(d);\n if(!r) return NULL;\n if(Assign_Array(r,s) == -1) {\n\t\tPy_DECREF(r);\n\t\treturn NULL;\n\t}\n return (PyObject*)r;\n}\n\n\nstatic int \nPyArray_ValidType(int type) \n{\n\tPyArray_Descr *descr;\n\t\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr==NULL) return 0;\n\treturn 1;\n}\n\n\n/* If the output is not a CARRAY, then it is buffered also */\n\nstatic int\n_bufferedcast(PyArrayObject *out, PyArrayObject *in)\n{\n\tchar *inbuffer, *bptr, *optr;\n\tchar *outbuffer=NULL;\n\tPyArrayIterObject *it_in=NULL, *it_out=NULL;\n\tregister intp i, index;\n\tintp ncopies = PyArray_SIZE(out) / PyArray_SIZE(in);\n\tint elsize=in->itemsize;\n\tint nels = PyArray_BUFSIZE;\n\tint el;\n\tint inswap, outswap=0;\n\tint obuf=!PyArray_ISCARRAY(out);\n\tint oelsize = out->itemsize;\n\tPyArray_VectorUnaryFunc *castfunc;\n PyArray_CopySwapFunc *in_csn;\n PyArray_CopySwapFunc *out_csn;\n\tint retval = -1;\n\n\tcastfunc = in->descr->cast[out->descr->type_num];\n in_csn = in->descr->copyswap;\n out_csn = out->descr->copyswap;\n\n\t/* If the input or output is STRING, UNICODE, or VOID */\n\t/* then getitem and setitem are used for the cast */\n\t/* and byteswapping is handled by those methods */\n\n\tinswap = !(PyArray_ISFLEXIBLE(in) || PyArray_ISNOTSWAPPED(in));\n\t\n\tinbuffer = PyDataMem_NEW(PyArray_BUFSIZE*elsize);\n\tif (inbuffer == NULL) return -1;\n\tit_in = (PyArrayIterObject *)PyArray_IterNew((PyObject *)in);\n\tif (it_in == NULL) goto exit;\n\n\tif (obuf) {\n\t\toutswap = !(PyArray_ISFLEXIBLE(out) || \\\n\t\t\t PyArray_ISNOTSWAPPED(out));\n\t\toutbuffer = PyDataMem_NEW(PyArray_BUFSIZE*oelsize);\n\t\tif (outbuffer == NULL) goto exit;\n\n\t\tit_out = (PyArrayIterObject *)PyArray_IterNew((PyObject *)out);\n\t\tif (it_out == NULL) goto exit;\n\n\t\tnels = MIN(nels, PyArray_BUFSIZE);\n\t}\n\t\n\toptr = (obuf) ? outbuffer: out->data;\n\tbptr = inbuffer;\n\tel = 0;\t\n\twhile(ncopies--) {\n\t\tindex = it_in->size;\n\t\tPyArray_ITER_RESET(it_in);\n\t\twhile(index--) {\n in_csn(bptr, it_in->dataptr, inswap, elsize);\n\t\t\tbptr += elsize;\n\t\t\tPyArray_ITER_NEXT(it_in);\n\t\t\tel += 1;\n\t\t\tif ((el == nels) || (index == 0)) {\n\t\t\t\t/* buffer filled, do cast */\n\t\t\t\t\n\t\t\t\tcastfunc(inbuffer, optr, el, in, out);\n\t\t\t\t\n\t\t\t\tif (obuf) {\n\t\t\t\t\t/* Copy from outbuffer to array */\n\t\t\t\t\tfor(i=0; idataptr,\n optr, outswap,\n oelsize);\n\t\t\t\t\t\toptr += oelsize;\n\t\t\t\t\t\tPyArray_ITER_NEXT(it_out);\n\t\t\t\t\t}\n\t\t\t\t\toptr = outbuffer;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toptr += out->itemsize * nels;\n\t\t\t\t}\n\t\t\t\tel = 0;\n\t\t\t\tbptr = inbuffer;\n\t\t\t}\n\t\t}\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(it_in);\n\tPyDataMem_FREE(inbuffer);\n\tPyDataMem_FREE(outbuffer);\t\n\tif (obuf) {\n\t\tPy_XDECREF(it_out);\n\t}\n\treturn retval;\n\n}\n\n\n/* For backward compatibility */\n\nstatic PyObject *\nPyArray_Cast(PyArrayObject *mp, int type_num) \n{\n\tPyArray_Typecode type;\n\tPyArray_Descr *descr;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\ttype.itemsize = descr->elsize;\n\ttype.type_num = descr->type_num;\n\ttype.fortran = 0;\n\t\n\treturn PyArray_CastToType(mp, &type);\n}\n\nstatic PyObject * \nPyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at) \n{\n\tPyObject *out;\n\tint ret;\n\n\tif ((mp->descr->type_num == at->type_num) && \\\n\t (at->itemsize==0 || mp->itemsize == at->itemsize) &&\n\t PyArray_ISBEHAVED_RO(mp)) {\n\t\tPy_INCREF(mp);\n\t\treturn (PyObject *)mp;\n\t}\n\t\t\n\tif (at->itemsize == 0) {\n\t\tif (mp->descr->type_num == PyArray_STRING &&\t\\\n\t\t at->type_num == PyArray_UNICODE)\n\t\t\tat->itemsize = mp->itemsize*sizeof(Py_UNICODE);\n\t\tif (mp->descr->type_num == PyArray_UNICODE &&\n\t\t at->type_num == PyArray_STRING) \n\t\t\tat->itemsize = mp->itemsize/sizeof(Py_UNICODE);\n\t\tif (at->type_num == PyArray_VOID)\n\t\t\tat->itemsize = mp->itemsize;\n\t}\n\n\tout = PyArray_New(mp->ob_type, mp->nd, \n\t\t\t mp->dimensions, \n\t\t\t at->type_num,\n\t\t\t NULL, NULL, at->itemsize, \n\t\t\t at->fortran, (PyObject *)mp);\n\tif (out == NULL) return NULL;\n\tret = PyArray_CastTo((PyArrayObject *)out, mp);\n\tif (ret != -1) return out;\n\n\tPy_DECREF(out);\n\treturn NULL;\n\t\n}\n\t \n/* The number of elements in out must be an integer multiple\n of the number of elements in mp. \n*/\n\nstatic int\nPyArray_CastTo(PyArrayObject *out, PyArrayObject *mp)\n{\n\n\tint simple;\n\tintp mpsize = PyArray_SIZE(mp);\n\tintp outsize = PyArray_SIZE(out);\n\n\tif (mpsize == 0) return 0;\n\tif (!PyArray_ISWRITEABLE(out)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array is not writeable.\");\n\t\treturn -1;\n\t}\n\tif (outsize % mpsize != 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array must have an integer-multiple\"\\\n\t\t\t\t\" of the number of elements in the input \"\\\n\t\t\t\t\"array\");\n\t\treturn -1; \n\t}\n\n\tsimple = ((PyArray_ISCARRAY(mp) && PyArray_ISCARRAY(out)) || \\\n (PyArray_ISFARRAY(mp) && PyArray_ISFARRAY(out)));\n\t\n\tif (simple) {\n\t\tchar *inptr;\n\t\tchar *optr = out->data;\n\t\tintp obytes = out->itemsize * outsize;\n\t\tintp ncopies = outsize / mpsize;\n\n\t\twhile(ncopies--) {\n\t\t\tinptr = mp->data;\n\t\t\tmp->descr->cast[out->descr->type_num](inptr, \n\t\t\t\t\t\t\t optr,\n\t\t\t\t\t\t\t mpsize,\n\t\t\t\t\t\t\t mp, out);\n\t\t\toptr += obytes;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t/* If not a well-behaved cast, then use buffers */\n\tif (_bufferedcast(out, mp) == -1) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nstatic PyObject *\narray_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags) \n{\n\t\n\tPyArrayObject *ret=NULL;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\tint copy = 0;\n\tint arrflags;\n\tPyArray_Typecode oldtype={PyArray_TYPE(arr),PyArray_ITEMSIZE(arr),0};\n\tchar *msg = \"Cannot copy-back to a read-only array.\";\n\t\n\tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n\tif (itemsize == 0) itemsize = arr->itemsize;\n\ttypecode->type_num = type;\n\ttypecode->itemsize = itemsize;\n\n\t/* Don't copy if sizes are compatible */\n\tif (PyArray_EquivalentTypes(&oldtype, typecode)) {\n\t\tarrflags = arr->flags;\n\n\t\tcopy = (flags & ENSURECOPY) || \\\n\t\t\t((flags & CONTIGUOUS) && (!(arrflags & CONTIGUOUS))) \\\n\t\t\t|| (PyArray_ITEMSIZE(arr) != itemsize) || \\\n\t\t\t((flags & ALIGNED) && (!(arrflags & ALIGNED))) || \\\n\t\t\t((flags & NOTSWAPPED) && (!(arrflags & NOTSWAPPED))) \\\n\t\t\t|| (arr->nd > 1 &&\t\t\t\t\\\n\t\t\t ((flags & FORTRAN) != (arrflags & FORTRAN))) || \\\n\t\t\t((flags & WRITEABLE) && (!(arrflags & WRITEABLE)));\n\t\t\n\t\tif (copy) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_New(arr->ob_type, \n\t\t\t\t\t arr->nd, \n\t\t\t\t\t arr->dimensions,\n\t\t\t\t\t arr->descr->type_num,\n\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t itemsize,\n\t\t\t\t\t flags & FORTRAN,\n\t\t\t\t\t (PyObject *)arr);\n\t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t} \n\t\t/* If no copy then just increase the reference\n\t\t count and return the input */\n\t\telse { \n\t\t\tPy_INCREF(arr);\n\t\t\tret = arr;\n\t\t}\n\t}\n\t\n\t/* The desired output type is different than the input\n\t array type */\n\telse {\n\t\t/* Cast to the desired type if we can do it safely\n\t\t Also cast if source is a ndim-0 array to mimic\n\t\t behavior with Python scalars */\n\t\tif (flags & FORCECAST || PyArray_NDIM(arr)==0 ||\n\t\t PyArray_CanCastSafely(PyArray_TYPE(arr), type)) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_CastToType(arr, typecode);\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Array can not be safely cast \"\\\n\t\t\t\t\t\"to required type\");\n\t\t\tret = NULL;\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic int\n_array_typecode_fromstr(char *str, int *swap, PyArray_Typecode *type)\n{\n int type_num;\n char typechar;\n int size;\n unsigned long number = 1;\n char *s;\n char msg[] = \"unsupported typestring\";\n \n s = (char *)&number; /* s[0] == 0 implies big-endian */\n\n *swap = 0;\n\n if (str[0] == '<' || str[0] == '>') {\n\tif ((str[0] == '<') && (s[0] == 0)) *swap = 1;\n\telse if ((str[0] == '>') && (s[0] != 0)) *swap = 1;\n }\n str += 1;\n \n#define _MY_FAIL {\t\t\t\t \\\n\t PyErr_SetString(PyExc_ValueError, msg); \\\n\t return -1;\t\t\t \\\n }\t\t\n\n typechar = str[0];\n size = atoi(str + 1);\n switch (typechar) {\n case 'b':\n\t if (size == sizeof(Bool))\n\t\t type_num = PyArray_BOOL;\t \n\t else _MY_FAIL \n\t break;\t\t \n case 'u':\n if (size == sizeof(uintp))\n type_num = PyArray_UINTP;\n\t else if (size == sizeof(char))\n\t\t type_num = PyArray_UBYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_USHORT;\n\t else if (size == sizeof(int)) \n\t\t type_num = PyArray_UINT;\n\t else if (size == sizeof(ulong)) \n\t\t type_num = PyArray_ULONG;\n\t else if (size == sizeof(ulonglong))\n\t\t type_num = PyArray_ULONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'i':\n if (size == sizeof(intp))\n type_num = PyArray_INTP;\n\t else if (size == sizeof(char)) \n\t\t type_num = PyArray_BYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_SHORT;\n\t else if (size == sizeof(int))\n\t\t type_num = PyArray_INT;\n\t else if (size == sizeof(long)) \n\t\t type_num = PyArray_LONG;\n\t else if (size == sizeof(longlong))\n\t\t type_num = PyArray_LONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'f':\n\t if (size == sizeof(float))\n\t\t type_num = PyArray_FLOAT;\n\t else if (size == sizeof(double))\n\t\t type_num = PyArray_DOUBLE;\n\t else if (size == sizeof(longdouble))\n\t\t type_num = PyArray_LONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'c':\n\t if (size == sizeof(float)*2)\n\t\t type_num = PyArray_CFLOAT;\n\t else if (size == sizeof(double)*2)\n\t\t type_num = PyArray_CDOUBLE;\n\t else if (size == sizeof(longdouble)*2)\n\t\t type_num = PyArray_CLONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'O':\n\t if (size == sizeof(PyObject *))\n\t\t type_num = PyArray_OBJECT;\n\t else _MY_FAIL\n\t break;\n case 'S':\n\t type_num = PyArray_STRING;\n\t break;\n case 'U':\n\t type_num = PyArray_UNICODE;\n\t size *= sizeof(Py_UNICODE);\n\t break;\t \n case 'V':\n\t type_num = PyArray_VOID;\n\t break;\n default:\n\t _MY_FAIL\n }\n\n#undef _MY_FAIL\n\n type->type_num = type_num;\n type->itemsize = size;\n type->fortran = 0;\n return 0;\n}\n\nstatic PyObject *\narray_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n{\n\tPyObject *attr=NULL, *item=NULL, *r;\n\tPyArrayObject *ret=NULL;\n\tPyArray_Typecode type;\n\tchar *data;\n\tint buffer_len;\n\tint res, i, n;\n\tintp dims[MAX_DIMS], strides[MAX_DIMS];\n\tint swap;\n\n\t/* Get the memory from __array_data__ and __array_offset__ */\n\t/* Get the shape */\n\t/* Get the typestring -- ignore array_descr */\n\t/* Get the strides */\n\t\n\tattr = PyObject_GetAttrString(input, \"__array_data__\");\n\tif (attr == NULL) {\n\t\tPy_INCREF(input);\n\t\tattr = input;\n\t}\n\t\n\tres = PyObject_AsWriteBuffer(attr, (void **)&data, &buffer_len);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n\n\tattr = PyObject_GetAttrString(input, \"__array_typestr__\");\n\tif (!PyString_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_typestr__ must be a string.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\t\n\t}\n\tres = _array_typecode_fromstr(PyString_AS_STRING(attr), &swap, &type);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n \n\tattr = PyObject_GetAttrString(input, \"__array_shape__\");\n\tif (!PyTuple_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_shape__ must be a tuple.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\n\t}\n\tn = PyTuple_GET_SIZE(attr);\n\tfor (i=0; ibase = input;\n \n\tattr = PyObject_GetAttrString(input, \"__array_strides__\");\n\tif (attr != NULL && attr != Py_None) {\n\t\tif (!PyTuple_Check(attr)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"__array_strides__ must be a tuple.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tif (n != PyTuple_GET_SIZE(attr)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"mismatch in length of \"\\\n\t\t\t\t\t\"__array_strides__ and \"\\\n\t\t\t\t\t\"__array_shape__.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tfor (i=0; istrides, strides, n*sizeof(intp));\n\t}\n\n\tif (swap) {\n\t\tPyObject *tmp;\n\t\ttmp = PyObject_CallMethod((PyObject *)ret, \"byteswap\", \"\");\n\t\tPy_DECREF(tmp);\n\t}\n\n\tPyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);\n\tr = array_fromarray(ret, intype, flags);\n\tPy_DECREF(ret);\n\treturn r;\n}\n\nstatic PyObject *\narray_fromattr(PyObject *op, PyArray_Typecode *typecode, int flags) \n{\n PyObject *new, *r;\n\t \n if (typecode->type_num == PyArray_NOTYPE) {\n new = PyObject_CallMethod(op, \"__array__\", NULL);\n } else {\n new = PyObject_CallMethod(op, \"__array__\", \"i\", \n typecode->type_num);\n }\n if (new == NULL) return NULL;\n if (!PyArray_Check(new)) {\n PyErr_SetString(PyExc_ValueError, \n \"object __array__ method not \" \\\n \"producing an array.\");\n Py_DECREF(new);\n return NULL;\n }\n r = array_fromarray((PyArrayObject *)new, typecode, flags);\n Py_DECREF(new);\n return r;\n} \n\n\nstatic PyObject *\narray_fromobject(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth, int flags) \n{\n /* This is the main code to make a NumPy array from a Python\n Object. It is called from lot's of different places which\n is why there are so many checks. The comments try to\n explain some of the checks. */\n\n\tint type = typecode->type_num;\n PyObject *r=NULL;\n\n\t/* Is input object already an array? */\n\t/* This is where the flags are used */\n if (PyArray_Check(op)) \n\t\tr = array_fromarray((PyArrayObject *)op, typecode, flags);\n\telse if (PyObject_HasAttrString(op, \"__array__\")) {\n\t\t/* Code that returns the object to convert for a non\n\t\t multiarray input object from the __array__ attribute of the\n\t\t object. */\n r = array_fromattr(op, typecode, flags);\n\t}\n\telse if (PyObject_HasAttrString(op, \"__array_shape__\") &&\n\t\t PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tr = array_frominterface(op, typecode, flags);\n\t}\n\telse {\n\t\tif (type == PyArray_NOTYPE) {\n\t\t\t_array_find_type(op, NULL, typecode, MAX_DIMS);\n\t\t}\n\t\tif (PySequence_Check(op))\n\t\t\tr = Array_FromSequence(op, typecode, \n\t\t\t\t\t min_depth, max_depth);\n\t\telse\n\t\t\tr = Array_FromScalar(op, typecode);\n\t}\n\n /* If we didn't succed return NULL */\n if (r == NULL) return NULL;\n\t\n\t/* Be sure we succeed here */\n\t\n if(!PyArray_Check(r)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Internal error array_fromobject \"\\\n\t\t\t\t\"not producing an array\");\n\t\tPy_DECREF(r);\n return NULL;\n }\n\n if (min_depth != 0 && ((PyArrayObject *)r)->nd < min_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object of too small depth for desired array\");\n return NULL;\n }\n if (max_depth != 0 && ((PyArrayObject *)r)->nd > max_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object too deep for desired array\");\n return NULL;\n }\n return r;\n}\n\nstatic void\nPyArray_ArrayType(PyObject *op, PyArray_Typecode *intype, \n\t\t PyArray_Typecode *outtype) \n{\n\t_array_find_type(op, intype, outtype, MAX_DIMS);\n\treturn;\n}\n\nstatic int \nPyArray_ObjectType(PyObject *op, int minimum_type) \n{\n\tPyArray_Typecode intype, outtype;\n\tintype.type_num = minimum_type;\n\t_array_find_type(op, &intype, &outtype, MAX_DIMS);\n\treturn outtype.type_num;\n}\n\n\n\n/* flags is any of \n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough\n to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, and WRITEABLE\n and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, the returned array will be a copy of the object, \n (C) contiguous in memory, aligned, notswapped, and writeable.\n \n So CONTIGUOUS | ENSURECOPY passed in means that the returned\n array does not have to be CONTIGUOUS or a COPY but should be\n ALIGNED, NOTSWAPPED and WRITEABLE. \n\n typecode->fortran can be set to request a\n fortran-contiguous array. Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n*/\n\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n{\n \tPyArray_Typecode mine = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode *type;\n\t\n\tif (typecode == NULL) type = &mine;\n\telse type = typecode;\n\t\t\n\tif (requires & ENSURECOPY) {\n\t\trequires |= DEFAULT_FLAGS;\n\t}\n\t/* Ensure that type->fortran and flags & FORTRAN are the\n\t same */\n\tif (requires & FORTRAN) typecode->fortran = 1;\n\tif (type->fortran == 1) {\n\t\trequires |= FARRAY_FLAGS;\n\t\tif (min_depth > 2) requires &= ~CONTIGUOUS;\n\t}\n\n\t/* make sure itemsize is not 0 unless warranted. */\n\tif ((type->itemsize == 0) && (type->type_num != PyArray_NOTYPE)) {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type->type_num);\n\t\tif (descr != NULL) type->itemsize = descr->elsize;\n\t\telse return NULL;\n\t}\n\t\n\treturn array_fromobject(op, type, min_depth, max_depth, \n\t\t\t\trequires);\t\n}\n\n/* This is a quick wrapper around PyArray_FromAny(op, NULL, 0, 0, 0) */\n/* that special cases Arrays and PyArray_Scalars up front */\n/* It steals a reference to the object */\n\n/* Because it decrefs op if any conversion needs to take place \n -- so it can be used like PyArray_EnsureArray(some_function(...)) */\n\nstatic PyObject *\nPyArray_EnsureArray(PyObject *op)\n{\n PyObject *new;\n\n if (op == NULL) return NULL;\n\n if (PyArray_Check(op)) return op;\n\n if (PyArray_IsScalar(op, Generic)) {\n new = PyArray_FromScalar(op, NULL);\n Py_DECREF(op);\n return new;\n }\n new = PyArray_FromAny(op, NULL, 0, 0, 0);\n Py_DECREF(op);\n return new;\n}\n\n/* These are all compressed into a single API */\n/* Deprecated calls -- Use PyArray_FromAny */\n\nstatic PyObject *\nPyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, BEHAVED_FLAGS);\n}\n\nstatic PyObject *\nPyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n\t\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, DEFAULT_FLAGS);\n}\n\nstatic PyObject *\nPyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n\t\t\t ENSURECOPY);\n}\n\n/* End of deprecated */\n\n\nstatic int \nPyArray_CanCastSafely(int fromtype, int totype) \n{\n\tPyArray_Descr *from, *to;\n\n if (fromtype == totype) return 1;\n if (fromtype == PyArray_BOOL) return 1;\n\tif (totype == PyArray_BOOL) return 0;\n if (totype == PyArray_OBJECT || totype == PyArray_VOID) return 1;\n\tif (fromtype == PyArray_OBJECT || fromtype == PyArray_VOID) return 0;\n\n\tfrom = PyArray_DescrFromType(fromtype);\n\tto = PyArray_DescrFromType(totype);\n \n switch(fromtype) {\n case PyArray_BYTE:\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISUNSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_UBYTE:\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_FLOAT:\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\tif (PyTypeNum_ISCOMPLEX(totype)) \n\t\t\treturn ((to->elsize >> 1) >= from->elsize);\n\t\telse\n\t\t\treturn (totype > fromtype);\n case PyArray_CFLOAT:\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn (totype > fromtype);\n\tcase PyArray_STRING:\n\tcase PyArray_UNICODE:\n\t\treturn (totype > fromtype);\n default:\n return 0;\n }\n}\n\nstatic Bool\nPyArray_CanCastTo(PyArray_Typecode *from, PyArray_Typecode *to)\n{\n\tint fromtype=from->type_num;\n\tint totype=to->type_num;\n\tBool ret;\n\n\tret = (Bool) PyArray_CanCastSafely(fromtype, totype);\n\tif (ret) { /* Check String and Unicode more closely */\n\t\tif (fromtype == PyArray_STRING) {\n\t\t\tif (totype == PyArray_STRING) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t\telse if (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize * sizeof(Py_UNICODE)\\\n\t\t\t\t <= to->itemsize);\n\t\t\t}\n\t\t}\n\t\telse if (fromtype == PyArray_UNICODE) {\n\t\t\tif (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}\n\n\n\n/*********************** Element-wise Array Iterator ***********************/\n/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/\n/* and Python's array iterator ***/\n \n\nstatic PyObject *\nPyArray_IterNew(PyObject *obj)\n{\n PyArrayIterObject *it;\n\tint i, nd; \n\tPyArrayObject *ao = (PyArrayObject *)obj;\n\n if (!PyArray_Check(ao)) {\n PyErr_BadInternalCall();\n return NULL;\n }\n\n it = PyObject_GC_New(PyArrayIterObject, &PyArrayIter_Type);\n if (it == NULL)\n return NULL;\n\n\tnd = ao->nd;\n\tPyArray_UpdateFlags(ao, CONTIGUOUS);\n\tit->contiguous = 0;\n\tif PyArray_ISCONTIGUOUS(ao) it->contiguous = 1;\n Py_INCREF(ao);\n it->ao = ao;\n\tit->size = PyArray_SIZE(ao);\n\tit->nd_m1 = nd - 1;\n\tit->factors[nd-1] = 1;\n\tfor (i=0; i < nd; i++) {\n\t\tit->dims_m1[i] = it->ao->dimensions[i] - 1;\n\t\tit->strides[i] = it->ao->strides[i];\n\t\tit->backstrides[i] = it->strides[i] *\t\\\n\t\t\tit->dims_m1[i];\n\t\tif (i > 0)\n\t\t\tit->factors[nd-i-1] = it->factors[nd-i] *\t\\\n\t\t\t\tit->ao->dimensions[nd-i];\n\t}\n\tPyArray_ITER_RESET(it);\n\t\n PyObject_GC_Track(it);\n return (PyObject *)it;\n}\n\n/* Returns an array scalar holding the element desired */\n\nstatic PyObject *\narrayiter_next(PyArrayIterObject *it)\n{\n\tPyObject *ret;\n\n\tif (it->index < it->size) {\n\t\tret = PyArray_ToScalar(it->dataptr, it->ao);\n\t\tPyArray_ITER_NEXT(it);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narrayiter_dealloc(PyArrayIterObject *it)\n{\n PyObject_GC_UnTrack(it);\n Py_XDECREF(it->ao);\n PyObject_GC_Del(it);\n }\n\nstatic int\narrayiter_traverse(PyArrayIterObject *it, visitproc visit, void *arg)\n{\n if (it->ao != NULL)\n return visit((PyObject *)(it->ao), arg);\n return 0;\n}\n\n\nstatic int\niter_length(PyArrayIterObject *self) \n{\n return (int) self->size;\n}\n\n\nstatic PyObject *\niter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tint index, strides, itemsize;\n\tintp count=0;\n\tchar *dptr, *optr;\n\tPyObject *r;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn NULL;\n\t}\n\tindex = (ind->dimensions[0]);\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\t/* Get size of return array */\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0)\n\t\t\tcount++;\n\t\tdptr += strides;\n\t}\n\titemsize = self->ao->itemsize;\n\tr = PyArray_New(self->ao->ob_type, 1, &count, \n\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\titemsize, 0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\t/* Set up loop */\n\toptr = PyArray_DATA(r);\n\tindex = ind->dimensions[0];\n\tdptr = ind->data;\n\n copyswap = self->ao->descr->copyswap;\n\t/* Loop over Boolean array */\n\tswap = !(PyArray_ISNOTSWAPPED(self->ao));\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\t\toptr += itemsize;\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\nstatic PyObject *\niter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tintp num;\n\tPyObject *r;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint swap;\n\tchar *optr;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = self->ao->itemsize;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t}\n\t\n\tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n\t\t\tself->ao->descr->type_num, NULL, \n\t\t\tNULL, self->ao->itemsize, \n\t\t\t0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\toptr = PyArray_DATA(r);\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) {Py_DECREF(r); return NULL;}\n\tindex = ind_it->size;\n copyswap = PyArray_DESCR(r)->copyswap;\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif (num < 0 || num >= self->size) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\tPy_DECREF(r);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\toptr += itemsize;\n\t\tPyArray_ITER_NEXT(ind_it);\n\t}\n\tPy_DECREF(ind_it);\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\n\nstatic PyObject *\niter_subscript(PyArrayIterObject *self, PyObject *ind)\n{\n\tint i;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *r;\n\tchar *dptr;\n\tint size;\n\tPyObject *obj = NULL;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\t\t\n\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\tobj = iter_subscript(self, ind);\n\t\tPy_DECREF(ind);\n\t\treturn obj;\n\t}\n\n\t/* Tuples not accepted --- i.e. no NewAxis */\n\t/* Could implement this with adjusted strides\n\t and dimensions in iterator */\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\tPyArray_ITER_RESET(self);\n\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n\t\t\treturn PyArray_ToScalar(self->dataptr, self->ao);\n\t\t}\n\t\telse { /* empty array */\n\t\t\tintp ii = 0;\n\t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n\t\t\t\t\tself->ao->descr->type_num, NULL, \n\t\t\t\t\tNULL, self->ao->itemsize, 0,\n\t\t\t\t\t(PyObject *)self->ao);\n\t\t\treturn r;\t\t\t\n\t\t}\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) \n\t\t\tgoto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start)\n\t\tif (n_steps == SingleIndex) { /* Integer */\n\t\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn r;\n\t\t}\n\t\tsize = self->ao->itemsize;\n\t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n\t\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\t\tsize, 0, (PyObject *)self->ao);\n\t\tif (r==NULL) goto fail; \n\t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n copyswap = PyArray_DESCR(r)->copyswap;\n\t\twhile(n_steps--) {\n copyswap(dptr, self->dataptr, swap, size);\n\t\t\tfor(i=0; i< step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tdptr += size;\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer) || PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tr = iter_subscript_Bool(self, (PyArrayObject *)obj);\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tobj = new;\n\t\t\tr = iter_subscript_int(self, (PyArrayObject *)obj);\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"unsupported iterator index\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPy_DECREF(obj);\n\t\treturn r;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\n fail:\n\tPy_XDECREF(obj);\n\treturn NULL;\n\n}\n\n\nstatic int\niter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tint index, strides, itemsize;\n\tchar *dptr;\n PyArray_CopySwapFunc *copyswap;\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn -1;\n\t}\n\titemsize = self->ao->itemsize;\n\tindex = ind->dimensions[0];\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\tPyArray_ITER_RESET(self);\n\t/* Loop over Boolean array */\n copyswap = self->ao->descr->copyswap;\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(self->dataptr, val->dataptr, swap,\n itemsize);\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index==val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn 0;\n}\n\nstatic int\niter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tPyArray_Typecode typecode;\n\tintp num;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = typecode.itemsize = self->ao->itemsize;\n\ttypecode.type_num = self->ao->descr->type_num;\n copyswap = self->ao->descr->copyswap;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\treturn 0;\n\t}\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) return -1;\n\tindex = ind_it->size;\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif ((num < 0) || (num >= self->size)) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\treturn -1;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\tPyArray_ITER_NEXT(ind_it);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index == val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPy_DECREF(ind_it);\n\treturn 0;\n}\n\n\nstatic int\niter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) \n{\n\tint i;\n\tPyObject *arrval=NULL;\n\tPyArrayIterObject *val_it=NULL;\n\tPyArray_Typecode type;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint swap;\n\tint itemsize;\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *obj;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\ti = iter_ass_subscript(self, ind, val);\n\t\tPy_DECREF(ind);\n\t\treturn i;\n\t}\n\t\n\ttype.type_num = self->ao->descr->type_num;\n\titemsize = type.itemsize = self->ao->itemsize;\n\t\n\tarrval = PyArray_FromAny(val, &type, 0, 0, 0);\n\tif (arrval==NULL) return -1;\n\tval_it = (PyArrayIterObject *)PyArray_IterNew(arrval);\n\tif (val_it==NULL) goto fail;\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\n copyswap = PyArray_DESCR(arrval)->copyswap;\n\tswap = (PyArray_ISNOTSWAPPED(self->ao)!=PyArray_ISNOTSWAPPED(arrval));\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n copyswap(self->dataptr, PyArray_DATA(arrval), \n swap, itemsize);\n\t\t}\n\t\tgoto succeed;\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) goto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start);\n\t\tif (n_steps == SingleIndex) { /* Integer */\n copyswap(self->dataptr, PyArray_DATA(arrval),\n swap, itemsize);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\tgoto succeed;\n\t\t}\n\t\twhile(n_steps--) {\n copyswap(self->dataptr, val_it->dataptr,\n swap, itemsize);\n\t\t\tfor(i=0; i < step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tPyArray_ITER_NEXT(val_it);\n\t\t\tif (val_it->index == val_it->size) \n\t\t\t\tPyArray_ITER_RESET(val_it);\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\tgoto succeed;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer))\n\t\tobj = PyArray_FromScalar(ind, &indtype);\n\telse if (PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tif (iter_ass_sub_Bool(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tPy_DECREF(obj);\n\t\t\tobj = new;\n\t\t\tif (iter_ass_sub_int(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t}\n\t\telse goto fail;\n\t\tPy_DECREF(obj);\n\t\tgoto succeed;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\tgoto fail;\n\n succeed:\n\tPy_DECREF(val_it);\n\tPy_DECREF(arrval);\n\treturn 0;\n\n fail:\n\tPy_XDECREF(val_it);\n\tPy_XDECREF(arrval);\n\treturn -1;\n\t\n}\n\n\nstatic PyMappingMethods iter_as_mapping = {\n (inquiry)iter_length,\t\t /*mp_length*/\n (binaryfunc)iter_subscript,\t /*mp_subscript*/\n (objobjargproc)iter_ass_subscript,\t/*mp_ass_subscript*/\n};\n\nstatic char doc_iter_array[] = \"__array__(type=None)\\n Get array \"\\\n \"from iterator\";\n\nstatic PyObject *\niter_array(PyArrayIterObject *it, PyObject *op) \n{\n \n PyObject *r;\n intp size;\n\n /* Any argument ignored */\n\n /* Two options: \n 1) underlying array is contiguous\n -- return 1-d wrapper around it \n 2) underlying array is not contiguous\n -- make new 1-d contiguous array with updateifcopy flag set\n to copy back to the old array\n */\n\n size = PyArray_SIZE(it->ao);\n if (PyArray_ISCONTIGUOUS(it->ao)) {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n\t\t\t\tit->ao->flags,\n (PyObject *)it->ao); \n\t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, NULL, it->ao->itemsize, 0, \n (PyObject *)it->ao);\n\t\tif (r==NULL) return NULL;\n\t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n\t\t\tPy_DECREF(r); \n\t\t\treturn NULL;\n\t\t}\n PyArray_FLAGS(r) |= UPDATEIFCOPY;\n it->ao->flags &= ~WRITEABLE;\n }\n Py_INCREF(it->ao);\n PyArray_BASE(r) = (PyObject *)it->ao;\n return r;\n \n}\n\nstatic char doc_iter_copy[] = \"copy()\\n Get a copy of 1-d array\";\n\nstatic PyObject *\niter_copy(PyArrayIterObject *it, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\t\n\treturn PyArray_Flatten(it->ao, 0);\n}\n\nstatic PyMethodDef iter_methods[] = {\n /* to get array */\n {\"__array__\", (PyCFunction)iter_array, 1, doc_iter_array},\n\t{\"copy\", (PyCFunction)iter_copy, 1, doc_iter_copy},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\nstatic PyTypeObject PyArrayIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.flatiter\",\t\t /* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arrayiter_dealloc,\t\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0, \t\t\t /* tp_as_sequence */\n &iter_as_mapping, \t /* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0,\t \t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arrayiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arrayiter_next,\t\t/* tp_iternext */\n iter_methods,\t\t\t\t/* tp_methods */\n};\n\n/** END of Array Iterator **/\n\n\n\n/*********************** Subscript Array Iterator *************************\n * *\n * This object handles subscript behavior for array objects. *\n * It is an iterator object with a next method *\n * It abstracts the n-dimensional mapping behavior to make the looping *\n * code more understandable (maybe) *\n * and so that indexing can be set up ahead of time *\n */ \n\n/* This checks the args for any fancy indexing objects */\n\n#define SOBJ_NOTFANCY 0 \n#define SOBJ_ISFANCY 1\n#define SOBJ_BADARRAY 2\n#define SOBJ_TOOMANY 3\n#define SOBJ_LISTTUP 4\n\nstatic int\nfancy_indexing_check(PyObject *args)\n{\n\tint i, n;\n\tPyObject *obj;\n\tint retval = SOBJ_NOTFANCY;\n\n\tif (PyTuple_Check(args)) {\n\t\tn = PyTuple_GET_SIZE(args);\n\t\tif (n >= MAX_DIMS) return SOBJ_TOOMANY;\n\t\tfor (i=0; i=MAX_DIMS) return SOBJ_ISFANCY;\n\t\tfor (i=0; i SOBJ_ISFANCY) return retval;\n\t\t}\n\t}\n\n\treturn retval;\n}\n\n/* convert an indexing object to an INTP indexing array iterator\n if possible -- otherwise, it is a Slice or Ellipsis object\n and has to be interpreted on bind to a particular \n array so leave it NULL for now.\n */\nstatic int\n_convert_obj(PyObject *obj, PyArrayIterObject **iter)\n{\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tPyObject *arr;\n\n\tif (PySlice_Check(obj) || (obj == Py_Ellipsis))\n\t\t*iter = NULL;\n\telse {\n\t\tarr = PyArray_FromAny(obj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) return -1;\n\t\t*iter = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (*iter == NULL) return -1;\n\t}\n\treturn 0;\n}\n\n/* Adjust dimensionality and strides for index object iterators \n --- i.e. broadcast\n */\nstatic int\nPyArray_Broadcast(PyArrayMultiIterObject *mit)\n{\n\tint i, nd, k, j;\n\tintp tmp;\n\tPyArrayIterObject *it;\n\t\n\t/* Discover the broadcast number of dimensions */\n\tfor (i=0, nd=0; inumiter; i++) \n\t\tnd = MAX(nd, mit->iters[i]->ao->nd);\n\tmit->nd = nd;\n\n\t/* Discover the broadcast shape in each dimension */\n\tfor (i=0; idimensions[i] = 1;\n\t\tfor (j=0; jnumiter; j++) {\n\t\t\tit = mit->iters[j];\n\t\t\t/* This prepends 1 to shapes not already \n\t\t\t equal to nd */\n\t\t\tk = i + it->ao->nd - nd;\n\t\t\tif (k>=0) {\n\t\t\t\ttmp = it->ao->dimensions[k];\n\t\t\t\tif (tmp == 1) continue;\n\t\t\t\tif (mit->dimensions[i] == 1) \n\t\t\t\t\tmit->dimensions[i] = tmp;\n\t\t\t\telse if (mit->dimensions[i] != tmp) {\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\t\"index objects are \" \\\n\t\t\t\t\t\t\t\"not broadcastable \" \\\n\t\t\t\t\t\t\t\"to a single shape.\");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Reset the iterator dimensions and strides of each iterator\n\t object -- using 0 valued strides for broadcasting */\n\n\ttmp = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tmit->size = tmp;\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tit->nd_m1 = mit->nd - 1;\n\t\tit->size = tmp;\n\t\tnd = it->ao->nd;\n\t\tit->factors[mit->nd-1] = 1;\n\t\tfor (j=0; j < mit->nd; j++) {\n\t\t\tit->dims_m1[j] = mit->dimensions[j] - 1;\n\t\t\tk = j + nd - mit->nd;\n\t\t\t/* If this dimension was added or shape\n\t\t\t of underlying array was 1 */\n\t\t\tif ((k < 0) || \\\n\t\t\t it->ao->dimensions[k] != mit->dimensions[j]) {\n\t\t\t\tit->contiguous = 0;\n\t\t\t\tit->strides[j] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tit->strides[j] = it->ao->strides[k];\n\t\t\t}\n\t\t\tit->backstrides[j] = it->strides[j] *\t\\\n\t\t\t\tit->dims_m1[j];\n\t\t\tif (j > 0)\n\t\t\t\tit->factors[mit->nd-j-1] =\t\t\\\n\t\t\t\t\tit->factors[mit->nd-j] *\t\\\n\t\t\t\t\tmit->dimensions[mit->nd-j];\n\t\t}\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn 0;\n}\n\n/* Reset the map iterator to the beginning */\nstatic void\nPyArray_MapIterReset(PyArrayMapIterObject *mit)\n{\n\tint i,j; intp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index = 0;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\n\tif (mit->subspace != NULL) {\n\t\tmemcpy(coord, mit->bscoord, sizeof(intp)*mit->ait->ao->nd);\n\t\tPyArray_ITER_RESET(mit->subspace);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tj = mit->iteraxes[i];\n\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* This function needs to update the state of the map iterator\n and point mit->dataptr to the memory-location of the next object\n*/\nstatic void\nPyArray_MapIterNext(PyArrayMapIterObject *mit)\n{\n\tint i, j;\n\tintp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index += 1;\n\tif (mit->index >= mit->size) return;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\t/* Sub-space iteration */\n\tif (mit->subspace != NULL) {\n\t\tPyArray_ITER_NEXT(mit->subspace);\n\t\tif (mit->subspace->index == mit->subspace->size) {\n\t\t\t/* reset coord to coordinates of \n\t\t\t beginning of the subspace */\n\t\t\tmemcpy(coord, mit->bscoord, \n\t\t\t sizeof(intp)*mit->ait->ao->nd);\n\t\t\tPyArray_ITER_RESET(mit->subspace);\n\t\t\tfor (i=0; inumiter; i++) {\n\t\t\t\tit = mit->iters[i];\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t\tj = mit->iteraxes[i];\n\t\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t\t sizeof(intp));\n\t\t\t}\n\t\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\t}\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* Bind a mapiteration to a particular array */\n\n/* Determine if subspace iteration is necessary. If so, \n 1) Fill in mit->iteraxes\n\t 2) Create subspace iterator\n\t 3) Update nd, dimensions, and size. \n\n Subspace iteration is necessary if: arr->nd > mit->numiter\n*/\n\n/* Need to check for index-errors somewhere. \n\n Let's do it at bind time and also convert all <0 values to >0 here\n as well. \n*/\nstatic void\nPyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n{\n\tint subnd;\n\tPyObject *sub=NULL, *obj=NULL;\n\tint i, j, n, curraxis, ellipexp, noellip;\n\tPyArrayIterObject *it;\n\tintp dimsize;\n\tintp *indptr;\n\n\t/* Remove old binding if any */\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\n\tPy_XDECREF(mit->subspace);\n\tmit->subspace = NULL;\n\t\n\tsubnd = arr->nd - mit->numiter;\n\tif (subnd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Too many indices for array.\");\n\t\treturn;\n\t}\n\n\tmit->ait = (PyArrayIterObject *)PyArray_IterNew((PyObject *)arr);\n\tif (mit->ait == NULL) return;\n\n\t/* If this is just a view, then do nothing more */\n\t/* views are handled by just adjusting the strides\n\t and dimensions of the object.\n\t*/\n\t \n\tif (mit->view) return;\n\n\t/* no subspace iteration needed. Return */\n\tif (subnd == 0) {\n\t\tn = arr->nd;\n\t\tfor (i=0; iiteraxes[i] = i;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\t/* all indexing arrays have been converted to 0 \n\t therefore we can extract the subspace with a simple\n\t getitem call which will use view semantics\n\t*/\n\t\n\tsub = PyObject_GetItem((PyObject *)arr, mit->indexobj);\n\tif (sub == NULL) goto fail;\n\tmit->subspace = (PyArrayIterObject *)PyArray_IterNew(sub);\n\tif (mit->subspace == NULL) goto fail;\n\tPy_DECREF(sub);\n\n\t/* Expand dimensions of result */\n\tn = mit->subspace->ao->nd;\n\tfor (i=0; idimensions[mit->nd+i] = mit->subspace->ao->dimensions[i];\n\tmit->nd += n;\n\n\t/* Now, we still need to interpret the ellipsis and slice objects \n\t to determine which axes the indexing arrays are referring to\n\t*/\n\tn = PyTuple_GET_SIZE(mit->indexobj);\n\n\t/* The number of dimensions an ellipsis takes up */\n\tellipexp = arr->nd - n + 1;\n\t/* Now fill in iteraxes -- remember indexing arrays have been \n converted to 0's in mit->indexobj */\n\tcurraxis = 0;\n\tj = 0;\n\tnoellip = 1; /* Only expand the first ellipsis */\n\tmemset(mit->bscoord, '\\0', sizeof(intp)*arr->nd);\n\tfor (i=0; iindexobj, i);\n\t\tif (PyInt_Check(obj) || PyLong_Check(obj)) \n\t\t\tmit->iteraxes[j++] = curraxis++;\n\t\telse if (noellip && obj == Py_Ellipsis) {\n\t\t\tcurraxis += ellipexp;\n\t\t\tnoellip = 0;\n\t\t}\n\t\telse {\n\t\t\tint start=0;\n\t\t\tint stop, step;\n\t\t\t/* Should be slice object or\n\t\t\t another Ellipsis */\n\t\t\tif (obj == Py_Ellipsis) {\n\t\t\t\tmit->bscoord[curraxis] = 0;\n\t\t\t}\n\t\t\telse if (!PySlice_Check(obj) || \\\n\t\t\t\t (slice_GetIndices((PySliceObject *)obj, \n\t\t\t\t\t\t arr->dimensions[curraxis],\n\t\t\t\t\t\t &start, &stop, &step,\n\t\t\t\t\t\t &dimsize) < 0)) {\n\t\t\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t\t\t \"unexpected object \"\t\\\n\t\t\t\t\t \"(%s) in selection position %d\",\n\t\t\t\t\t obj->ob_type->tp_name, i);\n\t\t\t goto fail;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmit->bscoord[curraxis] = start;\n\t\t\t}\n\t\t\tcurraxis += 1; \n\t\t}\n\t}\n finish:\n\t/* Here check the indexes (now that we have iteraxes) */\n\tmit->size = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tPyArray_ITER_RESET(it);\n\t\tdimsize = arr->dimensions[mit->iteraxes[i]];\n\t\twhile(it->index < it->size) {\n\t\t\tindptr = ((intp *)it->dataptr);\n\t\t\tif (*indptr < 0) *indptr += dimsize;\n\t\t\tif (*indptr < 0 || *indptr >= dimsize) {\n\t\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t\t \"index (%d) out of range \"\\\n\t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n\t\t\t\t\t *indptr, dimsize-1, \n\t\t\t\t\t mit->iteraxes[i]);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn;\n\n fail:\n\tPy_XDECREF(sub);\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\treturn;\n}\n\n/* This function takes a Boolean array and constructs index objects and\n iterators as if nonzero(Bool) had been called\n*/\nstatic int\n_nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)\n{\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\tPyArrayObject *ba =NULL, *new=NULL;\n\tint nd, j;\n\tintp size, i, count;\n\tBool *ptr;\n\tintp coords[MAX_DIMS], dims_m1[MAX_DIMS];\n\tintp *dptr[MAX_DIMS];\n\n\tba = (PyArrayObject *)PyArray_FromAny(myBool, &typecode, 0, 0, \n\t\t\t\t\t CARRAY_FLAGS);\n\tif (ba == NULL) return -1;\n\tnd = ba->nd;\n\tfor (j=0; jdata;\n\tcount = 0;\n\n\t/* pre-determine how many nonzero entries there are */\n\tfor (i=0; iao->data;\n\t\tcoords[j] = 0;\n\t\tdims_m1[j] = ba->dimensions[j]-1;\n\t}\n\n\tptr = (Bool *)ba->data;\n\n\tif (count == 0) return nd;\n\n\t/* Loop through the Boolean array and copy coordinates\n\t for non-zero entries */\n\tfor (i=0; i=0; j--) {\n\t\t\tif (coords[j] < dims_m1[j]) {\n\t\t\t\tcoords[j]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcoords[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn nd;\n\n fail:\n\tfor (j=0; jiters[i] = NULL;\n \tmit->view = 0;\n \tmit->index = 0;\n \tmit->ait = NULL;\n \tmit->subspace = NULL;\n\tmit->numiter = 0;\n\tmit->consec = 1;\n\tfancy = fancy_indexing_check(indexobj);\n\tPy_INCREF(indexobj);\n\tmit->indexobj = indexobj;\n\tif (fancy == SOBJ_NOTFANCY) { /* bail out */\n\t\tmit->view = 1;\n\t\tgoto ret;\n\t}\n\n\tif (fancy == SOBJ_BADARRAY) {\n\t\tPyErr_SetString(PyExc_TypeError,\t\t\t\\\n\t\t\t\t\"Arrays used as indexes must be of \" \\\n\t\t\t\t\"integer type\");\n\t\tgoto fail;\n\t}\n\tif (fancy == SOBJ_TOOMANY) {\n\t\tPyErr_SetString(PyExc_TypeError,\"Too many indicies\");\n\t\tgoto fail;\n\t}\n\n\tif (fancy == SOBJ_LISTTUP) {\n\t\tPyObject *newobj;\n\t\tnewobj = PySequence_Tuple(indexobj);\n\t\tif (newobj == NULL) goto fail;\n\t\tPy_DECREF(indexobj);\n\t\tindexobj = newobj;\n\t\tmit->indexobj = indexobj;\n\t}\n\n#undef SOBJ_NOTFANCY \n#undef SOBJ_ISFANCY \n#undef SOBJ_BADARRAY \n#undef SOBJ_TOOMANY \n#undef SOBJ_LISTTUP \n\n\n\t/* Must have some kind of fancy indexing if we are here */\n\t/* indexobj is either a list, an arrayobject, or a tuple \n\t (with at least 1 list or arrayobject or Bool object), */\n\t\n\t/* convert all inputs to iterators */\n\tif (PyArray_Check(indexobj) &&\t\t\t\\\n\t (PyArray_TYPE(indexobj) == PyArray_BOOL)) {\n\t\tmit->numiter = _nonzero_indices(indexobj, mit->iters);\n\t\tif (mit->numiter < 0) goto fail;\n\t\tmit->nd = 1;\n\t\tmit->dimensions[0] = mit->iters[0]->dims_m1[0]+1;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = PyTuple_New(mit->numiter);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tPyTuple_SET_ITEM(mit->indexobj, i, \n\t\t\t\t\t PyInt_FromLong(0));\n\t\t}\n\t}\n\n\telse if (PyList_Check(indexobj) || PyArray_Check(indexobj)) {\n\t\tmit->numiter = 1;\n\t\tarr = PyArray_FromAny(indexobj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) goto fail;\n\t\tmit->iters[0] = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (mit->iters[0] == NULL) goto fail;\n\t\tmit->nd = PyArray_NDIM(arr);\n\t\tmemcpy(mit->dimensions,PyArray_DIMS(arr),mit->nd*sizeof(intp));\n\t\tmit->size = PyArray_SIZE(arr);\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = Py_BuildValue(\"(N)\", PyInt_FromLong(0));\n\t}\n\telse { /* must be a tuple */\n\t\tPyObject *obj;\n\t\tPyArrayIterObject *iter;\n\t\tPyObject *new;\n\t\t/* Make a copy of the tuple -- we will be replacing \n\t\t index objects with 0's */\n\t\tn = PyTuple_GET_SIZE(indexobj);\n\t\tnew = PyTuple_New(n);\n\t\tif (new == NULL) goto fail;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = new;\n\t\tstarted = 0;\n\t\tnonindex = 0;\n\t\tfor (i=0; iconsec = 0;\n\t\t\t\tmit->iters[(mit->numiter)++] = iter;\n\t\t\t\tPyTuple_SET_ITEM(new,i,\n\t\t\t\t\t\t PyInt_FromLong(0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (started) nonindex = 1;\n\t\t\t\tPy_INCREF(obj);\n\t\t\t\tPyTuple_SET_ITEM(new,i,obj);\n\t\t\t}\n\t\t}\n\t\t/* Store the number of iterators actually converted */\n\t\t/* These will be mapped to actual axes at bind time */\n\t\tif (PyArray_Broadcast((PyArrayMultiIterObject *)mit) < 0)\n\t\t\tgoto fail;\n\t}\n\n ret:\n PyObject_GC_Track(mit);\n return (PyObject *)mit;\n \n fail:\n\tPy_XDECREF(arr);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n\treturn NULL;\n}\n\n\n/* return unbound mapiter object */\n\nstatic PyObject *\narraymapiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) \n{\n\tPyObject *newtup, *res;\n\tint n;\n\n\tif (!PyTuple_Check(args)) {\n\t\tPyErr_BadInternalCall();\n\t\treturn NULL;\n\t}\n\n\tn = PyTuple_GET_SIZE(args);\n\t\n\tif (n < 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"must be initialized with >= 1 argument\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n > 1) {\n\t\tnewtup = PyTuple_GetSlice(args, 0, n);\n\t\tif (newtup == NULL) return NULL;\n\t\tres = PyArray_MapIterNew(newtup);\n\t\tPy_DECREF(newtup);\n\t}\n\telse { /* n == 1 */\n\t\tnewtup = PyTuple_GET_ITEM(args, 0);\n\t\tres = PyArray_MapIterNew(newtup);\n\t}\n\n\treturn res; \t\n}\n\n\n/* Returns a 0-dim array holding the element desired */\n\nstatic PyObject *\narraymapiter_next(PyArrayMapIterObject *mit)\n{\n\tPyObject *ret;\n\tif (mit->ait == NULL) return NULL;\n\tif (mit->view) return NULL;\n\tif (mit->index < mit->size) {\n\t\tret = PyArray_ToScalar(mit->dataptr, mit->ait->ao);\n\t\tPyArray_MapIterNext(mit);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narraymapiter_dealloc(PyArrayMapIterObject *mit)\n{\n\tint i;\n PyObject_GC_UnTrack(mit);\n Py_XDECREF(mit->ait);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n}\n\nstatic int\narraymapiter_traverse(PyArrayMapIterObject *mit, visitproc visit, void *arg)\n{\n\tint ret, i;\n if (mit->ait != NULL)\n if ((ret = visit((PyObject *)(mit->ait), arg)) != 0) \n\t\t\treturn ret;\t\n\n\tif (mit->iters != NULL) \n\t\tfor (i=0; inumiter; i++) \n\t\t\tif (mit->iters[i] != NULL) \n\t\t\t\tif ((ret=visit((PyObject *)mit->iters[i], \n\t\t\t\t\t arg)) != 0)\n\t\t\t\t\treturn ret;\n\n\tif (mit->indexobj != NULL)\n\t\tif ((ret = visit(mit->indexobj, arg)) != 0) return ret;\n\t\n return 0;\n}\n\n/* \nstatic char doc_mapiter_bind[] = \"obj.bind(a)\\n Bind an array to the \"\\\n\t\"mapiter object\";\n\nstatic PyObject *\nmapiter_bind(PyArrayMapIterObject *mit, PyObject *args)\n{\n\tPyObject *r;\n intp size, strides;\n int nd;\n\tPyArrayObject *arr;\n\n if (!PyArg_ParseTuple(args, \"O!\", &PyArray_Type, &arr)) return NULL;\n\n\tPyArray_MapIterBind(mit, arr);\n\n\tif (mit->ait == NULL) return NULL;\n\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyMethodDef mapiter_methods[] = {\n\t{\"bind\", (PyCFunction)mapiter_bind, 1, doc_mapiter_bind},\n {NULL,\t\tNULL}\t\t\n};\n*/\n\n\nstatic PyTypeObject PyArrayMapIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.mapiter\",\t\t \t/* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arraymapiter_dealloc,\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0,\t\t\t\t\t/* tp_as_sequence */\n 0,\t\t\t\t\t/* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0, \t\t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arraymapiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arraymapiter_next,\t/* tp_iternext */\n 0,\t \t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n 0,\t\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0, \t /* tp_alloc */\n (newfunc)arraymapiter_new,\t /* tp_new */\n 0,\t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n\n};\n\n/** END of Subscript Iterator **/\n\n\n\n", "source_code_before": " /*\n Provide multidimensional arrays as a basic object type in python. \n\nBased on Original Numeric implementation\nCopyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\nwith contributions from many Numeric Python developers 1995-2004 *\n\nHeavily modified in 2005 with inspiration from Numarray \n\nby\n\nTravis Oliphant\nAssistant Professor at\nBrigham Young University \n\nmaintainer email: oliphant.travis@ieee.org\n\nNumarray design (which provided guidance) by \nSpace Science Telescope Institute \n (J. Todd Miller, Perry Greenfield, Rick White)\n\n*/\n\n/* $Id: arrayobject.c,v 1.59 2005/09/14 00:14:00 teoliphant Exp $ */\n\n/*\n#include \"Python.h\"\n#include \"structmember.h\"\n\n#define _MULTIARRAYMODULE\n#include \"Numeric3/arrayobject.h\"\n*/\n\n/* Helper functions */\n\n#define error_converting(x) (((x) == -1) && PyErr_Occurred())\n\nstatic intp\nPyArray_PyIntAsIntp(PyObject *o)\n{\n\tlonglong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INTP, 0, 0};\n\tintp ret;\n\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((intp *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (longlong) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (longlong) PyLong_AsLongLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\t\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONGLONG != SIZEOF_PY_INTPTR_T)\n\tif ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C intp\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (intp) long_value;\n}\n\n\nstatic PyObject *array_int(PyArrayObject *v);\n\nstatic int\nPyArray_PyIntAsInt(PyObject *o)\n{\n\tlong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INT, 0, 0};\n\tint ret;\n\t\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((int *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (long) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (long) PyLong_AsLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONG != SIZEOF_INT)\n\tif ((long_value < INT_MIN) || (long_value > INT_MAX)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C int\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (int) long_value;\n}\n\n\nstatic double\nPyArray_GetPriority(PyObject *obj, double default_) \n{\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n\n\tif (PyArray_CheckExact(obj) || PyBigArray_CheckExact(obj)) \n\t\treturn priority;\n\n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n if (PyErr_Occurred()) {\n PyErr_Clear(); \n priority = default_;\n }\n Py_XDECREF(ret);\n return priority; \n}\n\n/* Backward compatibility only */\n/* In both Zero and One\n\n ***You must free the memory once you are done with it\n using PyDataMem_FREE(ptr) or you create a memory leak***\n\n If arr is an Object array you are getting a \n BORROWED reference to Zero or One.\n Do not DECREF.\n Please INCREF if you will be hanging on to it.\n\n The memory for the ptr still must be freed in any case;\n*/\n\nstatic char *\nPyArray_Zero(PyArrayObject *arr)\n{\n char *zeroval;\n char *buf;\n int buf_len;\n PyObject *obj, *ret;\n\n zeroval = PyDataMem_NEW(arr->itemsize);\n if (zeroval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n if (PyArray_ISOBJECT(arr)) {\n obj=PyInt_FromLong((long) 0);\n memcpy(zeroval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return zeroval;\n }\n ret = PyObject_GetAttrString((PyObject *)arr, \"_zero\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_zero not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n return NULL;\n }\n memcpy(zeroval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n memset(zeroval, 0, arr->itemsize);\n return zeroval;\n}\n\nstatic char *\nPyArray_One(PyArrayObject *arr)\n{\n char *oneval;\n char *buf;\n int buf_len, ret2;\n PyObject *obj, *ret;\n\n oneval = PyDataMem_NEW(arr->itemsize);\n if (oneval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n obj = PyInt_FromLong((long) 1);\n if (PyArray_ISOBJECT(arr)) {\n memcpy(oneval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return oneval;\n }\n \n ret = PyObject_GetAttrString((PyObject *)arr, \"_one\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_one not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n PyDataMem_FREE(oneval);\n return NULL;\n }\n memcpy(oneval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n\n ret2 = arr->descr->setitem(obj, oneval, arr);\n Py_DECREF(obj);\n if (ret < 0) {\n PyDataMem_FREE(oneval);\n return NULL;\n }\n return oneval;\n}\n\n/* End deprecated */\n\n\nstatic int \ndo_sliced_copy(char *dest, intp *dest_strides, intp *dest_dimensions,\n\t int dest_nd, char *src, intp *src_strides, \n\t intp *src_dimensions, int src_nd, int elsize, \n\t int copies) {\n intp i, j;\n\t\n if (src_nd == 0 && dest_nd == 0) {\n for(j=0; j src_nd) {\n for(i=0; i<*dest_dimensions; i++, dest += *dest_strides) {\n if (do_sliced_copy(dest, dest_strides+1, \n dest_dimensions+1, dest_nd-1,\n src, src_strides, \n src_dimensions, src_nd, \n elsize, copies) == -1) \n return -1;\n }\n return 0;\n }\n\t\n if (dest_nd == 1) {\n if (*dest_dimensions != *src_dimensions) {\n PyErr_SetString(PyExc_ValueError, \n \"matrices are not aligned for copy\");\n return -1;\n }\n for(i=0; i<*dest_dimensions; i++, src += *src_strides) {\n for(j=0; j 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize) && \n ((*src_strides)[*src_nd-1] == *elsize)) {\n if ((*dest_dimensions)[*dest_nd-1] != \n (*src_dimensions)[*src_nd-1]) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"matrices are not aligned\");\n return -1;\n }\n *elsize *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1; *src_nd-=1;\n } else {\n break;\n }\n }\n if (*src_nd == 0) {\n while (*dest_nd > 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize)) {\n *copies *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1;\n } else {\n break;\n }\n }\n }\n return 0;\n}\n\nstatic char *\ncontiguous_data(PyArrayObject *src) \n{\n intp dest_strides[MAX_DIMS], *dest_strides_ptr;\n intp *dest_dimensions=src->dimensions;\n int dest_nd=src->nd;\n intp *src_strides = src->strides;\n intp *src_dimensions=src->dimensions;\n int src_nd=src->nd;\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n intp stride=elsize;\n char *new_data;\n\t\n for(i=dest_nd-1; i>=0; i--) {\n dest_strides[i] = stride;\n stride *= dest_dimensions[i];\n }\n\t\n dest_strides_ptr = dest_strides;\n\t\n if (optimize_slices(&dest_strides_ptr, &dest_dimensions, &dest_nd,\n &src_strides, &src_dimensions, &src_nd,\n &elsize, &copies) == -1) \n return NULL;\n\t\n new_data = (char *)malloc(stride);\n\t\n ret = do_sliced_copy(new_data, dest_strides_ptr, dest_dimensions, \n dest_nd, src->data, src_strides, \n src_dimensions, src_nd, elsize, copies);\n\t\n if (ret != -1) { return new_data; }\n else { free(new_data); return NULL; }\n}\n\n/* end Helper functions */\n\n\nstatic PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n int, intp *, char *, int, int, PyArrayObject *);\n\n/* C-API functions */\n\n/* Used for arrays of python objects to increment the reference count of */\n/* every python object in the array. */\nstatic int \nPyArray_INCREF(PyArrayObject *mp) \n{\n\tintp i, n;\n\n PyObject **data, **data2;\n\t\n if (mp->descr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data;\n for(i=0; idescr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data; \n for(i=0; i 0; n--, a += 1) {\n b = a + 1;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 4:\n for (a = (char*)p ; n > 0; n--, a += 2) {\n b = a + 3;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 8:\n for (a = (char*)p ; n > 0; n--, a += 4) {\n b = a + 7;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n default:\n m = size / 2;\n for (a = (char *)p ; n > 0; n--, a += m) {\n b = a + (size-1);\n for (j=0; j 1, then dst must be contiguous */\nstatic void\ncopy_and_swap(void *dst, void *src, int itemsize, intp numitems,\n intp srcstrides, int swap) \n{\n int i;\n char *s1 = (char *)src;\n char *d1 = (char *)dst;\n \n\n if ((numitems == 1) || (itemsize == srcstrides)) \n memcpy(d1, s1, itemsize*numitems);\n else { \n for (i = 0; i < numitems; i++) {\n memcpy(d1, s1, itemsize);\n d1 += itemsize;\n s1 += srcstrides;\n } \n }\n\n if (swap)\n byte_swap_vector(d1, numitems, itemsize);\n}\n\n\n/* Computer-generated arraytype and scalartype code */\n#include \"scalartypes.inc\"\n#include \"arraytypes.inc\"\n\nstatic char *\nindex2ptr(PyArrayObject *mp, int i) \n{\n\tif (i==0 && (mp->nd == 0 || mp->dimensions[0] > 0)) \n\t\treturn mp->data;\n\t\n if (mp->nd>0 && i>0 && i < mp->dimensions[0]) {\n return mp->data+i*mp->strides[0];\n }\n PyErr_SetString(PyExc_IndexError,\"index out of bounds\");\n return NULL;\n}\n\nstatic intp \nPyArray_Size(PyObject *op) \n{\n if (PyArray_Check(op)) {\n return PyArray_SIZE((PyArrayObject *)op);\n } \n\telse {\n return 0;\n }\n}\n\n/* If destination is not the right type, then src \n will be cast to destination. \n*/\n\n/* Does a flat iterator-based copy. \n\n The arrays are assumed to have the same number of elements\n They can be different sizes and have different types however. \n*/\n\nstatic int\nPyArray_CopyInto(PyArrayObject *dest, PyArrayObject *src)\n{\n intp dsize, ssize, sbytes;\n\tint ncopies, elsize, index;\n PyArrayIterObject *dit=NULL;\n PyArrayIterObject *sit=NULL;\n\tchar *dptr;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n PyArray_CopySwapNFunc *copyswapn;\n \n if (!PyArray_ISWRITEABLE(dest)) {\n PyErr_SetString(PyExc_RuntimeError, \n \"Cannot write to array.\");\n return -1;\n }\n\n if (!PyArray_EquivArrTypes(dest, src)) {\n return PyArray_CastTo(dest, src);\n }\n\n dsize = PyArray_SIZE(dest);\n ssize = PyArray_SIZE(src);\n\tif (ssize == 0) return 0;\n if (dsize % ssize != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Destination number of elements must be\"\\\n \"an integer multiple of the source number of\"\\\n \"elements.\");\n return -1;\n }\n ncopies = dsize / ssize;\n\n\tswap = PyArray_ISNOTSWAPPED(dest) != PyArray_ISNOTSWAPPED(src);\n\tcopyswap = dest->descr->copyswap;\n\tcopyswapn = dest->descr->copyswapn;\n\n elsize = dest->itemsize;\n\n if ((PyArray_ISCONTIGUOUS(dest) && PyArray_ISCONTIGUOUS(src)) \\\n\t || (PyArray_ISFORTRAN(dest) && PyArray_ISFORTRAN(src))) {\n \n PyArray_XDECREF(dest);\n dptr = dest->data;\n sbytes = ssize * src->itemsize;\n while(ncopies--) {\n memmove(dptr, src->data, sbytes);\n dptr += sbytes;\n }\n\t\tif (swap)\n\t\t\tcopyswapn(dest->data, NULL, dsize, 1, elsize);\n PyArray_INCREF(dest);\n return 0;\n }\n\n dit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)dest);\n sit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)src);\n\n if ((dit == NULL) || (sit == NULL)) {\n Py_XDECREF(dit);\n Py_XDECREF(sit);\n return -1;\n }\n\n PyArray_XDECREF(dest);\n while(ncopies--) {\n index = ssize;\n while(index--) {\n memmove(dit->dataptr, sit->dataptr, elsize);\n\t\t\tif (swap)\n\t\t\t\tcopyswap(dit->dataptr, NULL, 1, elsize);\n PyArray_ITER_NEXT(dit);\n PyArray_ITER_NEXT(sit);\n }\n PyArray_ITER_RESET(sit);\n } \n PyArray_INCREF(dest);\n Py_DECREF(dit);\n Py_DECREF(sit);\n\treturn 0;\n}\n\n\nstatic int \nPyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) \n{\n PyArrayObject *src;\n int ret;\n\tPyArray_Typecode typecode = {dest->descr->type_num, \n\t\t\t\t dest->itemsize, \n\t\t\t\t PyArray_ISFORTRAN(dest)};\n\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n\t\t\t\t\t &typecode, 0,\n\t\t\t\t\t dest->nd, 0);\n if (src == NULL) return -1;\n\n ret = PyArray_CopyInto(dest, src);\n Py_DECREF(src);\n return ret;\n}\n\n\n/* These are also old calls (should use PyArray_New) */\n\n/* They all zero-out the memory as previously done */\n\nstatic PyObject *\nPyArray_FromDimsAndDataAndDescr(int nd, int *d, \n PyArray_Descr *descr,\n char *data) {\n\tPyObject *ret;\n\n#if SIZEOF_INTP != SIZEOF_INT\n\tint i;\n\tintp newd[MAX_DIMS];\n\t\n\tfor (i=0; itype_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#else\n\tret = PyArray_New(&PyArray_Type, nd, (intp *)d, \n descr->type_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#endif\n\tif (descr->type_num != PyArray_OBJECT)\n\t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_FromDimsAndData(int nd, int *d, int type, char *data) \n{\n\tPyObject *ret;\n#if SIZEOF_INTP != SIZEOF_INT\n\tintp newd[MAX_DIMS];\n\tint i;\t\n\tfor (i=0; iob_type, m1->nd, \n\t\t\t\t\t m1->dimensions,\n\t\t\t\t\t m1->descr->type_num,\n\t\t\t\t\t NULL, NULL, m1->itemsize,\n\t\t\t\t\t 0, m1);\n\t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n\t\n return (PyObject *)ret;\n}\n\n\nstatic PyObject *array_item(PyArrayObject *, int);\n\nstatic PyObject *\nPyArray_Scalar(char *data, int type_num, int itemsize, int swap)\n{\n PyArray_Descr *descr;\n\tPyTypeObject *type;\n\tPyObject *obj;\t\n\tchar *destptr;\n PyArray_CopySwapFunc *copyswap;\n\n descr = PyArray_DescrFromType(type_num);\n if (descr == NULL) return NULL;\n type = descr->typeobj;\n copyswap = descr->copyswap;\n\tif (type_num == PyArray_STRING) \n\t\tobj = type->tp_alloc(type, itemsize);\n\telse\n\t\tobj = type->tp_alloc(type, 0);\n\tif (obj == NULL) return NULL;\n\tif PyTypeNum_ISFLEXIBLE(type_num) { \n\t\tif (type_num == PyArray_STRING) {\n\t\t\tdestptr = PyString_AS_STRING(obj);\n\t\t\t((PyStringObject *)obj)->ob_shash = -1;\n\t\t\t((PyStringObject *)obj)->ob_sstate =\t\\\n\t\t\t\tSSTATE_NOT_INTERNED; \n\t\t}\n\t\telse {\n\t\t\tdestptr = PyDataMem_NEW(itemsize);\n\t\t\tif (destptr == NULL) {\n\t\t\t\tPyObject_Del(obj);\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tif (type_num == PyArray_UNICODE) {\n\t\t\t\tPyUnicode_AS_UNICODE(obj) = \\\n\t\t\t\t\t(Py_UNICODE *)destptr;\n\t\t\t\t((PyUnicodeObject*)obj)->length = itemsize / \\\n\t\t\t\t\tsizeof(Py_UNICODE);\n\t\t\t\t((PyUnicodeObject*)obj)->hash = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t((PyVoidScalarObject *)obj)->obval = destptr;\n\t\t\t\t((PyVoidScalarObject *)obj)->ob_size = itemsize;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tdestptr = &(((PyScalarObject*)obj)->obval);\n\t}\n\t/* copyswap for OBJECT increments the reference count */\n copyswap(destptr, data, swap, itemsize);\n\treturn obj;\n}\n\n/* returns an Array-Scalar Object of the type of arr\n from the given pointer to memory -- main Scalar creation function\n default new method calls this. \n*/\nstatic PyObject *\nPyArray_ToScalar(char *data, PyArrayObject *arr)\n{\n\tint type_num = arr->descr->type_num;\n\tint itemsize = arr->itemsize;\n int swap = !(PyArray_ISNOTSWAPPED(arr));\n\n\treturn PyArray_Scalar(data, type_num, itemsize, swap);\n}\n\n\n/* Return Python scalar if 0-d array object is encountered */\n\nstatic PyObject *\nPyArray_Return(PyArrayObject *mp) \n{\n \n\tif (mp == NULL) return NULL;\n\n if (PyErr_Occurred()) {\n Py_XDECREF(mp);\n return NULL;\n }\n\n\tif (PyArray_Check((PyObject *)mp) && mp->nd == 0) {\n\t\tPyObject *ret;\n\t\tret = PyArray_ToScalar(mp->data, mp);\n\t\tPy_DECREF(mp);\n\t\treturn ret;\n\t}\n\telse {\n\t\treturn (PyObject *)mp;\n\t}\n}\n\n/*\n returns typenum to associate with this type >=PyArray_USERDEF.\n Also creates a copy of the VOID_DESCR table inserting it's typeobject in\n and it's typenum in the appropriate place.\n \n needs the userdecrs table and PyArray_NUMUSER variables\n defined in arratypes.inc\n*/\nstatic int \nPyArray_RegisterDataType(PyTypeObject *type)\n{\n\tPyArray_Descr *descr;\n\tint typenum;\n\tint i;\n\t\n\tif ((type == &PyVoidArrType_Type) ||\t\t\t\\\n\t !PyType_IsSubtype(type, &PyVoidArrType_Type)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can only register void subtypes.\");\n\t\treturn -1;\n\t}\n\t/* See if this type is already registered */\n\tfor (i=0; itypeobj == type)\n\t\t\treturn descr->type_num;\n\t}\n\tdescr = malloc(sizeof(PyArray_Descr));\n\tmemcpy(descr, PyArray_DescrFromType(PyArray_VOID), \n\t sizeof(PyArray_Descr));\n\ttypenum = PyArray_USERDEF + PyArray_NUMUSERTYPES;\n\tdescr->type_num = typenum;\n\tdescr->typeobj = type;\n\tuserdescrs = realloc(userdescrs, \n\t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n\tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n\treturn typenum;\n}\n\n\n/* \n copyies over from the old descr table for anything\n NULL or zero in what is given. \n frees the copy of the Descr_table already there.\n places a pointer to the new one into the slot.\n*/\nstatic int\nPyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n{\n\tPyArray_Descr *old;\n\tint i;\n\n\tif (!PyArray_ISUSERDEF(typenum)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Data type not registered.\");\n\t\treturn -1;\n\t}\n\told = userdescrs[typenum-PyArray_USERDEF];\n\tdescr->typeobj = old->typeobj;\n\tdescr->type_num = typenum;\n\n#define _NULL_CHECK(member) \\\n\tif (descr->member == NULL) descr->member = old->member\n\n\tfor (i=0; imember == 0) descr->member = old->member\n\n\t_ZERO_CHECK(kind);\n\t_ZERO_CHECK(type);\n\t_ZERO_CHECK(elsize);\n\t_ZERO_CHECK(alignment);\n#undef _ZERO_CHECK\n\n\tfree(old);\n\tuserdescrs[typenum-PyArray_USERDEF] = descr;\n\treturn 0;\n}\n\n\nstatic int\nPyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) \n{\n intp size;\n intp n, n2;\n int n3, n4;\n PyArrayIterObject *it;\n PyObject *obj, *strobj, *tupobj;\n\n n3 = strlen((const char *)sep);\n if (n3 == 0) { /* binary data */\n if (PyArray_ISOBJECT(self)) {\n PyErr_SetString(PyExc_ValueError, \"Cannot write \"\\\n\t\t\t\t\t\"object arrays to a file in \"\\\n\t\t\t\t\t\"binary mode.\");\n return -1;\n }\n\n if (PyArray_ISCONTIGUOUS(self)) {\n size = PyArray_SIZE(self);\n if ((n=fwrite((const void *)self->data, \n (size_t) self->itemsize,\n (size_t) size, fp)) < size) {\n PyErr_Format(PyExc_ValueError, \n \"%ld requested and %ld written\",\n (long) size, (long) n);\n return -1;\n }\n }\n else {\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n while(it->index < it->size) {\n if (fwrite((const void *)it->dataptr, \n (size_t) self->itemsize,\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n \" %d to file\", it->index);\n Py_DECREF(it);\n return -1;\n }\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n } \n }\n else { /* text data */\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n\t\tn4 = strlen((const char *)format);\n while(it->index < it->size) {\n obj = self->descr->getitem(it->dataptr, self);\n if (obj == NULL) {Py_DECREF(it); return -1;}\n\t\t\tif (n4 == 0) { /* standard writing */\n\t\t\t\tstrobj = PyObject_Str(obj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n\t\t\telse { /* use format string */\n\t\t\t\ttupobj = PyTuple_New(1);\n\t\t\t\tif (tupobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t\tPyTuple_SET_ITEM(tupobj,0,obj);\n\t\t\t\tobj = PyString_FromString((const char *)format);\n\t\t\t\tif (obj == NULL) {Py_DECREF(tupobj); \n\t\t\t\t\tPy_DECREF(it); return -1;}\n\t\t\t\tstrobj = PyString_Format(obj, tupobj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tPy_DECREF(tupobj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n if ((n=fwrite(PyString_AS_STRING(strobj), \n 1, n2=PyString_GET_SIZE(strobj),\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n \" to file\", it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n }\n /* write separator for all but last one */\n if (it->index != it->size-1) \n fwrite(sep, 1, n3, fp);\n Py_DECREF(strobj);\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n return 0;\n}\n\nstatic PyObject *\nPyArray_ToList(PyArrayObject *self) \n{\n PyObject *lp;\n PyArrayObject *v;\n intp sz, i;\n\t\n if (!PyArray_Check(self)) return (PyObject *)self;\n\n if (self->nd == 0) \n\t\treturn self->descr->getitem(self->data,self);\n\t\n sz = self->dimensions[0];\n lp = PyList_New(sz);\n\t\n for (i=0; ind >= self->nd) {\n\t\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\t\"array_item not returning smaller\" \\\n\t\t\t\t\t\" dimensional array\");\n\t\t\tPy_DECREF(lp);\n\t\t\treturn NULL;\n\t\t}\n PyList_SetItem(lp, i, PyArray_ToList(v));\n\t\tPy_DECREF(v);\n }\n\t\n return lp;\n}\n\nstatic PyObject *\nPyArray_ToString(PyArrayObject *self)\n{\n intp numbytes;\n intp index;\n char *dptr;\n int elsize;\n PyObject *ret;\n PyArrayIterObject *it;\n \n if (PyArray_TYPE(self) == PyArray_OBJECT) {\n PyErr_SetString(PyExc_ValueError, \"a string for the data\"\\\n\t\t\t\t\"in an object array is not appropriate.\");\n return NULL;\n }\n\n numbytes = PyArray_NBYTES(self);\n if (PyArray_ISONESEGMENT(self)) {\n ret = PyString_FromStringAndSize(self->data, (int) numbytes);\n }\n else {\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it==NULL) return NULL;\n ret = PyString_FromStringAndSize(NULL, (int) numbytes);\n if (ret == NULL) {Py_DECREF(it); return NULL;}\n dptr = PyString_AS_STRING(ret);\n index = it->size;\n elsize = self->itemsize;\n while(index--) {\n memcpy(dptr, it->dataptr, elsize);\n dptr += elsize;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n\treturn ret;\n}\n\n\n/*********************** end C-API functions **********************/\n\n\n/* array object functions */\n\nstatic void \narray_dealloc(PyArrayObject *self) {\n\n if (self->weakreflist != NULL)\n PyObject_ClearWeakRefs((PyObject *)self);\n\n if(self->base) {\n\t\t/* UPDATEIFCOPY means that base points to an \n\t\t array that should be updated with the contents\n\t\t of this array upon destruction.\n self->base->flags must have been WRITEABLE \n (checked previously) and it was locked here\n thus, unlock it.\n\t\t*/\n\t\tif (self->flags & UPDATEIFCOPY) {\n ((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tPy_INCREF(self); /* hold on to self in next call */\n PyArray_CopyInto((PyArrayObject *)self->base, self);\n\t\t\t/* Don't need to DECREF -- because we are deleting\n\t\t\t self already... */\n\t\t}\n\t\t/* In any case base is pointing to something that we need\n\t\t to DECREF -- either a view or a buffer object */\n Py_DECREF(self->base);\n }\n \n if ((self->flags & OWN_DATA) && (self->data != NULL)) {\n\t\t/* Free internal references if an Object array */\n\t\tPyArray_XDECREF(self);\n\n PyDataMem_FREE(self->data);\n }\n\t\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t}\n\t\n self->ob_type->tp_free((PyObject *)self);\n}\n\n/*************************************************************************\n **************** Implement Mapping Protocol ***************************\n *************************************************************************/\n\nstatic int \narray_length(PyArrayObject *self) \n{\n if (self->nd != 0) {\n return self->dimensions[0];\n } else {\n\t\tPyErr_SetString(PyExc_TypeError, \"len() of unsized object.\");\n\t\treturn -1;\n }\n}\n\n\nstatic PyObject *\narray_item(PyArrayObject *self, int i) \n{\n char *item;\n PyArrayObject *r;\n\n\n\tif(self->nd == 0) {\n\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\"0-d arrays can't be indexed.\");\n\t\treturn NULL;\n\t}\n if ((item = index2ptr(self, i)) == NULL) return NULL;\n\n\tr = (PyArrayObject *)PyArray_New(self->ob_type, \n\t\t\t\t\t self->nd-1, self->dimensions+1, \n\t\t\t\t\t self->descr->type_num, \n\t\t\t\t\t self->strides+1, item, \n\t\t\t\t\t self->itemsize, self->flags,\n\t\t\t\t\t self);\n\tif (r == NULL) return NULL;\n\tPy_INCREF(self);\n\tr->base = (PyObject *)self;\n PyArray_UpdateFlags(r, CONTIGUOUS | FORTRAN);\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_item_nice(PyArrayObject *self, int i) \n{\n\treturn PyArray_Return((PyArrayObject *)array_item(self, i));\n}\n\n\nstatic int \narray_ass_item(PyArrayObject *self, int i, PyObject *v) \n{\n PyArrayObject *tmp;\n char *item;\n int ret;\n\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n if (i < 0) i = i+self->dimensions[0];\n\n if (self->nd > 1) {\n if((tmp = (PyArrayObject *)array_item(self, i)) == NULL)\n return -1;\n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n return ret; \n }\n\t\n if ((item = index2ptr(self, i)) == NULL) return -1;\n if (self->descr->setitem(v, item, self) == -1) return -1;\n return 0;\n}\n\n/* -------------------------------------------------------------- */\nstatic int\nslice_coerce_index(PyObject *o, int *v)\n{\n\t*v = PyArray_PyIntAsInt(o);\n\tif (error_converting(*v)) {\n\t\tPyErr_Clear();\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\n/* This is basically PySlice_GetIndicesEx, but with our coercion\n * of indices to integers (plus, that function is new in Python 2.3) */\nstatic int\nslice_GetIndices(PySliceObject *r, int length,\n int *start, int *stop, int *step,\n intp *slicelength)\n{\n\tint defstart, defstop;\n\t\n\tif (r->step == Py_None) {\n\t\t*step = 1;\n\t} else {\n\t\tif (!slice_coerce_index(r->step, step)) return -1;\n\t\tif (*step == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"slice step can not be zero\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tdefstart = *step < 0 ? length - 1 : 0;\n\tdefstop = *step < 0 ? -1 : length;\n\t\n\tif (r->start == Py_None) {\n\t\t*start = *step < 0 ? length-1 : 0;\n\t} else {\n\t\tif (!slice_coerce_index(r->start, start)) return -1;\n\t\tif (*start < 0) *start += length;\n\t\tif (*start < 0) *start = (*step < 0) ? -1 : 0;\n\t\tif (*start >= length) {\n\t\t\t*start = (*step < 0) ? length - 1 : length;\n\t\t}\n\t}\n\t\n\tif (r->stop == Py_None) {\n\t\t*stop = defstop;\n\t} else {\n\t\tif (!slice_coerce_index(r->stop, stop)) return -1;\n\t\tif (*stop < 0) *stop += length;\n if (*stop < 0) *stop = -1;\n if (*stop > length) *stop = length;\n\t}\n\t\n\tif ((*step < 0 && *stop >= *start) || \\\n\t (*step > 0 && *start >= *stop)) {\n\t\t*slicelength = 0;\n\t} else if (*step < 0) {\n\t\t*slicelength = (*stop - *start + 1) / (*step) + 1;\n\t} else {\n\t\t*slicelength = (*stop - *start - 1) / (*step) + 1;\n\t}\n\t\n\treturn 0;\n}\n\n#define PseudoIndex -1\n#define RubberIndex -2\n#define SingleIndex -3\n\nstatic int\nparse_subindex(PyObject *op, int *step_size, intp *n_steps, int max)\n{\n\tint index;\n\t\n\tif (op == Py_None) {\n\t\t*n_steps = PseudoIndex;\n\t\tindex = 0;\n\t} else if (op == Py_Ellipsis) {\n\t\t*n_steps = RubberIndex;\n\t\tindex = 0;\n\t} else if (PySlice_Check(op)) {\n\t\tint stop;\n\t\tif (slice_GetIndices((PySliceObject *)op, max,\n\t\t\t\t &index, &stop, step_size, n_steps) < 0) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"invalid slice\");\n\t\t\t}\n\t\t\tgoto fail;\n\t\t}\n\t\tif (*n_steps <= 0) {\n\t\t\t*n_steps = 0;\n\t\t\t*step_size = 1;\n\t\t\tindex = 0;\n\t\t}\n\t} else {\n\t\tindex = PyArray_PyIntAsInt(op);\n\t\tif (error_converting(index)) {\n\t\t\tPyErr_SetString(PyExc_IndexError,\n\t\t\t\t\t\"each subindex must be either a \"\\\n\t\t\t\t\t\"slice, an integer, Ellipsis, or \"\\\n\t\t\t\t\t\"newaxis\");\n\t\t\tgoto fail;\n\t\t}\n\t\t*n_steps = SingleIndex;\n\t\t*step_size = 0;\n\t\tif (index < 0) index += max;\n\t\tif (index >= max || index < 0) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \"invalid index\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn index;\n fail:\n\treturn -1;\n}\n\n\nstatic int \nparse_index(PyArrayObject *self, PyObject *op, \n intp *dimensions, intp *strides, intp *offset_ptr)\n{\n int i, j, n;\n int nd_old, nd_new, start, offset, n_add, n_pseudo;\n int step_size;\n\tintp n_steps;\n PyObject *op1=NULL;\n int is_slice;\n\n\n if (PySlice_Check(op) || op == Py_Ellipsis || op == Py_None) {\n n = 1;\n op1 = op;\n Py_INCREF(op);\t\n /* this relies on the fact that n==1 for loop below */\n is_slice = 1;\n }\n else {\n if (!PySequence_Check(op)) {\n PyErr_SetString(PyExc_IndexError, \n \"index must be either an int \"\\\n \"or a sequence\");\n return -1;\n }\n n = PySequence_Length(op);\n is_slice = 0;\n }\n\t\n nd_old = nd_new = 0;\n\t\n offset = 0;\n for(i=0; ind ? \\\n self->dimensions[nd_old] : 0);\n Py_DECREF(op1);\n if (start == -1) break;\n\t\t\n if (n_steps == PseudoIndex) {\n dimensions[nd_new] = 1; strides[nd_new] = 0; nd_new++;\n } else {\n if (n_steps == RubberIndex) {\n for(j=i+1, n_pseudo=0; jnd-(n-i-n_pseudo-1+nd_old);\n if (n_add < 0) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = \\\n self->strides[nd_old];\n nd_new++; nd_old++;\n }\n } else {\n if (nd_old >= self->nd) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n offset += self->strides[nd_old]*start;\n nd_old++;\n if (n_steps != SingleIndex) {\n dimensions[nd_new] = n_steps;\n strides[nd_new] = step_size * \\\n self->strides[nd_old-1];\n nd_new++;\n }\n }\n }\n }\n if (i < n) return -1;\n n_add = self->nd-nd_old;\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = self->strides[nd_old];\n nd_new++; nd_old++;\n }\t \n *offset_ptr = offset;\n return nd_new;\n}\n\nstatic void\n_swap_axes(PyArrayMapIterObject *mit, PyArrayObject **ret)\n{\n\tPyObject *new, *tup;\n\tint n1, n2, n3, val;\n\tint i;\n\n\ttup = PyTuple_New(mit->nd);\n\t/* tuple for transpose is \n\t (n1,..,n1+n2-1,0,..,n1-1,n1+n2,...,n3-1)\n\t n1 is the number of dimensions of \n\t the broadcasted index array \n\t n2 is the number of dimensions skipped at the\n\t start\n\t n3 is the number of dimensions of the \n\t result \n\t*/\n\tn1 = mit->iters[0]->nd_m1 + 1;\n\tn2 = mit->iteraxes[0];\n\tn3 = mit->nd;\n\tval = n1;\n\ti = 0;\n\twhile(val < n1+n2) \n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = 0;\n\twhile(val < n1)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = n1+n2;\n\twhile(val < n3)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\n\tnew = PyArray_Transpose(*ret, tup);\n\tPy_DECREF(tup);\n\tPy_DECREF(*ret);\n\t*ret = (PyArrayObject *)new;\n}\n\n\n\nstatic PyObject *\nPyArray_GetMap(PyArrayMapIterObject *mit)\n{\n\n\tPyArrayObject *ret, *temp;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\t/* Unbound map iterator --- Bind should have been called */\n\tif (mit->ait == NULL) return NULL;\n\n\t/* This relies on the map iterator object telling us the shape\n\t of the new array in nd and dimensions.\n\t*/\n\ttemp = mit->ait->ao;\n\tret = (PyArrayObject *)\\\n\t\tPyArray_New(temp->ob_type, mit->nd, mit->dimensions, \n\t\t\t temp->descr->type_num, NULL, NULL, \n\t\t\t temp->itemsize, \n\t\t\t PyArray_ISFORTRAN(temp),\n\t\t\t temp);\n\tif (ret == NULL) return NULL;\n\n\t/* Now just iterate through the new array filling it in\n\t with the next object from the original array as\n\t defined by the mapping iterator */\n\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ret)) \n\t == NULL) \n\t\treturn NULL;\n\tindex = it->size;\n\tswap = ((temp->flags & NOTSWAPPED) != (ret->flags & NOTSWAPPED));\n copyswap = ret->descr->copyswap;\n\tPyArray_MapIterReset(mit);\n\twhile (index--) {\n copyswap(it->dataptr, mit->dataptr, swap, ret->itemsize);\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\t\n\t/* check for consecutive axes */\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, &ret);\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\nstatic int\nPyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)\n{\n\tPyObject *arr=NULL;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n\tPyArray_Typecode typecode = {0, 0, 0};\n PyArray_CopySwapFunc *copyswap;\n\n\t/* Unbound Map Iterator */\n\tif (mit->ait == NULL) return -1;\n\n\ttypecode.type_num = mit->ait->ao->descr->type_num;\n\ttypecode.itemsize = mit->ait->ao->itemsize;\n\n\tarr = PyArray_FromAny(op, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, (PyArrayObject **)&arr);\n\t\t}\n\t}\n\t\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) \n\t\treturn -1;\n\n\tindex = mit->size;\n\tswap = ((mit->ait->ao->flags & NOTSWAPPED) != \\\n\t\t(PyArray_FLAGS(arr) & NOTSWAPPED));\n\n copyswap = PyArray_DESCR(arr)->copyswap;\n\tPyArray_MapIterReset(mit);\n /* Need to decref OBJECT arrays */\n if (PyTypeNum_ISOBJECT(typecode.type_num)) {\n while (index--) {\n Py_XDECREF(*((PyObject **)mit->dataptr));\n Py_INCREF(*((PyObject **)it->dataptr));\n memmove(mit->dataptr, it->dataptr, sizeof(PyObject *));\n copyswap(mit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_MapIterNext(mit);\n PyArray_ITER_NEXT(it);\n if (it->index == it->size)\n PyArray_ITER_RESET(it);\n }\n return 0;\n }\n\n\twhile(index--) {\n\t\tmemmove(mit->dataptr, it->dataptr, PyArray_ITEMSIZE(arr));\n copyswap(mit->dataptr, NULL, swap, PyArray_ITEMSIZE(arr));\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t\tif (it->index == it->size)\n\t\t\tPyArray_ITER_RESET(it);\n\t}\t\t\n\treturn 0;\n}\n\n/* Called when treating array object like a mapping -- called first from \n Python when using a[object] unless object is a standard slice object\n (not an extended one). \n\n*/\n\n/* There are two situations: \n\n 1 - the subscript is a standard view and a reference to the \n array can be returned\n\n 2 - the subscript uses Boolean masks or integer indexing and\n therefore a new array is created and returned. \n\n*/\n\n/* Always returns 0-dimensional arrays */\n\nstatic PyObject *\narray_subscript(PyArrayObject *self, PyObject *op) \n{\n intp dimensions[MAX_DIMS], strides[MAX_DIMS];\n\tintp offset;\n int nd, i;\n PyArrayObject *other;\n\tPyArrayMapIterObject *mit;\n\n if (PyArray_IsScalar(op, Integer) || PyInt_Check(op) || \\\n PyLong_Check(op)) {\n intp value;\n value = PyArray_PyIntAsIntp(op);\n if (PyErr_Occurred())\n PyErr_Clear();\n else if (value >= 0) {\n if (value <= MAX_INT)\n return array_item(self, (int) value);\n }\n else if (value < 0) {\n if (value >= -MAX_INT) {\n if (self->nd > 0) value += self->dimensions[0];\n return array_item(self, (int) value);\n }\n }\n }\n\n\tif (PyArrayMapIter_Check(op)) {\n\t\tmit = (PyArrayMapIterObject *)op;\n\t\t/* bind to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\n\t\t/* If the mapiterator was created with standard indexing\n\t\t behavior, fall through to view-based code */\n\t\tif (!mit->view) return PyArray_GetMap(mit);\n\t\top = mit->indexobj;\n\t}\n\telse { /* wrap arguments into a mapiter object */\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(op);\n\t\tif (mit == NULL) return NULL;\n\t\tif (!mit->view) { /* fancy indexing */\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tother = (PyArrayObject *)PyArray_GetMap(mit);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn (PyObject *)other;\n\t\t}\n\t\tPy_DECREF(mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(op);\n\tif (!error_converting(i)) {\n\t\tif (i < 0 && self->nd > 0) i = i+self->dimensions[0];\n\t\treturn array_item(self, i);\n\t}\n\tPyErr_Clear();\n\n\t/* Standard (view-based) Indexing */\n if ((nd = parse_index(self, op, dimensions, strides, &offset)) \n == -1) \n return NULL;\n\n\t/* This will only work if new array will be a view */\n\tif ((other = (PyArrayObject *)\t\t\t\t\t\\\n\t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n\t\t\t strides, self->data+offset, \n\t\t\t self->itemsize, self->flags,\n\t\t\t self)) == NULL) \n\t\treturn NULL;\n\n\n\tother->base = (PyObject *)self;\n\tPy_INCREF(self);\n\t\n\tPyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);\n\t\n\treturn (PyObject *)other;\n}\n\n\n/* Another assignment hacked by using CopyObject. */\n\n/* This only works if subscript returns a standard view. */\n\n/* Again there are two cases. In the first case, PyArray_CopyObject\n can be used. In the second case, a new indexing function has to be \n used.\n*/\n\nstatic int \narray_ass_sub(PyArrayObject *self, PyObject *index, PyObject *op) \n{\n int ret, i;\n PyArrayObject *tmp;\n\tPyArrayMapIterObject *mit;\n\t\n if (op == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n\tif (PyArrayMapIter_Check(index)) {\n\t\tmit = (PyArrayMapIterObject *)index;\n\t\t/* bind behavior to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\t\n\t\t/* fall through if standard view-based map iterator */\n\t\tif (!mit->view) return PyArray_SetMap(mit, op);\n\t\tindex = mit->indexobj;\n\t}\n\telse {\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(index);\n\t\tif (mit == NULL) return -1;\n\t\tif (!mit->view) {\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tret = PyArray_SetMap(mit, op);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn ret;\n\t\t}\n\t\tPy_DECREF((PyObject*)mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(index);\n\tif (!error_converting(i)) {\n\t\treturn array_ass_item(self, i, op);\n\t}\n\tPyErr_Clear();\n\t\n\t/* Rest of standard (view-based) indexing */\n\n if ((tmp = (PyArrayObject *)array_subscript(self, index)) == NULL)\n return -1; \n ret = PyArray_CopyObject(tmp, op);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\n/* There are places that require that array_subscript return a PyArrayObject\n and not possibly a scalar. Thus, this is the function exposed to \n Python so that 0-dim arrays are passed as scalars\n*/\n\nstatic PyObject *\narray_subscript_nice(PyArrayObject *self, PyObject *op) \n{\n\treturn PyArray_Return((PyArrayObject *)array_subscript(self, op));\n}\n\n\nstatic PyMappingMethods array_as_mapping = {\n (inquiry)array_length,\t\t /*mp_length*/\n (binaryfunc)array_subscript_nice,\t/*mp_subscript*/\n (objobjargproc)array_ass_sub,\t /*mp_ass_subscript*/\n};\n\n/****************** End of Mapping Protocol ******************************/\n\n\n/*************************************************************************\n **************** Implement Buffer Protocol ****************************\n *************************************************************************/\n\n/* removed multiple segment interface */\n\nstatic int \narray_getsegcount(PyArrayObject *self, int *lenp) \n{\n if (lenp)\n *lenp = PyArray_NBYTES(self);\n\n if (PyArray_ISONESEGMENT(self)) {\n return 1;\n }\n\n if (lenp)\n *lenp = 0;\n return 0;\n}\n\nstatic int \narray_getreadbuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (segment != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Accessing non-existing array segment\");\n return -1;\n }\n \n if (PyArray_ISONESEGMENT(self)) {\n *ptrptr = self->data;\n return PyArray_NBYTES(self);\n }\n PyErr_SetString(PyExc_ValueError, \"Array is not a single segment\");\n *ptrptr = NULL;\n return -1;\n}\n\n\nstatic int \narray_getwritebuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (PyArray_CHKFLAGS(self, WRITEABLE)) \n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_ValueError, \"Array cannot be \"\\\n \"accessed as a writeable buffer.\");\n return -1;\n }\n}\n\nstatic int \narray_getcharbuf(PyArrayObject *self, int segment, const char **ptrptr) \n{\n if (self->descr->type_num == PyArray_STRING || \\\n\t self->descr->type_num == PyArray_UNICODE)\n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_TypeError, \n \"Non-character array cannot be interpreted \"\\\n \"as character buffer.\");\n return -1;\n }\n}\n\nstatic PyBufferProcs array_as_buffer = {\n (getreadbufferproc)array_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)array_getwritebuf, /*bf_getwritebuffer*/\n (getsegcountproc)array_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)array_getcharbuf, /*bf_getcharbuffer*/\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Number Protocol ****************************\n *************************************************************************/\n\n\ntypedef struct {\n PyObject *add,\n *subtract,\n *multiply,\n *divide,\n *remainder,\n *power,\n\t\t*sqrt,\n *negative,\n *absolute,\n *invert,\n *left_shift,\n *right_shift,\n *bitwise_and,\n *bitwise_xor,\n *bitwise_or,\n *less,\n *less_equal,\n *equal,\n *not_equal,\n *greater,\n *greater_equal,\n *floor_divide,\n *TRUE_divide,\n\t\t*logical_or,\n\t\t*logical_and,\n\t\t*floor,\n\t\t*ceil,\n\t\t*maximum,\n\t\t*minimum;\t\n\t\n} NumericOps;\n\nstatic NumericOps n_ops = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL};\n\n/* Dictionary can contain any of the numeric operations, by name. \n Those not present will not be changed\n */\n\n#define SET(op) temp=PyDict_GetItemString(dict, #op);\t\\\n\tif (temp != NULL) {\t\t\t\t\\\n\t\tif (!(PyCallable_Check(temp))) return -1; \\\n Py_XDECREF(n_ops.op); \\\n\t\tn_ops.op = temp; \\\n\t}\n\n \nint \nPyArray_SetNumericOps(PyObject *dict) \n{\n PyObject *temp = NULL;\n SET(add);\n SET(subtract);\n SET(multiply);\n SET(divide);\n SET(remainder);\n SET(power);\n\tSET(sqrt);\n SET(negative);\n SET(absolute);\n SET(invert);\n SET(left_shift);\n SET(right_shift);\n SET(bitwise_and);\n SET(bitwise_or);\n SET(bitwise_xor);\n SET(less);\t \n SET(less_equal);\n SET(equal);\n SET(not_equal);\n SET(greater);\n SET(greater_equal);\n SET(floor_divide);\t\n SET(TRUE_divide);\t\n\tSET(logical_or);\n\tSET(logical_and);\n\tSET(floor);\n\tSET(ceil);\n\tSET(maximum);\n\tSET(minimum);\n return 0;\n}\n\n#define GET(op) if (PyDict_SetItemString(dict, #op, n_ops.op)==-1) \\\n\t\tgoto fail;\n\nstatic PyObject *\nPyArray_GetNumericOps(void) \n{\n\tPyObject *dict;\n\tif ((dict = PyDict_New())==NULL) \n\t\treturn NULL;\t\n\tGET(add);\n GET(subtract);\n GET(multiply);\n GET(divide);\n GET(remainder);\n GET(power);\n\tGET(sqrt);\n GET(negative);\n GET(absolute);\n GET(invert);\n GET(left_shift);\n GET(right_shift);\n GET(bitwise_and);\n GET(bitwise_or);\n GET(bitwise_xor);\n GET(less);\t \n GET(less_equal);\n GET(equal);\n GET(not_equal);\n GET(greater);\n GET(greater_equal);\n GET(floor_divide); \n GET(TRUE_divide); \n\tGET(logical_or);\n\tGET(logical_and);\n\tGET(floor);\n\tGET(ceil);\n\tGET(maximum);\n\tGET(minimum);\n\treturn dict;\t\n\n fail:\n\tPy_DECREF(dict);\n\treturn NULL;\t\t\n}\n\nstatic PyObject *\nPyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"reduce\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"accumulate\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OO)\", m1, m2);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(O)\", m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericInplaceBinaryFunction(PyArrayObject *m1, \n\t\t\t\t PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OOO)\", m1, m2, m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\narray_add(PyArrayObject *m1, PyObject *m2) \n{ \n return PyArray_GenericBinaryFunction(m1, m2, n_ops.add); \n}\n\nstatic PyObject *\narray_subtract(PyArrayObject *m1, PyObject *m2) \n{\n\treturn PyArray_GenericBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_negative(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.negative);\n}\n\nstatic PyObject *\narray_absolute(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.absolute);\n}\n\nstatic PyObject *\narray_invert(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.invert);\n}\n\nstatic PyObject *\narray_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_inplace_add(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.add);\n}\n\nstatic PyObject *\narray_inplace_subtract(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_inplace_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_inplace_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_inplace_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_inplace_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_inplace_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_inplace_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_inplace_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_inplace_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_inplace_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.TRUE_divide);\n}\n\nstatic PyObject *\narray_inplace_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_inplace_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.TRUE_divide);\n}\n\n/* Array evaluates as \"TRUE\" if any of the elements are non-zero */\nstatic int \narray_all_nonzero(PyArrayObject *mp) \n{\n\tintp index;\n\tPyArrayIterObject *it;\n\tBool anyTRUE = 0;\n\t\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)mp);\n\tif (it==NULL) return anyTRUE;\n\tindex = it->size;\n\twhile(index--) {\n\t\tif (mp->descr->nonzero(it->dataptr, mp)) {\n\t\t\tanyTRUE = 1;\n\t\t\tbreak;\n\t\t}\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\treturn anyTRUE;\n}\n\nstatic PyObject *\narray_divmod(PyArrayObject *op1, PyObject *op2) \n{\n PyObject *divp, *modp, *result;\n\n divp = array_divide(op1, op2);\n if (divp == NULL) return NULL;\n modp = array_remainder(op1, op2);\n if (modp == NULL) {\n Py_DECREF(divp);\n return NULL;\n }\n result = Py_BuildValue(\"OO\", divp, modp);\n Py_DECREF(divp);\n Py_DECREF(modp);\n return result;\n}\n\n\nstatic PyObject *\narray_int(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can be\"\\\n\t\t\t\t\" converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_int == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to int\");\n Py_DECREF(pv);\n return NULL;\n }\n\n pv2 = pv->ob_type->tp_as_number->nb_int(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_float(PyArrayObject *v) \n{\n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an \"\\\n\t\t\t\t\"int, scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_float == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to float\");\n Py_DECREF(pv);\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_float(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_long(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_long == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to long\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_long(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_oct(PyArrayObject *v) \n{\t \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_oct == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to oct\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_oct(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_hex(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_hex == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to hex\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_hex(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\n_array_copy_nice(PyArrayObject *self)\n{\n\treturn PyArray_Return((PyArrayObject *)\t\t\\\n\t\t\t PyArray_Copy(self));\n}\n\nstatic PyNumberMethods array_as_number = {\n (binaryfunc)array_add,\t\t /*nb_add*/\n (binaryfunc)array_subtract,\t\t /*nb_subtract*/\n (binaryfunc)array_multiply,\t\t /*nb_multiply*/\n (binaryfunc)array_divide,\t\t /*nb_divide*/\n (binaryfunc)array_remainder,\t /*nb_remainder*/\n (binaryfunc)array_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)array_power,\t\t /*nb_power*/\n (unaryfunc)array_negative, /*nb_neg*/\t\n (unaryfunc)_array_copy_nice,\t\t /*nb_pos*/ \n (unaryfunc)array_absolute,\t\t /*(unaryfunc)array_abs,*/\n (inquiry)array_all_nonzero,\t\t /*nb_nonzero*/\n (unaryfunc)array_invert,\t\t /*nb_invert*/\n (binaryfunc)array_left_shift,\t /*nb_lshift*/\n (binaryfunc)array_right_shift,\t /*nb_rshift*/\n (binaryfunc)array_bitwise_and,\t /*nb_and*/\n (binaryfunc)array_bitwise_xor,\t /*nb_xor*/\n (binaryfunc)array_bitwise_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)array_int,\t\t /*nb_int*/\n (unaryfunc)array_long,\t\t /*nb_long*/\n (unaryfunc)array_float,\t\t /*nb_float*/\n (unaryfunc)array_oct,\t\t /*nb_oct*/\n (unaryfunc)array_hex,\t\t /*nb_hex*/\n\n /*This code adds augmented assignment functionality*/\n /*that was made available in Python 2.0*/\n (binaryfunc)array_inplace_add,\t /*inplace_add*/\n (binaryfunc)array_inplace_subtract,\t /*inplace_subtract*/\n (binaryfunc)array_inplace_multiply,\t /*inplace_multiply*/\n (binaryfunc)array_inplace_divide,\t /*inplace_divide*/\n (binaryfunc)array_inplace_remainder, /*inplace_remainder*/\n (ternaryfunc)array_inplace_power,\t /*inplace_power*/\n (binaryfunc)array_inplace_left_shift, /*inplace_lshift*/\n (binaryfunc)array_inplace_right_shift, /*inplace_rshift*/\n (binaryfunc)array_inplace_bitwise_and, /*inplace_and*/\n (binaryfunc)array_inplace_bitwise_xor, /*inplace_xor*/\n (binaryfunc)array_inplace_bitwise_or, /*inplace_or*/\n\n (binaryfunc)array_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)array_TRUE_divide,\t /*nb_TRUE_divide*/\n (binaryfunc)array_inplace_floor_divide, /*nb_inplace_floor_divide*/\n (binaryfunc)array_inplace_TRUE_divide, /*nb_inplace_TRUE_divide*/\n\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Sequence Protocol **************************\n *************************************************************************/\n\n/* Some of this is repeated in the array_as_mapping protocol. But\n we fill it in here so that PySequence_XXXX calls work as expected \n*/\n\n\nstatic PyObject * \narray_slice(PyArrayObject *self, int ilow, int ihigh) \n{\n PyArrayObject *r;\n int l;\n char *data;\n\n if (self->nd == 0) {\n PyErr_SetString(PyExc_ValueError, \"can't slice a scalar\");\n return NULL;\n }\n \t\n l=self->dimensions[0];\n if (ihigh < 0) ihigh += l;\n if (ilow < 0) ilow += l;\n if (ilow < 0) ilow = 0;\n else if (ilow > l) ilow = l;\n if (ihigh < 0) ihigh = 0;\n else if (ihigh > l) ihigh = l;\n if (ihigh < ilow) ihigh = ilow;\n\n if (ihigh != ilow) {\n data = index2ptr(self, ilow);\n if (data == NULL) return NULL;\n } else {\n data = self->data;\n }\n\n self->dimensions[0] = ihigh-ilow;\n r = (PyArrayObject *)\\\n\t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n\t\t\t self->descr->type_num, self->strides, data,\n\t\t\t self->itemsize, self->flags, self);\n\n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n Py_INCREF(self);\n\tPyArray_UpdateFlags(r, UPDATE_ALL_FLAGS); \n return (PyObject *)r;\n}\n\n\nstatic int \narray_ass_slice(PyArrayObject *self, int ilow, int ihigh, PyObject *v) {\n int ret;\n PyArrayObject *tmp;\n\t\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n if ((tmp = (PyArrayObject *)array_slice(self, ilow, ihigh)) \\\n == NULL) \n return -1; \n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\nstatic int\narray_contains(PyArrayObject *self, PyObject *el)\n{\n /* equivalent to any(self == el) */\n\n return PyObject_RichCompareBool((PyObject *)self, el, Py_EQ);\n}\n\n\nstatic PySequenceMethods array_as_sequence = {\n (inquiry)array_length,\t\t/*sq_length*/\n (binaryfunc)NULL, /* sq_concat is handled by nb_add*/\n (intargfunc)NULL, /* sq_repeat is handled nb_multiply*/\n (intargfunc)array_item_nice,\t\t/*sq_item*/\n (intintargfunc)array_slice,\t\t/*sq_slice*/\n (intobjargproc)array_ass_item,\t/*sq_ass_item*/\n (intintobjargproc)array_ass_slice,\t/*sq_ass_slice*/\n\t(objobjproc) array_contains, /* sq_contains */\n\t(binaryfunc) NULL, /* sg_inplace_concat */\n\t(intargfunc) NULL /* sg_inplace_repeat */\n};\n\n\n/****************** End of Sequence Protocol ****************************/\n\n\nstatic int \ndump_data(char **string, int *n, int *max_n, char *data, int nd, \n intp *dimensions, intp *strides, PyArrayObject* self) \n{\n PyArray_Descr *descr=self->descr;\n PyObject *op, *sp;\n char *ostring;\n int i, N;\n\t\n#define CHECK_MEMORY if (*n >= *max_n-16) { *max_n *= 2; \\\n\t\t*string = (char *)realloc(*string, *max_n); }\n\t\n if (nd == 0) {\n\t\t\n if ((op = descr->getitem(data, self)) == NULL) return -1;\n sp = PyObject_Repr(op);\n if (sp == NULL) {Py_DECREF(op); return -1;}\n ostring = PyString_AsString(sp);\n N = PyString_Size(sp)*sizeof(char);\n *n += N;\n CHECK_MEMORY\n memmove(*string+(*n-N), ostring, N);\n Py_DECREF(sp);\n Py_DECREF(op);\n return 0;\n } else {\n CHECK_MEMORY\n (*string)[*n] = '[';\n *n += 1;\n for(i=0; idata, \n\t\t self->nd, self->dimensions, \n self->strides, self) < 0) { \n\t\tfree(string); return NULL; \n\t}\n\t\n\tif (PyArray_ISFLEXIBLE(self)) {\n\t\tchar buf[100];\n\t\tsnprintf(buf, sizeof(buf), \"%d\", self->itemsize);\n\t\tsprintf(string+n, \", '%c%s')\", self->descr->type, buf);\n\t\tret = PyString_FromStringAndSize(string, n+6+strlen(buf));\n\t}\n\telse {\n\t\tsprintf(string+n, \", '%c')\", self->descr->type);\n\t\tret = PyString_FromStringAndSize(string, n+6);\n\t}\n\t\n\n free(string);\n return ret;\n}\n\nstatic PyObject *PyArray_StrFunction=NULL;\nstatic PyObject *PyArray_ReprFunction=NULL;\n\nstatic void \nPyArray_SetStringFunction(PyObject *op, int repr) \n{\n if (repr) {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_ReprFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_ReprFunction = op; \n } else {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_StrFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_StrFunction = op; \n }\n}\n\nstatic PyObject *\narray_repr(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_ReprFunction == NULL) {\n s = array_repr_builtin(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_ReprFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\nstatic PyObject *\narray_str(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_StrFunction == NULL) {\n s = array_repr(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_StrFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\n\nstatic PyObject *\narray_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) \n{\n PyObject *array_other, *result;\n\n switch (cmp_op) \n {\n case Py_LT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less);\n case Py_LE:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less_equal);\n case Py_EQ:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then return the integer\n\t\t\t object 0. This fixes code that used to\n\t\t\t allow equality comparisons between arrays\n\t\t\t and other objects which would give a result\n\t\t\t of 0\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.equal);\n /* If the comparison results in NULL, then the \n\t\t\t two array objects can not be compared together so \n\t\t\t return zero \n */\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n return result;\n case Py_NE:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then objects cannot be \n\t\t\t compared and cannot be equal, therefore, \n\t\t\t return True;\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.not_equal);\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n return result;\n case Py_GT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.greater);\n case Py_GE:\n return PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t other, \n\t\t\t\t\t \t n_ops.greater_equal);\n }\n return NULL;\n}\n\nstatic PyObject *\n_check_axis(PyArrayObject *arr, int *axis, int flags)\n{\n\tPyObject *temp;\n\tint n = arr->nd;\n\n\tif ((*axis >= MAX_DIMS) || (n==0)) {\n\t\ttemp = PyArray_Ravel(arr,0);\n\t\t*axis = 0;\n\t\treturn temp;\n\t}\n\telse {\n\t\tif (flags) {\n\t\t\ttemp = PyArray_FromAny((PyObject *)arr, NULL, \n\t\t\t\t\t 0, 0, flags);\n\t\t\tif (temp == NULL) return NULL;\n\t\t}\n\t\telse {\n\t\t\tPy_INCREF(arr);\n\t\t\ttemp = (PyObject *)arr;\n\t\t}\n\t}\n\tif (*axis < 0) *axis += n;\n\tif ((*axis < 0) || (*axis >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"axis(=%d) out of bounds\", *axis);\n\t\tPy_DECREF(temp);\n\t\treturn NULL;\n\t}\n\treturn temp;\n}\n\n#include \"arraymethods.c\"\n\n/* Lifted from numarray */\nstatic PyObject *\nPyArray_IntTupleFromIntp(int len, intp *vals)\n{\n\tint i;\n PyObject *intTuple = PyTuple_New(len);\n if (!intTuple) goto fail;\n for(i=0; ind == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i = ap->nd-1; i >= 0; --i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int \n_IsFortranContiguous(PyArrayObject *ap) \n{\n\tint sd;\n\tint i;\n\t\n\tif (ap->nd == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i=0; i< ap->nd; ++i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int\n_IsAligned(PyArrayObject *ap) \n{\n\tint i, alignment, aligned=1;\n\tintp ptr;\n\tint type = ap->descr->type_num;\n\n\tif ((type == PyArray_STRING) || (type == PyArray_VOID))\n\t\treturn 1;\n\n\talignment = ap->descr->alignment;\n\n\tptr = (intp) ap->data;\n aligned = (ptr % alignment) == 0;\n for (i=0; i nd; i++)\n aligned &= ((ap->strides[i] % alignment) == 0);\n return aligned != 0;\n}\n\nstatic Bool\n_IsWriteable(PyArrayObject *ap)\n{\n\tPyObject *base=ap->base;\n\tPyBufferProcs *pb;\n\n\t/* If we own our own data, then no-problem */\n\tif ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;\n\n\t/* Get to the final base object \n\t If it is a writeable array, then return TRUE\n\t If we can find an array object \n\t or a writeable buffer object as the final base object\n\t or a string object (for pickling support memory savings).\n\t - this last could be removed if a proper pickleable \n\t buffer was added to Python.\n\t*/\n\n\twhile(PyArray_Check(base)) {\n\t\tif (PyArray_CHKFLAGS(base, OWN_DATA)) \n\t\t\treturn (Bool) (PyArray_ISWRITEABLE(base));\n\t\tbase = PyArray_BASE(base);\n\t}\n\n\t/* here so pickle support works seamlessly \n\t and unpickled array can be set and reset writeable \n\t -- could be abused -- */\n\tif PyString_Check(base) return TRUE;\n\n\tpb = base->ob_type->tp_as_buffer;\n\tif (pb == NULL || pb->bf_getwritebuffer == NULL)\n\t\treturn FALSE;\n\t\n\treturn TRUE;\n}\n\n\nstatic void\nPyArray_UpdateFlags(PyArrayObject *ret, int flagmask)\n{\n\n\tif (flagmask & FORTRAN) {\n\t\tif (_IsFortranContiguous(ret)) {\n\t\t\tret->flags |= FORTRAN;\n\t\t\tif (ret->nd > 1) ret->flags &= ~CONTIGUOUS;\n\t\t}\n\t\telse ret->flags &= ~FORTRAN;\n\t}\n\tif (flagmask & CONTIGUOUS) {\n\t\tif (_IsContiguous(ret)) {\n\t\t\tret->flags |= CONTIGUOUS;\n\t\t\tif (ret->nd > 1) ret->flags &= ~FORTRAN;\n\t\t}\n\t\telse ret->flags &= ~CONTIGUOUS;\n\t}\n\tif (flagmask & ALIGNED) {\n\t\tif (_IsAligned(ret)) ret->flags |= ALIGNED;\n\t\telse ret->flags &= ~ALIGNED;\n\t}\n\treturn;\n}\n\n/* This routine checks to see if newstrides (of length nd) will not \n walk outside of the memory implied by either numbytes or\n a single segment array of the provided dimensions and element size if\n numbytes is 0 */\nstatic Bool\nPyArray_CheckStrides(int elsize, int nd, intp numbytes, \n\t\t intp *dims, intp *newstrides)\n{\n\tint i;\n\t\n\tif (numbytes == 0) \n\t\tnumbytes = PyArray_MultiplyList(dims, nd) * elsize;\n\t\n\tfor (i=0; i numbytes) {\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\treturn TRUE;\n\t\n}\n\n\n/* This is the main array creation routine. */\n\n/* Flags argument has multiple related meanings \n depending on data and strides: \n\n If data is given, then flags is flags associated with data. \n If strides is not given, then a contiguous strides array will be created\n and the CONTIGUOUS bit will be set. If the flags argument \n has the FORTRAN bit set, then a FORTRAN-style strides array will be\n created (and of course the FORTRAN flag bit will be set). \n\n If data is not given but created here, then flags will be DEFAULT_FLAGS\n and a non-zero flags argument can be used to indicate a FORTRAN style\n array is desired. \n*/\n\nstatic intp\n_array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize, \n\t\t int inflag, int *objflags) \n{\n\tint i;\n\t/* Only make Fortran strides if not contiguous as well */\n\tif ((inflag & FORTRAN) && !(inflag & CONTIGUOUS)) {\n\t\tfor (i=0; i 1) *objflags &= ~CONTIGUOUS;\n\t\telse *objflags |= CONTIGUOUS;\n\t}\n\telse {\n\t\tfor (i=nd-1;i>=0;i--) {\n\t\t\tstrides[i] = itemsize;\n\t\t\titemsize *= dims[i] ? dims[i] : 1;\n\t\t}\n\t\t*objflags |= CONTIGUOUS;\n\t\tif (nd > 1) *objflags &= ~FORTRAN;\n\t\telse *objflags |= FORTRAN;\n\t}\n\treturn itemsize;\n}\n\n\t\nstatic PyObject *\nPyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n\t PyArrayObject *obj)\n{\n\tPyArrayObject *self;\n\tPyArray_Descr *descr;\n\tregister int i;\n\tintp sd, temp;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\tif (descr == NULL) return NULL;\n\n\tif (nd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"number of dimensions must be >=0\");\n\t\treturn NULL;\n\t}\n if (nd > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError,\n \"maximum number of dimensions is %d\", MAX_DIMS);\n return NULL;\n\t}\n\n\t/* Check dimensions */\n\tfor (i=nd-1;i>=0;i--) {\n\t\tif (dims[i] < 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"negative dimensions\"\t\\\n\t\t\t\t\t\" are not allowed.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tself = (PyArrayObject *) subtype->tp_alloc(subtype, 0);\n\tif (self == NULL) return NULL;\t\n\tself->descr = descr;\n\tself->dimensions = NULL;\n\tif (data == NULL) { /* strides is NULL too */\n\t\tself->flags = DEFAULT_FLAGS;\n\t\tif (flags) {\n\t\t\tself->flags |= FORTRAN; \n\t\t\tif (nd > 1) self->flags &= ~CONTIGUOUS;\n\t\t\tflags = FORTRAN;\n\t\t}\n\t}\n\telse self->flags = (flags & ~UPDATEIFCOPY);\n\t\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tif (itemsize < 1) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"Type must provide an itemsize.\");\n\t\t\tPyObject_Del(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tself->itemsize = itemsize;\n\t\t/* Guarantee that these kind of arrays are never byteswapped\n\t\t unknowingly. \n\t\t*/\n\t\tif (type_num != PyArray_UNICODE)\n\t\t\tself->flags |= NOTSWAPPED;\n\t}\n\telse self->itemsize = descr->elsize; \n\t\t\n\tsd = self->itemsize;\n\t\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dims, sizeof(intp)*nd);\n\t\tif (strides == NULL) { /* fill it in */\n\t\t\tsd = _array_fill_strides(self->strides, dims, nd, sd,\n\t\t\t\t\t\t flags, &(self->flags));\n\t\t}\n\t\telse {\n\t\t\tif (data == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"If strides is given in \" \\\n\t\t\t\t\t\t\"array creation, data must \" \\\n\t\t\t\t\t\t\"be given too.\");\n\t\t\t\tPyObject_Del(self);\n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\t\treturn NULL;\n\t\t\t}\t\t\t\t\t\n\t\t\tmemcpy(self->strides, strides, sizeof(intp)*nd);\n\t\t}\n\t}\n \t\n\t\t\n\tif (data == NULL) {\n\n\t\t/* Make sure we are aligned on void ptrs (without wasting\n\t\t space if we already are). But, also, allocate something \n\t\t even for zero-space arrays e.g. shape=(0,) -- otherwise\n buffer exposure (a.data) doesn't work as it should. */\n\n\t\tif (sd==0) sd = sizeof(intp);\n\t\telse if ((temp=sd%sizeof(intp))) sd += sizeof(intp) - temp;\n\n\t\tif ((data = PyDataMem_NEW(sd))==NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\tif (self->dimensions != NULL) \n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\n\t\t/* It is bad to have unitialized OBJECT pointers */\n\t\t/* We shouldn't need to check for the OBJECT Letter\n\t\t but perhaps it's best. */\n\t\tif (type_num == PyArray_OBJECT || \\\n\t\t type_num == PyArray_OBJECTLTR) {\n\t\t\tmemset(data, 0, sd);\n\t\t}\n\t}\n\telse {\n self->flags &= ~OWN_DATA; /* If data is passed in, \n\t\t\t\t\t this object won't own it \n\t\t\t\t\t by default.\n\t\t\t\t\t Caller must arrange for \n\t\t\t\t\t this to be reset if truly\n\t\t\t\t\t desired */\n }\n self->data = data;\n\tself->nd = nd;\n\tself->base = (PyObject *)NULL;\n self->weakreflist = (PyObject *)NULL;\n\n /* call the __array_finalize__\n\t method if a subtype and some object passed in */\n\tif ((obj != NULL) && (subtype != &PyArray_Type) && \n\t (subtype != &PyBigArray_Type)) {\n\t\tPyObject *res;\n\t\tres = PyObject_CallMethod((PyObject *)self, \n\t\t\t\t\t \"__array_finalize__\",\n\t\t\t\t\t \"O\", (PyObject *)obj);\n\t\tif (res == NULL) PyErr_Clear();\n\t\telse Py_DECREF(res);\n\t}\n\n\treturn (PyObject *)self;\n}\n\n\n\nstatic PyObject * \nPyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape)\n{\n intp oldsize, newsize;\n int new_nd=newshape->len, k, n, elsize;\n int refcnt;\n intp* new_dimensions=newshape->ptr;\n intp new_strides[MAX_DIMS];\n intp sd;\n intp *dimptr;\n char *new_data;\n\t\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n \"resize only works on contiguous arrays\");\n return NULL;\n }\n\n\n newsize = PyArray_MultiplyList(new_dimensions, new_nd);\n\n if (newsize == 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Newsize is zero. Cannot delete an array \"\\\n \"in this way.\");\n return NULL;\n }\n oldsize = PyArray_SIZE(self);\n \n\tif (oldsize != newsize) {\n\t\tif (!(self->flags & OWN_DATA)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize this array: \"\t\\\n\t\t\t\t\t\"it does not own its data.\");\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\trefcnt = (((PyObject *)self)->ob_refcnt);\n\t\tif ((refcnt > 2) || (self->base != NULL) || \\\n\t\t (self->weakreflist != NULL)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize an array that has \"\\\n\t\t\t\t\t\"been referenced or is referencing\\n\"\\\n\t\t\t\t\t\"another array in this way. Use the \"\\\n\t\t\t\t\t\"resize function.\");\n\t\t\treturn NULL;\n\t\t} \n\t\t\n\t\t/* Reallocate space if needed */\n\t\tnew_data = PyDataMem_RENEW(self->data, \n\t\t\t\t\t newsize*(self->itemsize));\n\t\tif (new_data == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n\t\t\t\t\t\"can't allocate memory for array.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tself->data = new_data;\n\t}\n \n if ((newsize > oldsize) && PyArray_ISWRITEABLE(self)) { \n\t\t/* Fill new memory with zeros */\n elsize = self->itemsize;\n\t\tif ((PyArray_TYPE(self) == PyArray_OBJECT)) {\n\t\t\tPyObject *zero = PyInt_FromLong(0);\n PyObject **optr;\n\t\t\toptr = ((PyObject **)self->data) + oldsize;\n\t\t\tn = newsize - oldsize;\n\t\t\tfor (k=0; kdata+oldsize*elsize, 0, \n\t\t\t (newsize-oldsize)*elsize);\n\t\t}\n\t}\n \n if (self->nd != new_nd) { /* Different number of dimensions. */\n self->nd = new_nd;\n \n /* Need new dimensions and strides arrays */\n dimptr = PyDimMem_RENEW(self->dimensions, 2*new_nd);\n if (dimptr == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n \"can't allocate memory for array \" \\\n \"(array may be corrupted).\");\n return NULL;\n }\n self->dimensions = dimptr;\n\t\tself->strides = dimptr + new_nd;\n }\n\n /* make new_strides variable */\n sd = (intp) self->itemsize;\n sd = _array_fill_strides(new_strides, new_dimensions, new_nd, sd,\n 0, &(self->flags));\n\n \n memmove(self->dimensions, new_dimensions, new_nd*sizeof(intp));\n memmove(self->strides, new_strides, new_nd*sizeof(intp));\n\n Py_INCREF(Py_None);\t\n return Py_None;\n \n}\n\n\nstatic void\nPyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj)\n{\n PyObject **optr;\n intp i,n;\n optr = (PyObject **)(arr->data);\n n = PyArray_SIZE(arr);\n if (obj == NULL) {\n for (i=0; ibase = buffer.base;\n Py_INCREF(buffer.base); \n }\n\n PyDimMem_FREE(dims.ptr);\n if (strides.ptr) PyDimMem_FREE(strides.ptr);\n return PyArray_Return(ret);\n \n fail:\n if (dims.ptr) free(dims.ptr);\n if (strides.ptr) free(strides.ptr);\n return NULL;\n}\n\n\n\n/******************* array attribute get and set routines ******************/\n\nstatic PyObject *\narray_ndim_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong(self->nd);\n}\n\nstatic PyObject *\narray_flags_get(PyArrayObject *self)\n{\n static PyObject *module=NULL;\n\n if (module==NULL) {\n module = PyImport_ImportModule(\"scipy.base._internal\");\n if (module == NULL) return NULL;\n }\n return PyObject_CallMethod(module, \"flagsobj\", \"Oi\", \n self, self->flags);\n}\n\n/*\nstatic int\narray_flags_set(PyArrayObject *self, PyObject *obj) \n{\n\tint flagback = self->flags;\n\n if (PyDict_Check(obj)) {\n PyObject *new;\n\t\tnew = PyDict_GetItemString(obj, \"ALIGNED\");\n\t\tif (new) {\n\t\t\tif (PyObject_Not(new)) self->flags &= ~ALIGNED;\n\t\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\t\telse {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"cannot set aligned flag of \" \\\n\t\t\t\t\t\t\"mis-aligned array to True\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n new = PyDict_GetItemString(obj, \"UPDATEIFCOPY\");\n if (new) {\n if (PyObject_Not(new)) {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n else {\n\t\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return -1;\n }\n }\n new = PyDict_GetItemString(obj, \"WRITEABLE\");\n if (new) {\n\t\t\tif (PyObject_IsTrue(new)) {\n\t\t\t\tif (_IsWriteable(self)) {\n\t\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself->flags = flagback;\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\t\"cannot set \"\t\\\n\t\t\t\t\t\t\t\"WRITEABLE \"\t\\\n\t\t\t\t\t\t\t\"flag to True of \"\\\n\t\t\t\t\t\t\t\"this array \");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n new = PyDict_GetItemString(obj, \"NOTSWAPPED\");\n if (new) {\n if (PyObject_IsTrue(new))\n self->flags |= NOTSWAPPED;\n else {\n self->flags &= ~NOTSWAPPED;\n\t\t\t}\n\t\t}\n return 0;\n }\n PyErr_SetString(PyExc_ValueError, \n \"Object must be a dictionary\");\n return -1;\n}\n*/\n\n\nstatic PyObject *\narray_shape_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->dimensions);\n}\n\n\nstatic int\narray_shape_set(PyArrayObject *self, PyObject *val)\n{\n \tint nd;\n\tPyObject *ret;\n\n\tif (!PyTuple_Check(val)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"shape must be a tuple\");\n\t\treturn -1;\n\t}\n\tret = PyArray_Reshape(self, val);\n\tif (ret == NULL) return -1;\n\t\n\tif (self->nd > 0) { /* Free old dimensions and strides */\n\t\tPyDimMem_FREE(self->dimensions);\n\t}\n\tnd = PyArray_NDIM(ret);\n\tself->nd = nd;\n\tif (nd > 0) { /* create new dimensions and strides */\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\tPyErr_SetString(PyExc_MemoryError,\"\");\n\t\t\treturn -1;\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, PyArray_DIMS(ret), \n\t\t nd*sizeof(intp));\n\t\tmemcpy(self->strides, PyArray_STRIDES(ret), \n\t\t nd*sizeof(intp));\n\t}\n\telse self->dimensions=NULL;\n\tPy_DECREF(ret);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_strides_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic int\narray_strides_set(PyArrayObject *self, PyObject *obj)\n{\n\tPyArray_Dims newstrides = {NULL, 0};\n\tPyArrayObject *new;\n\tintp numbytes;\n\n\tif (!PyArray_IntpConverter(obj, &newstrides) || \\\n\t newstrides.ptr == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"invalid strides.\");\n\t\treturn -1;\n\t}\n\tif (newstrides.len != self->nd) {\n\t\tPyErr_Format(PyExc_ValueError, \"strides must be \"\t\\\n\t\t\t \" same length as shape (%d)\", self->nd);\n\t\treturn -1;\n\t}\n\tnew = self;\n\twhile(new->base != NULL) {\n\t\tif (PyArray_Check(new->base)) \n\t\t\tnew = (PyArrayObject *)new->base;\n\t}\n\tnumbytes = PyArray_MultiplyList(new->dimensions, \n\t\t\t\t\tnew->nd)*new->itemsize;\n\t\n\tif (!PyArray_CheckStrides(self->itemsize, self->nd, numbytes, \n\t\t\t\t self->dimensions, newstrides.ptr)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"strides is not \"\\\n\t\t\t\t\"compatible with available memory\");\n\t\treturn -1;\n\t}\n\tmemcpy(self->strides, newstrides.ptr, sizeof(intp)*newstrides.len);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_protocol_strides_get(PyArrayObject *self)\n{\n\tif PyArray_ISCONTIGUOUS(self) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic PyObject *\narray_priority_get(PyArrayObject *self)\n{\n\tif (PyArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_PRIORITY);\n\telse if (PyBigArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_BIG_PRIORITY);\n\telse\n\t\treturn PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY);\n}\n\n\nstatic PyObject *\narray_data_get(PyArrayObject *self)\n{\n\tintp nbytes;\n\tif (!(PyArray_ISONESEGMENT(self))) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot get single-\"\\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn NULL;\n\t}\t\t\n\tnbytes = PyArray_NBYTES(self);\n\tif PyArray_ISWRITEABLE(self) \n\t\treturn PyBuffer_FromReadWriteObject((PyObject *)self, 0, \n\t\t\t\t\t\t (int) nbytes);\n\telse\n\t\treturn PyBuffer_FromObject((PyObject *)self, 0, (int) nbytes);\n}\n\nstatic int\narray_data_set(PyArrayObject *self, PyObject *op)\n{\n\tvoid *buf;\n\tint buf_len;\n\tint writeable=1;\n\n\tif (PyObject_AsWriteBuffer(op, &buf, &buf_len) < 0) {\n\t\twriteable = 0;\n\t\tif (PyObject_AsReadBuffer(op, (const void **)&buf, \n\t\t\t\t\t &buf_len) < 0) {\n\t\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\t\"Object does not have single-segment\" \\\n\t\t\t\t\t\"buffer interface\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif (!PyArray_ISONESEGMENT(self)) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot set single-\" \\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn -1;\n\t}\n\tif (PyArray_NBYTES(self) > buf_len) {\n\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\"Not enough data for array.\");\n\t\treturn -1;\n\t}\n\tif (self->flags & OWN_DATA) {\n\t\tPyArray_XDECREF(self);\n\t\tPyDataMem_FREE(self->data);\n\t}\n\tif (self->base) {\n\t\tif (self->flags & UPDATEIFCOPY) {\n\t\t\t((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tself->flags &= ~UPDATEIFCOPY;\n\t\t}\n\t\tPy_DECREF(self->base);\n\t}\n\tPy_INCREF(op);\n\tself->base = op;\n\tself->data = buf;\n\tself->flags = CARRAY_FLAGS;\n\tif (!writeable)\n\t\tself->flags &= ~WRITEABLE;\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_itemsize_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->itemsize);\n}\n\nstatic PyObject *\narray_size_get(PyArrayObject *self)\n{\n\tlonglong size=PyArray_SIZE(self);\n\tif (size > MAX_INT || size < MIN_INT)\n\t\treturn PyLong_FromLongLong((longlong) size);\n\telse \n\t\treturn PyInt_FromLong((long) size);\n}\n\n\nstatic PyObject *\narray_typechar_get(PyArrayObject *self)\n{\n\tif PyArray_ISFLEXIBLE(self) \n\t\treturn PyString_FromFormat(\"%c%d\", (self->descr->type),\n\t\t\t\t\t self->itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(self->descr->type), 1);\n}\n\nstatic PyObject *\narray_typestr_get(PyArrayObject *self)\n{\n\tstatic char endians[] = \"<>\";\n\tchar endian;\n\tint which;\n\tunsigned long val = 1;\n\tchar *s;\n\tchar basic_=self->descr->kind;\n\n\ts = (char *)&val; /* s[0] == 0 implies big-endian */\n\twhich = (PyArray_ISNOTSWAPPED(self) ? 0 : 1);\n\tif (s[0] == 0) which = 1 - which;\n\tendian = endians[which]; \n\t\n\tif ((basic_==PyArray_VOIDLTR) || (basic_==PyArray_STRINGLTR) || \\\n\t (basic_==PyArray_OBJECTLTR) || (self->itemsize == 1))\n\t\treturn PyString_FromFormat(\"|%c%d\", basic_, self->itemsize);\n\telse\n\t\treturn PyString_FromFormat(\"%c%c%d\", endian, basic_,\n\t\t\t\t\t self->itemsize);\n}\n\nstatic PyObject *\narray_descr_get(PyArrayObject *self)\n{\n\tPyObject *res;\n\tPyObject *dobj;\n\n\t/* hand this off to the typeobject */\n\t/* or give default */\n\tif (PyArray_ISUSERDEF(self)) {\n\t\tres = PyObject_GetAttrString((PyObject *)self->descr->typeobj, \n\t\t\t\t\t \"__array_descr__\");\n\t\tif (res) return res;\n\t\tPyErr_Clear();\n\t}\n\t/* get default */\n\tdobj = PyTuple_New(2);\n\tif (dobj == NULL) return NULL;\n\tPyTuple_SET_ITEM(dobj, 0, PyString_FromString(\"\"));\n\tPyTuple_SET_ITEM(dobj, 1, array_typestr_get(self));\n\tres = PyList_New(1);\n\tif (res == NULL) {Py_DECREF(dobj); return NULL;}\n\tPyList_SET_ITEM(res, 0, dobj);\n\treturn res;\n}\n\nstatic PyObject *\narray_typenum_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->descr->type_num);\n}\n\n\nstatic PyObject *\narray_type_get(PyArrayObject *self)\n{\n\treturn PyArray_TypeObjectFromType(self->descr->type_num);\n}\n\n/* If the type is changed. \n Also needing change: strides, itemsize\n\n Either itemsize is exactly the same\n or the array is single-segment (contiguous or fortran) with\n compatibile dimensions\n\n*/\n\nstatic int\narray_type_set(PyArrayObject *self, PyObject *arg)\n{\n PyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n intp newdim;\n int index;\n char *msg = \"new type not compatible with array.\";\n\n if ((PyArray_TypecodeConverter(arg, &newtype) < 0) ||\n newtype.type_num == PyArray_NOTYPE) {\n PyErr_SetString(PyExc_TypeError, \"Invalid type for array\");\n return -1;\n }\n if (!(PyArray_ISONESEGMENT(self) ||\t\t\\\n\t (newtype.itemsize != self->itemsize))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1; \n }\n\n\tif (PyArray_ISCONTIGUOUS(self)) index = self->nd - 1;\n\telse index = 0;\n\n if (newtype.itemsize < self->itemsize) {\n /* if it is compatible increase the size of the dimension\n at end (or at the front for FORTRAN)\n */\n if (self->itemsize % newtype.itemsize != 0) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n newdim = self->itemsize / newtype.itemsize;\n\t\tself->dimensions[index] *= newdim;\n self->strides[index] = newtype.itemsize;\n\t}\n \n else if (newtype.itemsize > self->itemsize) {\n \n /* Determine if last (or first if FORTRAN) dimension\n is compatible */\n\n\t\tnewdim = self->dimensions[index] * self->itemsize;\n if ((newdim % newtype.itemsize) != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n\t\t\n self->dimensions[index] = newdim / newtype.itemsize;\n self->strides[index] = newtype.itemsize;\n\t\t\n }\n\t\n \n /* fall through -- adjust type*/\n\n self->descr = PyArray_DescrFromType(newtype.type_num);\n self->itemsize = newtype.itemsize;\n PyArray_UpdateFlags(self, ALIGNED);\n return 0;\n\n}\n\n\n\nstatic PyObject *\narray_base_get(PyArrayObject *self)\n{\n\tif (self->base == NULL) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\telse {\n\t\tPy_INCREF(self->base);\n\t\treturn self->base;\n\t}\n}\n\n\nstatic PyObject *\narray_real_get(PyArrayObject *self)\n{\n\tPyArrayObject *ret;\n\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *)ret;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n}\n\n\nstatic int\narray_real_set(PyArrayObject *self, PyObject *val)\n{\n\tPyArrayObject *ret;\n\tPyArrayObject *new;\n\tint rint;\n\n\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0);\n\tif (new == NULL) return -1;\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) return -1;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\tret = self;\n\t}\t\n\trint = PyArray_CopyInto(ret, new);\n\tPy_DECREF(ret);\n\treturn rint;\n}\n\nstatic PyObject *\narray_imag_get(PyArrayObject *self)\n{\t\n\tPyArrayObject *ret;\n\tint itemsize;\n\tint typenum;\n PyArray_Typecode type = {self->descr->type_num, \n self->itemsize,\t \n PyArray_ISFORTRAN(self)};\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\titemsize = self->itemsize >> 1;\n\t\ttypenum = self->descr->type_num - PyArray_NUM_FLOATTYPE;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t typenum,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data + itemsize,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *) ret;\n\t}\n\telse {\n\t\tret = (PyArrayObject *)PyArray_Zeros(self->nd, \n\t\t\t\t\t\t self->dimensions, &type);\n\t\tret->flags &= ~WRITEABLE;\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic int\narray_imag_set(PyArrayObject *self, PyObject *val)\n{\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyArrayObject *ret;\n\t\tPyArrayObject *new;\n\t\tint rint;\n\n\t\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0); \n\t\tif (new == NULL) return -1;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides+ \\\n\t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, self);\n\t\tif (ret == NULL) {\n\t\t\tPy_DECREF(new); \n\t\t\treturn -1;\n\t\t}\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\trint = PyArray_CopyInto(ret, new);\n\t\tPy_DECREF(ret);\t\t\n\t\tPy_DECREF(new);\n\t\treturn rint;\n\t}\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError, \"Does not have imaginary \" \\\n\t\t\t\t\"part to set.\");\n\t\treturn -1;\n\t}\n}\n\nstatic PyObject *\narray_flat_get(PyArrayObject *self)\n{\n return PyArray_IterNew((PyObject *)self);\n}\n\nstatic int \narray_flat_set(PyArrayObject *self, PyObject *val)\n{\n\tPyObject *arr=NULL;\n\tint retval = -1;\n\tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n\tPyArray_Typecode typecode = {self->descr->type_num,\n\t\t\t\t self->itemsize,\n\t\t\t\t PyArray_ISFORTRAN(self)};\n int swap;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tarr = PyArray_FromAny(val, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\tarrit = (PyArrayIterObject *)PyArray_IterNew(arr);\n\tif (arrit == NULL) goto exit;\n\tselfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (selfit == NULL) goto exit;\n\n swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);\n copyswap = self->descr->copyswap;\n if (PyArray_ISOBJECT(self)) {\n while(selfit->index < selfit->size) {\n Py_XDECREF(*((PyObject **)selfit->dataptr));\n Py_INCREF(*((PyObject **)arrit->dataptr)); \n memmove(selfit->dataptr, arrit->dataptr, \n sizeof(PyObject *));\n copyswap(selfit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_ITER_NEXT(selfit);\n PyArray_ITER_NEXT(arrit);\n if (arrit->index == arrit->size) \n PyArray_ITER_RESET(arrit);\n }\n retval = 0; \n goto exit;\n }\n\n\twhile(selfit->index < selfit->size) {\n\t\tmemmove(selfit->dataptr, arrit->dataptr, self->itemsize);\n copyswap(selfit->dataptr, NULL, swap, self->itemsize);\n\t\tPyArray_ITER_NEXT(selfit);\n\t\tPyArray_ITER_NEXT(arrit);\n\t\tif (arrit->index == arrit->size) \n\t\t\tPyArray_ITER_RESET(arrit);\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(selfit);\n\tPy_XDECREF(arrit);\n\tPy_XDECREF(arr);\n\treturn retval;\n}\n\nstatic PyGetSetDef array_getsetlist[] = {\n {\"ndim\", \n\t (getter)array_ndim_get, \n\t NULL, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)array_flags_get, \n NULL,\n\t \"special dictionary of flags\"},\n {\"shape\", \n\t (getter)array_shape_get, \n\t (setter)array_shape_set, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)array_strides_get, \n\t (setter)array_strides_set,\n\t \"tuple of bytes steps in each dimension\"},\n {\"data\", \n\t (getter)array_data_get, \n\t (setter)array_data_set, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)array_itemsize_get, \n\t NULL,\n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)array_size_get,\n\t NULL,\n \"number of elements in the array\"},\n\t{\"base\",\n\t (getter)array_base_get,\n\t NULL,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)array_type_get, \n\t (setter)array_type_set,\n\t \"get array type class\"},\n\t{\"dtypechar\",\n\t (getter)array_typechar_get,\n\t NULL,\n\t \"get array type character code\"},\n\t{\"dtypenum\",\n\t (getter)array_typenum_get,\n\t NULL,\n\t \"get array type number code\"},\n\t{\"dtypestr\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)array_real_get, \n\t (setter)array_real_set, \n\t \"real part of array\"},\n {\"imag\", \n\t (getter)array_imag_get, \n\t (setter)array_imag_set, \n\t \"imaginary part of array\"},\n\t{\"flat\", \n\t (getter)array_flat_get, \n\t (setter)array_flat_set, \n\t \"a 1-d view of a contiguous array\"}, \n\t{\"__array_data__\", \n\t (getter)array_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)array_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)array_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)array_protocol_strides_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t{\"__array_priority__\",\n\t (getter)array_priority_get,\n\t NULL,\n\t \"Array priority\"},\n \t{NULL, NULL, NULL, NULL}, /* Sentinel */\n};\n\n/****************** end of attribute get and set routines *******************/\n\n\n\nstatic char Arraytype__doc__[] = \n \"A array object represents a multidimensional, homogeneous array of basic values. It has the folowing data members, m.shape (the size of each dimension in the array), m.itemsize (the size (in bytes) of each element of the array), and m.typecode (a character representing the type of the array elements). Arrays are sequence, mapping and numeric objects. Sequence indexing is similar to lists, with single indices returning a reference that points to the old array data, and slices returning by copy. A array is also allowed to be indexed by a sequence of items.\t Each member of the sequence indexes the corresponding dimension of the array.\";\n\nstatic PyTypeObject PyBigArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.bigndarray\",\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n /* methods */\n (destructor)array_dealloc,\t\t /*tp_dealloc */\n (printfunc)NULL,\t\t\t /*tp_print*/\n 0,\t\t\t\t\t /*tp_getattr*/\n 0,\t\t\t\t\t /*tp_setattr*/\n (cmpfunc)0, \t\t /*tp_compare*/\n (reprfunc)array_repr,\t\t /*tp_repr*/\n &array_as_number,\t\t\t /*tp_as_number*/\n NULL, \t\t\t /*tp_as_sequence*/\n &array_as_mapping,\t\t\t /*tp_as_mapping*/\n (hashfunc)0,\t\t\t /*tp_hash*/\n (ternaryfunc)0,\t\t\t /*tp_call*/\n (reprfunc)array_str, \t /*tp_str*/\n\t\t\n (getattrofunc)0,\t\t\t /*tp_getattro*/\n (setattrofunc)0,\t\t\t /*tp_setattro*/\n NULL, \t /*tp_as_buffer*/\n (Py_TPFLAGS_DEFAULT \n | Py_TPFLAGS_BASETYPE\n | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/\n /*Documentation string */\n Arraytype__doc__,\t\t\t /*tp_doc*/\n\n (traverseproc)0,\t\t\t /*tp_traverse */\n (inquiry)0,\t\t\t /*tp_clear */\n (richcmpfunc)array_richcompare,\t \n offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */\n\n /* Iterator support (use standard) */\n\n (getiterfunc)0, \t\t /* tp_iter */\n (iternextfunc)0,\t\t\t /* tp_iternext */\n\n /* Sub-classing (new-style object) support */\n\n array_methods,\t\t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n array_getsetlist,\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0,\t /* tp_alloc */ \n (newfunc)array_new,\t\t /* tp_new */\n 0,\t \t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n};\n\n/* A standard array will subclass from the Big Array and \n add the array_as_sequence table\n and the array_as_buffer table\n */\n\nstatic PyTypeObject PyArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.ndarray\",\t\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n};\n\n\n/* The rest of this code is to build the right kind of array from a python */\n/* object. */\n\nstatic int \ndiscover_depth(PyObject *s, int max, int stop_at_string) \n{\n int d=0;\n PyObject *e;\n\t\n if(max < 1) return -1;\n\n if(! PySequence_Check(s) || PyInstance_Check(s) || \\\n\t PySequence_Length(s) < 0) {\n PyErr_Clear(); return 0;\n }\n if (PyArray_Check(s))\n\t\treturn PyArray_NDIM(s);\n if(PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))\n\t\treturn stop_at_string ? 0:1;\n if (PySequence_Length(s) == 0) \n\t\treturn 1;\n\t\n if ((e=PySequence_GetItem(s,0)) == NULL) return -1;\n if(e!=s) {\n\t\td=discover_depth(e,max-1, stop_at_string);\n\t\tif(d >= 0) d++;\n\t}\n Py_DECREF(e);\n return d;\n}\n\nstatic int\ndiscover_itemsize(PyObject *s, int nd, int *itemsize) \n{\n\tint n, r, i;\n\tPyObject *e;\n\t\n\tn = PyObject_Length(s);\n\n\tif ((nd == 0) || PyString_Check(s) ||\t\t\\\n\t PyUnicode_Check(s) || PyBuffer_Check(s)) {\n\t\tif PyUnicode_Check(s) \n\t\t\t*itemsize = MAX(*itemsize, sizeof(Py_UNICODE)*n);\n\t\telse\n\t\t\t*itemsize = MAX(*itemsize, n);\n\t\treturn 0;\n\t}\n\tfor (i=0; i n_lower) n_lower = d[1];\n }\n d[1] = n_lower;\n\t\n return 0;\n}\n\nstatic void\n_array_small_type(int chktype, int mintype, int chksize, int minsize, \n\t\t PyArray_Typecode *outtype)\n{\n\touttype->type_num = MAX(chktype, mintype);\n\tif (PyTypeNum_ISFLEXIBLE(outtype->type_num) &&\t\\\n\t PyTypeNum_ISFLEXIBLE(mintype)) {\n\t\t/* Handle string->unicode case separately \n\t\t because string itemsize is twice as large */\n\t\tif (outtype->type_num == PyArray_UNICODE && \n\t\t mintype == PyArray_STRING) {\n\t\t\touttype->itemsize = MAX(chksize, 2*minsize);\n\t\t}\n\t\telse {\n\t\t\touttype->itemsize = MAX(chksize, minsize);\n\t\t}\n\t}\n\telse {\n\t\touttype->itemsize = chksize;\n\t}\n\treturn;\t\n}\n\nstatic void\n_array_find_type(PyObject *op, PyArray_Typecode *minitype, \n\t\t PyArray_Typecode *outtype, int max)\n{\n int l;\n PyObject *ip;\n\tint chktype=0;\n\tint chksize=0;\n\tint mintype, minsize;\n\n\tif (minitype == NULL) {\n\t\tmintype = PyArray_BOOL;\n\t\tminsize = sizeof(Bool);\n\t}\n\telse {\n\t\tmintype = minitype->type_num;\n\t\tminsize = minitype->itemsize;\n\t}\n\n \n if (max < 0 || mintype == -1) goto deflt;\n\t\n if (PyArray_Check(op)) {\n\t\tchktype = PyArray_TYPE(op);\n\t\tchksize = PyArray_ITEMSIZE(op);\n\t\tgoto finish;\n\t}\n\t\n\tif (PyArray_IsScalar(op, Generic)) {\n\t\tPyArray_TypecodeFromScalar(op, outtype);\n\t\tchktype = outtype->type_num;\n\t\tchksize = outtype->itemsize;\n\t\tgoto finish;\n\t}\n\t\n\n if (PyObject_HasAttrString(op, \"__array__\")) {\n ip = PyObject_CallMethod(op, \"__array__\", NULL);\n if(ip && PyArray_Check(ip)) {\n\t\t\tchktype = PyArray_TYPE(ip);\n\t\t\tchksize = PyArray_ITEMSIZE(ip);\n\t\t\tgoto finish;\n\t\t}\n } \n\t\n\tif (PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tint swap=0, res;\n\t\tip = PyObject_GetAttrString(op, \"__array_typestr__\");\n\t\tif (ip && PyString_Check(ip)) {\n\t\t\tres = _array_typecode_fromstr(PyString_AS_STRING(ip), \n\t\t\t\t\t\t &swap, outtype); \n\t\t\tif (res >= 0) {\n\t\t\t\tPy_DECREF(ip);\n\t\t\t\tchktype = outtype->type_num;\n\t\t\t\tchksize = outtype->itemsize;\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t}\n\t\tPy_XDECREF(ip);\n\t}\n\n if (PyString_Check(op)) {\n\t\tchktype = PyArray_STRING;\n\t\tchksize = PyString_GET_SIZE(op);\n\t\tgoto finish;\n }\n\n\tif (PyUnicode_Check(op)) {\n\t\tchktype = PyArray_UNICODE;\n\t\tchksize = PyUnicode_GET_DATA_SIZE(op);\n\t\tgoto finish;\n\t}\n\n\tif (PyBuffer_Check(op)) {\n\t\tchktype = PyArray_VOID;\n\t\tchksize = op->ob_type->tp_as_sequence->sq_length(op);\n\t\tPyErr_Clear();\n\t\tgoto finish;\n\t}\n\n\tif (PyInstance_Check(op)) goto deflt;\n\t\n if (PySequence_Check(op)) {\n\t\tPyArray_Typecode newtype = {mintype, minsize, 0};\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n\t\t\tPyErr_Clear(); \n\t\t\tgoto deflt;\n\t\t}\n if (l == 0 && mintype == 0) {\n\t\t\tnewtype.type_num = PyArray_INTP;\n\t\t\tnewtype.itemsize = sizeof(intp);\n\t\t}\n while (--l >= 0) {\n ip = PySequence_GetItem(op, l);\n if (ip==NULL) {\n\t\t\t\tPyErr_Clear(); \n\t\t\t\tgoto deflt;\n\t\t\t}\n\t\t\t_array_find_type(ip, &newtype, outtype, max-1);\n\t\t\t_array_small_type(outtype->type_num,\n\t\t\t\t\t newtype.type_num, \n\t\t\t\t\t outtype->itemsize,\n\t\t\t\t\t newtype.itemsize,\n\t\t\t\t\t &newtype);\n Py_DECREF(ip);\n }\n\t\tchktype = newtype.type_num;\n\t\tchksize = newtype.itemsize;\n\t\tgoto finish;\n }\n\t\n\tif (PyBool_Check(op)) {\n\t\tchktype = PyArray_BOOL;\n\t\tchksize = sizeof(Bool);\n\t\tgoto finish;\t\t\n\t}\n else if (PyInt_Check(op)) {\n\t\tchktype = PyArray_LONG;\n\t\tchksize = sizeof(long);\n\t\tgoto finish;\n } else if (PyFloat_Check(op)) {\n\t\tchktype = PyArray_DOUBLE;\n\t\tchksize = sizeof(double);\n\t\tgoto finish;\n\t} else if (PyComplex_Check(op)) {\n\t\tchktype = PyArray_CDOUBLE;\n\t\tchksize = sizeof(cdouble);\n\t\tgoto finish;\n\t}\n\n deflt:\n\tchktype = PyArray_OBJECT;\n\tchksize = sizeof(void *);\n\n finish:\n\t_array_small_type(chktype, mintype, chksize, minsize, \n\t\t\t outtype);\n\treturn;\n}\n\nstatic int \nAssign_Array(PyArrayObject *self, PyObject *v) \n{\n PyObject *e;\n int l, r;\n\t\n if (!PySequence_Check(v)) {\n PyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"assignment from non-sequence\");\n return -1;\n }\n\t\n l=PyObject_Length(v);\n if(l < 0) return -1; \n\t\n while(--l >= 0)\n {\n e=PySequence_GetItem(v,l);\n if (e == NULL) return -1; \n\t\t\tr = PySequence_SetItem((PyObject*)self,l,e);\n Py_DECREF(e);\n if(r == -1) return -1;\n }\n return 0;\n}\n\n/* \"Array Scalars don't call this code\" */ \nstatic PyObject *\nArray_FromScalar(PyObject *op, PyArray_Typecode *typecode) \n{\n PyArrayObject *ret;\n\tint itemsize = 0;\n\tint type = typecode->type_num;\n\n\tif PyTypeNum_ISFLEXIBLE(type) {\n\t\titemsize = PyObject_Length(op);\n\t}\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,\n\t\t\t\t\t NULL, NULL, itemsize, 0, NULL);\n\n\tif (ret == NULL) return NULL;\n\n ret->descr->setitem(op, ret->data, ret);\n\t\n if (PyErr_Occurred()) {\n array_dealloc(ret);\n return NULL;\n } else {\n return (PyObject *)ret;\n }\n}\n\n\nstatic PyObject *\nArray_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth)\n{\n PyArrayObject *r;\n int nd;\n\tintp *d;\n\tint stop_at_string;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\t\n\t\n\tstop_at_string = ((type == PyArray_OBJECT) ||\t\\\n\t\t\t (type == PyArray_STRING) ||\t\\\n\t\t\t (type == PyArray_UNICODE) || \\\n\t\t\t (type == PyArray_VOID));\n\n if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string)) > 0)) {\n\t\tif (nd==0)\n\t\t\treturn Array_FromScalar(s, typecode);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid input sequence\");\n return NULL;\n }\n\t\n if ((max_depth && nd > max_depth) ||\t\\\n\t (min_depth && nd < min_depth)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of dimensions\");\n return NULL;\n }\n\t\n\tif ((d=PyDimMem_NEW(nd)) == NULL) {\n\t\treturn PyErr_NoMemory();\n }\n\tif(discover_dimensions(s,nd,d, !stop_at_string) == -1) {\n\t\tPyDimMem_FREE(d);\n\t\treturn NULL;\n\t}\n\tif (itemsize == 0 && PyTypeNum_ISFLEXIBLE(type)) {\n\t\tif (discover_itemsize(s, nd, &itemsize) == -1) {\n\t\t\tPyDimMem_FREE(d);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n r=(PyArrayObject*)PyArray_New(&PyArray_Type, nd, d, \n\t\t\t\t type, NULL, NULL,\n\t\t\t\t itemsize, \n\t\t\t\t typecode->fortran, NULL);\n\n PyDimMem_FREE(d);\n if(!r) return NULL;\n if(Assign_Array(r,s) == -1) {\n\t\tPy_DECREF(r);\n\t\treturn NULL;\n\t}\n return (PyObject*)r;\n}\n\n\nstatic int \nPyArray_ValidType(int type) \n{\n\tPyArray_Descr *descr;\n\t\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr==NULL) return 0;\n\treturn 1;\n}\n\n\n/* If the output is not a CARRAY, then it is buffered also */\n\nstatic int\n_bufferedcast(PyArrayObject *out, PyArrayObject *in)\n{\n\tchar *inbuffer, *bptr, *optr;\n\tchar *outbuffer=NULL;\n\tPyArrayIterObject *it_in=NULL, *it_out=NULL;\n\tregister intp i, index;\n\tintp ncopies = PyArray_SIZE(out) / PyArray_SIZE(in);\n\tint elsize=in->itemsize;\n\tint nels = PyArray_BUFSIZE;\n\tint el;\n\tint inswap, outswap=0;\n\tint obuf=!PyArray_ISCARRAY(out);\n\tint oelsize = out->itemsize;\n\tPyArray_VectorUnaryFunc *castfunc;\n PyArray_CopySwapFunc *in_csn;\n PyArray_CopySwapFunc *out_csn;\n\tint retval = -1;\n\n\tcastfunc = in->descr->cast[out->descr->type_num];\n in_csn = in->descr->copyswap;\n out_csn = out->descr->copyswap;\n\n\t/* If the input or output is STRING, UNICODE, or VOID */\n\t/* then getitem and setitem are used for the cast */\n\t/* and byteswapping is handled by those methods */\n\n\tinswap = !(PyArray_ISFLEXIBLE(in) || PyArray_ISNOTSWAPPED(in));\n\t\n\tinbuffer = PyDataMem_NEW(PyArray_BUFSIZE*elsize);\n\tif (inbuffer == NULL) return -1;\n\tit_in = (PyArrayIterObject *)PyArray_IterNew((PyObject *)in);\n\tif (it_in == NULL) goto exit;\n\n\tif (obuf) {\n\t\toutswap = !(PyArray_ISFLEXIBLE(out) || \\\n\t\t\t PyArray_ISNOTSWAPPED(out));\n\t\toutbuffer = PyDataMem_NEW(PyArray_BUFSIZE*oelsize);\n\t\tif (outbuffer == NULL) goto exit;\n\n\t\tit_out = (PyArrayIterObject *)PyArray_IterNew((PyObject *)out);\n\t\tif (it_out == NULL) goto exit;\n\n\t\tnels = MIN(nels, PyArray_BUFSIZE);\n\t}\n\t\n\toptr = (obuf) ? outbuffer: out->data;\n\tbptr = inbuffer;\n\tel = 0;\t\n\twhile(ncopies--) {\n\t\tindex = it_in->size;\n\t\tPyArray_ITER_RESET(it_in);\n\t\twhile(index--) {\n in_csn(bptr, it_in->dataptr, inswap, elsize);\n\t\t\tbptr += elsize;\n\t\t\tPyArray_ITER_NEXT(it_in);\n\t\t\tel += 1;\n\t\t\tif ((el == nels) || (index == 0)) {\n\t\t\t\t/* buffer filled, do cast */\n\t\t\t\t\n\t\t\t\tcastfunc(inbuffer, optr, el, in, out);\n\t\t\t\t\n\t\t\t\tif (obuf) {\n\t\t\t\t\t/* Copy from outbuffer to array */\n\t\t\t\t\tfor(i=0; idataptr,\n optr, outswap,\n oelsize);\n\t\t\t\t\t\toptr += oelsize;\n\t\t\t\t\t\tPyArray_ITER_NEXT(it_out);\n\t\t\t\t\t}\n\t\t\t\t\toptr = outbuffer;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toptr += out->itemsize * nels;\n\t\t\t\t}\n\t\t\t\tel = 0;\n\t\t\t\tbptr = inbuffer;\n\t\t\t}\n\t\t}\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(it_in);\n\tPyDataMem_FREE(inbuffer);\n\tPyDataMem_FREE(outbuffer);\t\n\tif (obuf) {\n\t\tPy_XDECREF(it_out);\n\t}\n\treturn retval;\n\n}\n\n\n/* For backward compatibility */\n\nstatic PyObject *\nPyArray_Cast(PyArrayObject *mp, int type_num) \n{\n\tPyArray_Typecode type;\n\tPyArray_Descr *descr;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\ttype.itemsize = descr->elsize;\n\ttype.type_num = descr->type_num;\n\ttype.fortran = 0;\n\t\n\treturn PyArray_CastToType(mp, &type);\n}\n\nstatic PyObject * \nPyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at) \n{\n\tPyObject *out;\n\tint ret;\n\n\tif ((mp->descr->type_num == at->type_num) && \\\n\t (at->itemsize==0 || mp->itemsize == at->itemsize) &&\n\t PyArray_ISBEHAVED_RO(mp)) {\n\t\tPy_INCREF(mp);\n\t\treturn (PyObject *)mp;\n\t}\n\t\t\n\tif (at->itemsize == 0) {\n\t\tif (mp->descr->type_num == PyArray_STRING &&\t\\\n\t\t at->type_num == PyArray_UNICODE)\n\t\t\tat->itemsize = mp->itemsize*sizeof(Py_UNICODE);\n\t\tif (mp->descr->type_num == PyArray_UNICODE &&\n\t\t at->type_num == PyArray_STRING) \n\t\t\tat->itemsize = mp->itemsize/sizeof(Py_UNICODE);\n\t\tif (at->type_num == PyArray_VOID)\n\t\t\tat->itemsize = mp->itemsize;\n\t}\n\n\tout = PyArray_New(mp->ob_type, mp->nd, \n\t\t\t mp->dimensions, \n\t\t\t at->type_num,\n\t\t\t NULL, NULL, at->itemsize, \n\t\t\t at->fortran, mp);\n\tif (out == NULL) return NULL;\n\tret = PyArray_CastTo((PyArrayObject *)out, mp);\n\tif (ret != -1) return out;\n\n\tPy_DECREF(out);\n\treturn NULL;\n\t\n}\n\t \n/* The number of elements in out must be an integer multiple\n of the number of elements in mp. \n*/\n\nstatic int\nPyArray_CastTo(PyArrayObject *out, PyArrayObject *mp)\n{\n\n\tint simple;\n\tintp mpsize = PyArray_SIZE(mp);\n\tintp outsize = PyArray_SIZE(out);\n\n\tif (mpsize == 0) return 0;\n\tif (!PyArray_ISWRITEABLE(out)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array is not writeable.\");\n\t\treturn -1;\n\t}\n\tif (outsize % mpsize != 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array must have an integer-multiple\"\\\n\t\t\t\t\" of the number of elements in the input \"\\\n\t\t\t\t\"array\");\n\t\treturn -1; \n\t}\n\n\tsimple = ((PyArray_ISCARRAY(mp) && PyArray_ISCARRAY(out)) || \\\n (PyArray_ISFARRAY(mp) && PyArray_ISFARRAY(out)));\n\t\n\tif (simple) {\n\t\tchar *inptr;\n\t\tchar *optr = out->data;\n\t\tintp obytes = out->itemsize * outsize;\n\t\tintp ncopies = outsize / mpsize;\n\n\t\twhile(ncopies--) {\n\t\t\tinptr = mp->data;\n\t\t\tmp->descr->cast[out->descr->type_num](inptr, \n\t\t\t\t\t\t\t optr,\n\t\t\t\t\t\t\t mpsize,\n\t\t\t\t\t\t\t mp, out);\n\t\t\toptr += obytes;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t/* If not a well-behaved cast, then use buffers */\n\tif (_bufferedcast(out, mp) == -1) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nstatic PyObject *\narray_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags) \n{\n\t\n\tPyArrayObject *ret=NULL;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\tint copy = 0;\n\tint arrflags;\n\tPyArray_Typecode oldtype={PyArray_TYPE(arr),PyArray_ITEMSIZE(arr),0};\n\tchar *msg = \"Cannot copy-back to a read-only array.\";\n\t\n\tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n\tif (itemsize == 0) itemsize = arr->itemsize;\n\ttypecode->type_num = type;\n\ttypecode->itemsize = itemsize;\n\n\t/* Don't copy if sizes are compatible */\n\tif (PyArray_EquivalentTypes(&oldtype, typecode)) {\n\t\tarrflags = arr->flags;\n\n\t\tcopy = (flags & ENSURECOPY) || \\\n\t\t\t((flags & CONTIGUOUS) && (!(arrflags & CONTIGUOUS))) \\\n\t\t\t|| (PyArray_ITEMSIZE(arr) != itemsize) || \\\n\t\t\t((flags & ALIGNED) && (!(arrflags & ALIGNED))) || \\\n\t\t\t((flags & NOTSWAPPED) && (!(arrflags & NOTSWAPPED))) \\\n\t\t\t|| (arr->nd > 1 &&\t\t\t\t\\\n\t\t\t ((flags & FORTRAN) != (arrflags & FORTRAN))) || \\\n\t\t\t((flags & WRITEABLE) && (!(arrflags & WRITEABLE)));\n\t\t\n\t\tif (copy) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_New(arr->ob_type, \n\t\t\t\t\t arr->nd, \n\t\t\t\t\t arr->dimensions,\n\t\t\t\t\t arr->descr->type_num,\n\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t itemsize,\n\t\t\t\t\t flags & FORTRAN,\n\t\t\t\t\t arr);\n\t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t} \n\t\t/* If no copy then just increase the reference\n\t\t count and return the input */\n\t\telse { \n\t\t\tPy_INCREF(arr);\n\t\t\tret = arr;\n\t\t}\n\t}\n\t\n\t/* The desired output type is different than the input\n\t array type */\n\telse {\n\t\t/* Cast to the desired type if we can do it safely\n\t\t Also cast if source is a ndim-0 array to mimic\n\t\t behavior with Python scalars */\n\t\tif (flags & FORCECAST || PyArray_NDIM(arr)==0 ||\n\t\t PyArray_CanCastSafely(PyArray_TYPE(arr), type)) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_CastToType(arr, typecode);\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Array can not be safely cast \"\\\n\t\t\t\t\t\"to required type\");\n\t\t\tret = NULL;\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic int\n_array_typecode_fromstr(char *str, int *swap, PyArray_Typecode *type)\n{\n int type_num;\n char typechar;\n int size;\n unsigned long number = 1;\n char *s;\n char msg[] = \"unsupported typestring\";\n \n s = (char *)&number; /* s[0] == 0 implies big-endian */\n\n *swap = 0;\n\n if (str[0] == '<' || str[0] == '>') {\n\tif ((str[0] == '<') && (s[0] == 0)) *swap = 1;\n\telse if ((str[0] == '>') && (s[0] != 0)) *swap = 1;\n }\n str += 1;\n \n#define _MY_FAIL {\t\t\t\t \\\n\t PyErr_SetString(PyExc_ValueError, msg); \\\n\t return -1;\t\t\t \\\n }\t\t\n\n typechar = str[0];\n size = atoi(str + 1);\n switch (typechar) {\n case 'b':\n\t if (size == sizeof(Bool))\n\t\t type_num = PyArray_BOOL;\t \n\t else _MY_FAIL \n\t break;\t\t \n case 'u':\n if (size == sizeof(uintp))\n type_num = PyArray_UINTP;\n\t else if (size == sizeof(char))\n\t\t type_num = PyArray_UBYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_USHORT;\n\t else if (size == sizeof(int)) \n\t\t type_num = PyArray_UINT;\n\t else if (size == sizeof(ulong)) \n\t\t type_num = PyArray_ULONG;\n\t else if (size == sizeof(ulonglong))\n\t\t type_num = PyArray_ULONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'i':\n if (size == sizeof(intp))\n type_num = PyArray_INTP;\n\t else if (size == sizeof(char)) \n\t\t type_num = PyArray_BYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_SHORT;\n\t else if (size == sizeof(int))\n\t\t type_num = PyArray_INT;\n\t else if (size == sizeof(long)) \n\t\t type_num = PyArray_LONG;\n\t else if (size == sizeof(longlong))\n\t\t type_num = PyArray_LONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'f':\n\t if (size == sizeof(float))\n\t\t type_num = PyArray_FLOAT;\n\t else if (size == sizeof(double))\n\t\t type_num = PyArray_DOUBLE;\n\t else if (size == sizeof(longdouble))\n\t\t type_num = PyArray_LONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'c':\n\t if (size == sizeof(float)*2)\n\t\t type_num = PyArray_CFLOAT;\n\t else if (size == sizeof(double)*2)\n\t\t type_num = PyArray_CDOUBLE;\n\t else if (size == sizeof(longdouble)*2)\n\t\t type_num = PyArray_CLONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'O':\n\t if (size == sizeof(PyObject *))\n\t\t type_num = PyArray_OBJECT;\n\t else _MY_FAIL\n\t break;\n case 'S':\n\t type_num = PyArray_STRING;\n\t break;\n case 'U':\n\t type_num = PyArray_UNICODE;\n\t size *= sizeof(Py_UNICODE);\n\t break;\t \n case 'V':\n\t type_num = PyArray_VOID;\n\t break;\n default:\n\t _MY_FAIL\n }\n\n#undef _MY_FAIL\n\n type->type_num = type_num;\n type->itemsize = size;\n type->fortran = 0;\n return 0;\n}\n\nstatic PyObject *\narray_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n{\n\tPyObject *attr=NULL, *item=NULL, *r;\n\tPyArrayObject *ret=NULL;\n\tPyArray_Typecode type;\n\tchar *data;\n\tint buffer_len;\n\tint res, i, n;\n\tintp dims[MAX_DIMS], strides[MAX_DIMS];\n\tint swap;\n\n\t/* Get the memory from __array_data__ and __array_offset__ */\n\t/* Get the shape */\n\t/* Get the typestring -- ignore array_descr */\n\t/* Get the strides */\n\t\n\tattr = PyObject_GetAttrString(input, \"__array_data__\");\n\tif (attr == NULL) {\n\t\tPy_INCREF(input);\n\t\tattr = input;\n\t}\n\t\n\tres = PyObject_AsWriteBuffer(attr, (void **)&data, &buffer_len);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n\n\tattr = PyObject_GetAttrString(input, \"__array_typestr__\");\n\tif (!PyString_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_typestr__ must be a string.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\t\n\t}\n\tres = _array_typecode_fromstr(PyString_AS_STRING(attr), &swap, &type);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n \n\tattr = PyObject_GetAttrString(input, \"__array_shape__\");\n\tif (!PyTuple_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_shape__ must be a tuple.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\n\t}\n\tn = PyTuple_GET_SIZE(attr);\n\tfor (i=0; ibase = input;\n \n\tattr = PyObject_GetAttrString(input, \"__array_strides__\");\n\tif (attr != NULL && attr != Py_None) {\n\t\tif (!PyTuple_Check(attr)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"__array_strides__ must be a tuple.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tif (n != PyTuple_GET_SIZE(attr)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"mismatch in length of \"\\\n\t\t\t\t\t\"__array_strides__ and \"\\\n\t\t\t\t\t\"__array_shape__.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tfor (i=0; istrides, strides, n*sizeof(intp));\n\t}\n\n\tif (swap) {\n\t\tPyObject *tmp;\n\t\ttmp = PyObject_CallMethod((PyObject *)ret, \"byteswap\", \"\");\n\t\tPy_DECREF(tmp);\n\t}\n\n\tPyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);\n\tr = array_fromarray(ret, intype, flags);\n\tPy_DECREF(ret);\n\treturn r;\n}\n\nstatic PyObject *\narray_fromattr(PyObject *op, PyArray_Typecode *typecode, int flags) \n{\n PyObject *new, *r;\n\t \n if (typecode->type_num == PyArray_NOTYPE) {\n new = PyObject_CallMethod(op, \"__array__\", NULL);\n } else {\n new = PyObject_CallMethod(op, \"__array__\", \"i\", \n typecode->type_num);\n }\n if (new == NULL) return NULL;\n if (!PyArray_Check(new)) {\n PyErr_SetString(PyExc_ValueError, \n \"object __array__ method not \" \\\n \"producing an array.\");\n Py_DECREF(new);\n return NULL;\n }\n r = array_fromarray((PyArrayObject *)new, typecode, flags);\n Py_DECREF(new);\n return r;\n} \n\n\nstatic PyObject *\narray_fromobject(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth, int flags) \n{\n /* This is the main code to make a NumPy array from a Python\n Object. It is called from lot's of different places which\n is why there are so many checks. The comments try to\n explain some of the checks. */\n\n\tint type = typecode->type_num;\n PyObject *r=NULL;\n\n\t/* Is input object already an array? */\n\t/* This is where the flags are used */\n if (PyArray_Check(op)) \n\t\tr = array_fromarray((PyArrayObject *)op, typecode, flags);\n\telse if (PyObject_HasAttrString(op, \"__array__\")) {\n\t\t/* Code that returns the object to convert for a non\n\t\t multiarray input object from the __array__ attribute of the\n\t\t object. */\n r = array_fromattr(op, typecode, flags);\n\t}\n\telse if (PyObject_HasAttrString(op, \"__array_shape__\") &&\n\t\t PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tr = array_frominterface(op, typecode, flags);\n\t}\n\telse {\n\t\tif (type == PyArray_NOTYPE) {\n\t\t\t_array_find_type(op, NULL, typecode, MAX_DIMS);\n\t\t}\n\t\tif (PySequence_Check(op))\n\t\t\tr = Array_FromSequence(op, typecode, \n\t\t\t\t\t min_depth, max_depth);\n\t\telse\n\t\t\tr = Array_FromScalar(op, typecode);\n\t}\n\n /* If we didn't succed return NULL */\n if (r == NULL) return NULL;\n\t\n\t/* Be sure we succeed here */\n\t\n if(!PyArray_Check(r)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Internal error array_fromobject \"\\\n\t\t\t\t\"not producing an array\");\n\t\tPy_DECREF(r);\n return NULL;\n }\n\n if (min_depth != 0 && ((PyArrayObject *)r)->nd < min_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object of too small depth for desired array\");\n return NULL;\n }\n if (max_depth != 0 && ((PyArrayObject *)r)->nd > max_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object too deep for desired array\");\n return NULL;\n }\n return r;\n}\n\nstatic void\nPyArray_ArrayType(PyObject *op, PyArray_Typecode *intype, \n\t\t PyArray_Typecode *outtype) \n{\n\t_array_find_type(op, intype, outtype, MAX_DIMS);\n\treturn;\n}\n\nstatic int \nPyArray_ObjectType(PyObject *op, int minimum_type) \n{\n\tPyArray_Typecode intype, outtype;\n\tintype.type_num = minimum_type;\n\t_array_find_type(op, &intype, &outtype, MAX_DIMS);\n\treturn outtype.type_num;\n}\n\n\n\n/* flags is any of \n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough\n to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, and WRITEABLE\n and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, the returned array will be a copy of the object, \n (C) contiguous in memory, aligned, notswapped, and writeable.\n \n So CONTIGUOUS | ENSURECOPY passed in means that the returned\n array does not have to be CONTIGUOUS or a COPY but should be\n ALIGNED, NOTSWAPPED and WRITEABLE. \n\n typecode->fortran can be set to request a\n fortran-contiguous array. Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n*/\n\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n{\n \tPyArray_Typecode mine = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode *type;\n\t\n\tif (typecode == NULL) type = &mine;\n\telse type = typecode;\n\t\t\n\tif (requires & ENSURECOPY) {\n\t\trequires |= DEFAULT_FLAGS;\n\t}\n\t/* Ensure that type->fortran and flags & FORTRAN are the\n\t same */\n\tif (requires & FORTRAN) typecode->fortran = 1;\n\tif (type->fortran == 1) {\n\t\trequires |= FARRAY_FLAGS;\n\t\tif (min_depth > 2) requires &= ~CONTIGUOUS;\n\t}\n\n\t/* make sure itemsize is not 0 unless warranted. */\n\tif ((type->itemsize == 0) && (type->type_num != PyArray_NOTYPE)) {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type->type_num);\n\t\tif (descr != NULL) type->itemsize = descr->elsize;\n\t\telse return NULL;\n\t}\n\t\n\treturn array_fromobject(op, type, min_depth, max_depth, \n\t\t\t\trequires);\t\n}\n\n/* This is a quick wrapper around PyArray_FromAny(op, NULL, 0, 0, 0) */\n/* that special cases Arrays and PyArray_Scalars up front */\n/* It steals a reference to the object */\n\n/* Because it decrefs op if any conversion needs to take place \n -- so it can be used like PyArray_EnsureArray(some_function(...)) */\n\nstatic PyObject *\nPyArray_EnsureArray(PyObject *op)\n{\n PyObject *new;\n\n if (op == NULL) return NULL;\n\n if (PyArray_Check(op)) return op;\n\n if (PyArray_IsScalar(op, Generic)) {\n new = PyArray_FromScalar(op, NULL);\n Py_DECREF(op);\n return new;\n }\n new = PyArray_FromAny(op, NULL, 0, 0, 0);\n Py_DECREF(op);\n return new;\n}\n\n/* These are all compressed into a single API */\n/* Deprecated calls -- Use PyArray_FromAny */\n\nstatic PyObject *\nPyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, BEHAVED_FLAGS);\n}\n\nstatic PyObject *\nPyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n\t\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, DEFAULT_FLAGS);\n}\n\nstatic PyObject *\nPyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n\t\t\t ENSURECOPY);\n}\n\n/* End of deprecated */\n\n\nstatic int \nPyArray_CanCastSafely(int fromtype, int totype) \n{\n\tPyArray_Descr *from, *to;\n\n if (fromtype == totype) return 1;\n if (fromtype == PyArray_BOOL) return 1;\n\tif (totype == PyArray_BOOL) return 0;\n if (totype == PyArray_OBJECT || totype == PyArray_VOID) return 1;\n\tif (fromtype == PyArray_OBJECT || fromtype == PyArray_VOID) return 0;\n\n\tfrom = PyArray_DescrFromType(fromtype);\n\tto = PyArray_DescrFromType(totype);\n \n switch(fromtype) {\n case PyArray_BYTE:\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISUNSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_UBYTE:\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_FLOAT:\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\tif (PyTypeNum_ISCOMPLEX(totype)) \n\t\t\treturn ((to->elsize >> 1) >= from->elsize);\n\t\telse\n\t\t\treturn (totype > fromtype);\n case PyArray_CFLOAT:\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn (totype > fromtype);\n\tcase PyArray_STRING:\n\tcase PyArray_UNICODE:\n\t\treturn (totype > fromtype);\n default:\n return 0;\n }\n}\n\nstatic Bool\nPyArray_CanCastTo(PyArray_Typecode *from, PyArray_Typecode *to)\n{\n\tint fromtype=from->type_num;\n\tint totype=to->type_num;\n\tBool ret;\n\n\tret = (Bool) PyArray_CanCastSafely(fromtype, totype);\n\tif (ret) { /* Check String and Unicode more closely */\n\t\tif (fromtype == PyArray_STRING) {\n\t\t\tif (totype == PyArray_STRING) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t\telse if (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize * sizeof(Py_UNICODE)\\\n\t\t\t\t <= to->itemsize);\n\t\t\t}\n\t\t}\n\t\telse if (fromtype == PyArray_UNICODE) {\n\t\t\tif (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}\n\n\n\n/*********************** Element-wise Array Iterator ***********************/\n/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/\n/* and Python's array iterator ***/\n \n\nstatic PyObject *\nPyArray_IterNew(PyObject *obj)\n{\n PyArrayIterObject *it;\n\tint i, nd; \n\tPyArrayObject *ao = (PyArrayObject *)obj;\n\n if (!PyArray_Check(ao)) {\n PyErr_BadInternalCall();\n return NULL;\n }\n\n it = PyObject_GC_New(PyArrayIterObject, &PyArrayIter_Type);\n if (it == NULL)\n return NULL;\n\n\tnd = ao->nd;\n\tPyArray_UpdateFlags(ao, CONTIGUOUS);\n\tit->contiguous = 0;\n\tif PyArray_ISCONTIGUOUS(ao) it->contiguous = 1;\n Py_INCREF(ao);\n it->ao = ao;\n\tit->size = PyArray_SIZE(ao);\n\tit->nd_m1 = nd - 1;\n\tit->factors[nd-1] = 1;\n\tfor (i=0; i < nd; i++) {\n\t\tit->dims_m1[i] = it->ao->dimensions[i] - 1;\n\t\tit->strides[i] = it->ao->strides[i];\n\t\tit->backstrides[i] = it->strides[i] *\t\\\n\t\t\tit->dims_m1[i];\n\t\tif (i > 0)\n\t\t\tit->factors[nd-i-1] = it->factors[nd-i] *\t\\\n\t\t\t\tit->ao->dimensions[nd-i];\n\t}\n\tPyArray_ITER_RESET(it);\n\t\n PyObject_GC_Track(it);\n return (PyObject *)it;\n}\n\n/* Returns an array scalar holding the element desired */\n\nstatic PyObject *\narrayiter_next(PyArrayIterObject *it)\n{\n\tPyObject *ret;\n\n\tif (it->index < it->size) {\n\t\tret = PyArray_ToScalar(it->dataptr, it->ao);\n\t\tPyArray_ITER_NEXT(it);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narrayiter_dealloc(PyArrayIterObject *it)\n{\n PyObject_GC_UnTrack(it);\n Py_XDECREF(it->ao);\n PyObject_GC_Del(it);\n }\n\nstatic int\narrayiter_traverse(PyArrayIterObject *it, visitproc visit, void *arg)\n{\n if (it->ao != NULL)\n return visit((PyObject *)(it->ao), arg);\n return 0;\n}\n\n\nstatic int\niter_length(PyArrayIterObject *self) \n{\n return (int) self->size;\n}\n\n\nstatic PyObject *\niter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tint index, strides, itemsize;\n\tintp count=0;\n\tchar *dptr, *optr;\n\tPyObject *r;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn NULL;\n\t}\n\tindex = (ind->dimensions[0]);\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\t/* Get size of return array */\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0)\n\t\t\tcount++;\n\t\tdptr += strides;\n\t}\n\titemsize = self->ao->itemsize;\n\tr = PyArray_New(self->ao->ob_type, 1, &count, \n\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\titemsize, 0, self->ao);\n\tif (r==NULL) return NULL;\n\n\t/* Set up loop */\n\toptr = PyArray_DATA(r);\n\tindex = ind->dimensions[0];\n\tdptr = ind->data;\n\n copyswap = self->ao->descr->copyswap;\n\t/* Loop over Boolean array */\n\tswap = !(PyArray_ISNOTSWAPPED(self->ao));\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\t\toptr += itemsize;\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\nstatic PyObject *\niter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tintp num;\n\tPyObject *r;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint swap;\n\tchar *optr;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = self->ao->itemsize;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t}\n\t\n\tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n\t\t\tself->ao->descr->type_num, NULL, \n\t\t\tNULL, self->ao->itemsize, \n\t\t\t0, self->ao);\n\tif (r==NULL) return NULL;\n\n\toptr = PyArray_DATA(r);\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) {Py_DECREF(r); return NULL;}\n\tindex = ind_it->size;\n copyswap = PyArray_DESCR(r)->copyswap;\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif (num < 0 || num >= self->size) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\tPy_DECREF(r);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\toptr += itemsize;\n\t\tPyArray_ITER_NEXT(ind_it);\n\t}\n\tPy_DECREF(ind_it);\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\n\nstatic PyObject *\niter_subscript(PyArrayIterObject *self, PyObject *ind)\n{\n\tint i;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *r;\n\tchar *dptr;\n\tint size;\n\tPyObject *obj = NULL;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\t\t\n\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\tobj = iter_subscript(self, ind);\n\t\tPy_DECREF(ind);\n\t\treturn obj;\n\t}\n\n\t/* Tuples not accepted --- i.e. no NewAxis */\n\t/* Could implement this with adjusted strides\n\t and dimensions in iterator */\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\tPyArray_ITER_RESET(self);\n\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n\t\t\treturn PyArray_ToScalar(self->dataptr, self->ao);\n\t\t}\n\t\telse { /* empty array */\n\t\t\tintp ii = 0;\n\t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n\t\t\t\t\tself->ao->descr->type_num, NULL, \n\t\t\t\t\tNULL, self->ao->itemsize, 0,\n\t\t\t\t\tself->ao);\n\t\t\treturn r;\t\t\t\n\t\t}\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) \n\t\t\tgoto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start)\n\t\tif (n_steps == SingleIndex) { /* Integer */\n\t\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn r;\n\t\t}\n\t\tsize = self->ao->itemsize;\n\t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n\t\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\t\tsize, 0, self->ao);\n\t\tif (r==NULL) goto fail; \n\t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n copyswap = PyArray_DESCR(r)->copyswap;\n\t\twhile(n_steps--) {\n copyswap(dptr, self->dataptr, swap, size);\n\t\t\tfor(i=0; i< step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tdptr += size;\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer) || PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tr = iter_subscript_Bool(self, (PyArrayObject *)obj);\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tobj = new;\n\t\t\tr = iter_subscript_int(self, (PyArrayObject *)obj);\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"unsupported iterator index\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPy_DECREF(obj);\n\t\treturn r;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\n fail:\n\tPy_XDECREF(obj);\n\treturn NULL;\n\n}\n\n\nstatic int\niter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tint index, strides, itemsize;\n\tchar *dptr;\n PyArray_CopySwapFunc *copyswap;\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn -1;\n\t}\n\titemsize = self->ao->itemsize;\n\tindex = ind->dimensions[0];\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\tPyArray_ITER_RESET(self);\n\t/* Loop over Boolean array */\n copyswap = self->ao->descr->copyswap;\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(self->dataptr, val->dataptr, swap,\n itemsize);\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index==val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn 0;\n}\n\nstatic int\niter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tPyArray_Typecode typecode;\n\tintp num;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = typecode.itemsize = self->ao->itemsize;\n\ttypecode.type_num = self->ao->descr->type_num;\n copyswap = self->ao->descr->copyswap;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\treturn 0;\n\t}\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) return -1;\n\tindex = ind_it->size;\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif ((num < 0) || (num >= self->size)) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\treturn -1;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\tPyArray_ITER_NEXT(ind_it);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index == val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPy_DECREF(ind_it);\n\treturn 0;\n}\n\n\nstatic int\niter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) \n{\n\tint i;\n\tPyObject *arrval=NULL;\n\tPyArrayIterObject *val_it=NULL;\n\tPyArray_Typecode type;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint swap;\n\tint itemsize;\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *obj;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\ti = iter_ass_subscript(self, ind, val);\n\t\tPy_DECREF(ind);\n\t\treturn i;\n\t}\n\t\n\ttype.type_num = self->ao->descr->type_num;\n\titemsize = type.itemsize = self->ao->itemsize;\n\t\n\tarrval = PyArray_FromAny(val, &type, 0, 0, 0);\n\tif (arrval==NULL) return -1;\n\tval_it = (PyArrayIterObject *)PyArray_IterNew(arrval);\n\tif (val_it==NULL) goto fail;\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\n copyswap = PyArray_DESCR(arrval)->copyswap;\n\tswap = (PyArray_ISNOTSWAPPED(self->ao)!=PyArray_ISNOTSWAPPED(arrval));\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n copyswap(self->dataptr, PyArray_DATA(arrval), \n swap, itemsize);\n\t\t}\n\t\tgoto succeed;\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) goto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start);\n\t\tif (n_steps == SingleIndex) { /* Integer */\n copyswap(self->dataptr, PyArray_DATA(arrval),\n swap, itemsize);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\tgoto succeed;\n\t\t}\n\t\twhile(n_steps--) {\n copyswap(self->dataptr, val_it->dataptr,\n swap, itemsize);\n\t\t\tfor(i=0; i < step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tPyArray_ITER_NEXT(val_it);\n\t\t\tif (val_it->index == val_it->size) \n\t\t\t\tPyArray_ITER_RESET(val_it);\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\tgoto succeed;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer))\n\t\tobj = PyArray_FromScalar(ind, &indtype);\n\telse if (PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tif (iter_ass_sub_Bool(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tPy_DECREF(obj);\n\t\t\tobj = new;\n\t\t\tif (iter_ass_sub_int(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t}\n\t\telse goto fail;\n\t\tPy_DECREF(obj);\n\t\tgoto succeed;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\tgoto fail;\n\n succeed:\n\tPy_DECREF(val_it);\n\tPy_DECREF(arrval);\n\treturn 0;\n\n fail:\n\tPy_XDECREF(val_it);\n\tPy_XDECREF(arrval);\n\treturn -1;\n\t\n}\n\n\nstatic PyMappingMethods iter_as_mapping = {\n (inquiry)iter_length,\t\t /*mp_length*/\n (binaryfunc)iter_subscript,\t /*mp_subscript*/\n (objobjargproc)iter_ass_subscript,\t/*mp_ass_subscript*/\n};\n\nstatic char doc_iter_array[] = \"__array__(type=None)\\n Get array \"\\\n \"from iterator\";\n\nstatic PyObject *\niter_array(PyArrayIterObject *it, PyObject *op) \n{\n \n PyObject *r;\n intp size;\n\n /* Any argument ignored */\n\n /* Two options: \n 1) underlying array is contiguous\n -- return 1-d wrapper around it \n 2) underlying array is not contiguous\n -- make new 1-d contiguous array with updateifcopy flag set\n to copy back to the old array\n */\n\n size = PyArray_SIZE(it->ao);\n if (PyArray_ISCONTIGUOUS(it->ao)) {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n\t\t\t\tit->ao->flags,\n it->ao); \n\t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, NULL, it->ao->itemsize, 0, it->ao);\n\t\tif (r==NULL) return NULL;\n\t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n\t\t\tPy_DECREF(r); \n\t\t\treturn NULL;\n\t\t}\n PyArray_FLAGS(r) |= UPDATEIFCOPY;\n it->ao->flags &= ~WRITEABLE;\n }\n Py_INCREF(it->ao);\n PyArray_BASE(r) = (PyObject *)it->ao;\n return r;\n \n}\n\nstatic char doc_iter_copy[] = \"copy()\\n Get a copy of 1-d array\";\n\nstatic PyObject *\niter_copy(PyArrayIterObject *it, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\t\n\treturn PyArray_Flatten(it->ao, 0);\n}\n\nstatic PyMethodDef iter_methods[] = {\n /* to get array */\n {\"__array__\", (PyCFunction)iter_array, 1, doc_iter_array},\n\t{\"copy\", (PyCFunction)iter_copy, 1, doc_iter_copy},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\nstatic PyTypeObject PyArrayIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.flatiter\",\t\t /* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arrayiter_dealloc,\t\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0, \t\t\t /* tp_as_sequence */\n &iter_as_mapping, \t /* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0,\t \t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arrayiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arrayiter_next,\t\t/* tp_iternext */\n iter_methods,\t\t\t\t/* tp_methods */\n};\n\n/** END of Array Iterator **/\n\n\n\n/*********************** Subscript Array Iterator *************************\n * *\n * This object handles subscript behavior for array objects. *\n * It is an iterator object with a next method *\n * It abstracts the n-dimensional mapping behavior to make the looping *\n * code more understandable (maybe) *\n * and so that indexing can be set up ahead of time *\n */ \n\n/* This checks the args for any fancy indexing objects */\n\n#define SOBJ_NOTFANCY 0 \n#define SOBJ_ISFANCY 1\n#define SOBJ_BADARRAY 2\n#define SOBJ_TOOMANY 3\n#define SOBJ_LISTTUP 4\n\nstatic int\nfancy_indexing_check(PyObject *args)\n{\n\tint i, n;\n\tPyObject *obj;\n\tint retval = SOBJ_NOTFANCY;\n\n\tif (PyTuple_Check(args)) {\n\t\tn = PyTuple_GET_SIZE(args);\n\t\tif (n >= MAX_DIMS) return SOBJ_TOOMANY;\n\t\tfor (i=0; i=MAX_DIMS) return SOBJ_ISFANCY;\n\t\tfor (i=0; i SOBJ_ISFANCY) return retval;\n\t\t}\n\t}\n\n\treturn retval;\n}\n\n/* convert an indexing object to an INTP indexing array iterator\n if possible -- otherwise, it is a Slice or Ellipsis object\n and has to be interpreted on bind to a particular \n array so leave it NULL for now.\n */\nstatic int\n_convert_obj(PyObject *obj, PyArrayIterObject **iter)\n{\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tPyObject *arr;\n\n\tif (PySlice_Check(obj) || (obj == Py_Ellipsis))\n\t\t*iter = NULL;\n\telse {\n\t\tarr = PyArray_FromAny(obj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) return -1;\n\t\t*iter = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (*iter == NULL) return -1;\n\t}\n\treturn 0;\n}\n\n/* Adjust dimensionality and strides for index object iterators \n --- i.e. broadcast\n */\nstatic int\nPyArray_Broadcast(PyArrayMultiIterObject *mit)\n{\n\tint i, nd, k, j;\n\tintp tmp;\n\tPyArrayIterObject *it;\n\t\n\t/* Discover the broadcast number of dimensions */\n\tfor (i=0, nd=0; inumiter; i++) \n\t\tnd = MAX(nd, mit->iters[i]->ao->nd);\n\tmit->nd = nd;\n\n\t/* Discover the broadcast shape in each dimension */\n\tfor (i=0; idimensions[i] = 1;\n\t\tfor (j=0; jnumiter; j++) {\n\t\t\tit = mit->iters[j];\n\t\t\t/* This prepends 1 to shapes not already \n\t\t\t equal to nd */\n\t\t\tk = i + it->ao->nd - nd;\n\t\t\tif (k>=0) {\n\t\t\t\ttmp = it->ao->dimensions[k];\n\t\t\t\tif (tmp == 1) continue;\n\t\t\t\tif (mit->dimensions[i] == 1) \n\t\t\t\t\tmit->dimensions[i] = tmp;\n\t\t\t\telse if (mit->dimensions[i] != tmp) {\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\t\"index objects are \" \\\n\t\t\t\t\t\t\t\"not broadcastable \" \\\n\t\t\t\t\t\t\t\"to a single shape.\");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Reset the iterator dimensions and strides of each iterator\n\t object -- using 0 valued strides for broadcasting */\n\n\ttmp = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tmit->size = tmp;\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tit->nd_m1 = mit->nd - 1;\n\t\tit->size = tmp;\n\t\tnd = it->ao->nd;\n\t\tit->factors[mit->nd-1] = 1;\n\t\tfor (j=0; j < mit->nd; j++) {\n\t\t\tit->dims_m1[j] = mit->dimensions[j] - 1;\n\t\t\tk = j + nd - mit->nd;\n\t\t\t/* If this dimension was added or shape\n\t\t\t of underlying array was 1 */\n\t\t\tif ((k < 0) || \\\n\t\t\t it->ao->dimensions[k] != mit->dimensions[j]) {\n\t\t\t\tit->contiguous = 0;\n\t\t\t\tit->strides[j] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tit->strides[j] = it->ao->strides[k];\n\t\t\t}\n\t\t\tit->backstrides[j] = it->strides[j] *\t\\\n\t\t\t\tit->dims_m1[j];\n\t\t\tif (j > 0)\n\t\t\t\tit->factors[mit->nd-j-1] =\t\t\\\n\t\t\t\t\tit->factors[mit->nd-j] *\t\\\n\t\t\t\t\tmit->dimensions[mit->nd-j];\n\t\t}\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn 0;\n}\n\n/* Reset the map iterator to the beginning */\nstatic void\nPyArray_MapIterReset(PyArrayMapIterObject *mit)\n{\n\tint i,j; intp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index = 0;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\n\tif (mit->subspace != NULL) {\n\t\tmemcpy(coord, mit->bscoord, sizeof(intp)*mit->ait->ao->nd);\n\t\tPyArray_ITER_RESET(mit->subspace);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tj = mit->iteraxes[i];\n\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* This function needs to update the state of the map iterator\n and point mit->dataptr to the memory-location of the next object\n*/\nstatic void\nPyArray_MapIterNext(PyArrayMapIterObject *mit)\n{\n\tint i, j;\n\tintp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index += 1;\n\tif (mit->index >= mit->size) return;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\t/* Sub-space iteration */\n\tif (mit->subspace != NULL) {\n\t\tPyArray_ITER_NEXT(mit->subspace);\n\t\tif (mit->subspace->index == mit->subspace->size) {\n\t\t\t/* reset coord to coordinates of \n\t\t\t beginning of the subspace */\n\t\t\tmemcpy(coord, mit->bscoord, \n\t\t\t sizeof(intp)*mit->ait->ao->nd);\n\t\t\tPyArray_ITER_RESET(mit->subspace);\n\t\t\tfor (i=0; inumiter; i++) {\n\t\t\t\tit = mit->iters[i];\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t\tj = mit->iteraxes[i];\n\t\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t\t sizeof(intp));\n\t\t\t}\n\t\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\t}\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* Bind a mapiteration to a particular array */\n\n/* Determine if subspace iteration is necessary. If so, \n 1) Fill in mit->iteraxes\n\t 2) Create subspace iterator\n\t 3) Update nd, dimensions, and size. \n\n Subspace iteration is necessary if: arr->nd > mit->numiter\n*/\n\n/* Need to check for index-errors somewhere. \n\n Let's do it at bind time and also convert all <0 values to >0 here\n as well. \n*/\nstatic void\nPyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n{\n\tint subnd;\n\tPyObject *sub=NULL, *obj=NULL;\n\tint i, j, n, curraxis, ellipexp, noellip;\n\tPyArrayIterObject *it;\n\tintp dimsize;\n\tintp *indptr;\n\n\t/* Remove old binding if any */\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\n\tPy_XDECREF(mit->subspace);\n\tmit->subspace = NULL;\n\t\n\tsubnd = arr->nd - mit->numiter;\n\tif (subnd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Too many indices for array.\");\n\t\treturn;\n\t}\n\n\tmit->ait = (PyArrayIterObject *)PyArray_IterNew((PyObject *)arr);\n\tif (mit->ait == NULL) return;\n\n\t/* If this is just a view, then do nothing more */\n\t/* views are handled by just adjusting the strides\n\t and dimensions of the object.\n\t*/\n\t \n\tif (mit->view) return;\n\n\t/* no subspace iteration needed. Return */\n\tif (subnd == 0) {\n\t\tn = arr->nd;\n\t\tfor (i=0; iiteraxes[i] = i;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\t/* all indexing arrays have been converted to 0 \n\t therefore we can extract the subspace with a simple\n\t getitem call which will use view semantics\n\t*/\n\t\n\tsub = PyObject_GetItem((PyObject *)arr, mit->indexobj);\n\tif (sub == NULL) goto fail;\n\tmit->subspace = (PyArrayIterObject *)PyArray_IterNew(sub);\n\tif (mit->subspace == NULL) goto fail;\n\tPy_DECREF(sub);\n\n\t/* Expand dimensions of result */\n\tn = mit->subspace->ao->nd;\n\tfor (i=0; idimensions[mit->nd+i] = mit->subspace->ao->dimensions[i];\n\tmit->nd += n;\n\n\t/* Now, we still need to interpret the ellipsis and slice objects \n\t to determine which axes the indexing arrays are referring to\n\t*/\n\tn = PyTuple_GET_SIZE(mit->indexobj);\n\n\t/* The number of dimensions an ellipsis takes up */\n\tellipexp = arr->nd - n + 1;\n\t/* Now fill in iteraxes -- remember indexing arrays have been \n converted to 0's in mit->indexobj */\n\tcurraxis = 0;\n\tj = 0;\n\tnoellip = 1; /* Only expand the first ellipsis */\n\tmemset(mit->bscoord, '\\0', sizeof(intp)*arr->nd);\n\tfor (i=0; iindexobj, i);\n\t\tif (PyInt_Check(obj) || PyLong_Check(obj)) \n\t\t\tmit->iteraxes[j++] = curraxis++;\n\t\telse if (noellip && obj == Py_Ellipsis) {\n\t\t\tcurraxis += ellipexp;\n\t\t\tnoellip = 0;\n\t\t}\n\t\telse {\n\t\t\tint start=0;\n\t\t\tint stop, step;\n\t\t\t/* Should be slice object or\n\t\t\t another Ellipsis */\n\t\t\tif (obj == Py_Ellipsis) {\n\t\t\t\tmit->bscoord[curraxis] = 0;\n\t\t\t}\n\t\t\telse if (!PySlice_Check(obj) || \\\n\t\t\t\t (slice_GetIndices((PySliceObject *)obj, \n\t\t\t\t\t\t arr->dimensions[curraxis],\n\t\t\t\t\t\t &start, &stop, &step,\n\t\t\t\t\t\t &dimsize) < 0)) {\n\t\t\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t\t\t \"unexpected object \"\t\\\n\t\t\t\t\t \"(%s) in selection position %d\",\n\t\t\t\t\t obj->ob_type->tp_name, i);\n\t\t\t goto fail;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmit->bscoord[curraxis] = start;\n\t\t\t}\n\t\t\tcurraxis += 1; \n\t\t}\n\t}\n finish:\n\t/* Here check the indexes (now that we have iteraxes) */\n\tmit->size = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tPyArray_ITER_RESET(it);\n\t\tdimsize = arr->dimensions[mit->iteraxes[i]];\n\t\twhile(it->index < it->size) {\n\t\t\tindptr = ((intp *)it->dataptr);\n\t\t\tif (*indptr < 0) *indptr += dimsize;\n\t\t\tif (*indptr < 0 || *indptr >= dimsize) {\n\t\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t\t \"index (%d) out of range \"\\\n\t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n\t\t\t\t\t *indptr, dimsize-1, \n\t\t\t\t\t mit->iteraxes[i]);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn;\n\n fail:\n\tPy_XDECREF(sub);\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\treturn;\n}\n\n/* This function takes a Boolean array and constructs index objects and\n iterators as if nonzero(Bool) had been called\n*/\nstatic int\n_nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)\n{\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\tPyArrayObject *ba =NULL, *new=NULL;\n\tint nd, j;\n\tintp size, i, count;\n\tBool *ptr;\n\tintp coords[MAX_DIMS], dims_m1[MAX_DIMS];\n\tintp *dptr[MAX_DIMS];\n\n\tba = (PyArrayObject *)PyArray_FromAny(myBool, &typecode, 0, 0, \n\t\t\t\t\t CARRAY_FLAGS);\n\tif (ba == NULL) return -1;\n\tnd = ba->nd;\n\tfor (j=0; jdata;\n\tcount = 0;\n\n\t/* pre-determine how many nonzero entries there are */\n\tfor (i=0; iao->data;\n\t\tcoords[j] = 0;\n\t\tdims_m1[j] = ba->dimensions[j]-1;\n\t}\n\n\tptr = (Bool *)ba->data;\n\n\tif (count == 0) return nd;\n\n\t/* Loop through the Boolean array and copy coordinates\n\t for non-zero entries */\n\tfor (i=0; i=0; j--) {\n\t\t\tif (coords[j] < dims_m1[j]) {\n\t\t\t\tcoords[j]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcoords[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn nd;\n\n fail:\n\tfor (j=0; jiters[i] = NULL;\n \tmit->view = 0;\n \tmit->index = 0;\n \tmit->ait = NULL;\n \tmit->subspace = NULL;\n\tmit->numiter = 0;\n\tmit->consec = 1;\n\tfancy = fancy_indexing_check(indexobj);\n\tPy_INCREF(indexobj);\n\tmit->indexobj = indexobj;\n\tif (fancy == SOBJ_NOTFANCY) { /* bail out */\n\t\tmit->view = 1;\n\t\tgoto ret;\n\t}\n\n\tif (fancy == SOBJ_BADARRAY) {\n\t\tPyErr_SetString(PyExc_TypeError,\t\t\t\\\n\t\t\t\t\"Arrays used as indexes must be of \" \\\n\t\t\t\t\"integer type\");\n\t\tgoto fail;\n\t}\n\tif (fancy == SOBJ_TOOMANY) {\n\t\tPyErr_SetString(PyExc_TypeError,\"Too many indicies\");\n\t\tgoto fail;\n\t}\n\n\tif (fancy == SOBJ_LISTTUP) {\n\t\tPyObject *newobj;\n\t\tnewobj = PySequence_Tuple(indexobj);\n\t\tif (newobj == NULL) goto fail;\n\t\tPy_DECREF(indexobj);\n\t\tindexobj = newobj;\n\t\tmit->indexobj = indexobj;\n\t}\n\n#undef SOBJ_NOTFANCY \n#undef SOBJ_ISFANCY \n#undef SOBJ_BADARRAY \n#undef SOBJ_TOOMANY \n#undef SOBJ_LISTTUP \n\n\n\t/* Must have some kind of fancy indexing if we are here */\n\t/* indexobj is either a list, an arrayobject, or a tuple \n\t (with at least 1 list or arrayobject or Bool object), */\n\t\n\t/* convert all inputs to iterators */\n\tif (PyArray_Check(indexobj) &&\t\t\t\\\n\t (PyArray_TYPE(indexobj) == PyArray_BOOL)) {\n\t\tmit->numiter = _nonzero_indices(indexobj, mit->iters);\n\t\tif (mit->numiter < 0) goto fail;\n\t\tmit->nd = 1;\n\t\tmit->dimensions[0] = mit->iters[0]->dims_m1[0]+1;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = PyTuple_New(mit->numiter);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tPyTuple_SET_ITEM(mit->indexobj, i, \n\t\t\t\t\t PyInt_FromLong(0));\n\t\t}\n\t}\n\n\telse if (PyList_Check(indexobj) || PyArray_Check(indexobj)) {\n\t\tmit->numiter = 1;\n\t\tarr = PyArray_FromAny(indexobj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) goto fail;\n\t\tmit->iters[0] = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (mit->iters[0] == NULL) goto fail;\n\t\tmit->nd = PyArray_NDIM(arr);\n\t\tmemcpy(mit->dimensions,PyArray_DIMS(arr),mit->nd*sizeof(intp));\n\t\tmit->size = PyArray_SIZE(arr);\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = Py_BuildValue(\"(N)\", PyInt_FromLong(0));\n\t}\n\telse { /* must be a tuple */\n\t\tPyObject *obj;\n\t\tPyArrayIterObject *iter;\n\t\tPyObject *new;\n\t\t/* Make a copy of the tuple -- we will be replacing \n\t\t index objects with 0's */\n\t\tn = PyTuple_GET_SIZE(indexobj);\n\t\tnew = PyTuple_New(n);\n\t\tif (new == NULL) goto fail;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = new;\n\t\tstarted = 0;\n\t\tnonindex = 0;\n\t\tfor (i=0; iconsec = 0;\n\t\t\t\tmit->iters[(mit->numiter)++] = iter;\n\t\t\t\tPyTuple_SET_ITEM(new,i,\n\t\t\t\t\t\t PyInt_FromLong(0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (started) nonindex = 1;\n\t\t\t\tPy_INCREF(obj);\n\t\t\t\tPyTuple_SET_ITEM(new,i,obj);\n\t\t\t}\n\t\t}\n\t\t/* Store the number of iterators actually converted */\n\t\t/* These will be mapped to actual axes at bind time */\n\t\tif (PyArray_Broadcast((PyArrayMultiIterObject *)mit) < 0)\n\t\t\tgoto fail;\n\t}\n\n ret:\n PyObject_GC_Track(mit);\n return (PyObject *)mit;\n \n fail:\n\tPy_XDECREF(arr);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n\treturn NULL;\n}\n\n\n/* return unbound mapiter object */\n\nstatic PyObject *\narraymapiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) \n{\n\tPyObject *newtup, *res;\n\tint n;\n\n\tif (!PyTuple_Check(args)) {\n\t\tPyErr_BadInternalCall();\n\t\treturn NULL;\n\t}\n\n\tn = PyTuple_GET_SIZE(args);\n\t\n\tif (n < 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"must be initialized with >= 1 argument\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n > 1) {\n\t\tnewtup = PyTuple_GetSlice(args, 0, n);\n\t\tif (newtup == NULL) return NULL;\n\t\tres = PyArray_MapIterNew(newtup);\n\t\tPy_DECREF(newtup);\n\t}\n\telse { /* n == 1 */\n\t\tnewtup = PyTuple_GET_ITEM(args, 0);\n\t\tres = PyArray_MapIterNew(newtup);\n\t}\n\n\treturn res; \t\n}\n\n\n/* Returns a 0-dim array holding the element desired */\n\nstatic PyObject *\narraymapiter_next(PyArrayMapIterObject *mit)\n{\n\tPyObject *ret;\n\tif (mit->ait == NULL) return NULL;\n\tif (mit->view) return NULL;\n\tif (mit->index < mit->size) {\n\t\tret = PyArray_ToScalar(mit->dataptr, mit->ait->ao);\n\t\tPyArray_MapIterNext(mit);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narraymapiter_dealloc(PyArrayMapIterObject *mit)\n{\n\tint i;\n PyObject_GC_UnTrack(mit);\n Py_XDECREF(mit->ait);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n}\n\nstatic int\narraymapiter_traverse(PyArrayMapIterObject *mit, visitproc visit, void *arg)\n{\n\tint ret, i;\n if (mit->ait != NULL)\n if ((ret = visit((PyObject *)(mit->ait), arg)) != 0) \n\t\t\treturn ret;\t\n\n\tif (mit->iters != NULL) \n\t\tfor (i=0; inumiter; i++) \n\t\t\tif (mit->iters[i] != NULL) \n\t\t\t\tif ((ret=visit((PyObject *)mit->iters[i], \n\t\t\t\t\t arg)) != 0)\n\t\t\t\t\treturn ret;\n\n\tif (mit->indexobj != NULL)\n\t\tif ((ret = visit(mit->indexobj, arg)) != 0) return ret;\n\t\n return 0;\n}\n\n/* \nstatic char doc_mapiter_bind[] = \"obj.bind(a)\\n Bind an array to the \"\\\n\t\"mapiter object\";\n\nstatic PyObject *\nmapiter_bind(PyArrayMapIterObject *mit, PyObject *args)\n{\n\tPyObject *r;\n intp size, strides;\n int nd;\n\tPyArrayObject *arr;\n\n if (!PyArg_ParseTuple(args, \"O!\", &PyArray_Type, &arr)) return NULL;\n\n\tPyArray_MapIterBind(mit, arr);\n\n\tif (mit->ait == NULL) return NULL;\n\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyMethodDef mapiter_methods[] = {\n\t{\"bind\", (PyCFunction)mapiter_bind, 1, doc_mapiter_bind},\n {NULL,\t\tNULL}\t\t\n};\n*/\n\n\nstatic PyTypeObject PyArrayMapIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.mapiter\",\t\t \t/* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arraymapiter_dealloc,\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0,\t\t\t\t\t/* tp_as_sequence */\n 0,\t\t\t\t\t/* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0, \t\t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arraymapiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arraymapiter_next,\t/* tp_iternext */\n 0,\t \t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n 0,\t\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0, \t /* tp_alloc */\n (newfunc)arraymapiter_new,\t /* tp_new */\n 0,\t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n\n};\n\n/** END of Subscript Iterator **/\n\n\n\n", "methods": [ { "name": "PyArray_PyIntAsIntp", "long_name": "PyArray_PyIntAsIntp( PyObject * o)", "filename": "arrayobject.c", "nloc": 59, "complexity": 19, "token_count": 385, "parameters": [ "o" ], "start_line": 40, "end_line": 103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "PyArray_PyIntAsInt", "long_name": "PyArray_PyIntAsInt( PyObject * o)", "filename": "arrayobject.c", "nloc": 57, "complexity": 19, "token_count": 389, "parameters": [ "o" ], "start_line": 109, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 86, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 191, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "PyArray_Zero", "long_name": "PyArray_Zero( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 190, "parameters": [ "arr" ], "start_line": 208, "end_line": 243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_One", "long_name": "PyArray_One( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 40, "complexity": 7, "token_count": 222, "parameters": [ "arr" ], "start_line": 246, "end_line": 289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "do_sliced_copy", "long_name": "do_sliced_copy( char * dest , intp * dest_strides , intp * dest_dimensions , int dest_nd , char * src , intp * src_strides , intp * src_dimensions , int src_nd , int elsize , int copies)", "filename": "arrayobject.c", "nloc": 48, "complexity": 13, "token_count": 313, "parameters": [ "dest", "dest_strides", "dest_dimensions", "dest_nd", "src", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 295, "end_line": 345, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "optimize_slices", "long_name": "optimize_slices( intp ** dest_strides , intp ** dest_dimensions , int * dest_nd , intp ** src_strides , intp ** src_dimensions , int * src_nd , int * elsize , int * copies)", "filename": "arrayobject.c", "nloc": 32, "complexity": 8, "token_count": 214, "parameters": [ "dest_strides", "dest_dimensions", "dest_nd", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 368, "end_line": 399, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 402, "end_line": 436, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_INCREF", "long_name": "PyArray_INCREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 449, "end_line": 471, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_XDECREF", "long_name": "PyArray_XDECREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 474, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "byte_swap_vector", "long_name": "byte_swap_vector( * p , int n , int size)", "filename": "arrayobject.c", "nloc": 38, "complexity": 10, "token_count": 340, "parameters": [ "p", "n", "size" ], "start_line": 499, "end_line": 537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "copy_and_swap", "long_name": "copy_and_swap( * dst , * src , int itemsize , intp numitems , intp srcstrides , int swap)", "filename": "arrayobject.c", "nloc": 18, "complexity": 5, "token_count": 120, "parameters": [ "dst", "src", "itemsize", "numitems", "srcstrides", "swap" ], "start_line": 542, "end_line": 562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "index2ptr", "long_name": "index2ptr( PyArrayObject * mp , int i)", "filename": "arrayobject.c", "nloc": 10, "complexity": 7, "token_count": 86, "parameters": [ "mp", "i" ], "start_line": 570, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Size", "long_name": "PyArray_Size( PyObject * op)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 33, "parameters": [ "op" ], "start_line": 583, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_CopyInto", "long_name": "PyArray_CopyInto( PyArrayObject * dest , PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 71, "complexity": 16, "token_count": 425, "parameters": [ "dest", "src" ], "start_line": 604, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 15, "complexity": 2, "token_count": 88, "parameters": [ "dest", "src_object" ], "start_line": 688, "end_line": 704, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndDataAndDescr", "long_name": "PyArray_FromDimsAndDataAndDescr( int nd , int * d , PyArray_Descr * descr , char * data)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 144, "parameters": [ "nd", "d", "descr", "data" ], "start_line": 712, "end_line": 733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 5, "token_count": 137, "parameters": [ "nd", "d", "type", "data" ], "start_line": 737, "end_line": 757, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 5, "token_count": 133, "parameters": [ "nd", "d", "type" ], "start_line": 761, "end_line": 778, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 77, "parameters": [ "m1" ], "start_line": 784, "end_line": 796, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_Scalar", "long_name": "PyArray_Scalar( char * data , int type_num , int itemsize , int swap)", "filename": "arrayobject.c", "nloc": 48, "complexity": 8, "token_count": 289, "parameters": [ "data", "type_num", "itemsize", "swap" ], "start_line": 802, "end_line": 851, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyArray_ToScalar", "long_name": "PyArray_ToScalar( char * data , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 51, "parameters": [ "data", "arr" ], "start_line": 858, "end_line": 865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_Return", "long_name": "PyArray_Return( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 85, "parameters": [ "mp" ], "start_line": 871, "end_line": 890, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 31, "complexity": 6, "token_count": 177, "parameters": [ "type" ], "start_line": 901, "end_line": 933, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 943, "end_line": 986, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 87, "complexity": 16, "token_count": 571, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 990, "end_line": 1079, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "PyArray_ToList", "long_name": "PyArray_ToList( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 24, "complexity": 5, "token_count": 151, "parameters": [ "self" ], "start_line": 1082, "end_line": 1110, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_ToString", "long_name": "PyArray_ToString( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 191, "parameters": [ "self" ], "start_line": 1113, "end_line": 1148, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_dealloc", "long_name": "array_dealloc( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 20, "complexity": 7, "token_count": 144, "parameters": [ "self" ], "start_line": 1157, "end_line": 1194, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_length", "long_name": "array_length( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 1201, "end_line": 1209, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 150, "parameters": [ "self", "i" ], "start_line": 1213, "end_line": 1237, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_item_nice", "long_name": "array_item_nice( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "i" ], "start_line": 1240, "end_line": 1243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_ass_item", "long_name": "array_ass_item( PyArrayObject * self , int i , PyObject * v)", "filename": "arrayobject.c", "nloc": 27, "complexity": 8, "token_count": 177, "parameters": [ "self", "i", "v" ], "start_line": 1247, "end_line": 1277, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "slice_coerce_index", "long_name": "slice_coerce_index( PyObject * o , int * v)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "o", "v" ], "start_line": 1281, "end_line": 1289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "slice_GetIndices", "long_name": "slice_GetIndices( PySliceObject * r , int length , int * start , int * stop , int * step , intp * slicelength)", "filename": "arrayobject.c", "nloc": 45, "complexity": 24, "token_count": 376, "parameters": [ "r", "length", "start", "stop", "step", "slicelength" ], "start_line": 1295, "end_line": 1345, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "parse_subindex", "long_name": "parse_subindex( PyObject * op , int * step_size , intp * n_steps , int max)", "filename": "arrayobject.c", "nloc": 45, "complexity": 11, "token_count": 223, "parameters": [ "op", "step_size", "n_steps", "max" ], "start_line": 1352, "end_line": 1397, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "parse_index", "long_name": "parse_index( PyArrayObject * self , PyObject * op , intp * dimensions , intp * strides , intp * offset_ptr)", "filename": "arrayobject.c", "nloc": 89, "complexity": 20, "token_count": 540, "parameters": [ "self", "op", "dimensions", "strides", "offset_ptr" ], "start_line": 1401, "end_line": 1496, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "_swap_axes", "long_name": "_swap_axes( PyArrayMapIterObject * mit , PyArrayObject ** ret)", "filename": "arrayobject.c", "nloc": 24, "complexity": 4, "token_count": 187, "parameters": [ "mit", "ret" ], "start_line": 1499, "end_line": 1533, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 252, "parameters": [ "mit" ], "start_line": 1538, "end_line": 1588, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "PyArray_SetMap", "long_name": "PyArray_SetMap( PyArrayMapIterObject * mit , PyObject * op)", "filename": "arrayobject.c", "nloc": 50, "complexity": 12, "token_count": 392, "parameters": [ "mit", "op" ], "start_line": 1591, "end_line": 1650, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 425, "parameters": [ "self", "op" ], "start_line": 1671, "end_line": 1746, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "array_ass_sub", "long_name": "array_ass_sub( PyArrayObject * self , PyObject * index , PyObject * op)", "filename": "arrayobject.c", "nloc": 43, "complexity": 9, "token_count": 251, "parameters": [ "self", "index", "op" ], "start_line": 1759, "end_line": 1811, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "array_subscript_nice", "long_name": "array_subscript_nice( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "self", "op" ], "start_line": 1819, "end_line": 1822, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_getsegcount", "long_name": "array_getsegcount( PyArrayObject * self , int * lenp)", "filename": "arrayobject.c", "nloc": 11, "complexity": 4, "token_count": 48, "parameters": [ "self", "lenp" ], "start_line": 1841, "end_line": 1853, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_getreadbuf", "long_name": "array_getreadbuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 72, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1856, "end_line": 1871, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_getwritebuf", "long_name": "array_getwritebuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1875, "end_line": 1884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_getcharbuf", "long_name": "array_getcharbuf( PyArrayObject * self , int segment , const char ** ptrptr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 3, "token_count": 65, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1887, "end_line": 1898, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_SetNumericOps", "long_name": "PyArray_SetNumericOps( PyObject * dict)", "filename": "arrayobject.c", "nloc": 34, "complexity": 1, "token_count": 162, "parameters": [ "dict" ], "start_line": 1966, "end_line": 1999, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_GetNumericOps", "long_name": "PyArray_GetNumericOps()", "filename": "arrayobject.c", "nloc": 39, "complexity": 2, "token_count": 183, "parameters": [], "start_line": 2005, "end_line": 2044, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_GenericReduceFunction", "long_name": "PyArray_GenericReduceFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2047, "end_line": 2066, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericAccumulateFunction", "long_name": "PyArray_GenericAccumulateFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2070, "end_line": 2089, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericBinaryFunction", "long_name": "PyArray_GenericBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 69, "parameters": [ "m1", "m2", "op" ], "start_line": 2093, "end_line": 2104, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericUnaryFunction", "long_name": "PyArray_GenericUnaryFunction( PyArrayObject * m1 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 63, "parameters": [ "m1", "op" ], "start_line": 2107, "end_line": 2118, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericInplaceBinaryFunction", "long_name": "PyArray_GenericInplaceBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 13, "complexity": 2, "token_count": 71, "parameters": [ "m1", "m2", "op" ], "start_line": 2121, "end_line": 2133, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_add", "long_name": "array_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2136, "end_line": 2139, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_subtract", "long_name": "array_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2142, "end_line": 2145, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_multiply", "long_name": "array_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2148, "end_line": 2151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_divide", "long_name": "array_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2154, "end_line": 2157, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_remainder", "long_name": "array_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2160, "end_line": 2163, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_power", "long_name": "array_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2166, "end_line": 2169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_negative", "long_name": "array_negative( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2172, "end_line": 2175, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_absolute", "long_name": "array_absolute( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2178, "end_line": 2181, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_invert", "long_name": "array_invert( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2184, "end_line": 2187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_left_shift", "long_name": "array_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2190, "end_line": 2193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_right_shift", "long_name": "array_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2196, "end_line": 2199, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_and", "long_name": "array_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2202, "end_line": 2205, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_or", "long_name": "array_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2208, "end_line": 2211, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_xor", "long_name": "array_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2214, "end_line": 2217, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_add", "long_name": "array_inplace_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2220, "end_line": 2223, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_subtract", "long_name": "array_inplace_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2226, "end_line": 2229, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_multiply", "long_name": "array_inplace_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2232, "end_line": 2235, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_divide", "long_name": "array_inplace_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2238, "end_line": 2241, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_remainder", "long_name": "array_inplace_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2244, "end_line": 2247, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_power", "long_name": "array_inplace_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2250, "end_line": 2253, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_left_shift", "long_name": "array_inplace_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2256, "end_line": 2259, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_right_shift", "long_name": "array_inplace_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2262, "end_line": 2265, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_and", "long_name": "array_inplace_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2268, "end_line": 2271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_or", "long_name": "array_inplace_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2274, "end_line": 2277, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_xor", "long_name": "array_inplace_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2280, "end_line": 2283, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_floor_divide", "long_name": "array_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2286, "end_line": 2289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_TRUE_divide", "long_name": "array_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2292, "end_line": 2295, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_floor_divide", "long_name": "array_inplace_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2298, "end_line": 2302, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_inplace_TRUE_divide", "long_name": "array_inplace_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2305, "end_line": 2309, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_all_nonzero", "long_name": "array_all_nonzero( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 93, "parameters": [ "mp" ], "start_line": 2313, "end_line": 2331, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_divmod", "long_name": "array_divmod( PyArrayObject * op1 , PyObject * op2)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 89, "parameters": [ "op1", "op2" ], "start_line": 2334, "end_line": 2349, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_int", "long_name": "array_int( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2353, "end_line": 2379, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_float", "long_name": "array_float( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2382, "end_line": 2407, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_long", "long_name": "array_long( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2410, "end_line": 2432, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_oct", "long_name": "array_oct( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2435, "end_line": 2457, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_hex", "long_name": "array_hex( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2460, "end_line": 2482, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "_array_copy_nice", "long_name": "_array_copy_nice( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 22, "parameters": [ "self" ], "start_line": 2485, "end_line": 2489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 258, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2550, "end_line": 2588, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_ass_slice", "long_name": "array_ass_slice( PyArrayObject * self , int ilow , int ihigh , PyObject * v)", "filename": "arrayobject.c", "nloc": 20, "complexity": 4, "token_count": 108, "parameters": [ "self", "ilow", "ihigh", "v" ], "start_line": 2592, "end_line": 2613, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_contains", "long_name": "array_contains( PyArrayObject * self , PyObject * el)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "el" ], "start_line": 2616, "end_line": 2621, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "dump_data", "long_name": "dump_data( char ** string , int * n , int * max_n , char * data , int nd , intp * dimensions , intp * strides , PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 41, "complexity": 7, "token_count": 308, "parameters": [ "string", "n", "max_n", "data", "nd", "dimensions", "strides", "self" ], "start_line": 2642, "end_line": 2689, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "array_repr_builtin", "long_name": "array_repr_builtin( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 30, "complexity": 4, "token_count": 222, "parameters": [ "self" ], "start_line": 2692, "end_line": 2728, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_SetStringFunction", "long_name": "PyArray_SetStringFunction( PyObject * op , int repr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 48, "parameters": [ "op", "repr" ], "start_line": 2734, "end_line": 2751, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2754, "end_line": 2766, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2769, "end_line": 2781, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_richcompare", "long_name": "array_richcompare( PyArrayObject * self , PyObject * other , int cmp_op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 13, "token_count": 273, "parameters": [ "self", "other", "cmp_op" ], "start_line": 2785, "end_line": 2862, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 78, "top_nesting_level": 0 }, { "name": "_check_axis", "long_name": "_check_axis( PyArrayObject * arr , int * axis , int flags)", "filename": "arrayobject.c", "nloc": 29, "complexity": 8, "token_count": 164, "parameters": [ "arr", "axis", "flags" ], "start_line": 2865, "end_line": 2894, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyArray_IntTupleFromIntp", "long_name": "PyArray_IntTupleFromIntp( int len , intp * vals)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 91, "parameters": [ "len", "vals" ], "start_line": 2900, "end_line": 2916, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_IntpFromSequence", "long_name": "PyArray_IntpFromSequence( PyObject * seq , intp * vals , int maxvals)", "filename": "arrayobject.c", "nloc": 21, "complexity": 7, "token_count": 161, "parameters": [ "seq", "vals", "maxvals" ], "start_line": 2921, "end_line": 2944, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "_IsContiguous", "long_name": "_IsContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 109, "parameters": [ "ap" ], "start_line": 2950, "end_line": 2966, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsFortranContiguous", "long_name": "_IsFortranContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 107, "parameters": [ "ap" ], "start_line": 2970, "end_line": 2986, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsAligned", "long_name": "_IsAligned( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 110, "parameters": [ "ap" ], "start_line": 2990, "end_line": 3006, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsWriteable", "long_name": "_IsWriteable( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 16, "complexity": 8, "token_count": 109, "parameters": [ "ap" ], "start_line": 3009, "end_line": 3042, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_UpdateFlags", "long_name": "PyArray_UpdateFlags( PyArrayObject * ret , int flagmask)", "filename": "arrayobject.c", "nloc": 22, "complexity": 9, "token_count": 129, "parameters": [ "ret", "flagmask" ], "start_line": 3046, "end_line": 3068, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_CheckStrides", "long_name": "PyArray_CheckStrides( int elsize , int nd , intp numbytes , intp * dims , intp * newstrides)", "filename": "arrayobject.c", "nloc": 13, "complexity": 4, "token_count": 84, "parameters": [ "elsize", "nd", "numbytes", "dims", "newstrides" ], "start_line": 3075, "end_line": 3090, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "_array_fill_strides", "long_name": "_array_fill_strides( intp * strides , intp * dims , int nd , intp itemsize , int inflag , int * objflags)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 171, "parameters": [ "strides", "dims", "nd", "itemsize", "inflag", "objflags" ], "start_line": 3110, "end_line": 3134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 672, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3138, "end_line": 3282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "PyArray_Resize", "long_name": "PyArray_Resize( PyArrayObject * self , PyArray_Dims * newshape)", "filename": "arrayobject.c", "nloc": 87, "complexity": 15, "token_count": 501, "parameters": [ "self", "newshape" ], "start_line": 3287, "end_line": 3392, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_FillObjectArray", "long_name": "PyArray_FillObjectArray( PyArrayObject * arr , PyObject * obj)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 98, "parameters": [ "arr", "obj" ], "start_line": 3396, "end_line": 3413, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_new", "long_name": "array_new( PyTypeObject * subtype , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 100, "complexity": 20, "token_count": 593, "parameters": [ "subtype", "args", "kwds" ], "start_line": 3417, "end_line": 3532, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 116, "top_nesting_level": 0 }, { "name": "array_ndim_get", "long_name": "array_ndim_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 3539, "end_line": 3542, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flags_get", "long_name": "array_flags_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 10, "complexity": 3, "token_count": 55, "parameters": [ "self" ], "start_line": 3545, "end_line": 3555, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_shape_get", "long_name": "array_shape_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3628, "end_line": 3631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_shape_set", "long_name": "array_shape_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 33, "complexity": 6, "token_count": 206, "parameters": [ "self", "val" ], "start_line": 3635, "end_line": 3669, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_strides_get", "long_name": "array_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3673, "end_line": 3676, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_strides_set", "long_name": "array_strides_set( PyArrayObject * self , PyObject * obj)", "filename": "arrayobject.c", "nloc": 32, "complexity": 7, "token_count": 209, "parameters": [ "self", "obj" ], "start_line": 3679, "end_line": 3712, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_protocol_strides_get", "long_name": "array_protocol_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 35, "parameters": [ "self" ], "start_line": 3716, "end_line": 3723, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_priority_get", "long_name": "array_priority_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 3, "token_count": 42, "parameters": [ "self" ], "start_line": 3726, "end_line": 3734, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_data_get", "long_name": "array_data_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 82, "parameters": [ "self" ], "start_line": 3738, "end_line": 3752, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_data_set", "long_name": "array_data_set( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 44, "complexity": 9, "token_count": 229, "parameters": [ "self", "op" ], "start_line": 3755, "end_line": 3799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "array_itemsize_get", "long_name": "array_itemsize_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 3803, "end_line": 3806, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_size_get", "long_name": "array_size_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "self" ], "start_line": 3809, "end_line": 3816, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typechar_get", "long_name": "array_typechar_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 47, "parameters": [ "self" ], "start_line": 3820, "end_line": 3827, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typestr_get", "long_name": "array_typestr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 7, "token_count": 141, "parameters": [ "self" ], "start_line": 3830, "end_line": 3850, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_descr_get", "long_name": "array_descr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 128, "parameters": [ "self" ], "start_line": 3853, "end_line": 3875, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_typenum_get", "long_name": "array_typenum_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 3878, "end_line": 3881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_get", "long_name": "array_type_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 3885, "end_line": 3888, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_set", "long_name": "array_type_set( PyArrayObject * self , PyObject * arg)", "filename": "arrayobject.c", "nloc": 41, "complexity": 10, "token_count": 294, "parameters": [ "self", "arg" ], "start_line": 3900, "end_line": 3958, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "array_base_get", "long_name": "array_base_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 41, "parameters": [ "self" ], "start_line": 3963, "end_line": 3973, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 129, "parameters": [ "self" ], "start_line": 3977, "end_line": 4002, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 177, "parameters": [ "self", "val" ], "start_line": 4006, "end_line": 4038, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 33, "complexity": 3, "token_count": 190, "parameters": [ "self" ], "start_line": 4041, "end_line": 4074, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 203, "parameters": [ "self", "val" ], "start_line": 4077, "end_line": 4114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_flat_get", "long_name": "array_flat_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 4117, "end_line": 4120, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 50, "complexity": 9, "token_count": 358, "parameters": [ "self", "val" ], "start_line": 4123, "end_line": 4175, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "discover_depth", "long_name": "discover_depth( PyObject * s , int max , int stop_at_string)", "filename": "arrayobject.c", "nloc": 23, "complexity": 14, "token_count": 169, "parameters": [ "s", "max", "stop_at_string" ], "start_line": 4351, "end_line": 4376, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "discover_itemsize", "long_name": "discover_itemsize( PyObject * s , int nd , int * itemsize)", "filename": "arrayobject.c", "nloc": 21, "complexity": 9, "token_count": 161, "parameters": [ "s", "nd", "itemsize" ], "start_line": 4379, "end_line": 4401, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "discover_dimensions", "long_name": "discover_dimensions( PyObject * s , int nd , intp * d , int check_it)", "filename": "arrayobject.c", "nloc": 24, "complexity": 10, "token_count": 188, "parameters": [ "s", "nd", "d", "check_it" ], "start_line": 4408, "end_line": 4434, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_array_small_type", "long_name": "_array_small_type( int chktype , int mintype , int chksize , int minsize , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 100, "parameters": [ "chktype", "mintype", "chksize", "minsize", "outtype" ], "start_line": 4437, "end_line": 4457, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 123, "complexity": 28, "token_count": 661, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4460, "end_line": 4598, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "Assign_Array", "long_name": "Assign_Array( PyArrayObject * self , PyObject * v)", "filename": "arrayobject.c", "nloc": 21, "complexity": 6, "token_count": 121, "parameters": [ "self", "v" ], "start_line": 4601, "end_line": 4624, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromScalar", "long_name": "Array_FromScalar( PyObject * op , PyArray_Typecode * typecode)", "filename": "arrayobject.c", "nloc": 19, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode" ], "start_line": 4628, "end_line": 4651, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromSequence", "long_name": "Array_FromSequence( PyObject * s , PyArray_Typecode * typecode , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 51, "complexity": 17, "token_count": 313, "parameters": [ "s", "typecode", "min_depth", "max_depth" ], "start_line": 4655, "end_line": 4712, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_ValidType", "long_name": "PyArray_ValidType( int type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 2, "token_count": 30, "parameters": [ "type" ], "start_line": 4716, "end_line": 4723, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "_bufferedcast", "long_name": "_bufferedcast( PyArrayObject * out , PyArrayObject * in)", "filename": "arrayobject.c", "nloc": 75, "complexity": 16, "token_count": 477, "parameters": [ "out", "in" ], "start_line": 4729, "end_line": 4819, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "PyArray_Cast", "long_name": "PyArray_Cast( PyArrayObject * mp , int type_num)", "filename": "arrayobject.c", "nloc": 10, "complexity": 1, "token_count": 56, "parameters": [ "mp", "type_num" ], "start_line": 4825, "end_line": 4836, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 233, "parameters": [ "mp", "at" ], "start_line": 4839, "end_line": 4874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_CastTo", "long_name": "PyArray_CastTo( PyArrayObject * out , PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 40, "complexity": 10, "token_count": 214, "parameters": [ "out", "mp" ], "start_line": 4881, "end_line": 4927, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 77, "complexity": 26, "token_count": 512, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4930, "end_line": 5020, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "_array_typecode_fromstr", "long_name": "_array_typecode_fromstr( char * str , int * swap , PyArray_Typecode * type)", "filename": "arrayobject.c", "nloc": 94, "complexity": 36, "token_count": 533, "parameters": [ "str", "swap", "type" ], "start_line": 5024, "end_line": 5129, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5132, "end_line": 5226, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_fromattr", "long_name": "array_fromattr( PyObject * op , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 21, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode", "flags" ], "start_line": 5229, "end_line": 5250, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_fromobject", "long_name": "array_fromobject( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int flags)", "filename": "arrayobject.c", "nloc": 46, "complexity": 13, "token_count": 270, "parameters": [ "op", "typecode", "min_depth", "max_depth", "flags" ], "start_line": 5254, "end_line": 5316, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_ArrayType", "long_name": "PyArray_ArrayType( PyObject * op , PyArray_Typecode * intype , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 29, "parameters": [ "op", "intype", "outtype" ], "start_line": 5319, "end_line": 5324, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ObjectType", "long_name": "PyArray_ObjectType( PyObject * op , int minimum_type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 40, "parameters": [ "op", "minimum_type" ], "start_line": 5327, "end_line": 5333, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_FromAny", "long_name": "PyArray_FromAny( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int requires)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 165, "parameters": [ "op", "typecode", "min_depth", "max_depth", "requires" ], "start_line": 5387, "end_line": 5417, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "PyArray_EnsureArray", "long_name": "PyArray_EnsureArray( PyObject * op)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 82, "parameters": [ "op" ], "start_line": 5427, "end_line": 5443, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5449, "end_line": 5454, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5457, "end_line": 5463, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5466, "end_line": 5472, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_CanCastSafely", "long_name": "PyArray_CanCastSafely( int fromtype , int totype)", "filename": "arrayobject.c", "nloc": 69, "complexity": 35, "token_count": 386, "parameters": [ "fromtype", "totype" ], "start_line": 5478, "end_line": 5549, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_CanCastTo", "long_name": "PyArray_CanCastTo( PyArray_Typecode * from , PyArray_Typecode * to)", "filename": "arrayobject.c", "nloc": 24, "complexity": 7, "token_count": 134, "parameters": [ "from", "to" ], "start_line": 5552, "end_line": 5576, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_IterNew", "long_name": "PyArray_IterNew( PyObject * obj)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 258, "parameters": [ "obj" ], "start_line": 5586, "end_line": 5623, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "arrayiter_next", "long_name": "arrayiter_next( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "it" ], "start_line": 5628, "end_line": 5638, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "arrayiter_dealloc", "long_name": "arrayiter_dealloc( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 25, "parameters": [ "it" ], "start_line": 5641, "end_line": 5646, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "arrayiter_traverse", "long_name": "arrayiter_traverse( PyArrayIterObject * it , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 6, "complexity": 2, "token_count": 42, "parameters": [ "it", "visit", "arg" ], "start_line": 5649, "end_line": 5654, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "iter_length", "long_name": "iter_length( PyArrayIterObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 5658, "end_line": 5661, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 272, "parameters": [ "self", "ind" ], "start_line": 5665, "end_line": 5713, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 50, "complexity": 8, "token_count": 341, "parameters": [ "self", "ind" ], "start_line": 5716, "end_line": 5768, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 593, "parameters": [ "self", "ind" ], "start_line": 5772, "end_line": 5891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "iter_ass_sub_Bool", "long_name": "iter_ass_sub_Bool( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 31, "complexity": 5, "token_count": 176, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5895, "end_line": 5927, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 41, "complexity": 8, "token_count": 283, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5930, "end_line": 5971, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_ass_subscript", "long_name": "iter_ass_subscript( PyArrayIterObject * self , PyObject * ind , PyObject * val)", "filename": "arrayobject.c", "nloc": 103, "complexity": 24, "token_count": 636, "parameters": [ "self", "ind", "val" ], "start_line": 5975, "end_line": 6097, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 30, "complexity": 5, "token_count": 221, "parameters": [ "it", "op" ], "start_line": 6110, "end_line": 6152, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "iter_copy", "long_name": "iter_copy( PyArrayIterObject * it , PyObject * args)", "filename": "arrayobject.c", "nloc": 5, "complexity": 2, "token_count": 35, "parameters": [ "it", "args" ], "start_line": 6157, "end_line": 6161, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "fancy_indexing_check", "long_name": "fancy_indexing_check( PyObject * args)", "filename": "arrayobject.c", "nloc": 55, "complexity": 22, "token_count": 293, "parameters": [ "args" ], "start_line": 6226, "end_line": 6287, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 62, "top_nesting_level": 0 }, { "name": "_convert_obj", "long_name": "_convert_obj( PyObject * obj , PyArrayIterObject ** iter)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 105, "parameters": [ "obj", "iter" ], "start_line": 6295, "end_line": 6310, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyArray_Broadcast", "long_name": "PyArray_Broadcast( PyArrayMultiIterObject * mit)", "filename": "arrayobject.c", "nloc": 58, "complexity": 13, "token_count": 464, "parameters": [ "mit" ], "start_line": 6316, "end_line": 6385, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterReset", "long_name": "PyArray_MapIterReset( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 35, "complexity": 4, "token_count": 261, "parameters": [ "mit" ], "start_line": 6389, "end_line": 6425, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNext", "long_name": "PyArray_MapIterNext( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 41, "complexity": 6, "token_count": 296, "parameters": [ "mit" ], "start_line": 6431, "end_line": 6475, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 682, "parameters": [ "mit", "arr" ], "start_line": 6493, "end_line": 6629, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "_nonzero_indices", "long_name": "_nonzero_indices( PyObject * myBool , PyArrayIterObject ** iters)", "filename": "arrayobject.c", "nloc": 57, "complexity": 15, "token_count": 454, "parameters": [ "myBool", "iters" ], "start_line": 6635, "end_line": 6704, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNew", "long_name": "PyArray_MapIterNew( PyObject * indexobj)", "filename": "arrayobject.c", "nloc": 111, "complexity": 24, "token_count": 745, "parameters": [ "indexobj" ], "start_line": 6707, "end_line": 6840, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 134, "top_nesting_level": 0 }, { "name": "arraymapiter_new", "long_name": "arraymapiter_new( PyTypeObject * type , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 130, "parameters": [ "type", "args", "kwds" ], "start_line": 6846, "end_line": 6876, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "arraymapiter_next", "long_name": "arraymapiter_next( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 12, "complexity": 4, "token_count": 70, "parameters": [ "mit" ], "start_line": 6882, "end_line": 6893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "arraymapiter_dealloc", "long_name": "arraymapiter_dealloc( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 60, "parameters": [ "mit" ], "start_line": 6896, "end_line": 6905, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "arraymapiter_traverse", "long_name": "arraymapiter_traverse( PyArrayMapIterObject * mit , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 16, "complexity": 9, "token_count": 146, "parameters": [ "mit", "visit", "arg" ], "start_line": 6908, "end_line": 6926, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyArray_PyIntAsIntp", "long_name": "PyArray_PyIntAsIntp( PyObject * o)", "filename": "arrayobject.c", "nloc": 59, "complexity": 19, "token_count": 385, "parameters": [ "o" ], "start_line": 40, "end_line": 103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "PyArray_PyIntAsInt", "long_name": "PyArray_PyIntAsInt( PyObject * o)", "filename": "arrayobject.c", "nloc": 57, "complexity": 19, "token_count": 389, "parameters": [ "o" ], "start_line": 109, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 81, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_Zero", "long_name": "PyArray_Zero( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 190, "parameters": [ "arr" ], "start_line": 206, "end_line": 241, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_One", "long_name": "PyArray_One( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 40, "complexity": 7, "token_count": 222, "parameters": [ "arr" ], "start_line": 244, "end_line": 287, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "do_sliced_copy", "long_name": "do_sliced_copy( char * dest , intp * dest_strides , intp * dest_dimensions , int dest_nd , char * src , intp * src_strides , intp * src_dimensions , int src_nd , int elsize , int copies)", "filename": "arrayobject.c", "nloc": 48, "complexity": 13, "token_count": 313, "parameters": [ "dest", "dest_strides", "dest_dimensions", "dest_nd", "src", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 293, "end_line": 343, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "optimize_slices", "long_name": "optimize_slices( intp ** dest_strides , intp ** dest_dimensions , int * dest_nd , intp ** src_strides , intp ** src_dimensions , int * src_nd , int * elsize , int * copies)", "filename": "arrayobject.c", "nloc": 32, "complexity": 8, "token_count": 214, "parameters": [ "dest_strides", "dest_dimensions", "dest_nd", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 366, "end_line": 397, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 400, "end_line": 434, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_INCREF", "long_name": "PyArray_INCREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 447, "end_line": 469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_XDECREF", "long_name": "PyArray_XDECREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 472, "end_line": 493, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "byte_swap_vector", "long_name": "byte_swap_vector( * p , int n , int size)", "filename": "arrayobject.c", "nloc": 38, "complexity": 10, "token_count": 340, "parameters": [ "p", "n", "size" ], "start_line": 497, "end_line": 535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "copy_and_swap", "long_name": "copy_and_swap( * dst , * src , int itemsize , intp numitems , intp srcstrides , int swap)", "filename": "arrayobject.c", "nloc": 18, "complexity": 5, "token_count": 120, "parameters": [ "dst", "src", "itemsize", "numitems", "srcstrides", "swap" ], "start_line": 540, "end_line": 560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "index2ptr", "long_name": "index2ptr( PyArrayObject * mp , int i)", "filename": "arrayobject.c", "nloc": 10, "complexity": 7, "token_count": 86, "parameters": [ "mp", "i" ], "start_line": 568, "end_line": 578, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Size", "long_name": "PyArray_Size( PyObject * op)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 33, "parameters": [ "op" ], "start_line": 581, "end_line": 589, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_CopyInto", "long_name": "PyArray_CopyInto( PyArrayObject * dest , PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 71, "complexity": 16, "token_count": 425, "parameters": [ "dest", "src" ], "start_line": 602, "end_line": 682, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 15, "complexity": 2, "token_count": 88, "parameters": [ "dest", "src_object" ], "start_line": 686, "end_line": 702, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndDataAndDescr", "long_name": "PyArray_FromDimsAndDataAndDescr( int nd , int * d , PyArray_Descr * descr , char * data)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 144, "parameters": [ "nd", "d", "descr", "data" ], "start_line": 710, "end_line": 731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 4, "token_count": 133, "parameters": [ "nd", "d", "type", "data" ], "start_line": 735, "end_line": 754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 129, "parameters": [ "nd", "d", "type" ], "start_line": 758, "end_line": 775, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 73, "parameters": [ "m1" ], "start_line": 781, "end_line": 793, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_Scalar", "long_name": "PyArray_Scalar( char * data , int type_num , int itemsize , int swap)", "filename": "arrayobject.c", "nloc": 48, "complexity": 8, "token_count": 289, "parameters": [ "data", "type_num", "itemsize", "swap" ], "start_line": 799, "end_line": 848, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyArray_ToScalar", "long_name": "PyArray_ToScalar( char * data , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 51, "parameters": [ "data", "arr" ], "start_line": 855, "end_line": 862, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_Return", "long_name": "PyArray_Return( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 85, "parameters": [ "mp" ], "start_line": 868, "end_line": 887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 27, "complexity": 5, "token_count": 158, "parameters": [ "type" ], "start_line": 898, "end_line": 926, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 936, "end_line": 979, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 87, "complexity": 16, "token_count": 571, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 983, "end_line": 1072, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "PyArray_ToList", "long_name": "PyArray_ToList( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 24, "complexity": 5, "token_count": 151, "parameters": [ "self" ], "start_line": 1075, "end_line": 1103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_ToString", "long_name": "PyArray_ToString( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 191, "parameters": [ "self" ], "start_line": 1106, "end_line": 1141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_dealloc", "long_name": "array_dealloc( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 20, "complexity": 7, "token_count": 144, "parameters": [ "self" ], "start_line": 1150, "end_line": 1187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_length", "long_name": "array_length( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 1194, "end_line": 1202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 146, "parameters": [ "self", "i" ], "start_line": 1206, "end_line": 1230, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_item_nice", "long_name": "array_item_nice( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "i" ], "start_line": 1233, "end_line": 1236, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_ass_item", "long_name": "array_ass_item( PyArrayObject * self , int i , PyObject * v)", "filename": "arrayobject.c", "nloc": 27, "complexity": 8, "token_count": 177, "parameters": [ "self", "i", "v" ], "start_line": 1240, "end_line": 1270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "slice_coerce_index", "long_name": "slice_coerce_index( PyObject * o , int * v)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "o", "v" ], "start_line": 1274, "end_line": 1282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "slice_GetIndices", "long_name": "slice_GetIndices( PySliceObject * r , int length , int * start , int * stop , int * step , intp * slicelength)", "filename": "arrayobject.c", "nloc": 45, "complexity": 24, "token_count": 376, "parameters": [ "r", "length", "start", "stop", "step", "slicelength" ], "start_line": 1288, "end_line": 1338, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "parse_subindex", "long_name": "parse_subindex( PyObject * op , int * step_size , intp * n_steps , int max)", "filename": "arrayobject.c", "nloc": 45, "complexity": 11, "token_count": 223, "parameters": [ "op", "step_size", "n_steps", "max" ], "start_line": 1345, "end_line": 1390, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "parse_index", "long_name": "parse_index( PyArrayObject * self , PyObject * op , intp * dimensions , intp * strides , intp * offset_ptr)", "filename": "arrayobject.c", "nloc": 89, "complexity": 20, "token_count": 540, "parameters": [ "self", "op", "dimensions", "strides", "offset_ptr" ], "start_line": 1394, "end_line": 1489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "_swap_axes", "long_name": "_swap_axes( PyArrayMapIterObject * mit , PyArrayObject ** ret)", "filename": "arrayobject.c", "nloc": 24, "complexity": 4, "token_count": 187, "parameters": [ "mit", "ret" ], "start_line": 1492, "end_line": 1526, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 248, "parameters": [ "mit" ], "start_line": 1531, "end_line": 1581, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "PyArray_SetMap", "long_name": "PyArray_SetMap( PyArrayMapIterObject * mit , PyObject * op)", "filename": "arrayobject.c", "nloc": 50, "complexity": 12, "token_count": 392, "parameters": [ "mit", "op" ], "start_line": 1584, "end_line": 1643, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 421, "parameters": [ "self", "op" ], "start_line": 1664, "end_line": 1739, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "array_ass_sub", "long_name": "array_ass_sub( PyArrayObject * self , PyObject * index , PyObject * op)", "filename": "arrayobject.c", "nloc": 43, "complexity": 9, "token_count": 251, "parameters": [ "self", "index", "op" ], "start_line": 1752, "end_line": 1804, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "array_subscript_nice", "long_name": "array_subscript_nice( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "self", "op" ], "start_line": 1812, "end_line": 1815, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_getsegcount", "long_name": "array_getsegcount( PyArrayObject * self , int * lenp)", "filename": "arrayobject.c", "nloc": 11, "complexity": 4, "token_count": 48, "parameters": [ "self", "lenp" ], "start_line": 1834, "end_line": 1846, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_getreadbuf", "long_name": "array_getreadbuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 72, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1849, "end_line": 1864, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_getwritebuf", "long_name": "array_getwritebuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1868, "end_line": 1877, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_getcharbuf", "long_name": "array_getcharbuf( PyArrayObject * self , int segment , const char ** ptrptr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 3, "token_count": 65, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1880, "end_line": 1891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_SetNumericOps", "long_name": "PyArray_SetNumericOps( PyObject * dict)", "filename": "arrayobject.c", "nloc": 34, "complexity": 1, "token_count": 162, "parameters": [ "dict" ], "start_line": 1959, "end_line": 1992, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_GetNumericOps", "long_name": "PyArray_GetNumericOps()", "filename": "arrayobject.c", "nloc": 39, "complexity": 2, "token_count": 183, "parameters": [], "start_line": 1998, "end_line": 2037, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_GenericReduceFunction", "long_name": "PyArray_GenericReduceFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2040, "end_line": 2059, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericAccumulateFunction", "long_name": "PyArray_GenericAccumulateFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2063, "end_line": 2082, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericBinaryFunction", "long_name": "PyArray_GenericBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 69, "parameters": [ "m1", "m2", "op" ], "start_line": 2086, "end_line": 2097, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericUnaryFunction", "long_name": "PyArray_GenericUnaryFunction( PyArrayObject * m1 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 63, "parameters": [ "m1", "op" ], "start_line": 2100, "end_line": 2111, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericInplaceBinaryFunction", "long_name": "PyArray_GenericInplaceBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 13, "complexity": 2, "token_count": 71, "parameters": [ "m1", "m2", "op" ], "start_line": 2114, "end_line": 2126, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_add", "long_name": "array_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2129, "end_line": 2132, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_subtract", "long_name": "array_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2135, "end_line": 2138, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_multiply", "long_name": "array_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2141, "end_line": 2144, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_divide", "long_name": "array_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2147, "end_line": 2150, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_remainder", "long_name": "array_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2153, "end_line": 2156, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_power", "long_name": "array_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2159, "end_line": 2162, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_negative", "long_name": "array_negative( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2165, "end_line": 2168, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_absolute", "long_name": "array_absolute( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2171, "end_line": 2174, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_invert", "long_name": "array_invert( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2177, "end_line": 2180, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_left_shift", "long_name": "array_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2183, "end_line": 2186, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_right_shift", "long_name": "array_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2189, "end_line": 2192, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_and", "long_name": "array_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2195, "end_line": 2198, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_or", "long_name": "array_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2201, "end_line": 2204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_xor", "long_name": "array_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2207, "end_line": 2210, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_add", "long_name": "array_inplace_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2213, "end_line": 2216, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_subtract", "long_name": "array_inplace_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2219, "end_line": 2222, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_multiply", "long_name": "array_inplace_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2225, "end_line": 2228, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_divide", "long_name": "array_inplace_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2231, "end_line": 2234, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_remainder", "long_name": "array_inplace_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2237, "end_line": 2240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_power", "long_name": "array_inplace_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2243, "end_line": 2246, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_left_shift", "long_name": "array_inplace_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2249, "end_line": 2252, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_right_shift", "long_name": "array_inplace_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2255, "end_line": 2258, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_and", "long_name": "array_inplace_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2261, "end_line": 2264, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_or", "long_name": "array_inplace_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2267, "end_line": 2270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_xor", "long_name": "array_inplace_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2273, "end_line": 2276, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_floor_divide", "long_name": "array_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2279, "end_line": 2282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_TRUE_divide", "long_name": "array_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2285, "end_line": 2288, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_floor_divide", "long_name": "array_inplace_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2291, "end_line": 2295, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_inplace_TRUE_divide", "long_name": "array_inplace_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2298, "end_line": 2302, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_all_nonzero", "long_name": "array_all_nonzero( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 93, "parameters": [ "mp" ], "start_line": 2306, "end_line": 2324, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_divmod", "long_name": "array_divmod( PyArrayObject * op1 , PyObject * op2)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 89, "parameters": [ "op1", "op2" ], "start_line": 2327, "end_line": 2342, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_int", "long_name": "array_int( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2346, "end_line": 2372, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_float", "long_name": "array_float( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2375, "end_line": 2400, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_long", "long_name": "array_long( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2403, "end_line": 2425, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_oct", "long_name": "array_oct( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2428, "end_line": 2450, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_hex", "long_name": "array_hex( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2453, "end_line": 2475, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "_array_copy_nice", "long_name": "_array_copy_nice( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 22, "parameters": [ "self" ], "start_line": 2478, "end_line": 2482, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 254, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2543, "end_line": 2581, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_ass_slice", "long_name": "array_ass_slice( PyArrayObject * self , int ilow , int ihigh , PyObject * v)", "filename": "arrayobject.c", "nloc": 20, "complexity": 4, "token_count": 108, "parameters": [ "self", "ilow", "ihigh", "v" ], "start_line": 2585, "end_line": 2606, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_contains", "long_name": "array_contains( PyArrayObject * self , PyObject * el)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "el" ], "start_line": 2609, "end_line": 2614, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "dump_data", "long_name": "dump_data( char ** string , int * n , int * max_n , char * data , int nd , intp * dimensions , intp * strides , PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 41, "complexity": 7, "token_count": 308, "parameters": [ "string", "n", "max_n", "data", "nd", "dimensions", "strides", "self" ], "start_line": 2635, "end_line": 2682, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "array_repr_builtin", "long_name": "array_repr_builtin( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 30, "complexity": 4, "token_count": 222, "parameters": [ "self" ], "start_line": 2685, "end_line": 2721, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_SetStringFunction", "long_name": "PyArray_SetStringFunction( PyObject * op , int repr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 48, "parameters": [ "op", "repr" ], "start_line": 2727, "end_line": 2744, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2747, "end_line": 2759, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2762, "end_line": 2774, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_richcompare", "long_name": "array_richcompare( PyArrayObject * self , PyObject * other , int cmp_op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 13, "token_count": 273, "parameters": [ "self", "other", "cmp_op" ], "start_line": 2778, "end_line": 2855, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 78, "top_nesting_level": 0 }, { "name": "_check_axis", "long_name": "_check_axis( PyArrayObject * arr , int * axis , int flags)", "filename": "arrayobject.c", "nloc": 29, "complexity": 8, "token_count": 164, "parameters": [ "arr", "axis", "flags" ], "start_line": 2858, "end_line": 2887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyArray_IntTupleFromIntp", "long_name": "PyArray_IntTupleFromIntp( int len , intp * vals)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 91, "parameters": [ "len", "vals" ], "start_line": 2893, "end_line": 2909, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_IntpFromSequence", "long_name": "PyArray_IntpFromSequence( PyObject * seq , intp * vals , int maxvals)", "filename": "arrayobject.c", "nloc": 21, "complexity": 7, "token_count": 161, "parameters": [ "seq", "vals", "maxvals" ], "start_line": 2914, "end_line": 2937, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "_IsContiguous", "long_name": "_IsContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 109, "parameters": [ "ap" ], "start_line": 2943, "end_line": 2959, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsFortranContiguous", "long_name": "_IsFortranContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 107, "parameters": [ "ap" ], "start_line": 2963, "end_line": 2979, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsAligned", "long_name": "_IsAligned( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 110, "parameters": [ "ap" ], "start_line": 2983, "end_line": 2999, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsWriteable", "long_name": "_IsWriteable( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 16, "complexity": 8, "token_count": 109, "parameters": [ "ap" ], "start_line": 3002, "end_line": 3035, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_UpdateFlags", "long_name": "PyArray_UpdateFlags( PyArrayObject * ret , int flagmask)", "filename": "arrayobject.c", "nloc": 22, "complexity": 9, "token_count": 129, "parameters": [ "ret", "flagmask" ], "start_line": 3039, "end_line": 3061, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_CheckStrides", "long_name": "PyArray_CheckStrides( int elsize , int nd , intp numbytes , intp * dims , intp * newstrides)", "filename": "arrayobject.c", "nloc": 13, "complexity": 4, "token_count": 84, "parameters": [ "elsize", "nd", "numbytes", "dims", "newstrides" ], "start_line": 3068, "end_line": 3083, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "_array_fill_strides", "long_name": "_array_fill_strides( intp * strides , intp * dims , int nd , intp itemsize , int inflag , int * objflags)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 171, "parameters": [ "strides", "dims", "nd", "itemsize", "inflag", "objflags" ], "start_line": 3103, "end_line": 3127, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyArrayObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 676, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3131, "end_line": 3275, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "PyArray_Resize", "long_name": "PyArray_Resize( PyArrayObject * self , PyArray_Dims * newshape)", "filename": "arrayobject.c", "nloc": 87, "complexity": 15, "token_count": 501, "parameters": [ "self", "newshape" ], "start_line": 3280, "end_line": 3385, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_FillObjectArray", "long_name": "PyArray_FillObjectArray( PyArrayObject * arr , PyObject * obj)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 98, "parameters": [ "arr", "obj" ], "start_line": 3389, "end_line": 3406, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_new", "long_name": "array_new( PyTypeObject * subtype , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 100, "complexity": 20, "token_count": 593, "parameters": [ "subtype", "args", "kwds" ], "start_line": 3410, "end_line": 3525, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 116, "top_nesting_level": 0 }, { "name": "array_ndim_get", "long_name": "array_ndim_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 3532, "end_line": 3535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flags_get", "long_name": "array_flags_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 10, "complexity": 3, "token_count": 55, "parameters": [ "self" ], "start_line": 3538, "end_line": 3548, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_shape_get", "long_name": "array_shape_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3621, "end_line": 3624, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_shape_set", "long_name": "array_shape_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 33, "complexity": 6, "token_count": 206, "parameters": [ "self", "val" ], "start_line": 3628, "end_line": 3662, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_strides_get", "long_name": "array_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3666, "end_line": 3669, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_strides_set", "long_name": "array_strides_set( PyArrayObject * self , PyObject * obj)", "filename": "arrayobject.c", "nloc": 32, "complexity": 7, "token_count": 209, "parameters": [ "self", "obj" ], "start_line": 3672, "end_line": 3705, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_protocol_strides_get", "long_name": "array_protocol_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 35, "parameters": [ "self" ], "start_line": 3709, "end_line": 3716, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_priority_get", "long_name": "array_priority_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 3, "token_count": 42, "parameters": [ "self" ], "start_line": 3719, "end_line": 3727, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_data_get", "long_name": "array_data_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 82, "parameters": [ "self" ], "start_line": 3731, "end_line": 3745, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_data_set", "long_name": "array_data_set( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 44, "complexity": 9, "token_count": 229, "parameters": [ "self", "op" ], "start_line": 3748, "end_line": 3792, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "array_itemsize_get", "long_name": "array_itemsize_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 3796, "end_line": 3799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_size_get", "long_name": "array_size_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "self" ], "start_line": 3802, "end_line": 3809, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typechar_get", "long_name": "array_typechar_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 47, "parameters": [ "self" ], "start_line": 3813, "end_line": 3820, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typestr_get", "long_name": "array_typestr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 7, "token_count": 141, "parameters": [ "self" ], "start_line": 3823, "end_line": 3843, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_descr_get", "long_name": "array_descr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 128, "parameters": [ "self" ], "start_line": 3846, "end_line": 3868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_typenum_get", "long_name": "array_typenum_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 3871, "end_line": 3874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_get", "long_name": "array_type_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 3878, "end_line": 3881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_set", "long_name": "array_type_set( PyArrayObject * self , PyObject * arg)", "filename": "arrayobject.c", "nloc": 41, "complexity": 10, "token_count": 294, "parameters": [ "self", "arg" ], "start_line": 3893, "end_line": 3951, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "array_base_get", "long_name": "array_base_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 41, "parameters": [ "self" ], "start_line": 3956, "end_line": 3966, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 125, "parameters": [ "self" ], "start_line": 3970, "end_line": 3995, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 173, "parameters": [ "self", "val" ], "start_line": 3999, "end_line": 4031, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 33, "complexity": 3, "token_count": 186, "parameters": [ "self" ], "start_line": 4034, "end_line": 4067, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 199, "parameters": [ "self", "val" ], "start_line": 4070, "end_line": 4107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_flat_get", "long_name": "array_flat_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 4110, "end_line": 4113, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 50, "complexity": 9, "token_count": 358, "parameters": [ "self", "val" ], "start_line": 4116, "end_line": 4168, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "discover_depth", "long_name": "discover_depth( PyObject * s , int max , int stop_at_string)", "filename": "arrayobject.c", "nloc": 23, "complexity": 14, "token_count": 169, "parameters": [ "s", "max", "stop_at_string" ], "start_line": 4344, "end_line": 4369, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "discover_itemsize", "long_name": "discover_itemsize( PyObject * s , int nd , int * itemsize)", "filename": "arrayobject.c", "nloc": 21, "complexity": 9, "token_count": 161, "parameters": [ "s", "nd", "itemsize" ], "start_line": 4372, "end_line": 4394, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "discover_dimensions", "long_name": "discover_dimensions( PyObject * s , int nd , intp * d , int check_it)", "filename": "arrayobject.c", "nloc": 24, "complexity": 10, "token_count": 188, "parameters": [ "s", "nd", "d", "check_it" ], "start_line": 4401, "end_line": 4427, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_array_small_type", "long_name": "_array_small_type( int chktype , int mintype , int chksize , int minsize , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 100, "parameters": [ "chktype", "mintype", "chksize", "minsize", "outtype" ], "start_line": 4430, "end_line": 4450, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 123, "complexity": 28, "token_count": 661, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4453, "end_line": 4591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "Assign_Array", "long_name": "Assign_Array( PyArrayObject * self , PyObject * v)", "filename": "arrayobject.c", "nloc": 21, "complexity": 6, "token_count": 121, "parameters": [ "self", "v" ], "start_line": 4594, "end_line": 4617, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromScalar", "long_name": "Array_FromScalar( PyObject * op , PyArray_Typecode * typecode)", "filename": "arrayobject.c", "nloc": 19, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode" ], "start_line": 4621, "end_line": 4644, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromSequence", "long_name": "Array_FromSequence( PyObject * s , PyArray_Typecode * typecode , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 51, "complexity": 17, "token_count": 313, "parameters": [ "s", "typecode", "min_depth", "max_depth" ], "start_line": 4648, "end_line": 4705, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_ValidType", "long_name": "PyArray_ValidType( int type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 2, "token_count": 30, "parameters": [ "type" ], "start_line": 4709, "end_line": 4716, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "_bufferedcast", "long_name": "_bufferedcast( PyArrayObject * out , PyArrayObject * in)", "filename": "arrayobject.c", "nloc": 75, "complexity": 16, "token_count": 477, "parameters": [ "out", "in" ], "start_line": 4722, "end_line": 4812, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "PyArray_Cast", "long_name": "PyArray_Cast( PyArrayObject * mp , int type_num)", "filename": "arrayobject.c", "nloc": 10, "complexity": 1, "token_count": 56, "parameters": [ "mp", "type_num" ], "start_line": 4818, "end_line": 4829, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 229, "parameters": [ "mp", "at" ], "start_line": 4832, "end_line": 4867, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_CastTo", "long_name": "PyArray_CastTo( PyArrayObject * out , PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 40, "complexity": 10, "token_count": 214, "parameters": [ "out", "mp" ], "start_line": 4874, "end_line": 4920, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 77, "complexity": 26, "token_count": 508, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4923, "end_line": 5013, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "_array_typecode_fromstr", "long_name": "_array_typecode_fromstr( char * str , int * swap , PyArray_Typecode * type)", "filename": "arrayobject.c", "nloc": 94, "complexity": 36, "token_count": 533, "parameters": [ "str", "swap", "type" ], "start_line": 5017, "end_line": 5122, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5125, "end_line": 5219, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_fromattr", "long_name": "array_fromattr( PyObject * op , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 21, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode", "flags" ], "start_line": 5222, "end_line": 5243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_fromobject", "long_name": "array_fromobject( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int flags)", "filename": "arrayobject.c", "nloc": 46, "complexity": 13, "token_count": 270, "parameters": [ "op", "typecode", "min_depth", "max_depth", "flags" ], "start_line": 5247, "end_line": 5309, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_ArrayType", "long_name": "PyArray_ArrayType( PyObject * op , PyArray_Typecode * intype , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 29, "parameters": [ "op", "intype", "outtype" ], "start_line": 5312, "end_line": 5317, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ObjectType", "long_name": "PyArray_ObjectType( PyObject * op , int minimum_type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 40, "parameters": [ "op", "minimum_type" ], "start_line": 5320, "end_line": 5326, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_FromAny", "long_name": "PyArray_FromAny( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int requires)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 165, "parameters": [ "op", "typecode", "min_depth", "max_depth", "requires" ], "start_line": 5380, "end_line": 5410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "PyArray_EnsureArray", "long_name": "PyArray_EnsureArray( PyObject * op)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 82, "parameters": [ "op" ], "start_line": 5420, "end_line": 5436, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5442, "end_line": 5447, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5450, "end_line": 5456, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5459, "end_line": 5465, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_CanCastSafely", "long_name": "PyArray_CanCastSafely( int fromtype , int totype)", "filename": "arrayobject.c", "nloc": 69, "complexity": 35, "token_count": 386, "parameters": [ "fromtype", "totype" ], "start_line": 5471, "end_line": 5542, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_CanCastTo", "long_name": "PyArray_CanCastTo( PyArray_Typecode * from , PyArray_Typecode * to)", "filename": "arrayobject.c", "nloc": 24, "complexity": 7, "token_count": 134, "parameters": [ "from", "to" ], "start_line": 5545, "end_line": 5569, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_IterNew", "long_name": "PyArray_IterNew( PyObject * obj)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 258, "parameters": [ "obj" ], "start_line": 5579, "end_line": 5616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "arrayiter_next", "long_name": "arrayiter_next( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "it" ], "start_line": 5621, "end_line": 5631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "arrayiter_dealloc", "long_name": "arrayiter_dealloc( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 25, "parameters": [ "it" ], "start_line": 5634, "end_line": 5639, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "arrayiter_traverse", "long_name": "arrayiter_traverse( PyArrayIterObject * it , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 6, "complexity": 2, "token_count": 42, "parameters": [ "it", "visit", "arg" ], "start_line": 5642, "end_line": 5647, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "iter_length", "long_name": "iter_length( PyArrayIterObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 5651, "end_line": 5654, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 268, "parameters": [ "self", "ind" ], "start_line": 5658, "end_line": 5706, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 50, "complexity": 8, "token_count": 337, "parameters": [ "self", "ind" ], "start_line": 5709, "end_line": 5761, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 585, "parameters": [ "self", "ind" ], "start_line": 5765, "end_line": 5884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "iter_ass_sub_Bool", "long_name": "iter_ass_sub_Bool( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 31, "complexity": 5, "token_count": 176, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5888, "end_line": 5920, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 41, "complexity": 8, "token_count": 283, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5923, "end_line": 5964, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_ass_subscript", "long_name": "iter_ass_subscript( PyArrayIterObject * self , PyObject * ind , PyObject * val)", "filename": "arrayobject.c", "nloc": 103, "complexity": 24, "token_count": 636, "parameters": [ "self", "ind", "val" ], "start_line": 5968, "end_line": 6090, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 29, "complexity": 5, "token_count": 213, "parameters": [ "it", "op" ], "start_line": 6103, "end_line": 6144, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_copy", "long_name": "iter_copy( PyArrayIterObject * it , PyObject * args)", "filename": "arrayobject.c", "nloc": 5, "complexity": 2, "token_count": 35, "parameters": [ "it", "args" ], "start_line": 6149, "end_line": 6153, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "fancy_indexing_check", "long_name": "fancy_indexing_check( PyObject * args)", "filename": "arrayobject.c", "nloc": 55, "complexity": 22, "token_count": 293, "parameters": [ "args" ], "start_line": 6218, "end_line": 6279, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 62, "top_nesting_level": 0 }, { "name": "_convert_obj", "long_name": "_convert_obj( PyObject * obj , PyArrayIterObject ** iter)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 105, "parameters": [ "obj", "iter" ], "start_line": 6287, "end_line": 6302, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyArray_Broadcast", "long_name": "PyArray_Broadcast( PyArrayMultiIterObject * mit)", "filename": "arrayobject.c", "nloc": 58, "complexity": 13, "token_count": 464, "parameters": [ "mit" ], "start_line": 6308, "end_line": 6377, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterReset", "long_name": "PyArray_MapIterReset( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 35, "complexity": 4, "token_count": 261, "parameters": [ "mit" ], "start_line": 6381, "end_line": 6417, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNext", "long_name": "PyArray_MapIterNext( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 41, "complexity": 6, "token_count": 296, "parameters": [ "mit" ], "start_line": 6423, "end_line": 6467, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 682, "parameters": [ "mit", "arr" ], "start_line": 6485, "end_line": 6621, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "_nonzero_indices", "long_name": "_nonzero_indices( PyObject * myBool , PyArrayIterObject ** iters)", "filename": "arrayobject.c", "nloc": 57, "complexity": 15, "token_count": 454, "parameters": [ "myBool", "iters" ], "start_line": 6627, "end_line": 6696, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNew", "long_name": "PyArray_MapIterNew( PyObject * indexobj)", "filename": "arrayobject.c", "nloc": 111, "complexity": 24, "token_count": 745, "parameters": [ "indexobj" ], "start_line": 6699, "end_line": 6832, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 134, "top_nesting_level": 0 }, { "name": "arraymapiter_new", "long_name": "arraymapiter_new( PyTypeObject * type , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 130, "parameters": [ "type", "args", "kwds" ], "start_line": 6838, "end_line": 6868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "arraymapiter_next", "long_name": "arraymapiter_next( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 12, "complexity": 4, "token_count": 70, "parameters": [ "mit" ], "start_line": 6874, "end_line": 6885, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "arraymapiter_dealloc", "long_name": "arraymapiter_dealloc( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 60, "parameters": [ "mit" ], "start_line": 6888, "end_line": 6897, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "arraymapiter_traverse", "long_name": "arraymapiter_traverse( PyArrayMapIterObject * mit , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 16, "complexity": 9, "token_count": 146, "parameters": [ "mit", "visit", "arg" ], "start_line": 6900, "end_line": 6918, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 272, "parameters": [ "self", "ind" ], "start_line": 5665, "end_line": 5713, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyArrayObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 676, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3131, "end_line": 3275, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 33, "complexity": 3, "token_count": 190, "parameters": [ "self" ], "start_line": 4041, "end_line": 4074, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 50, "complexity": 8, "token_count": 341, "parameters": [ "self", "ind" ], "start_line": 5716, "end_line": 5768, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 5, "token_count": 137, "parameters": [ "nd", "d", "type", "data" ], "start_line": 737, "end_line": 757, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 129, "parameters": [ "self" ], "start_line": 3977, "end_line": 4002, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 150, "parameters": [ "self", "i" ], "start_line": 1213, "end_line": 1237, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 5, "token_count": 133, "parameters": [ "nd", "d", "type" ], "start_line": 761, "end_line": 778, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 177, "parameters": [ "self", "val" ], "start_line": 4006, "end_line": 4038, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 31, "complexity": 6, "token_count": 177, "parameters": [ "type" ], "start_line": 901, "end_line": 933, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 86, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 191, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 30, "complexity": 5, "token_count": 221, "parameters": [ "it", "op" ], "start_line": 6110, "end_line": 6152, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 593, "parameters": [ "self", "ind" ], "start_line": 5772, "end_line": 5891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 233, "parameters": [ "mp", "at" ], "start_line": 4839, "end_line": 4874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 672, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3138, "end_line": 3282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 258, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2550, "end_line": 2588, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 77, "parameters": [ "m1" ], "start_line": 784, "end_line": 796, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 425, "parameters": [ "self", "op" ], "start_line": 1671, "end_line": 1746, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 252, "parameters": [ "mit" ], "start_line": 1538, "end_line": 1588, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 203, "parameters": [ "self", "val" ], "start_line": 4077, "end_line": 4114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 77, "complexity": 26, "token_count": 512, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4930, "end_line": 5020, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 } ], "nloc": 5481, "complexity": 1207, "token_count": 32802, "diff_parsed": { "added": [ "\tif (PyArray_CheckExact(obj))", " if (PyBigArray_CheckExact(obj))", " return PyArray_BIG_PRIORITY;", " int, intp *, char *, int, int, PyObject *);", "\tif (type != PyArray_OBJECT && type != PyArray_OBJECTLTR)", " /* already done*/", "\tif (type != PyArray_OBJECT && type != PyArray_OBJECTLTR)", "\t\t\t\t\t 0, (PyObject *)m1);", " if (userdescrs == NULL) {", " PyErr_SetString(PyExc_MemoryError, \"RegisterDataType\");", " return -1;", " }", "\t\t\t\t\t (PyObject *)self);", "\t\t\t (PyObject *)temp);", "\t\t\t (PyObject *)self)) == NULL)", "\t\t\t self->itemsize, self->flags, (PyObject *)self);", "\t PyObject *obj)", "\t\t\t\t\t \"O\", obj);", "\t\t\t\t\t\t self->flags, (PyObject *)self);", "\t\t\t\t\t\t self->flags, (PyObject *)self);", "\t\t\t\t\t\t self->flags, (PyObject *)self);", "\t\t\t\t\t\t self->flags, (PyObject *)self);", "\t\t\t at->fortran, (PyObject *)mp);", "\t\t\t\t\t (PyObject *)arr);", "\t\t\titemsize, 0, (PyObject *)self->ao);", "\t\t\t0, (PyObject *)self->ao);", "\t\t\t\t\t(PyObject *)self->ao);", "\t\t\t\tsize, 0, (PyObject *)self->ao);", " (PyObject *)it->ao);", " NULL, NULL, it->ao->itemsize, 0,", " (PyObject *)it->ao);" ], "deleted": [ "\tif (PyArray_CheckExact(obj) || PyBigArray_CheckExact(obj))", " int, intp *, char *, int, int, PyArrayObject *);", "\tif (type != PyArray_OBJECT)", "\tif (type != PyArray_OBJECT)", "\t\t\t\t\t 0, m1);", "\t\t\t\t\t self);", "\t\t\t temp);", "\t\t\t self)) == NULL)", "\t\t\t self->itemsize, self->flags, self);", "\t PyArrayObject *obj)", "\t\t\t\t\t \"O\", (PyObject *)obj);", "\t\t\t\t\t\t self->flags, self);", "\t\t\t\t\t\t self->flags, self);", "\t\t\t\t\t\t self->flags, self);", "\t\t\t\t\t\t self->flags, self);", "\t\t\t at->fortran, mp);", "\t\t\t\t\t arr);", "\t\t\titemsize, 0, self->ao);", "\t\t\t0, self->ao);", "\t\t\t\t\tself->ao);", "\t\t\t\tsize, 0, self->ao);", " it->ao);", " NULL, NULL, it->ao->itemsize, 0, it->ao);" ] } }, { "old_path": "scipy/base/src/multiarraymodule.c", "new_path": "scipy/base/src/multiarraymodule.c", "filename": "multiarraymodule.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -99,7 +99,7 @@ PyArray_View(PyArrayObject *self, PyArray_Typecode *type)\n \t\t\t self->strides,\n \t\t\t self->data,\n \t\t\t self->itemsize,\n-\t\t\t self->flags, self);\n+\t\t\t self->flags, (PyObject *)self);\n \n \tif (new==NULL) return NULL;\n \t\n@@ -163,7 +163,7 @@ PyArray_Flatten(PyArrayObject *a, int fortran)\n \t\t\t NULL,\n NULL,\n \t\t\t a->itemsize,\n-\t\t\t 0, a);\n+\t\t\t 0, (PyObject *)a);\n \n \tif (ret== NULL) return NULL;\n \tif (fortran) {\n@@ -275,7 +275,7 @@ PyArray_Newshape(PyArrayObject *self, PyArray_Dims *newdims)\n \t\t\t\t NULL,\n \t\t\t\t self->data,\n \t\t\t\t self->itemsize,\n-\t\t\t\t self->flags, self);\n+\t\t\t\t self->flags, (PyObject *)self);\n \n \tif (ret== NULL)\n goto fail;\n@@ -322,7 +322,7 @@ PyArray_Squeeze(PyArrayObject *self)\n \tret = PyArray_New(self->ob_type, newnd, dimensions, \n \t\t\t self->descr->type_num, strides,\n \t\t\t self->data, self->itemsize, self->flags,\n-\t\t\t self);\n+\t\t\t (PyObject *)self);\n \tself->flags &= ~OWN_DATA;\n \tself->base = (PyObject *)self;\n \tPy_INCREF(self);\n@@ -539,7 +539,7 @@ PyArray_Nonzero(PyArrayObject *self)\n \tPyArray_ITER_RESET(it);\n \tif (n==1) {\n \t\tret = PyArray_New(self->ob_type, 1, &count, PyArray_INTP, \n-\t\t\t\t NULL, NULL, 0, 0, self);\n+\t\t\t\t NULL, NULL, 0, 0, (PyObject *)self);\n \t\tif (ret == NULL) goto fail;\n \t\tdptr[0] = (intp *)PyArray_DATA(ret);\n \t\t\n@@ -554,7 +554,7 @@ PyArray_Nonzero(PyArrayObject *self)\n \t\tfor (j=0; job_type, 1, &count, \n \t\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0,\n-\t\t\t\t\t self);\n+\t\t\t\t\t (PyObject *)self);\n \t\t\tPyTuple_SET_ITEM(ret, j, item);\n \t\t\tif (item == NULL) goto fail;\n \t\t\tdptr[j] = (intp *)PyArray_DATA(item);\n@@ -1046,7 +1046,8 @@ PyArray_Concatenate(PyObject *op, int axis)\n \tmps[0]->dimensions[0] = new_dim;\n \tret = (PyArrayObject *)PyArray_New(subtype, nd,\n \t\t\t\t\t mps[0]->dimensions, \n-\t\t\t\t\t type_num, NULL, NULL, 0, 0, ret);\n+\t\t\t\t\t type_num, NULL, NULL, 0, 0,\n+ (PyObject *)ret);\n \tmps[0]->dimensions[0] = tmp;\n \t\n \tif (ret == NULL) goto fail;\n@@ -1149,7 +1150,7 @@ PyArray_Transpose(PyArrayObject *ap, PyObject *op) {\n \tret = (PyArrayObject *)PyArray_New(ap->ob_type, n, permutation, \n \t\t\t\t\t ap->descr->type_num, NULL,\n \t\t\t\t\t ap->data, ap->itemsize, ap->flags,\n-\t\t\t\t\t ap);\n+\t\t\t\t\t (PyObject *)ap);\n \tif (ret == NULL) goto fail;\n \t\n \t/* point at true owner of memory: */\n@@ -1231,7 +1232,7 @@ PyArray_Repeat(PyArrayObject *aop, PyObject *op, int axis) {\n \t\t\t\t\t aop->dimensions, \n \t\t\t\t\t aop->descr->type_num,\n \t\t\t\t\t NULL, NULL, aop->itemsize, 0,\n-\t\t\t\t\t aop);\n+\t\t\t\t\t (PyObject *)aop);\n \taop->dimensions[axis] = n;\n \t\n \tif (ret == NULL) goto fail;\n@@ -1348,7 +1349,7 @@ PyArray_Choose(PyArrayObject *ip, PyObject *op) {\n \t*/\n \tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n \t\t\t\t\t ap->dimensions, type_num,\n-\t\t\t\t\t NULL, NULL, 0, 0, ap);\n+\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap);\n \tif (ret == NULL) goto fail;\n \t\n \telsize = ret->itemsize;\n@@ -1504,7 +1505,7 @@ PyArray_ArgSort(PyArrayObject *op, int axis)\n \t\n \tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n \t\t\t\t\t ap->dimensions, PyArray_INTP,\n-\t\t\t\t\t NULL, NULL, 0, 0, ap);\n+\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap);\n \tif (ret == NULL) goto fail;\n \t\n \tif (ap->descr->compare == NULL) {\n@@ -1608,7 +1609,7 @@ PyArray_SearchSorted(PyArrayObject *op1, PyObject *op2)\n \t\n \tret = (PyArrayObject *)PyArray_New(ap2->ob_type, ap2->nd, \n \t\t\t\t\t ap2->dimensions, PyArray_INTP,\n-\t\t\t\t\t NULL, NULL, 0, 0, ap2);\n+\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap2);\n \tif (ret == NULL) goto fail;\n \n \tif (ap2->descr->compare == NULL) {\n@@ -1700,6 +1701,7 @@ PyArray_InnerProduct(PyObject *op1, PyObject *op2)\n \n \tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n \t\t\t\t\t typenum, NULL, NULL, 0, 0, \n+ (PyObject *)\n \t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n \tif (ret == NULL) goto fail;\n \n@@ -1822,6 +1824,7 @@ PyArray_MatrixProduct(PyObject *op1, PyObject *op2)\n \n \tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n \t\t\t\t\t typenum, NULL, NULL, 0, 0, \n+ (PyObject *)\n \t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n \tif (ret == NULL) goto fail;\n \n@@ -1898,7 +1901,7 @@ PyArray_CopyAndTranspose(PyObject *op)\n \telsize = PyArray_ITEMSIZE(arr);\n \n \tret = PyArray_New(arr->ob_type, 2, dims, PyArray_TYPE(arr),\n-\t\t\t NULL, NULL, elsize, 0, (PyArrayObject *)arr);\n+\t\t\t NULL, NULL, elsize, 0, arr);\n \n \tif (ret == NULL) {\n \t\tPy_DECREF(arr);\n@@ -1973,7 +1976,8 @@ PyArray_Correlate(PyObject *op1, PyObject *op2, int mode)\n \t\n \tret = (PyArrayObject *)PyArray_New(ap1->ob_type, 1,\n \t\t\t\t\t &length, typenum, \n-\t\t\t\t\t NULL, NULL, 0, 0, ap1);\n+\t\t\t\t\t NULL, NULL, 0, 0, \n+ (PyObject *)ap1);\n \tif (ret == NULL) goto fail;\n \n \t\n@@ -2130,7 +2134,8 @@ PyArray_ArgMax(PyArrayObject *op, int axis)\n \n \trp = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd-1,\n \t\t\t\t\t ap->dimensions, PyArray_INTP,\n-\t\t\t\t\t NULL, NULL, 0, 0, ap);\n+\t\t\t\t\t NULL, NULL, 0, 0, \n+ (PyObject *)ap);\n \tif (rp == NULL) goto fail;\n \n \n@@ -2195,7 +2200,8 @@ PyArray_Take(PyArrayObject *self0, PyObject *indices0, int axis) {\n }\n ret = (PyArrayObject *)PyArray_New(self->ob_type, nd, shape, \n \t\t\t\t\t self->descr->type_num,\n-\t\t\t\t\t NULL, NULL, 0, 0, self);\n+\t\t\t\t\t NULL, NULL, 0, 0, \n+ (PyObject *)self);\n \t\n if (ret == NULL) goto fail;\n \t\n", "added_lines": 22, "deleted_lines": 16, "source_code": "\n/*\n Python Multiarray Module -- A useful collection of functions for creating and\n using ndarrays\n\n Original file \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n Modified for scipy_core in 2005 \n\n Travis E. Oliphant\n Assistant Professor at\n Brigham Young University\n \n*/\n\n/* $Id: multiarraymodule.c,v 1.36 2005/09/14 00:14:00 teoliphant Exp $ */\n\n#include \"Python.h\"\n#include \"structmember.h\"\n/*#include \n#include \n*/\n\n#define _MULTIARRAYMODULE\n#include \"scipy/arrayobject.h\"\n\n#define PyAO PyArrayObject\n\nstatic PyObject *typeDict=NULL; /* Must be explicitly loaded */\n\n/* Including this file is the only way I know how to declare functions\n static in each file, and store the pointers from functions in both\n arrayobject.c and multiarraymodule.c for the C-API \n\n Declarying an external pointer-containing variable in arrayobject.c\n and trying to copy it to PyArray_API, did not work.\n\n Think about two modules with a common api that import each other...\n\n This file would just be the module calls. \n*/\n\n#include \"arrayobject.c\"\n\n\n/* An Error object -- rarely used? */\nstatic PyObject *MultiArrayError;\n\nstatic intp \nPyArray_MultiplyList(intp *l1, int n) \n{\n\tregister intp s=1;\n\tregister int i=0;\n while (i++ < n) s *= (*l1++);\n return s;\n}\n\n\nstatic int \nPyArray_AxisConverter(PyObject *obj, int *axis)\n{\n\tif (obj == Py_None) {\n\t\t*axis = MAX_DIMS;\n\t}\n\telse {\n\t\t*axis = (int) PyInt_AsLong(obj);\n\t\tif (PyErr_Occurred()) {\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n\treturn PY_SUCCEED;\n}\n\nstatic int \nPyArray_CompareLists(intp *l1, intp *l2, int n) \n{\n int i;\n for(i=0;itype_num;\n\t}\n\n\tnew = PyArray_New(self->ob_type,\n\t\t\t self->nd, self->dimensions,\n\t\t\t self->descr->type_num,\n\t\t\t self->strides,\n\t\t\t self->data,\n\t\t\t self->itemsize,\n\t\t\t self->flags, (PyObject *)self);\n\n\tif (new==NULL) return NULL;\n\t\n Py_INCREF(self);\n PyArray_BASE(new) = (PyObject *)self;\n if ((type_num != PyArray_NOTYPE) && \\\n (type_num != self->descr->type_num)) {\n if (!PyTypeNum_ISFLEXIBLE(type_num)) {\n v = PyArray_TypeObjectFromType(type_num);\n }\n else {\n PyArray_Descr *descr;\n int itemsize = type->itemsize;\n descr = PyArray_DescrFromType(type_num);\n if (type_num == PyArray_UNICODE) \n itemsize /= sizeof(Py_UNICODE);\n /* construct a string representation */\n v = PyString_FromFormat(\"%c%d\", descr->type, \n itemsize);\n }\n if (v == NULL) goto fail;\n /* set attribute new.dtype = newtype */\n if (PyObject_SetAttrString(new, \"dtype\", v) < 0) goto fail;\n Py_DECREF(v);\n }\n\treturn new;\t\n\n fail:\n Py_XDECREF(v);\n Py_XDECREF(new);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Ravel(PyArrayObject *a, int fortran)\n{\n\tPyArray_Dims newdim = {NULL,1};\n\tintp val[1] = {-1};\n\n if (a->nd == 1) {\n Py_INCREF(a);\n return (PyObject *)a;\n }\n\tnewdim.ptr = val;\n\tif (!fortran && PyArray_ISCONTIGUOUS(a)) \n\t\treturn PyArray_Newshape(a, &newdim);\n\telse\n\t return PyArray_Flatten(a, fortran);\n}\n\nstatic PyObject *\nPyArray_Flatten(PyArrayObject *a, int fortran)\n{\n\tPyObject *ret, *new;\n\tintp size;\n\n\tsize = PyArray_SIZE(a);\n\tret = PyArray_New(a->ob_type,\n\t\t\t 1, &size,\n\t\t\t a->descr->type_num,\n\t\t\t NULL,\n NULL,\n\t\t\t a->itemsize,\n\t\t\t 0, (PyObject *)a);\n\n\tif (ret== NULL) return NULL;\n\tif (fortran) {\n\t\tnew = PyArray_Transpose(a, NULL);\n\t\tif (new == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\telse {\n\t\tPy_INCREF(a);\n\t\tnew = (PyObject *)a;\n\t}\n\tif (PyArray_CopyInto((PyArrayObject *)ret, (PyArrayObject *)new) < 0) {\n\t\tPy_DECREF(ret);\n\t\tPy_DECREF(new);\n\t\treturn NULL;\n\t}\n\tPy_DECREF(new);\n\treturn ret;\n}\n\n\n/* For back-ward compatability *\n\n/ * Not recommended */\n\nstatic PyObject *\nPyArray_Reshape(PyArrayObject *self, PyObject *shape) \n{\n PyObject *ret;\n PyArray_Dims newdims;\n\n if (!PyArray_IntpConverter(shape, &newdims)) return NULL;\n ret = PyArray_Newshape(self, &newdims);\n PyDimMem_FREE(newdims.ptr);\n return ret;\n}\n\n/* Returns a new array \n with the a new shape from the data\n in the old array\n*/\n\nstatic PyObject * \nPyArray_Newshape(PyArrayObject *self, PyArray_Dims *newdims)\n{\n intp i, s_original, i_unknown, s_known;\n intp *dimensions = newdims->ptr;\n PyArrayObject *ret;\n\tchar msg[] = \"total size of new array must be unchanged\";\n\tint n = newdims->len;\n Bool same;\n\n /* Quick check to make sure anything needs to be done */\n if (n == self->nd) {\n same = TRUE;\n i=0;\n while(same && i= 0) {\n if ((s_known == 0) || (s_original % s_known != 0)) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n dimensions[i_unknown] = s_original/s_known;\n } else {\n if (s_original != s_known) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n }\n \n\tret = (PyAO *)PyArray_New(self->ob_type,\n\t\t\t\t n, dimensions,\n\t\t\t\t self->descr->type_num,\n\t\t\t\t NULL,\n\t\t\t\t self->data,\n\t\t\t\t self->itemsize,\n\t\t\t\t self->flags, (PyObject *)self);\n\n\tif (ret== NULL)\n goto fail;\n\t\n Py_INCREF(self);\n ret->base = (PyObject *)self;\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n return (PyObject *)ret;\n\t\n fail:\n return NULL;\n}\n\n/* return a new view of the array object with all of its unit-length \n dimensions squeezed out if needed, otherwise\n return the same array.\n */\n\nstatic PyObject *\nPyArray_Squeeze(PyArrayObject *self)\n{\n\tint nd = self->nd;\n\tint newnd = nd;\n\tintp dimensions[MAX_DIMS];\n\tintp strides[MAX_DIMS];\n\tint i,j;\n\tPyObject *ret;\n\n\tif (nd == 0) {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n\tfor (j=0, i=0; idimensions[i] == 1) {\n\t\t\tnewnd -= 1;\n\t\t}\n\t\telse {\n\t\t\tdimensions[j] = self->dimensions[i];\n\t\t\tstrides[j++] = self->strides[i];\n\t\t}\n\t}\n\t\n\tret = PyArray_New(self->ob_type, newnd, dimensions, \n\t\t\t self->descr->type_num, strides,\n\t\t\t self->data, self->itemsize, self->flags,\n\t\t\t (PyObject *)self);\n\tself->flags &= ~OWN_DATA;\n\tself->base = (PyObject *)self;\n\tPy_INCREF(self);\n\treturn (PyObject *)ret;\n}\n\n\nstatic PyObject *\nPyArray_Mean(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL;\n\tPyObject *new, *ret;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\n\tobj1 = PyArray_GenericReduceFunction((PyAO *)new, n_ops.add, axis,\n\t\t\t\t\t rtype);\n\tobj2 = PyFloat_FromDouble((double) PyArray_DIM(new,axis));\n Py_DECREF(new);\n\tif (obj1 == NULL || obj2 == NULL) {\n\t\tPy_XDECREF(obj1);\n\t\tPy_XDECREF(obj2);\n\t\treturn NULL;\n\t}\n\n\tret = PyNumber_Divide(obj1, obj2);\n\tPy_DECREF(obj1);\n\tPy_DECREF(obj2);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Std(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL, *new=NULL;\n\tPyObject *ret=NULL, *newshape=NULL;\n\tint i, n;\n\tintp val;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\t\n\t/* Compute and reshape mean */\n\tobj1 = PyArray_EnsureArray(PyArray_Mean((PyAO *)new, axis, rtype));\n\tif (obj1 == NULL) {Py_DECREF(new); return NULL;} \n\tn = PyArray_NDIM(new);\n\tnewshape = PyTuple_New(n);\n\tif (newshape == NULL) {Py_DECREF(obj1); Py_DECREF(new); return NULL;}\n\tfor (i=0; ind != 1) {\n Py_DECREF(cond);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Condition must be 1-d array.\");\n return NULL;\n }\n\n res = PyArray_Nonzero(cond);\n Py_DECREF(cond);\n\tret = PyArray_Take(self, res, axis);\n\tPy_DECREF(res);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Nonzero(PyArrayObject *self)\n{\n int n=self->nd, j;\n\tintp count=0, i, size;\n\tPyArrayIterObject *it=NULL;\n\tPyObject *ret=NULL, *item;\n\tintp *dptr[MAX_DIMS];\n\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (it==NULL) return NULL;\n\n\tsize = it->size;\n\tfor (i=0; idescr->nonzero(it->dataptr, self)) count++;\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\n\tPyArray_ITER_RESET(it);\n\tif (n==1) {\n\t\tret = PyArray_New(self->ob_type, 1, &count, PyArray_INTP, \n\t\t\t\t NULL, NULL, 0, 0, (PyObject *)self);\n\t\tif (ret == NULL) goto fail;\n\t\tdptr[0] = (intp *)PyArray_DATA(ret);\n\t\t\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\t*(dptr[0])++ = i;\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t}\n\telse {\n\t\tret = PyTuple_New(n);\n\t\tfor (j=0; job_type, 1, &count, \n\t\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0,\n\t\t\t\t\t (PyObject *)self);\n\t\t\tPyTuple_SET_ITEM(ret, j, item);\n\t\t\tif (item == NULL) goto fail;\n\t\t\tdptr[j] = (intp *)PyArray_DATA(item);\n\t\t}\n\t\t\n\t\t/* reset contiguous so that coordinates gets updated */\n\t\tit->contiguous = 0;\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\tfor (j=0; jcoordinates[j];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\n\t}\n\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ret);\n\tPy_XDECREF(it);\n\treturn NULL;\n \n}\n\nstatic PyObject *\nPyArray_Clip(PyArrayObject *self, PyObject *min, PyObject *max)\n{\n\tPyObject *selector=NULL, *newtup=NULL, *ret=NULL;\n\tPyObject *res1=NULL, *res2=NULL, *res3=NULL;\n\tPyObject *two;\n\n\ttwo = PyInt_FromLong((long)2);\n\tres1 = PyArray_GenericBinaryFunction(self, max, n_ops.greater);\n\tres2 = PyArray_GenericBinaryFunction(self, min, n_ops.less);\n\tif ((res1 == NULL) || (res2 == NULL)) goto fail;\n\tres3 = PyNumber_Multiply(two, res1);\n\tPy_DECREF(two);\n\tPy_DECREF(res1);\n\tif (res3 == NULL) return NULL;\n\n\tselector = PyArray_EnsureArray(PyNumber_Add(res2, res3));\n\tPy_DECREF(res2);\n\tPy_DECREF(res3);\n\tif (selector == NULL) return NULL;\n\n\tnewtup = Py_BuildValue(\"(OOO)\", (PyObject *)self, min, max);\n\tif (newtup == NULL) goto fail;\n\tret = PyArray_Choose((PyAO *)selector, newtup);\n\tPy_DECREF(selector);\n\tPy_DECREF(newtup);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(res1);\n\tPy_XDECREF(res2);\n\tPy_XDECREF(two);\n\tPy_XDECREF(selector);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Conjugate(PyArrayObject *self)\n{\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyObject *new;\n\t\tintp size, i;\n\t\t/* Make a copy */\n\t\tnew = PyArray_Copy(self);\n\t\tif (new==NULL) return NULL;\n\t\tsize = PyArray_SIZE(new);\n\t\tif (self->descr->type_num == PyArray_CFLOAT) {\n\t\t\tcfloat *dptr = (cfloat *) PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CDOUBLE) {\n\t\t\tcdouble *dptr = (cdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CLONGDOUBLE) {\n\t\t\tclongdouble *dptr = (clongdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\t\t\t\n\t\t}\t\t\n\t\treturn new;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *) self;\n\t}\n}\n\nstatic PyObject *\nPyArray_Trace(PyArrayObject *self, int offset, int axis1, int axis2, \nint rtype)\n{\n\tPyObject *diag=NULL, *ret=NULL;\n\n\tdiag = PyArray_Diagonal(self, offset, axis1, axis2);\n\tif (diag == NULL) return NULL;\n\tret = PyArray_GenericReduceFunction((PyAO *)diag, n_ops.add, -1, rtype);\n\tPy_DECREF(diag);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Diagonal(PyArrayObject *self, int offset, int axis1, int axis2)\n{\n\tint n = self->nd;\n\tPyObject *new;\n\tPyObject *newaxes;\n\tint i, pos;\t\n\n\tif (n < 2) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"array.ndim must be >= 2\");\n\t\treturn NULL;\n\t}\n\tif (axis1 < 0) axis1 += n;\n\tif (axis2 < 0) axis2 += n;\n\tif ((axis1 == axis2) || (axis1 < 0) || (axis1 >= n) ||\t\\\n\t (axis2 < 0) || (axis2 >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \"axis1(=%d) and axis2(=%d) \"\\\n\t\t\t \"must be different and within range (nd=%d)\",\n\t\t\t axis1, axis2, n);\n\t\treturn NULL;\n\t}\n \n\tnewaxes = PyTuple_New(n);\n\tif (newaxes==NULL) return NULL;\n\t/* insert at the end */\n\tPyTuple_SET_ITEM(newaxes, n-2, PyInt_FromLong((long)axis1));\n\tPyTuple_SET_ITEM(newaxes, n-1, PyInt_FromLong((long)axis2));\n\tpos = 0;\n\tfor (i=0; idimensions[0];\n\t\tn2 = self->dimensions[1];\n\t\tstep = n2+1;\n\t\tif (offset < 0) {\n\t\t\tstart = -n2 * offset;\n\t\t\tstop = MIN(n2, n1+offset)*(n2+1) - n2*offset;\n\t\t}\n\t\telse {\n\t\t\tstart = offset;\n\t\t\tstop = MIN(n1, n2-offset)*(n2+1) + offset;\n\t\t}\n\t\t\n\t\t/* count = ceil((stop-start)/step) */\n\t\tcount = ((stop-start) / step) + (((stop-start) % step) != 0);\n\t\t\t\n\t\tindices = PyArray_New(&PyArray_Type, 1, &count, \n\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0, NULL);\n\t\tif (indices == NULL) {\n\t\t\tPy_DECREF(self); return NULL;\n\t\t}\n\t\tdptr = (intp *)PyArray_DATA(indices);\n\t\tfor (n1=start; n1descr->type_num,\n\t\t\t\t\t self->itemsize, 0};\n\t\t\n\t\tmydiagonal = PyList_New(0);\n\t\tif (mydiagonal == NULL) {Py_DECREF(self); return NULL;}\n\t\tn1 = self->dimensions[0];\n\t\tfor (i=0; i 3)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"Only Carrays of 1-3 dimensions available.\");\n\t\treturn -1;\n\t}\n\tif ((ap = (PyArrayObject*)PyArray_FromAny(*op, &typecode, nd, nd,\n\t\t\t\t\t\t CARRAY_FLAGS)) == NULL)\n\t\treturn -1;\n\tswitch(nd) {\n\tcase 1:\n\t\t*((char **)ptr) = ap->data;\n\t\tbreak;\n\tcase 2:\n\t\tn = ap->dimensions[0];\n\t\tptr2 = (char **)malloc(n * sizeof(char *));\n\t\tif (!ptr2) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0];\n\t\t}\n\t\t*((char ***)ptr) = ptr2;\n\t\tbreak;\t\t\n\tcase 3:\n\t\tn = ap->dimensions[0];\n\t\tm = ap->dimensions[1];\n\t\tptr3 = (char ***)malloc(n*(m+1) * sizeof(char *));\n\t\tif (!ptr3) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0] + \\\n\t\t\t\t\tj*ap->strides[1];\n\t\t\t}\n\t\t}\n\t\t*((char ****)ptr) = ptr3;\n\t}\n\tmemcpy(dims, ap->dimensions, nd*sizeof(intp));\n\t*op = (PyObject *)ap;\n\treturn 0;\n\n fail:\n\tPyErr_SetString(PyExc_MemoryError, \"No memory.\");\n\treturn -1;\n}\n\n/* Deprecated --- Use PyArray_AsCArray instead */\n\nstatic int \nPyArray_As1D(PyObject **op, char **ptr, int *d1, int typecode) \n{\n\tintp newd1;\n\t\n\tif (PyArray_AsCArray(op, (void *)ptr, &newd1, 1, typecode) == -1)\n\t\treturn -1;\t\n\t*d1 = (int) newd1;\n\treturn 0;\n}\n\n\nstatic int \nPyArray_As2D(PyObject **op, char ***ptr, int *d1, int *d2, int typecode) \n{\n\tintp newdims[2];\n\n\tif (PyArray_AsCArray(op, (void *)ptr, newdims, 2, typecode) == -1)\n\t\treturn -1;\n\n\t*d1 = (int ) newdims[0];\n\t*d2 = (int ) newdims[1];\n return 0;\n}\n\n/* End Deprecated */\n\nstatic int \nPyArray_Free(PyObject *op, void *ptr) \n{\n PyArrayObject *ap = (PyArrayObject *)op;\n\t\n if ((ap->nd < 1) || (ap->nd > 3)) \n\t\treturn -1;\n if (ap->nd >= 2) {\n\t\tfree(ptr);\n }\n Py_DECREF(ap);\n return 0;\n}\n\n\nstatic PyObject *\n_swap_and_concat(PyObject *op, int axis, int n)\n{\n\tPyObject *newtup=NULL;\n\tPyObject *otmp, *arr;\n\tint i;\n\n\tnewtup = PyTuple_New(n);\n\tif (newtup==NULL) return NULL;\n\tfor (i=0; i= MAX_DIMS) {\n\t\t\totmp = PyArray_Ravel(mps[i],0);\n\t\t\tPy_DECREF(mps[i]);\n\t\t\tmps[i] = (PyArrayObject *)otmp;\n\t\t}\n\t\tprior2 = PyArray_GetPriority((PyObject *)(mps[i]), 0.0);\n\t\tif (prior2 > prior1) {\n\t\t\tprior1 = prior2;\n\t\t\tsubtype = mps[i]->ob_type;\n\t\t\tret = mps[i];\n\t\t}\n\t}\n\t\n\tnew_dim = 0;\n\tfor(i=0; ind;\n\t\telse {\n\t\t\tif (nd != mps[i]->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"arrays must have same \"\\\n\t\t\t\t\t\t\"number of dimensions\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tif (!PyArray_CompareLists(mps[0]->dimensions+1, \n\t\t\t\t\t\t mps[i]->dimensions+1, \n\t\t\t\t\t\t nd-1)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"array dimensions must \"\\\n\t\t\t\t\t\t\"agree except for d_0\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t}\n\t\tif (nd == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"0d arrays can't be concatenated\");\n\t\t\tgoto fail;\n\t\t}\n\t\tnew_dim += mps[i]->dimensions[0];\n\t}\n\t\n\ttmp = mps[0]->dimensions[0];\n\tmps[0]->dimensions[0] = new_dim;\n\tret = (PyArrayObject *)PyArray_New(subtype, nd,\n\t\t\t\t\t mps[0]->dimensions, \n\t\t\t\t\t type_num, NULL, NULL, 0, 0,\n (PyObject *)ret);\n\tmps[0]->dimensions[0] = tmp;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tdata = ret->data;\n\tfor(i=0; idata, numbytes);\n\t\tdata += numbytes;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; ind;\n\tif (n <= 1) {\n\t\tPy_INCREF(ap);\n\t\treturn (PyObject *)ap;\n\t}\n\n\tif (a1 < 0) a1 += n;\n\tif (a2 < 0) a2 += n;\n\tif ((a1 < 0) || (a1 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis1 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tif ((a2 < 0) || (a2 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis2 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tnew_axes = PyTuple_New(n);\n\tfor (i=0; ind;\n\t\tpermutation = (intp *)malloc(n*sizeof(int));\n\t\tfor(i=0; ind+axis;\n\t\t\tif (axis < 0 || axis >= ap->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"invalid axis for this array\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tpermutation[i] = axis;\n\t\t}\n\t}\n\t\n\t/* this allocates memory for dimensions and strides (but fills them\n\t incorrectly), sets up descr, and points data at ap->data. */\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, n, permutation, \n\t\t\t\t\t ap->descr->type_num, NULL,\n\t\t\t\t\t ap->data, ap->itemsize, ap->flags,\n\t\t\t\t\t (PyObject *)ap);\n\tif (ret == NULL) goto fail;\n\t\n\t/* point at true owner of memory: */\n\tret->base = (PyObject *)ap;\n\tPy_INCREF(ap);\n\t\n\tfor(i=0; idimensions[i] = ap->dimensions[permutation[i]];\n\t\tret->strides[i] = ap->strides[permutation[i]];\n\t}\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n\tif (op && (op != Py_None))\n\t\tPyArray_Free(op, (char *)axes);\n\tfree(permutation);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ret);\n\tif (permutation != NULL) free(permutation);\n\tif (op != Py_None)\n\t\tPyArray_Free(op, (char *)axes);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Repeat(PyArrayObject *aop, PyObject *op, int axis) {\n\tintp *counts;\n\tintp n, n_outer, i, j, k, chunk, total;\n\tintp tmp;\n\tint nd;\n\tPyArrayObject *repeats=NULL;\n\tPyObject *ap=NULL;\n\tPyArrayObject *ret=NULL;\n\tchar *new_data, *old_data;\n\n\trepeats = (PyAO *)PyArray_ContiguousFromObject(op, PyArray_INTP, 0, 1);\n\tif (repeats == NULL) return NULL;\n\tnd = repeats->nd;\n\tcounts = (intp *)repeats->data;\n\n\tif ((ap=_check_axis(aop, &axis, CARRAY_FLAGS))==NULL) {\n\t\tPy_DECREF(repeats);\n\t\treturn NULL;\n\t}\n\n\taop = (PyAO *)ap;\n\n\tif (nd == 1)\n\t\tn = repeats->dimensions[0];\n\telse /* nd == 0 */\n\t\tn = aop->dimensions[axis];\n\n\tif (aop->dimensions[axis] != n) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"a.shape[axis] != len(repeats)\");\n\t\tgoto fail;\n\t}\n\n\t\n\tif (nd == 0) \n\t\ttotal = counts[0]*n;\n\telse {\n\t\t\n\t\ttotal = 0;\n\t\tfor(j=0; jdimensions[axis] = total;\n\tret = (PyArrayObject *)PyArray_New(aop->ob_type, aop->nd,\n\t\t\t\t\t aop->dimensions, \n\t\t\t\t\t aop->descr->type_num,\n\t\t\t\t\t NULL, NULL, aop->itemsize, 0,\n\t\t\t\t\t (PyObject *)aop);\n\taop->dimensions[axis] = n;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tnew_data = ret->data;\n\told_data = aop->data;\n\t\n\tchunk = aop->itemsize;\n\tfor(i=axis+1; ind; i++) {\n\t\tchunk *= aop->dimensions[i];\n\t}\n\t\n\tn_outer = 1;\n\tfor(i=0; idimensions[i];\n\n\tfor(i=0; ind < mps[i]->nd) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"too many dimensions\");\n\t\t\tgoto fail;\n\t\t}\n\t\tif (!PyArray_CompareLists(ap->dimensions+(ap->nd-mps[i]->nd),\n\t\t\t\t mps[i]->dimensions, mps[i]->nd)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"array dimensions must agree\");\n\t\t\tgoto fail;\n\t\t}\n\t\tsizes[i] = PyArray_NBYTES(mps[i]);\n\t}\n\t\n\t/* why not ??? \n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tPyErr_SetString(PyExc_NotImplementedError, \n\t\t\t\t\"Not implemented for flexible sizes\");\n\t\treturn NULL;\n\t}\n\t*/\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap);\n\tif (ret == NULL) goto fail;\n\t\n\telsize = ret->itemsize;\n\tm = PyArray_SIZE(ret);\n\tself_data = (intp *)ap->data;\n\tret_data = ret->data;\n\t\n\tfor (i=0; i= n) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"invalid entry in choice array\");\n\t\t\tgoto fail;\n\t\t}\n\t\toffset = i*elsize;\n\t\tif (offset >= sizes[mi]) {offset = offset % sizes[mi]; }\n\t\tmemmove(ret_data, mps[mi]->data+offset, elsize);\n\t\tret_data += elsize; self_data++;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; idescr->compare(a,b,global_obj);\n}\n\n#define SWAPAXES(op, ap) {\t\t\t\t\t\t\\\n\t\torign = (ap)->nd-1;\t\t\t\t\t\\\n\t\tif (axis != orign) {\t\t\t\t\t\\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\n#define SWAPBACK(op, ap) { \\\n\t\tif (axis != orign) { \\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\nstatic PyObject *\nPyArray_Sort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap=NULL, *store_arr=NULL;\n\tchar *ip;\n\tint i, n, m, elsize, orign;\n\n\tif ((ap = (PyAO*) _check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_CopyFromObject((PyObject *)op, \n\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tPy_DECREF(ap);\n\t\treturn NULL;\n\t}\n\t\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\n\t/* Store global -- allows re-entry -- restore before leaving*/\n\tstore_arr = global_obj; \n\tglobal_obj = ap;\n\t\n\tfor (ip=ap->data, i=0; iitemsize;\n\tconst intp *ipa = ip1;\n\tconst intp *ipb = ip2;\t\n\treturn global_obj->descr->compare(global_data + (isize * *ipa),\n global_data + (isize * *ipb), \n\t\t\t\t\t global_obj);\n}\n\nstatic PyObject *\nPyArray_ArgSort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap, *ret, *store;\n\tintp *ip;\n\tintp i, j, n, m, orign;\n\tint argsort_elsize;\n\tchar *store_ptr;\n\n\tif ((ap = (PyAO *)_check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op, \n\t\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap);\n\tif (ret == NULL) goto fail;\n\t\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tip = (intp *)ret->data;\n\targsort_elsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\tstore_ptr = global_data;\n\tglobal_data = ap->data;\n\tstore = global_obj;\n\tglobal_obj = ap;\n\tfor (i=0; idescr->compare;\n\tintp min_i, max_i, i, j;\n\tint location, elsize = ap1->itemsize;\n\tintp elements = ap1->dimensions[ap1->nd-1];\n\tintp n = PyArray_Size((PyObject *)ap2);\n\tintp *rp = (intp *)ret->data;\n\tchar *ip = ap2->data;\n\tchar *vp = ap1->data;\n\n\tfor (j=0; j 0) {\n\t\t\t\t\tif (compare(ip, vp+elsize*(--i), ap2) \\\n\t\t\t\t\t != 0) {\n\t\t\t\t\t\ti = i+1; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmin_i = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (location < 0) {\n\t\t\t\tmax_i = i;\n\t\t\t} else {\n\t\t\t\tmin_i = i+1;\n\t\t\t}\n\t\t}\n\t\t*rp = min_i;\n\t}\n}\n\nstatic PyObject *\nPyArray_SearchSorted(PyArrayObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tint typenum = 0;\n\n\t/* \n PyObject *args;\n args = Py_BuildValue(\"O\",op2);\n\tPy_DELEGATE_ARGS(((PyObject *)op1), searchsorted, args);\n Py_XDECREF(args);\n\t*/\n\n\ttypenum = PyArray_ObjectType((PyObject *)op1, 0);\n\ttypenum = PyArray_ObjectType(op2, typenum);\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op1, \n\t\t\t\t\t\t\t typenum, \n\t\t\t\t\t\t\t 1, 1);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap2->ob_type, ap2->nd, \n\t\t\t\t\t ap2->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap2);\n\tif (ret == NULL) goto fail;\n\n\tif (ap2->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tlocal_where(ap1, ap2, ret); \n\t\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ret);\n\treturn NULL;\n}\n\n\n\n/* Could perhaps be redone to not make contiguous arrays \n */\n\nstatic PyObject *\nPyArray_InnerProduct(PyObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tintp i, j, l, i1, i2, n1, n2;\n\tint typenum;\n\tintp is1, is2, os;\n\tchar *ip1, *ip2, *op;\n\tintp dimensions[MAX_DIMS], nd;\n\tPyArray_DotFunc *dot;\n\tPyTypeObject *subtype;\n double prior1, prior2;\n\t\n\ttypenum = PyArray_ObjectType(op1, 0); \n\ttypenum = PyArray_ObjectType(op2, typenum);\n\t\t\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject(op1, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tif (ap1->nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\t\n\tif (ap2->dimensions[ap2->nd-1] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"matrices are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\n\n\t/* Need to choose an output array that can hold a sum \n\t -- use priority to determine which subtype.\n\t */\n prior2 = PyArray_GetPriority((PyObject *)ap2, 0.0);\n prior1 = PyArray_GetPriority((PyObject *)ap1, 0.0);\n subtype = (prior2 > prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n (PyObject *)\n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = (ret->descr->dotfunc);\n\t\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\n\t\n\tis1 = ap1->strides[ap1->nd-1]; \n\tis2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\tif (ap2->nd > 1) {\n\t\tmatchDim = ap2->nd - 2;\n\t\totherDim = ap2->nd - 1;\n\t}\n\telse {\n\t\tmatchDim = 0;\n\t\totherDim = 0;\n\t}\n\n\tif (ap2->dimensions[matchDim] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"objects are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-2; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\tif(ap2->nd > 1) {\n\t\tdimensions[j++] = ap2->dimensions[ap2->nd-1];\n\t}\n\t/*\n\tfprintf(stderr, \"nd=%d dimensions=\", nd);\n\t for(i=0; i prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n (PyObject *)\n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\t\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[matchDim];\n\tif(ap1->nd > 1)\n\t\tis1r = ap1->strides[ap1->nd-2];\n\telse\n\t\tis1r = ap1->strides[ap1->nd-1];\n\tis2r = ap2->strides[otherDim];\n\n\top = ret->data; os = ret->itemsize;\n\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2ob_type, 2, dims, PyArray_TYPE(arr),\n\t\t\t NULL, NULL, elsize, 0, arr);\n\n\tif (ret == NULL) {\n\t\tPy_DECREF(arr);\n\t\treturn NULL;\n\t}\n\t/* do 2-d loop */\n\toptr = PyArray_DATA(ret);\n\tstr2 = elsize*dims[0];\n\tfor (i=0; idimensions[ap1->nd-1];\n\tn2 = ap2->dimensions[ap2->nd-1];\n\n\tif (n1 < n2) { \n\t\tret = ap1; ap1 = ap2; ap2 = ret; \n\t\tret = NULL; i = n1;n1=n2;n2=i;\n\t}\n\tlength = n1;\n\tn = n2;\n\tswitch(mode) {\n\tcase 0:\t\n\t\tlength = length-n+1;\n\t\tn_left = n_right = 0;\n\t\tbreak;\n\tcase 1:\n\t\tn_left = (int)(n/2);\n\t\tn_right = n-n_left-1;\n\t\tbreak;\n\tcase 2:\n\t\tn_right = n-1;\n\t\tn_left = n-1;\n\t\tlength = length+n-1;\n\t\tbreak;\n\tdefault:\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"mode must be 0,1, or 2\");\n\t\tgoto fail;\n\t}\n\t\n\tret = (PyArrayObject *)PyArray_New(ap1->ob_type, 1,\n\t\t\t\t\t &length, typenum, \n\t\t\t\t\t NULL, NULL, 0, 0, \n (PyObject *)ap1);\n\tif (ret == NULL) goto fail;\n\n\t\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"function not available for this type\");\n\t\tgoto fail;\n\t}\n\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data; ip2 = ap2->data+n_left*is2;\n\tn = n-n_left;\n\tfor(i=0; idescr->argmax;\n\tif (arg_func == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"data type not ordered\");\n\t\tgoto fail;\n\t}\n\n\trp = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd-1,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, \n (PyObject *)ap);\n\tif (rp == NULL) goto fail;\n\n\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) {\n\t\tPyErr_SetString(MultiArrayError, \n\t\t\t\t\"Attempt to get argmax/argmin \"\\\n\t\t\t\t\"of an empty sequence??\");\n\t\tgoto fail;\n\t}\n\tn = PyArray_SIZE(ap)/m;\n\trptr = (intp *)rp->data;\n\tfor (ip = ap->data, i=0; ind + indices->nd - 1;\n for (i=0; i< nd; i++) {\n if (i < axis) {\n shape[i] = self->dimensions[i];\n n *= shape[i];\n } else {\n if (i < axis+indices->nd) {\n shape[i] = indices->dimensions[i-axis];\n m *= shape[i];\n } else {\n shape[i] = self->dimensions[i-indices->nd+1];\n chunk *= shape[i];\n }\n }\n }\n ret = (PyArrayObject *)PyArray_New(self->ob_type, nd, shape, \n\t\t\t\t\t self->descr->type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, \n (PyObject *)self);\n\t\n if (ret == NULL) goto fail;\n\t\n max_item = self->dimensions[axis];\n chunk = chunk * ret->itemsize;\n src = self->data;\n dest = ret->data;\n\t\n for(i=0; idata))[j];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"Index out of range for \"\\\n\t\t\t\t\t\t\"array\");\n goto fail;\n }\n memmove(dest, src+tmp*chunk, chunk);\n dest += chunk;\n }\n src += chunk*max_item;\n }\n\t\n PyArray_INCREF(ret);\n\n Py_XDECREF(indices);\n Py_XDECREF(self);\n\n return (PyObject *)ret;\n\t\n\t\n fail:\n Py_XDECREF(ret);\n Py_XDECREF(indices);\n Py_XDECREF(self);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Put(PyArrayObject *self, PyObject *indices0, PyObject* values0) \n{\n PyArrayObject *indices, *values;\n int i, chunk, ni, max_item, nv, tmp; \n char *src, *dest;\n\n indices = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be contiguous\");\n return NULL;\n }\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n indices = (PyArrayObject *)PyArray_ContiguousFromObject(indices0, PyArray_INTP, 0, 0);\n if (indices == NULL) goto fail;\n ni = PyArray_SIZE(indices);\n\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, self->descr->type_num, \n\t\t\t\t\t 0, 0);\n if (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\n if (nv > 0) { /* nv == 0 for a null array */\n for(i=0; idata + chunk * (i % nv);\n tmp = ((intp *)(indices->data))[i];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \"Index out of range for array\");\n goto fail;\n }\n memmove(dest + tmp * chunk, src, chunk);\n }\n }\n\n Py_XDECREF(values);\n Py_XDECREF(indices);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(indices);\n Py_XDECREF(values);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_PutMask(PyArrayObject *self, PyObject *mask0, PyObject* values0) \n{\n PyArrayObject *mask, *values;\n int i, chunk, ni, max_item, nv, tmp, thistype;\n char *src, *dest;\n\n mask = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must \"\\\n\t\t\t\t\"be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must be contiguous\");\n return NULL;\n }\n\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n mask = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(mask0, PyArray_BOOL, 0, 0);\n if (mask == NULL) goto fail;\n ni = PyArray_SIZE(mask);\n if (ni != max_item) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: mask and data must be \"\\\n\t\t\t\t\"the same size.\");\n goto fail;\n }\n\n\tthistype = self->descr->type_num;\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, thistype, 0, 0);\n\tif (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\t /* zero if null array */\n if (nv > 0) {\n\t\tfor(i=0; idata + chunk * (i % nv);\n\t\t\ttmp = ((Bool *)(mask->data))[i];\n\t\t\tif (tmp) {\n\t\t\t\tmemmove(dest + i * chunk, src, chunk);\n\t\t\t\tif (thistype == PyArray_OBJECT)\n\t\t\t\t\tPy_INCREF(*((PyObject **)src));\n\t\t\t}\n\t\t}\n }\n\n Py_XDECREF(values);\n Py_XDECREF(mask);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(mask);\n Py_XDECREF(values);\n return NULL;\n}\n\n\n/* This conversion function can be used with the \"O&\" argument for\n PyArg_ParseTuple. It will immediately return an object of array type\n or will convert to a CARRAY any other object. \n\n If you use PyArray_Converter, you must DECREF the array when finished\n as you get a new reference to it.\n*/\n \nstatic int \nPyArray_Converter(PyObject *object, PyObject **address) \n{\n if (PyArray_Check(object)) {\n *address = object;\n\t\tPy_INCREF(object);\n return PY_SUCCEED;\n }\n else {\n\t\t*address = PyArray_FromAny(object, NULL, 0, 0, CARRAY_FLAGS);\n\t\tif (*address == NULL) return PY_FAIL;\n\t\treturn PY_SUCCEED;\n }\n}\n\nstatic int\nPyArray_BoolConverter(PyObject *object, Bool *val)\n{\n\tif (PyObject_IsTrue(object)) *val=TRUE;\n\telse *val=FALSE;\n\tif (PyErr_Occurred()) return PY_FAIL;\n\treturn PY_SUCCEED;\n}\n\n\nstatic int\nPyArray_TypestrConvert(int itemsize, int gentype)\n{\n\tregister int newtype = gentype;\n\t\n\tif (gentype == PyArray_SIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_INT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_INT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_INT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_INT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_INT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\n\t}\n\n\telse if (gentype == PyArray_UNSIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_UINT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_UINT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_UINT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_UINT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_UINT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t\tbreak;\n\t\t}\n\t}\n\telse if (gentype == PyArray_FLOATINGLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 4:\n\t\t\tnewtype = PyArray_FLOAT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_FLOAT64;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 10:\n\t\t\tnewtype = PyArray_FLOAT80;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 12:\n\t\t\tnewtype = PyArray_FLOAT96;\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_FLOAT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\t\n\telse if (gentype == PyArray_COMPLEXLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 8:\n\t\t\tnewtype = PyArray_COMPLEX64;\n\t\t\tbreak;\n\t\tcase 16:\n\t\t\tnewtype = PyArray_COMPLEX128;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 20:\n\t\t\tnewtype = PyArray_COMPLEX160;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 24:\n\t\t\tnewtype = PyArray_COMPLEX192;\t\t\t\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 32:\n\t\t\tnewtype = PyArray_COMPLEX256;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\n\treturn newtype;\n}\n\n\n/* this function takes a Python object which exposes the (single-segment)\n buffer interface and returns a pointer to the data segment\n \n You should increment the reference count by one of buf->base\n if you will hang on to a reference\n\n You only get a borrowed reference to the object. Do not free the\n memory...\n*/\n\n\nstatic int\nPyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf)\n{\n int buflen;\n\n buf->ptr = NULL;\n buf->flags = WRITEABLE;\n buf->base = NULL;\n\n\tif (obj == Py_None)\n\t\treturn PY_SUCCEED;\n\n if (PyObject_AsWriteBuffer(obj, &(buf->ptr), &buflen) < 0) {\n PyErr_Clear();\n buf->flags &= ~WRITEABLE;\n if (PyObject_AsReadBuffer(obj, (const void **)&(buf->ptr), \n &buflen) < 0)\n return PY_FAIL;\n }\n buf->len = (intp) buflen;\n \n /* Point to the base of the buffer object if present */\n if (PyBuffer_Check(obj)) buf->base = ((PyArray_Chunk *)obj)->base;\n if (buf->base == NULL) buf->base = obj;\n \n return PY_SUCCEED; \n}\n\n\n\n/* This function takes a Python sequence object and allocates and\n fills in an intp array with the converted values.\n\n **Remember to free the pointer seq.ptr when done using\n PyDimMem_FREE(seq.ptr)**\n*/\n\nstatic int\nPyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq)\n{\n int len;\n int nd;\n\n seq->ptr = NULL;\n if (obj == Py_None) return PY_SUCCEED;\n len = PySequence_Size(obj);\n if (len == -1) { /* Check to see if it is a number */\n if (PyNumber_Check(obj)) len = 1;\n }\n if (len < 0) {\n PyErr_SetString(PyExc_TypeError, \n \"Expected sequence object with len >= 0\");\n return PY_FAIL;\n }\n if (len > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError, \"Sequence too large, \" \\\n \"must be smaller than %d\", MAX_DIMS);\n return PY_FAIL;\n }\n\tif (len > 0) {\n\t\tseq->ptr = PyDimMem_NEW(len);\n\t\tif (seq->ptr == NULL) {\n\t\t\tPyErr_NoMemory();\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n seq->len = len;\n nd = PyArray_IntpFromSequence(obj, (intp *)seq->ptr, len);\n if (nd == -1 || nd != len) goto fail;\n return PY_SUCCEED;\n\n fail:\n\tPyDimMem_FREE(seq->ptr);\n\treturn PY_FAIL;\n}\n\n/* This function takes a Python object representing a type and converts it \n to a C type_num and an itemsize (elements of PyArray_Typecode structure)\n \n Many objects can be used to represent a type.\n */\n\nstatic int\nPyArray_TypecodeConverter(PyObject *obj, PyArray_Typecode *at)\n{\n char *type;\n PyArray_Descr *descr;\n int check_num=PyArray_NOTYPE+10;\n\tint len;\n\tPyObject *item, *attr=NULL;\n\n\tat->itemsize = 0;\n if (obj == Py_None) {\n at->type_num = PyArray_NOTYPE;\n return PY_SUCCEED;\n }\n\n if (PyType_Check(obj) && PyType_IsSubtype((PyTypeObject *)obj, \n &PyGenericArrType_Type)) {\n PyArray_TypecodeFromTypeObject(obj, at);\n return PY_SUCCEED;\n }\n\n\n\t/* type object could be an array */\n\tif (PyArray_Check(obj)) {\n\t\tat->type_num = PyArray_TYPE(obj);\n\t\tat->itemsize = PyArray_ITEMSIZE(obj);\n\t\treturn PY_SUCCEED;\n\t}\n\n\t/* or an array scalar */\n if (PyArray_IsScalar(obj, Generic)) {\n PyArray_TypecodeFromScalar(obj, at);\n return PY_SUCCEED;\n }\n\n\t/* or a typecode string */\n\n\tif (PyString_Check(obj)) {\n\t\t/* Check for a string typecode. */\n\t\ttype = PyString_AS_STRING(obj);\n\t\tlen = PyString_GET_SIZE(obj);\t\t\n\t\tif (len > 0) {\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tif (len > 1) {\n\t\t\tat->itemsize = atoi(type+1);\n\t\t\t/* When specifying length of UNICODE\n\t\t\t the number of characters is given to match \n\t\t\t the STRING interface. Each character can be\n\t\t\t more than one byte and itemsize must be\n\t\t\t the number of bytes.\n\t\t\t*/\n\t\t\tif (check_num == PyArray_UNICODELTR ||\t\\\n\t\t\t check_num == PyArray_UNICODE) \n\t\t\t at->itemsize *= sizeof(Py_UNICODE);\n\n\t\t\t/* Support for generic processing */\n\t\t\telse if ((check_num != PyArray_STRINGLTR) &&\n\t\t\t\t (check_num != PyArray_VOIDLTR) &&\n\t\t\t\t (check_num != PyArray_STRING) &&\n\t\t\t\t (check_num != PyArray_VOID)) {\n\t\t\t\tcheck_num = \\\n\t\t\t\t\tPyArray_TypestrConvert(at->itemsize, \n\t\t\t\t\t\t\t check_num);\n\t\t\t at->itemsize = 0;\n\t\t\t\tif (check_num == PyArray_NOTYPE) goto fail;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Arbitray object with dtypenum and itemsize attributes. */\n\telse if (PyObject_HasAttrString(obj, \"dtypenum\") && \n\t PyObject_HasAttrString(obj, \"itemsize\")) {\n\t\tattr = PyObject_GetAttrString(obj, \"dtypenum\");\n\t\tcheck_num = PyInt_AsLong(attr);\n\t\tif (PyErr_Occurred()) { /* not an integer, try character */\n\t\t\tPyErr_Clear();\n\t\t\ttype = PyString_AsString(attr);\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tPy_XDECREF(attr);\n\t\tif (!PyErr_Occurred()) {\n\t\t\tattr = PyObject_GetAttrString(obj, \"itemsize\");\n\t\t\tat->itemsize = PyInt_AsLong(attr);\n\t\t\tPy_XDECREF(attr);\n\t\t}\t\t\t\n\t}\t\t\n\telse if (PyType_Check(obj)) {\n\t\tcheck_num = PyArray_OBJECT;\n\t\tif (obj == (PyObject *)(&PyInt_Type)) \n\t\t\tcheck_num = PyArray_LONG;\n\t\telse if (obj == (PyObject *)(&PyBool_Type))\n\t\t\tcheck_num = PyArray_BOOL;\n\t\telse if (obj == (PyObject *)(&PyFloat_Type)) \n\t\t\tcheck_num = PyArray_DOUBLE;\n\t\telse if (obj == (PyObject *)(&PyComplex_Type)) \n\t\t\tcheck_num = PyArray_CDOUBLE;\n else if (obj == (PyObject *)(&PyString_Type))\n check_num = PyArray_STRING;\n else if (obj == (PyObject *)(&PyUnicode_Type))\n check_num = PyArray_UNICODE;\n\t}\t\n else { /* Default -- try integer conversion */\n check_num = PyInt_AsLong(obj);\n\t}\n\n\tif (PyErr_Occurred()) goto fail;\n\n\t/*\n\tif (check_num == PyArray_NOTYPE) return PY_FAIL;\n\t*/\n\tif (check_num == PyArray_NOTYPE) {\n\t\tat->type_num = PyArray_NOTYPE;\n\t\tat->itemsize = 0;\n\t\treturn PY_SUCCEED;\n\t}\n\n if ((descr = PyArray_DescrFromType(check_num))==NULL) {\n\t\t/* Now check to see if the object is registered\n\t\t in typeDict */\n\t\tif (typeDict != NULL) {\n\t\t\titem = PyDict_GetItem(typeDict, obj);\n\t\t\tif (item) {\n\t\t\t\tPyArray_TypecodeFromTypeObject(obj, at);\n\t\t\t\tPyErr_Clear();\n\t\t\t\treturn PY_SUCCEED;\n\t\t\t}\n\t\t}\n return PY_FAIL;\n\t}\n\t\n at->type_num = descr->type_num;\n\tif (at->itemsize == 0) at->itemsize = descr->elsize;\n\t\n return PY_SUCCEED;\n fail:\n\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\"data type not understood\");\n\treturn PY_FAIL;\n}\t\n\n\n/* This function returns true if the two typecodes are \n equivalent (same basic kind and same itemsize).\n*/\n\nstatic Bool\nPyArray_EquivalentTypes(PyArray_Typecode *typ1, PyArray_Typecode *typ2)\n{\n\tregister int typenum1=typ1->type_num;\n\tregister int typenum2=typ2->type_num;\n\tregister int size1=typ1->itemsize;\n\tregister int size2=typ2->itemsize;\n\n\tif (size1 != size2) return FALSE;\n\tif (typenum1==typenum2) return TRUE;\n\n\t/* If we are here then size1 == size2 */\n\tif (typenum1 < PyArray_FLOAT) {\n\t\tif (PyTypeNum_ISBOOL(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISBOOL(typenum2));\n\t\telse if (PyTypeNum_ISUNSIGNED(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISUNSIGNED(typenum2));\n\t\telse \n\t\t\treturn (Bool)(PyTypeNum_ISSIGNED(typenum2));\n\t}\n\telse {\n\t\tif (PyTypeNum_ISFLOAT(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISFLOAT(typenum2));\n\t\telse if (PyTypeNum_ISCOMPLEX(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISCOMPLEX(typenum2));\n\t}\n\t/* Default size1 != size2 and typenum1 != typenum2 */\n\treturn FALSE;\t\n}\n\nstatic Bool \nPyArray_EquivArrTypes(PyArrayObject *a1, PyArrayObject *a2)\n{\n PyArray_Typecode type1={PyArray_TYPE(a1), PyArray_ITEMSIZE(a1), 0};\n PyArray_Typecode type2={PyArray_TYPE(a2), PyArray_ITEMSIZE(a2), 0};\n \n return PyArray_EquivalentTypes(&type1, &type2);\n}\n\n\n/*** END C-API FUNCTIONS **/\n\n\n#define _ARET(x) PyArray_Return((PyArrayObject *)(x))\n\nstatic char doc_fromobject[] = \"array(object, dtype=None, copy=1, fortran=0) will return a new array formed from the given object type given. Object can anything with an __array__ method, or any (nested) sequence. If no type is given, then the type will be determined as the minimum type required to hold the objects in the sequence. If copy is zero and sequence is already an array with the right type, a reference will be returned. If the sequence is an array, type can be used only to upcast the array. For downcasting use .astype(t) method.\";\n\nstatic PyObject *\n_array_fromobject(PyObject *ignored, PyObject *args, PyObject *kws)\n{\n\tPyObject *op, *ret=NULL;\n\tstatic char *kwd[]= {\"object\", \"dtype\", \"copy\", \"fortran\", NULL};\n\tBool copy=TRUE;\n\tPyArray_Typecode type = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode oldtype = {PyArray_NOTYPE, 0, 0};\n\tint type_num;\n\tBool fortran=FALSE;\n\tint flags=0;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|O&O&O&\", kwd, &op, \n\t\t\t\t\tPyArray_TypecodeConverter,\n &type, \n\t\t\t\t\tPyArray_BoolConverter, ©, \n\t\t\t\t\tPyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\ttype_num = type.type_num;\n\n\t/* fast exit if simple call */\n\tif (PyArray_Check(op) && (copy==0) &&\t\t\t\\\n\t (fortran == PyArray_CHKFLAGS(op, FORTRAN))) {\n\t\tif (type_num == PyArray_NOTYPE) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t\t/* One more chance */\n\t\toldtype.type_num = PyArray_TYPE(op);\n\t\toldtype.itemsize = PyArray_ITEMSIZE(op);\n\t\tif (PyArray_EquivalentTypes(&oldtype, &type)) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t}\n\n\ttype.fortran = fortran; \n\tif (copy) {\n\t\tflags = ENSURECOPY;\n\t}\n\n\tif ((ret = PyArray_FromAny(op, &type, 0, 0, flags)) == NULL) \n\t\treturn NULL;\n\n\treturn _ARET(ret);\n}\n\nstatic PyObject *\nPyArray_Empty(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n \n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n PyArray_FillObjectArray(ret, Py_None);\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic char doc_empty[] = \"empty((d1,...,dn),dtype=intp,fortran=0) will return a new array\\n of shape (d1,...,dn) and given type with all its entries uninitialized. This can be faster than zeros.\";\n\nstatic PyObject *\narray_empty(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Empty(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_scalar[] = \"scalar(dtypestr,obj) will return a new scalar array of the given type initialized with obj. Mainly for pickle support. typestr must be a valid data typestr (complete with < > or |). If dtypestr is object, then obj can be any object, otherwise obj must be a string. If obj is not given it will be interpreted as None for object type and zeros for all other types.\";\n\nstatic PyObject *\narray_scalar(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"dtypestr\",\"obj\", NULL};\n\tPyArray_Typecode typecode;\n\tPyObject *obj=NULL;\n\tchar *typestr;\n\tint typestrlen;\n\tint swap, alloc=0;\n\tvoid *dptr;\n\tPyObject *ret;\n\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"z#|O\",\n\t\t\t\t\t kwlist, &typestr, &typestrlen,\n\t\t\t\t\t &obj)) \n\t\treturn NULL;\n\t\n\tif (_array_typecode_fromstr(typestr, &swap, &typecode) < 0) \n\t\treturn NULL;\n\t\n\tif (typecode.itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\t\t\\\n\t\t\t\t\"itemsize cannot be zero\");\n\t\treturn NULL;\n\t}\n\n\tif (typecode.type_num == PyArray_OBJECT) {\n\t\tif (obj == NULL) obj = Py_None;\n\t\tdptr = &obj;\n\t\tswap = 0;\n\t}\n\telse {\n\t\tif (obj == NULL) {\n\t\t\tdptr = malloc(typecode.itemsize);\n\t\t\tif (dptr == NULL) {\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tmemset(dptr, '\\0', typecode.itemsize);\n\t\t\talloc = 1;\n\t\t}\n\t\telse {\n\t\t\tif (!PyString_Check(obj)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"initializing object must \"\\\n\t\t\t\t\t\t\"be a string.\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (PyString_GET_SIZE(obj) < typecode.itemsize) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"initialization string is too\"\\\n\t\t\t\t\t\t\" small\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = PyString_AS_STRING(obj);\n\t\t}\n\t}\n\n\tret = PyArray_Scalar(dptr, typecode.type_num,\n\t\t\t typecode.itemsize, swap); \n\n\t/* free dptr which contains zeros */\n\tif (alloc) free(dptr);\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_Zeros(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n\t\tPyObject *zero = PyInt_FromLong(0);\n PyArray_FillObjectArray(ret, zero);\n Py_DECREF(zero);\n\t}\n\telse {\t\t\n\t\tmemset(ret->data, 0, n*(ret->itemsize));\n\t}\n\treturn (PyObject *)ret;\n\n}\n\nstatic char doc_zeros[] = \"zeros((d1,...,dn),dtype=intp,fortran=0) will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero.\";\n\n\nstatic PyObject *\narray_zeros(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Zeros(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_set_typeDict[] = \"set_typeDict(dict) set the internal \"\\\n\t\"dictionary that can look up an array type using a registered \"\\\n\t\"code\";\n\nstatic PyObject *\narray_set_typeDict(PyObject *ignored, PyObject *args)\n{\n\tPyObject *dict;\n\tif (!PyArg_ParseTuple(args, \"O\", &dict)) return NULL;\n\tPy_XDECREF(typeDict); /* Decrement old reference (if any)*/\n\ttypeDict = dict;\n\tPy_INCREF(dict); /* Create an internal reference to it */\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char doc_fromString[] = \"fromstring(string, dtype=intp, count=-1, swap=False) returns a new 1d array initialized from the raw binary data in string. If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.\";\n\nstatic PyObject *\narray_fromString(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyArrayObject *ret; \n\tchar *data;\n\tlonglong nin=-1;\n\tintp s, n;\n\tstatic char *kwlist[] = {\"string\", \"dtype\", \"count\", \"swap\",NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint itemsize;\n\tint swapped=FALSE;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"s#|O&LO&\", kwlist, \n\t\t\t\t\t &data, &s, \n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &swapped)) {\n\t\treturn NULL;\n\t}\n\t\n\tn = (intp) nin;\n\n\titemsize = type.itemsize;\n\tif (itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \"zero-valued itemsize.\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype.type_num, NULL, \n\t\t\t\t\t\tNULL, itemsize, 0,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\t\n\tmemcpy(ret->data, data, n*ret->itemsize);\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPyArray_INCREF(ret);\n\treturn (PyObject *)ret;\n}\n\n\n/* This needs an open file object and reads it in directly. \n memory-mapped files handled differently through buffer interface.\n\nfile pointer number in resulting 1d array \n(can easily reshape later, -1 for to end of file)\ntype of array\nsep is a separator string for character-based data (or NULL for binary)\n \" \" means whitespace\n*/\n\nstatic char doc_fromfile[] = \"\";\n\nstatic int\n_fill_in_itemsize(PyArray_Typecode *typecode)\n{\n\tPyArray_Descr *descr;\n\tdescr = PyArray_DescrFromType(typecode->type_num);\n\tif (descr==NULL) return -1;\n\ttypecode->itemsize = descr->elsize;\n\treturn 0;\n}\n\n\nstatic PyObject *\nPyArray_FromFile(FILE *fp, PyArray_Typecode *typecode, intp num, char *sep)\n{\n\tPyArrayObject *r;\n\tsize_t nread = 0;\n\tPyArray_ScanFunc *scan;\n\n\tif (typecode->itemsize == 0) {\n\t\tif (_fill_in_itemsize(typecode) < 0) \n\t\t\treturn NULL;\n\t}\n\n\tif (num == -1 && sep == NULL) { /* Get size for binary file*/\n\t\tintp start, numbytes;\n\t\tstart = (intp )ftell(fp);\n\t\tfseek(fp, 0, SEEK_END);\n\t\tnumbytes = (intp )ftell(fp) - start;\n\t\tfseek(fp, (long) start, SEEK_SET);\n\t\tif (numbytes == -1) {\n\t\t\tPyErr_SetString(PyExc_IOError, \"Could not seek in file.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tif (typecode->itemsize == 0) {\n\t\t\ttypecode->itemsize = numbytes;\n\t\t\tnum = 1;\n\t\t}\n\t\telse {\n\t\t\tnum = numbytes / typecode->itemsize;\n\t\t}\n\t}\n\t\n\tif (sep==NULL) { /* binary data */\n\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &num, \n\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t typecode->itemsize, 0, NULL);\n\t\tif (r==NULL) return NULL;\n\t\tnread = fread(r->data, typecode->itemsize, num, fp);\n\t}\n\telse { /* character reading */\n\t\tintp i;\n\t\tchar *dptr;\n\n\t\tif (num != -1) { /* number to read is known */\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &num, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = r->data;\n\t\t\tfor (i=0; i < num-1; i++) {\n\t\t\t\tif (scan(fp, dptr, r->itemsize, sep, NULL))\n\t\t\t\t\tbreak;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (!(scan(fp, dptr, r->itemsize, NULL, NULL)))\n\t\t\t\tnread += 1;\n\t\t}\n\t\telse { /* we have to watch for the end of the file and \n\t\t\t reallocate at the end */\n#define _FILEBUFNUM 4096\n\t\t\tintp thisbuf=0;\n\t\t\tintp size = _FILEBUFNUM;\n\t\t\tintp bytes;\n\t\t\tintp totalbytes;\n\t\t\tint done=0;\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &size, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\ttotalbytes = bytes = size * typecode->itemsize;\n\t\t\tdptr = r->data;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\twhile (!done) {\n\t\t\t\tdone = scan(fp, dptr, r->itemsize, sep, NULL);\n\t\t\t\t/* end of file reached trying to \n\t\t\t\t scan value \n\t\t\t\t*/\n\t\t\t\tif (done == 1 || done < 0) break;\n\t\t\t\n\t\t\t\tthisbuf += 1;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t\tif (!done && thisbuf == size) {\n\t\t\t\t\ttotalbytes += bytes;\n\t\t\t\t\tr->data = PyDataMem_RENEW(r->data, \n\t\t\t\t\t\t\t\t totalbytes);\n\t\t\t\t\tdptr = r->data + (totalbytes - bytes);\n\t\t\t\t\tthisbuf = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr->data = PyDataMem_RENEW(r->data, nread*r->itemsize);\n\t\t\tPyArray_DIM(r,0) = nread;\n\t\t\tnum = nread;\n#undef _FILEBUFNUM\n\t\t}\n\t}\n\tif (nread < num) {\n\t\tchar msg[80];\n\t\tsnprintf(msg, 80, \n\t\t\t \"%ld items requested only %ld read\", (long) num, \n (long) nread);\n\t\tif (PyErr_Warn(PyExc_RuntimeWarning, msg) < 0) {\n\t\t\tPy_DECREF(r);\n\t\t\treturn NULL;\n\t\t}\n\t\tr->data = PyDataMem_RENEW(r->data, nread * r->itemsize);\n\t\tPyArray_DIM(r,0) = nread;\n\t}\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_fromfile(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *file=NULL, *ret;\n\tFILE *fp;\n\tchar *sep=\"\";\n\tchar *mode=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"file\", \"dtype\", \"count\", \"sep\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Ls\", kwlist, \n\t\t\t\t\t &file,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &sep)) {\n\t\treturn NULL;\n\t}\n\n\tif (PyString_Check(file)) {\n\t\tif (sep == \"\") mode=\"rb\";\n\t\telse mode=\"r\";\n\t\tfile = PyFile_FromString(PyString_AS_STRING(file), mode);\n\t\tif (file==NULL) return NULL;\n\t}\n\telse {\n\t\tPy_INCREF(file);\n\t}\n\tfp = PyFile_AsFile(file);\n\tif (fp == NULL) {\n\t\tPyErr_SetString(PyExc_IOError, \"First argument must be an open file\");\n\t\tPy_DECREF(file);\n\t\treturn NULL;\n\t}\n\tret = PyArray_FromFile(fp, &type, (intp) nin, sep);\n\tPy_DECREF(file);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_FromBuffer(PyObject *buf, PyArray_Typecode *type, \n\t\t intp count, int swapped) \n{\n\tPyArrayObject *ret;\n\tchar *data;\n\tint ts;\n\tintp s, n;\n\tint itemsize;\n\tint write=1;\n\n\tif (type->type_num == PyArray_OBJECT) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Cannot create an OBJECT array from memory\"\\\n\t\t\t\t\" buffer.\");\n\t\treturn NULL;\n\t}\n\tif (type->itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Itemsize cannot be zero in type\");\n\t\treturn NULL;\n\t}\n\n\tif (PyObject_AsWriteBuffer(buf, (void *)&data, &ts)==-1) {\n\t\twrite = 0;\n\t\tPyErr_Clear();\n\t\tif (PyObject_AsReadBuffer(buf, (void *)&data, &ts)==-1) {\n\t\t\treturn NULL;\n\t\t}\n\t}\n\ts = (intp)ts;\t\n\tn = (intp)count;\n\titemsize = type->itemsize;\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype->type_num, NULL, \n\t\t\t\t\t\tdata, itemsize, DEFAULT_FLAGS,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\n\tif (!write) ret->flags &= ~WRITEABLE;\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPy_INCREF(buf);\n\t/* Store a reference for decref on deallocation */\n\tret->base = buf;\n\tPyArray_UpdateFlags(ret, ALIGNED);\n\treturn (PyObject *)ret; \t\n}\n\nstatic char doc_frombuffer[] = \"\";\n\nstatic PyObject *\narray_frombuffer(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *obj=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"buffer\", \"dtype\", \"count\", \n\t\t\t\t \"swap\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint swapped=0;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Li\", kwlist, \n\t\t\t\t\t &obj,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &swapped)) {\n\t\treturn NULL;\n\t}\n\n\treturn PyArray_FromBuffer(obj, &type, (intp)nin, swapped);\n}\n\n\n\nstatic char doc_concatenate[] = \"concatenate((a1,a2,...),axis=None).\";\n\nstatic PyObject *\narray_concatenate(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *a0;\n\tint axis=0;\n\tstatic char *kwlist[] = {\"seq\", \"axis\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist,\n\t\t\t\t\t &a0,\n\t\t\t\t\t PyArray_AxisConverter, &axis))\n\t\treturn NULL;\n\treturn PyArray_Concatenate(a0, axis);\n}\n\nstatic char doc_innerproduct[] = \\\n\t\"inner(a,b) returns the dot product of two arrays, which has\\n\"\\\n\t\"shape a.shape[:-1] + b.shape[:-1] with elements computed by\\n\" \\\n\t\"the product of the elements from the last dimensions of a and b.\";\n\nstatic PyObject *array_innerproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *b0, *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a0, &b0)) return NULL;\n\t\n\treturn _ARET(PyArray_InnerProduct(a0, b0));\n}\n\nstatic char doc_matrixproduct[] = \\\n\t\"dot(a,v) returns matrix-multiplication between a and b. \\n\"\\\n\t\"The product-sum is over the last dimension of a and the \\n\"\\\n\t\"second-to-last dimension of b.\";\n\nstatic PyObject *array_matrixproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *v, *a;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a, &v)) return NULL;\n\t\n\treturn _ARET(PyArray_MatrixProduct(a, v));\n}\n\nstatic char doc_fastCopyAndTranspose[] = \"_fastCopyAndTranspose(a)\";\n\nstatic PyObject *array_fastCopyAndTranspose(PyObject *dummy, PyObject *args) {\n\tPyObject *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &a0)) return NULL;\n\t\n\treturn _ARET(PyArray_CopyAndTranspose(a0));\n}\n\nstatic char doc_correlate[] = \"cross_correlate(a,v, mode=0)\";\n\nstatic PyObject *array_correlate(PyObject *dummy, PyObject *args, PyObject *kwds) {\n\tPyObject *shape, *a0;\n\tint mode=0;\n\tstatic char *kwlist[] = {\"a\", \"v\", \"mode\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|i\", kwlist, \n\t\t\t\t\t &a0, &shape, &mode)) return NULL;\n\t\n\treturn PyArray_Correlate(a0, shape, mode);\n}\n\n\nstatic PyObject *\nPyArray_Arange(double start, double stop, double step, int type_num)\n{\n\tintp length, i;\n\tPyObject *range;\n\tchar *rptr;\n\tint elsize, type;\n\tdouble value;\n\tPyArray_Descr *dbl_descr;\n\n\tlength = (intp ) ceil((stop - start)/step);\n \n\tif (length <= 0) {\n\t\tlength = 0;\n\t\treturn PyArray_New(&PyArray_Type, 1, &length, type_num,\n\t\t\t\t NULL, NULL, 0, 0, NULL);\n\t}\n\n\trange = PyArray_New(&PyArray_Type, 1, &length, type_num, \n\t\t\t NULL, NULL, 0, 0, NULL);\n\tif (range == NULL) return NULL;\n\tdbl_descr = PyArray_DescrFromType(PyArray_DOUBLE);\n \n\trptr = ((PyArrayObject *)range)->data;\n\telsize = ((PyArrayObject *)range)->itemsize;\n\ttype = ((PyArrayObject *)range)->descr->type_num;\n\tfor (i=0; i < length; i++) {\n\t\tvalue = start + i*step;\n\t\tdbl_descr->cast[type]((char*)&value, rptr, 1, NULL, \n\t\t\t\t (PyArrayObject *)range);\n\t\trptr += elsize;\n\t}\n \n\treturn range;\n}\n\n\nstatic char doc_arange[] = \"arange(start, stop=None, step=1, dtype=intp)\\n\\n Just like range() except it returns an array whose type can be\\n specified by the keyword argument typecode.\";\n\nstatic PyObject *\narray_arange(PyObject *ignored, PyObject *args, PyObject *kws) {\n\tPyObject *o_start=NULL, *o_stop=Py_None, *o_step=NULL;\n\tstatic char *kwd[]= {\"start\", \"stop\", \"step\", \"dtype\", NULL};\n\tdouble start, stop, step;\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0};\n\tint type_num;\n\tint deftype = PyArray_INTP;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|OOO&\", kwd, &o_start,\n\t\t\t\t\t&o_stop, &o_step, \n\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t&typecode)) \n\t\treturn NULL;\n\n\tdeftype = PyArray_ObjectType(o_start, deftype);\n\tif (o_stop != Py_None) {\n\t\tdeftype = PyArray_ObjectType(o_stop, deftype);\n\t}\n\tif (o_step != NULL) {\n\t\tdeftype = PyArray_ObjectType(o_step, deftype);\n\t}\n\n\ttype_num = typecode.type_num;\n\tif (type_num == PyArray_NOTYPE) {\n\t\ttype_num = deftype;\n\t}\n\n\tstart = PyFloat_AsDouble(o_start);\n\tif error_converting(start) return NULL;\n\n\tif (o_step == NULL) {\n\t\tstep = 1;\n\t}\n\telse {\n\t\tstep = PyFloat_AsDouble(o_step);\n\t\tif error_converting(step) return NULL;\n\t}\n\n\tif (o_stop == Py_None) {\n\t\tstop = start;\n\t\tstart = 0;\n\t}\n\telse {\n\t\tstop = PyFloat_AsDouble(o_stop);\n\t\tif error_converting(stop) return NULL;\n\t}\n\n\treturn PyArray_Arange(start, stop, step, type_num);\n}\n\n#undef _ARET\n\n/*****\n static char doc_arrayMap[] = \"arrayMap(func, [a1,...,an])\";\n\n static PyObject *array_arrayMap(PyObject *dummy, PyObject *args) {\n PyObject *shape, *a0;\n \n if (PyArg_ParseTuple(args, \"OO\", &a0, &shape) == NULL) return NULL;\n\t\n return PyArray_Map(a0, shape);\n }\n*****/\n\nstatic char \ndoc_set_string_function[] = \"set_string_function(f, repr=1) sets the python function f to be the function used to obtain a pretty printable string version of a array whenever a array is printed. f(M) should expect a array argument M, and should return a string consisting of the desired representation of M for printing.\";\n\nstatic PyObject *\narray_set_string_function(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *op;\n\tint repr=1;\n\tstatic char *kwlist[] = {\"f\", \"repr\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|i\", kwlist, \n\t\t\t\t\t&op, &repr)) return NULL; \n\tPyArray_SetStringFunction(op, repr);\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char \ndoc_set_ops_function[] = \"set_numeric_ops(op=func, ...) sets some or all of the number methods for all array objects. Don't forget **dict can be used as the argument list. Returns the functions that were replaced -- can be stored and set later.\";\n\nstatic PyObject *\narray_set_ops_function(PyObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *oldops=NULL;\n\t\n\tif ((oldops = PyArray_GetNumericOps())==NULL) return NULL;\n\n\t/* Should probably ensure that objects are at least callable */\n\t/* Leave this to the caller for now --- error will be raised\n\t later when use is attempted \n\t*/\n\tif (PyArray_SetNumericOps(kwds) == -1) {\n\t\tPy_DECREF(oldops);\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"One or more objects is not callable.\");\n\t\treturn NULL;\n\t}\n\treturn oldops;\n}\n\n\nstatic PyObject *\nPyArray_Where(PyObject *condition, PyObject *x, PyObject *y)\n{\n\tPyArrayObject *arr;\n\tPyObject *tup=NULL, *obj=NULL;\n\tPyObject *ret=NULL, *zero=NULL;\n\n\tif ((x==NULL) || (y==NULL)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"either both or neither\"\n\t\t\t\t\"of x and y should be given.\");\n\t\treturn NULL;\n\t}\n\n\tarr = (PyArrayObject *)PyArray_FromAny(condition, NULL, 0, 0, 0);\n\tif (arr == NULL) return NULL;\n\n\tif ((x==NULL) && (y==NULL)) {\n\t\tret = PyArray_Nonzero(arr);\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\n\n\tzero = PyInt_FromLong((long) 0);\n\n\tobj = PyArray_EnsureArray(PyArray_GenericBinaryFunction(arr, zero, n_ops.not_equal));\n\tPy_DECREF(zero);\n\tPy_DECREF(arr);\n\tif (obj == NULL) return NULL;\n\n\ttup = Py_BuildValue(\"(OO)\", y, x);\n\tif (tup == NULL) {Py_DECREF(obj); return NULL;}\n\n\tret = PyArray_Choose((PyAO *)obj, tup);\n\n\tPy_DECREF(obj);\n\tPy_DECREF(tup);\n\treturn ret;\n}\n\nstatic char doc_where[] = \"where(condition, | x, y) is shaped like condition\"\\\n\t\" and has elements of x and y where condition is respectively true or\"\\\n\t\" false. If x or y are not given, then it is equivalent to\"\\\n\t\" nonzero(condition).\";\n\nstatic PyObject *\narray_where(PyObject *ignored, PyObject *args)\n{\n\tPyObject *obj=NULL, *x=NULL, *y=NULL;\n\t\n\tif (!PyArg_ParseTuple(args, \"O|OO\", &obj, &x, &y)) return NULL;\n\n\treturn PyArray_Where(obj, x, y);\n\n}\n\nstatic char doc_register_dtype[] = \\\n\t\"register_dtype(a) registers a new type object -- gives it a typenum\";\n\nstatic PyObject *\narray_register_dtype(PyObject *dummy, PyObject *args)\n{\n\tPyObject *dtype;\n\tint ret;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &dtype)) return NULL;\n\t\n\tret = PyArray_RegisterDataType((PyTypeObject *)dtype);\n\tif (ret < 0)\n\t\treturn NULL;\n\treturn PyInt_FromLong((long) ret);\n}\n\nstatic char doc_can_cast_safely[] = \\\n\t\"can_cast_safely(from=d1, to=d2) returns True if data type d1 \"\\\n\t\"can be cast to data type d2 without losing precision.\";\n\nstatic PyObject *\narray_can_cast_safely(PyObject *dummy, PyObject *args, PyObject *kwds)\n{\n\tPyArray_Typecode d1={PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode d2={PyArray_NOTYPE, 0, 0};\n\tBool ret;\n\tPyObject *retobj;\n\tstatic char *kwlist[] = {\"from\", \"to\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O&O&\", kwlist, \n\t\t\t\t\tPyArray_TypecodeConverter, &d1,\n\t\t\t\t\tPyArray_TypecodeConverter, &d2))\n\t\treturn NULL;\n\tif (d1.type_num == PyArray_NOTYPE || \\\n\t d2.type_num == PyArray_NOTYPE) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"did not understand one of the types. \"\\\n\t\t\t\t\"'None' not accepted.\");\n\t\treturn NULL;\n\t}\n\t\t\n\tret = PyArray_CanCastTo(&d1, &d2);\n\tretobj = (ret ? Py_True : Py_False);\n\tPy_INCREF(retobj);\n\treturn retobj;\n}\n\n\nstatic struct PyMethodDef array_module_methods[] = {\n\t{\"set_string_function\", (PyCFunction)array_set_string_function, \n\t METH_VARARGS|METH_KEYWORDS, doc_set_string_function},\n\t{\"set_numeric_ops\", (PyCFunction)array_set_ops_function,\n\t METH_VARARGS|METH_KEYWORDS, doc_set_ops_function},\n\t{\"set_typeDict\", (PyCFunction)array_set_typeDict,\n\t METH_VARARGS, doc_set_typeDict},\n\n\t{\"array\",\t(PyCFunction)_array_fromobject, \n\t METH_VARARGS|METH_KEYWORDS, doc_fromobject},\n\t{\"arange\", (PyCFunction)array_arange, \n\t METH_VARARGS|METH_KEYWORDS, doc_arange},\n\t{\"zeros\",\t(PyCFunction)array_zeros, \n\t METH_VARARGS|METH_KEYWORDS, doc_zeros},\n\t{\"empty\",\t(PyCFunction)array_empty, \n\t METH_VARARGS|METH_KEYWORDS, doc_empty},\n\t{\"scalar\", (PyCFunction)array_scalar,\n\t METH_VARARGS|METH_KEYWORDS, doc_scalar},\n\t{\"where\", (PyCFunction)array_where,\n\t METH_VARARGS, doc_where},\n\t{\"fromstring\",(PyCFunction)array_fromString,\n\t METH_VARARGS|METH_KEYWORDS, doc_fromString},\n\t{\"concatenate\", (PyCFunction)array_concatenate, \n\t METH_VARARGS|METH_KEYWORDS, doc_concatenate},\n\t{\"inner\", (PyCFunction)array_innerproduct, \n\t METH_VARARGS, doc_innerproduct}, \n\t{\"dot\", (PyCFunction)array_matrixproduct, \n\t METH_VARARGS, doc_matrixproduct}, \n\t{\"_fastCopyAndTranspose\", (PyCFunction)array_fastCopyAndTranspose, \n\t METH_VARARGS, doc_fastCopyAndTranspose},\n\t{\"correlate\", (PyCFunction)array_correlate, \n\t METH_VARARGS | METH_KEYWORDS, doc_correlate},\n\t{\"frombuffer\", (PyCFunction)array_frombuffer,\n\t METH_VARARGS | METH_KEYWORDS, doc_frombuffer},\n\t{\"fromfile\", (PyCFunction)array_fromfile,\n\t METH_VARARGS | METH_KEYWORDS, doc_fromfile},\n\t{\"register_dtype\", (PyCFunction)array_register_dtype,\n\t METH_VARARGS, doc_register_dtype},\n\t{\"can_cast\", (PyCFunction)array_can_cast_safely,\n\t METH_VARARGS | METH_KEYWORDS, doc_can_cast_safely},\t\t\n\t/* {\"arrayMap\",\t(PyCFunction)array_arrayMap, \n\t METH_VARARGS, doc_arrayMap},*/\n\t\n\t{NULL,\t\tNULL, 0}\t\t/* sentinel */\n};\n\n#include \"__multiarray_api.c\"\n\n/* Establish scalar-type hierarchy */\n\n/* For dual inheritance we need to make sure that the objects being\n inherited from have the tp->mro object initialized. This is\n not necessarily true for the basic type objects of Python (it is \n checked for single inheritance but not dual in PyType_Ready).\n\n Thus, we call PyType_Ready on the standard Python Types, here.\n*/ \nstatic int\nsetup_scalartypes(PyObject *dict)\n{\n\n\tinitialize_numeric_types();\n\n if (PyType_Ready(&PyBool_Type) < 0) return -1;\n if (PyType_Ready(&PyInt_Type) < 0) return -1;\n if (PyType_Ready(&PyFloat_Type) < 0) return -1;\n if (PyType_Ready(&PyComplex_Type) < 0) return -1;\n if (PyType_Ready(&PyString_Type) < 0) return -1;\n if (PyType_Ready(&PyUnicode_Type) < 0) return -1;\n\n#define SINGLE_INHERIT(child, parent) \\\n Py##child##ArrType_Type.tp_base = &Py##parent##ArrType_Type;\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) {\t\t\\\n PyErr_Print(); \\\n PyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Tyupe\", \\\n #child); \\\n return -1;\t\t\t\t\t\t\\\n }\n \n if (PyType_Ready(&PyGenericArrType_Type) < 0)\n return -1;\n\n SINGLE_INHERIT(Numeric, Generic);\n SINGLE_INHERIT(Integer, Numeric);\n SINGLE_INHERIT(Inexact, Numeric);\n SINGLE_INHERIT(SignedInteger, Integer);\n SINGLE_INHERIT(UnsignedInteger, Integer);\n SINGLE_INHERIT(Floating, Inexact);\n SINGLE_INHERIT(ComplexFloating, Inexact);\n SINGLE_INHERIT(Flexible, Generic);\n SINGLE_INHERIT(Character, Flexible);\n\t\n#define DUAL_INHERIT(child, parent1, parent2) \\\n Py##child##ArrType_Type.tp_base = &Py##parent2##ArrType_Type;\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent2##ArrType_Type,\t\\\n\t\t\t &Py##parent1##_Type);\t\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n#define DUAL_INHERIT2(child, parent1, parent2)\t\t\t\t\\\n Py##child##ArrType_Type.tp_base = &Py##parent1##_Type;\t\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent1##_Type,\t\t\\\n\t\t\t &Py##parent2##ArrType_Type);\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n SINGLE_INHERIT(Bool, Generic);\n SINGLE_INHERIT(Byte, SignedInteger);\n SINGLE_INHERIT(Short, SignedInteger);\n#if SIZEOF_INT == SIZEOF_LONG\n DUAL_INHERIT(Int, Int, SignedInteger);\n#else\n SINGLE_INHERIT(Int, SignedInteger);\n#endif\n DUAL_INHERIT(Long, Int, SignedInteger);\n#if SIZEOF_LONGLONG == SIZEOF_LONG\n DUAL_INHERIT(LongLong, Int, SignedInteger);\n#else\n SINGLE_INHERIT(LongLong, SignedInteger);\n#endif\n\n SINGLE_INHERIT(UByte, UnsignedInteger);\n SINGLE_INHERIT(UShort, UnsignedInteger);\n SINGLE_INHERIT(UInt, UnsignedInteger);\n SINGLE_INHERIT(ULong, UnsignedInteger);\n SINGLE_INHERIT(ULongLong, UnsignedInteger);\n\n SINGLE_INHERIT(Float, Floating);\n DUAL_INHERIT(Double, Float, Floating);\n SINGLE_INHERIT(LongDouble, Floating);\n\n SINGLE_INHERIT(CFloat, ComplexFloating);\n DUAL_INHERIT(CDouble, Complex, ComplexFloating);\n SINGLE_INHERIT(CLongDouble, ComplexFloating);\n\n DUAL_INHERIT2(String, String, Character);\n DUAL_INHERIT2(Unicode, Unicode, Character);\n\t\n SINGLE_INHERIT(Void, Flexible);\n \n SINGLE_INHERIT(Object, Generic);\n\n return 0;\n\n#undef SINGLE_INHERIT\n#undef DUAL_INHERIT\n\n\t/* Clean up string and unicode array types so they act more like\n\t strings -- get their tables from the standard types.\n\t \n\t \n\t*/\n}\n\n/* place a flag dictionary in d */\n\nstatic void\nset_flaginfo(PyObject *d)\n{\n PyObject *s;\n PyObject *newd;\n \n newd = PyDict_New();\n\n PyDict_SetItemString(newd, \"OWNDATA\", s=PyInt_FromLong(OWNDATA));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"FORTRAN\", s=PyInt_FromLong(FORTRAN));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"CONTIGUOUS\", s=PyInt_FromLong(CONTIGUOUS));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"ALIGNED\", s=PyInt_FromLong(ALIGNED));\n Py_DECREF(s);\n\n PyDict_SetItemString(newd, \"NOTSWAPPED\", s=PyInt_FromLong(NOTSWAPPED));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"UPDATEIFCOPY\", s=PyInt_FromLong(UPDATEIFCOPY));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"WRITEABLE\", s=PyInt_FromLong(WRITEABLE));\n Py_DECREF(s);\n \n PyDict_SetItemString(d, \"_flagdict\", newd);\n Py_DECREF(newd);\n return;\n}\n\n\n/* Initialization function for the module */\n\nDL_EXPORT(void) initmultiarray(void) {\n\tPyObject *m, *d, *s;\n\tPyObject *c_api;\n\t\n\t/* Create the module and add the functions */\n\tm = Py_InitModule(\"multiarray\", array_module_methods);\n\tif (!m) goto err;\n\n\t/* Add some symbolic constants to the module */\n\td = PyModule_GetDict(m);\n\tif (!d) goto err; \n\n\t/* Create the module and add the functions */\n\tif (PyType_Ready(&PyBigArray_Type) < 0) \n\t\treturn;\n\n PyArray_Type.tp_base = &PyBigArray_Type;\n\n PyArray_Type.tp_as_mapping = &array_as_mapping;\n\t/* Even though, this would be inherited, it needs to be set now\n\t so that the __getitem__ will map to the as_mapping descriptor\n\t*/\n PyArray_Type.tp_as_number = &array_as_number; \n\t/* For good measure */\n\tPyArray_Type.tp_as_sequence = &array_as_sequence;\n\tPyArray_Type.tp_as_buffer = &array_as_buffer;\t\n PyArray_Type.tp_flags = (Py_TPFLAGS_DEFAULT \n\t\t\t\t | Py_TPFLAGS_BASETYPE\n\t\t\t\t | Py_TPFLAGS_CHECKTYPES);\n PyArray_Type.tp_doc = Arraytype__doc__;\n\n\tif (PyType_Ready(&PyArray_Type) < 0)\n return;\n\n if (setup_scalartypes(d) < 0) goto err;\n\n\tif (PyType_Ready(&PyArrayIter_Type) < 0)\n\t\treturn; \n \n\tif (PyType_Ready(&PyArrayMapIter_Type) < 0)\n return; \n\n\tc_api = PyCObject_FromVoidPtr((void *)PyArray_API, NULL);\n\tif (PyErr_Occurred()) goto err;\n\tPyDict_SetItemString(d, \"_ARRAY_API\", c_api);\n\tPy_DECREF(c_api);\n\tif (PyErr_Occurred()) goto err;\n\n\tMultiArrayError = PyString_FromString (\"multiarray.error\");\n\tPyDict_SetItemString (d, \"error\", MultiArrayError);\n\t\n\ts = PyString_FromString(\"3.0\");\n\tPyDict_SetItemString(d, \"__version__\", s);\n\tPy_DECREF(s);\n Py_INCREF(&PyBigArray_Type);\n\tPyDict_SetItemString(d, \"bigndarray\", (PyObject *)&PyBigArray_Type);\n Py_INCREF(&PyArray_Type);\n\tPyDict_SetItemString(d, \"ndarray\", (PyObject *)&PyArray_Type);\n Py_INCREF(&PyArrayIter_Type);\n\tPyDict_SetItemString(d, \"flatiter\", (PyObject *)&PyArrayIter_Type);\n Py_INCREF(&PyArrayMapIter_Type);\n\tPyDict_SetItemString(d, \"mapiter\", (PyObject *)&PyArrayMapIter_Type);\n\n set_flaginfo(d);\n\n\tif (set_typeinfo(d) == 0) \n return; /* otherwise there is an error */\n\n\n err:\t\n\t/* Check for errors */\n\tif (PyErr_Occurred())\n PyErr_Print();\n\t\tPy_FatalError(\"can't initialize module multiarray\");\n\n\treturn;\n}\n\n", "source_code_before": "\n/*\n Python Multiarray Module -- A useful collection of functions for creating and\n using ndarrays\n\n Original file \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n Modified for scipy_core in 2005 \n\n Travis E. Oliphant\n Assistant Professor at\n Brigham Young University\n \n*/\n\n/* $Id: multiarraymodule.c,v 1.36 2005/09/14 00:14:00 teoliphant Exp $ */\n\n#include \"Python.h\"\n#include \"structmember.h\"\n/*#include \n#include \n*/\n\n#define _MULTIARRAYMODULE\n#include \"scipy/arrayobject.h\"\n\n#define PyAO PyArrayObject\n\nstatic PyObject *typeDict=NULL; /* Must be explicitly loaded */\n\n/* Including this file is the only way I know how to declare functions\n static in each file, and store the pointers from functions in both\n arrayobject.c and multiarraymodule.c for the C-API \n\n Declarying an external pointer-containing variable in arrayobject.c\n and trying to copy it to PyArray_API, did not work.\n\n Think about two modules with a common api that import each other...\n\n This file would just be the module calls. \n*/\n\n#include \"arrayobject.c\"\n\n\n/* An Error object -- rarely used? */\nstatic PyObject *MultiArrayError;\n\nstatic intp \nPyArray_MultiplyList(intp *l1, int n) \n{\n\tregister intp s=1;\n\tregister int i=0;\n while (i++ < n) s *= (*l1++);\n return s;\n}\n\n\nstatic int \nPyArray_AxisConverter(PyObject *obj, int *axis)\n{\n\tif (obj == Py_None) {\n\t\t*axis = MAX_DIMS;\n\t}\n\telse {\n\t\t*axis = (int) PyInt_AsLong(obj);\n\t\tif (PyErr_Occurred()) {\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n\treturn PY_SUCCEED;\n}\n\nstatic int \nPyArray_CompareLists(intp *l1, intp *l2, int n) \n{\n int i;\n for(i=0;itype_num;\n\t}\n\n\tnew = PyArray_New(self->ob_type,\n\t\t\t self->nd, self->dimensions,\n\t\t\t self->descr->type_num,\n\t\t\t self->strides,\n\t\t\t self->data,\n\t\t\t self->itemsize,\n\t\t\t self->flags, self);\n\n\tif (new==NULL) return NULL;\n\t\n Py_INCREF(self);\n PyArray_BASE(new) = (PyObject *)self;\n if ((type_num != PyArray_NOTYPE) && \\\n (type_num != self->descr->type_num)) {\n if (!PyTypeNum_ISFLEXIBLE(type_num)) {\n v = PyArray_TypeObjectFromType(type_num);\n }\n else {\n PyArray_Descr *descr;\n int itemsize = type->itemsize;\n descr = PyArray_DescrFromType(type_num);\n if (type_num == PyArray_UNICODE) \n itemsize /= sizeof(Py_UNICODE);\n /* construct a string representation */\n v = PyString_FromFormat(\"%c%d\", descr->type, \n itemsize);\n }\n if (v == NULL) goto fail;\n /* set attribute new.dtype = newtype */\n if (PyObject_SetAttrString(new, \"dtype\", v) < 0) goto fail;\n Py_DECREF(v);\n }\n\treturn new;\t\n\n fail:\n Py_XDECREF(v);\n Py_XDECREF(new);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Ravel(PyArrayObject *a, int fortran)\n{\n\tPyArray_Dims newdim = {NULL,1};\n\tintp val[1] = {-1};\n\n if (a->nd == 1) {\n Py_INCREF(a);\n return (PyObject *)a;\n }\n\tnewdim.ptr = val;\n\tif (!fortran && PyArray_ISCONTIGUOUS(a)) \n\t\treturn PyArray_Newshape(a, &newdim);\n\telse\n\t return PyArray_Flatten(a, fortran);\n}\n\nstatic PyObject *\nPyArray_Flatten(PyArrayObject *a, int fortran)\n{\n\tPyObject *ret, *new;\n\tintp size;\n\n\tsize = PyArray_SIZE(a);\n\tret = PyArray_New(a->ob_type,\n\t\t\t 1, &size,\n\t\t\t a->descr->type_num,\n\t\t\t NULL,\n NULL,\n\t\t\t a->itemsize,\n\t\t\t 0, a);\n\n\tif (ret== NULL) return NULL;\n\tif (fortran) {\n\t\tnew = PyArray_Transpose(a, NULL);\n\t\tif (new == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\telse {\n\t\tPy_INCREF(a);\n\t\tnew = (PyObject *)a;\n\t}\n\tif (PyArray_CopyInto((PyArrayObject *)ret, (PyArrayObject *)new) < 0) {\n\t\tPy_DECREF(ret);\n\t\tPy_DECREF(new);\n\t\treturn NULL;\n\t}\n\tPy_DECREF(new);\n\treturn ret;\n}\n\n\n/* For back-ward compatability *\n\n/ * Not recommended */\n\nstatic PyObject *\nPyArray_Reshape(PyArrayObject *self, PyObject *shape) \n{\n PyObject *ret;\n PyArray_Dims newdims;\n\n if (!PyArray_IntpConverter(shape, &newdims)) return NULL;\n ret = PyArray_Newshape(self, &newdims);\n PyDimMem_FREE(newdims.ptr);\n return ret;\n}\n\n/* Returns a new array \n with the a new shape from the data\n in the old array\n*/\n\nstatic PyObject * \nPyArray_Newshape(PyArrayObject *self, PyArray_Dims *newdims)\n{\n intp i, s_original, i_unknown, s_known;\n intp *dimensions = newdims->ptr;\n PyArrayObject *ret;\n\tchar msg[] = \"total size of new array must be unchanged\";\n\tint n = newdims->len;\n Bool same;\n\n /* Quick check to make sure anything needs to be done */\n if (n == self->nd) {\n same = TRUE;\n i=0;\n while(same && i= 0) {\n if ((s_known == 0) || (s_original % s_known != 0)) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n dimensions[i_unknown] = s_original/s_known;\n } else {\n if (s_original != s_known) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n }\n \n\tret = (PyAO *)PyArray_New(self->ob_type,\n\t\t\t\t n, dimensions,\n\t\t\t\t self->descr->type_num,\n\t\t\t\t NULL,\n\t\t\t\t self->data,\n\t\t\t\t self->itemsize,\n\t\t\t\t self->flags, self);\n\n\tif (ret== NULL)\n goto fail;\n\t\n Py_INCREF(self);\n ret->base = (PyObject *)self;\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n return (PyObject *)ret;\n\t\n fail:\n return NULL;\n}\n\n/* return a new view of the array object with all of its unit-length \n dimensions squeezed out if needed, otherwise\n return the same array.\n */\n\nstatic PyObject *\nPyArray_Squeeze(PyArrayObject *self)\n{\n\tint nd = self->nd;\n\tint newnd = nd;\n\tintp dimensions[MAX_DIMS];\n\tintp strides[MAX_DIMS];\n\tint i,j;\n\tPyObject *ret;\n\n\tif (nd == 0) {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n\tfor (j=0, i=0; idimensions[i] == 1) {\n\t\t\tnewnd -= 1;\n\t\t}\n\t\telse {\n\t\t\tdimensions[j] = self->dimensions[i];\n\t\t\tstrides[j++] = self->strides[i];\n\t\t}\n\t}\n\t\n\tret = PyArray_New(self->ob_type, newnd, dimensions, \n\t\t\t self->descr->type_num, strides,\n\t\t\t self->data, self->itemsize, self->flags,\n\t\t\t self);\n\tself->flags &= ~OWN_DATA;\n\tself->base = (PyObject *)self;\n\tPy_INCREF(self);\n\treturn (PyObject *)ret;\n}\n\n\nstatic PyObject *\nPyArray_Mean(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL;\n\tPyObject *new, *ret;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\n\tobj1 = PyArray_GenericReduceFunction((PyAO *)new, n_ops.add, axis,\n\t\t\t\t\t rtype);\n\tobj2 = PyFloat_FromDouble((double) PyArray_DIM(new,axis));\n Py_DECREF(new);\n\tif (obj1 == NULL || obj2 == NULL) {\n\t\tPy_XDECREF(obj1);\n\t\tPy_XDECREF(obj2);\n\t\treturn NULL;\n\t}\n\n\tret = PyNumber_Divide(obj1, obj2);\n\tPy_DECREF(obj1);\n\tPy_DECREF(obj2);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Std(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL, *new=NULL;\n\tPyObject *ret=NULL, *newshape=NULL;\n\tint i, n;\n\tintp val;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\t\n\t/* Compute and reshape mean */\n\tobj1 = PyArray_EnsureArray(PyArray_Mean((PyAO *)new, axis, rtype));\n\tif (obj1 == NULL) {Py_DECREF(new); return NULL;} \n\tn = PyArray_NDIM(new);\n\tnewshape = PyTuple_New(n);\n\tif (newshape == NULL) {Py_DECREF(obj1); Py_DECREF(new); return NULL;}\n\tfor (i=0; ind != 1) {\n Py_DECREF(cond);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Condition must be 1-d array.\");\n return NULL;\n }\n\n res = PyArray_Nonzero(cond);\n Py_DECREF(cond);\n\tret = PyArray_Take(self, res, axis);\n\tPy_DECREF(res);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Nonzero(PyArrayObject *self)\n{\n int n=self->nd, j;\n\tintp count=0, i, size;\n\tPyArrayIterObject *it=NULL;\n\tPyObject *ret=NULL, *item;\n\tintp *dptr[MAX_DIMS];\n\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (it==NULL) return NULL;\n\n\tsize = it->size;\n\tfor (i=0; idescr->nonzero(it->dataptr, self)) count++;\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\n\tPyArray_ITER_RESET(it);\n\tif (n==1) {\n\t\tret = PyArray_New(self->ob_type, 1, &count, PyArray_INTP, \n\t\t\t\t NULL, NULL, 0, 0, self);\n\t\tif (ret == NULL) goto fail;\n\t\tdptr[0] = (intp *)PyArray_DATA(ret);\n\t\t\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\t*(dptr[0])++ = i;\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t}\n\telse {\n\t\tret = PyTuple_New(n);\n\t\tfor (j=0; job_type, 1, &count, \n\t\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0,\n\t\t\t\t\t self);\n\t\t\tPyTuple_SET_ITEM(ret, j, item);\n\t\t\tif (item == NULL) goto fail;\n\t\t\tdptr[j] = (intp *)PyArray_DATA(item);\n\t\t}\n\t\t\n\t\t/* reset contiguous so that coordinates gets updated */\n\t\tit->contiguous = 0;\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\tfor (j=0; jcoordinates[j];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\n\t}\n\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ret);\n\tPy_XDECREF(it);\n\treturn NULL;\n \n}\n\nstatic PyObject *\nPyArray_Clip(PyArrayObject *self, PyObject *min, PyObject *max)\n{\n\tPyObject *selector=NULL, *newtup=NULL, *ret=NULL;\n\tPyObject *res1=NULL, *res2=NULL, *res3=NULL;\n\tPyObject *two;\n\n\ttwo = PyInt_FromLong((long)2);\n\tres1 = PyArray_GenericBinaryFunction(self, max, n_ops.greater);\n\tres2 = PyArray_GenericBinaryFunction(self, min, n_ops.less);\n\tif ((res1 == NULL) || (res2 == NULL)) goto fail;\n\tres3 = PyNumber_Multiply(two, res1);\n\tPy_DECREF(two);\n\tPy_DECREF(res1);\n\tif (res3 == NULL) return NULL;\n\n\tselector = PyArray_EnsureArray(PyNumber_Add(res2, res3));\n\tPy_DECREF(res2);\n\tPy_DECREF(res3);\n\tif (selector == NULL) return NULL;\n\n\tnewtup = Py_BuildValue(\"(OOO)\", (PyObject *)self, min, max);\n\tif (newtup == NULL) goto fail;\n\tret = PyArray_Choose((PyAO *)selector, newtup);\n\tPy_DECREF(selector);\n\tPy_DECREF(newtup);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(res1);\n\tPy_XDECREF(res2);\n\tPy_XDECREF(two);\n\tPy_XDECREF(selector);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Conjugate(PyArrayObject *self)\n{\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyObject *new;\n\t\tintp size, i;\n\t\t/* Make a copy */\n\t\tnew = PyArray_Copy(self);\n\t\tif (new==NULL) return NULL;\n\t\tsize = PyArray_SIZE(new);\n\t\tif (self->descr->type_num == PyArray_CFLOAT) {\n\t\t\tcfloat *dptr = (cfloat *) PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CDOUBLE) {\n\t\t\tcdouble *dptr = (cdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CLONGDOUBLE) {\n\t\t\tclongdouble *dptr = (clongdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\t\t\t\n\t\t}\t\t\n\t\treturn new;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *) self;\n\t}\n}\n\nstatic PyObject *\nPyArray_Trace(PyArrayObject *self, int offset, int axis1, int axis2, \nint rtype)\n{\n\tPyObject *diag=NULL, *ret=NULL;\n\n\tdiag = PyArray_Diagonal(self, offset, axis1, axis2);\n\tif (diag == NULL) return NULL;\n\tret = PyArray_GenericReduceFunction((PyAO *)diag, n_ops.add, -1, rtype);\n\tPy_DECREF(diag);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Diagonal(PyArrayObject *self, int offset, int axis1, int axis2)\n{\n\tint n = self->nd;\n\tPyObject *new;\n\tPyObject *newaxes;\n\tint i, pos;\t\n\n\tif (n < 2) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"array.ndim must be >= 2\");\n\t\treturn NULL;\n\t}\n\tif (axis1 < 0) axis1 += n;\n\tif (axis2 < 0) axis2 += n;\n\tif ((axis1 == axis2) || (axis1 < 0) || (axis1 >= n) ||\t\\\n\t (axis2 < 0) || (axis2 >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \"axis1(=%d) and axis2(=%d) \"\\\n\t\t\t \"must be different and within range (nd=%d)\",\n\t\t\t axis1, axis2, n);\n\t\treturn NULL;\n\t}\n \n\tnewaxes = PyTuple_New(n);\n\tif (newaxes==NULL) return NULL;\n\t/* insert at the end */\n\tPyTuple_SET_ITEM(newaxes, n-2, PyInt_FromLong((long)axis1));\n\tPyTuple_SET_ITEM(newaxes, n-1, PyInt_FromLong((long)axis2));\n\tpos = 0;\n\tfor (i=0; idimensions[0];\n\t\tn2 = self->dimensions[1];\n\t\tstep = n2+1;\n\t\tif (offset < 0) {\n\t\t\tstart = -n2 * offset;\n\t\t\tstop = MIN(n2, n1+offset)*(n2+1) - n2*offset;\n\t\t}\n\t\telse {\n\t\t\tstart = offset;\n\t\t\tstop = MIN(n1, n2-offset)*(n2+1) + offset;\n\t\t}\n\t\t\n\t\t/* count = ceil((stop-start)/step) */\n\t\tcount = ((stop-start) / step) + (((stop-start) % step) != 0);\n\t\t\t\n\t\tindices = PyArray_New(&PyArray_Type, 1, &count, \n\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0, NULL);\n\t\tif (indices == NULL) {\n\t\t\tPy_DECREF(self); return NULL;\n\t\t}\n\t\tdptr = (intp *)PyArray_DATA(indices);\n\t\tfor (n1=start; n1descr->type_num,\n\t\t\t\t\t self->itemsize, 0};\n\t\t\n\t\tmydiagonal = PyList_New(0);\n\t\tif (mydiagonal == NULL) {Py_DECREF(self); return NULL;}\n\t\tn1 = self->dimensions[0];\n\t\tfor (i=0; i 3)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"Only Carrays of 1-3 dimensions available.\");\n\t\treturn -1;\n\t}\n\tif ((ap = (PyArrayObject*)PyArray_FromAny(*op, &typecode, nd, nd,\n\t\t\t\t\t\t CARRAY_FLAGS)) == NULL)\n\t\treturn -1;\n\tswitch(nd) {\n\tcase 1:\n\t\t*((char **)ptr) = ap->data;\n\t\tbreak;\n\tcase 2:\n\t\tn = ap->dimensions[0];\n\t\tptr2 = (char **)malloc(n * sizeof(char *));\n\t\tif (!ptr2) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0];\n\t\t}\n\t\t*((char ***)ptr) = ptr2;\n\t\tbreak;\t\t\n\tcase 3:\n\t\tn = ap->dimensions[0];\n\t\tm = ap->dimensions[1];\n\t\tptr3 = (char ***)malloc(n*(m+1) * sizeof(char *));\n\t\tif (!ptr3) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0] + \\\n\t\t\t\t\tj*ap->strides[1];\n\t\t\t}\n\t\t}\n\t\t*((char ****)ptr) = ptr3;\n\t}\n\tmemcpy(dims, ap->dimensions, nd*sizeof(intp));\n\t*op = (PyObject *)ap;\n\treturn 0;\n\n fail:\n\tPyErr_SetString(PyExc_MemoryError, \"No memory.\");\n\treturn -1;\n}\n\n/* Deprecated --- Use PyArray_AsCArray instead */\n\nstatic int \nPyArray_As1D(PyObject **op, char **ptr, int *d1, int typecode) \n{\n\tintp newd1;\n\t\n\tif (PyArray_AsCArray(op, (void *)ptr, &newd1, 1, typecode) == -1)\n\t\treturn -1;\t\n\t*d1 = (int) newd1;\n\treturn 0;\n}\n\n\nstatic int \nPyArray_As2D(PyObject **op, char ***ptr, int *d1, int *d2, int typecode) \n{\n\tintp newdims[2];\n\n\tif (PyArray_AsCArray(op, (void *)ptr, newdims, 2, typecode) == -1)\n\t\treturn -1;\n\n\t*d1 = (int ) newdims[0];\n\t*d2 = (int ) newdims[1];\n return 0;\n}\n\n/* End Deprecated */\n\nstatic int \nPyArray_Free(PyObject *op, void *ptr) \n{\n PyArrayObject *ap = (PyArrayObject *)op;\n\t\n if ((ap->nd < 1) || (ap->nd > 3)) \n\t\treturn -1;\n if (ap->nd >= 2) {\n\t\tfree(ptr);\n }\n Py_DECREF(ap);\n return 0;\n}\n\n\nstatic PyObject *\n_swap_and_concat(PyObject *op, int axis, int n)\n{\n\tPyObject *newtup=NULL;\n\tPyObject *otmp, *arr;\n\tint i;\n\n\tnewtup = PyTuple_New(n);\n\tif (newtup==NULL) return NULL;\n\tfor (i=0; i= MAX_DIMS) {\n\t\t\totmp = PyArray_Ravel(mps[i],0);\n\t\t\tPy_DECREF(mps[i]);\n\t\t\tmps[i] = (PyArrayObject *)otmp;\n\t\t}\n\t\tprior2 = PyArray_GetPriority((PyObject *)(mps[i]), 0.0);\n\t\tif (prior2 > prior1) {\n\t\t\tprior1 = prior2;\n\t\t\tsubtype = mps[i]->ob_type;\n\t\t\tret = mps[i];\n\t\t}\n\t}\n\t\n\tnew_dim = 0;\n\tfor(i=0; ind;\n\t\telse {\n\t\t\tif (nd != mps[i]->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"arrays must have same \"\\\n\t\t\t\t\t\t\"number of dimensions\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tif (!PyArray_CompareLists(mps[0]->dimensions+1, \n\t\t\t\t\t\t mps[i]->dimensions+1, \n\t\t\t\t\t\t nd-1)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"array dimensions must \"\\\n\t\t\t\t\t\t\"agree except for d_0\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t}\n\t\tif (nd == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"0d arrays can't be concatenated\");\n\t\t\tgoto fail;\n\t\t}\n\t\tnew_dim += mps[i]->dimensions[0];\n\t}\n\t\n\ttmp = mps[0]->dimensions[0];\n\tmps[0]->dimensions[0] = new_dim;\n\tret = (PyArrayObject *)PyArray_New(subtype, nd,\n\t\t\t\t\t mps[0]->dimensions, \n\t\t\t\t\t type_num, NULL, NULL, 0, 0, ret);\n\tmps[0]->dimensions[0] = tmp;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tdata = ret->data;\n\tfor(i=0; idata, numbytes);\n\t\tdata += numbytes;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; ind;\n\tif (n <= 1) {\n\t\tPy_INCREF(ap);\n\t\treturn (PyObject *)ap;\n\t}\n\n\tif (a1 < 0) a1 += n;\n\tif (a2 < 0) a2 += n;\n\tif ((a1 < 0) || (a1 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis1 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tif ((a2 < 0) || (a2 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis2 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tnew_axes = PyTuple_New(n);\n\tfor (i=0; ind;\n\t\tpermutation = (intp *)malloc(n*sizeof(int));\n\t\tfor(i=0; ind+axis;\n\t\t\tif (axis < 0 || axis >= ap->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"invalid axis for this array\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tpermutation[i] = axis;\n\t\t}\n\t}\n\t\n\t/* this allocates memory for dimensions and strides (but fills them\n\t incorrectly), sets up descr, and points data at ap->data. */\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, n, permutation, \n\t\t\t\t\t ap->descr->type_num, NULL,\n\t\t\t\t\t ap->data, ap->itemsize, ap->flags,\n\t\t\t\t\t ap);\n\tif (ret == NULL) goto fail;\n\t\n\t/* point at true owner of memory: */\n\tret->base = (PyObject *)ap;\n\tPy_INCREF(ap);\n\t\n\tfor(i=0; idimensions[i] = ap->dimensions[permutation[i]];\n\t\tret->strides[i] = ap->strides[permutation[i]];\n\t}\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n\tif (op && (op != Py_None))\n\t\tPyArray_Free(op, (char *)axes);\n\tfree(permutation);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ret);\n\tif (permutation != NULL) free(permutation);\n\tif (op != Py_None)\n\t\tPyArray_Free(op, (char *)axes);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Repeat(PyArrayObject *aop, PyObject *op, int axis) {\n\tintp *counts;\n\tintp n, n_outer, i, j, k, chunk, total;\n\tintp tmp;\n\tint nd;\n\tPyArrayObject *repeats=NULL;\n\tPyObject *ap=NULL;\n\tPyArrayObject *ret=NULL;\n\tchar *new_data, *old_data;\n\n\trepeats = (PyAO *)PyArray_ContiguousFromObject(op, PyArray_INTP, 0, 1);\n\tif (repeats == NULL) return NULL;\n\tnd = repeats->nd;\n\tcounts = (intp *)repeats->data;\n\n\tif ((ap=_check_axis(aop, &axis, CARRAY_FLAGS))==NULL) {\n\t\tPy_DECREF(repeats);\n\t\treturn NULL;\n\t}\n\n\taop = (PyAO *)ap;\n\n\tif (nd == 1)\n\t\tn = repeats->dimensions[0];\n\telse /* nd == 0 */\n\t\tn = aop->dimensions[axis];\n\n\tif (aop->dimensions[axis] != n) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"a.shape[axis] != len(repeats)\");\n\t\tgoto fail;\n\t}\n\n\t\n\tif (nd == 0) \n\t\ttotal = counts[0]*n;\n\telse {\n\t\t\n\t\ttotal = 0;\n\t\tfor(j=0; jdimensions[axis] = total;\n\tret = (PyArrayObject *)PyArray_New(aop->ob_type, aop->nd,\n\t\t\t\t\t aop->dimensions, \n\t\t\t\t\t aop->descr->type_num,\n\t\t\t\t\t NULL, NULL, aop->itemsize, 0,\n\t\t\t\t\t aop);\n\taop->dimensions[axis] = n;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tnew_data = ret->data;\n\told_data = aop->data;\n\t\n\tchunk = aop->itemsize;\n\tfor(i=axis+1; ind; i++) {\n\t\tchunk *= aop->dimensions[i];\n\t}\n\t\n\tn_outer = 1;\n\tfor(i=0; idimensions[i];\n\n\tfor(i=0; ind < mps[i]->nd) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"too many dimensions\");\n\t\t\tgoto fail;\n\t\t}\n\t\tif (!PyArray_CompareLists(ap->dimensions+(ap->nd-mps[i]->nd),\n\t\t\t\t mps[i]->dimensions, mps[i]->nd)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"array dimensions must agree\");\n\t\t\tgoto fail;\n\t\t}\n\t\tsizes[i] = PyArray_NBYTES(mps[i]);\n\t}\n\t\n\t/* why not ??? \n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tPyErr_SetString(PyExc_NotImplementedError, \n\t\t\t\t\"Not implemented for flexible sizes\");\n\t\treturn NULL;\n\t}\n\t*/\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, ap);\n\tif (ret == NULL) goto fail;\n\t\n\telsize = ret->itemsize;\n\tm = PyArray_SIZE(ret);\n\tself_data = (intp *)ap->data;\n\tret_data = ret->data;\n\t\n\tfor (i=0; i= n) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"invalid entry in choice array\");\n\t\t\tgoto fail;\n\t\t}\n\t\toffset = i*elsize;\n\t\tif (offset >= sizes[mi]) {offset = offset % sizes[mi]; }\n\t\tmemmove(ret_data, mps[mi]->data+offset, elsize);\n\t\tret_data += elsize; self_data++;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; idescr->compare(a,b,global_obj);\n}\n\n#define SWAPAXES(op, ap) {\t\t\t\t\t\t\\\n\t\torign = (ap)->nd-1;\t\t\t\t\t\\\n\t\tif (axis != orign) {\t\t\t\t\t\\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\n#define SWAPBACK(op, ap) { \\\n\t\tif (axis != orign) { \\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\nstatic PyObject *\nPyArray_Sort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap=NULL, *store_arr=NULL;\n\tchar *ip;\n\tint i, n, m, elsize, orign;\n\n\tif ((ap = (PyAO*) _check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_CopyFromObject((PyObject *)op, \n\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tPy_DECREF(ap);\n\t\treturn NULL;\n\t}\n\t\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\n\t/* Store global -- allows re-entry -- restore before leaving*/\n\tstore_arr = global_obj; \n\tglobal_obj = ap;\n\t\n\tfor (ip=ap->data, i=0; iitemsize;\n\tconst intp *ipa = ip1;\n\tconst intp *ipb = ip2;\t\n\treturn global_obj->descr->compare(global_data + (isize * *ipa),\n global_data + (isize * *ipb), \n\t\t\t\t\t global_obj);\n}\n\nstatic PyObject *\nPyArray_ArgSort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap, *ret, *store;\n\tintp *ip;\n\tintp i, j, n, m, orign;\n\tint argsort_elsize;\n\tchar *store_ptr;\n\n\tif ((ap = (PyAO *)_check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op, \n\t\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, ap);\n\tif (ret == NULL) goto fail;\n\t\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tip = (intp *)ret->data;\n\targsort_elsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\tstore_ptr = global_data;\n\tglobal_data = ap->data;\n\tstore = global_obj;\n\tglobal_obj = ap;\n\tfor (i=0; idescr->compare;\n\tintp min_i, max_i, i, j;\n\tint location, elsize = ap1->itemsize;\n\tintp elements = ap1->dimensions[ap1->nd-1];\n\tintp n = PyArray_Size((PyObject *)ap2);\n\tintp *rp = (intp *)ret->data;\n\tchar *ip = ap2->data;\n\tchar *vp = ap1->data;\n\n\tfor (j=0; j 0) {\n\t\t\t\t\tif (compare(ip, vp+elsize*(--i), ap2) \\\n\t\t\t\t\t != 0) {\n\t\t\t\t\t\ti = i+1; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmin_i = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (location < 0) {\n\t\t\t\tmax_i = i;\n\t\t\t} else {\n\t\t\t\tmin_i = i+1;\n\t\t\t}\n\t\t}\n\t\t*rp = min_i;\n\t}\n}\n\nstatic PyObject *\nPyArray_SearchSorted(PyArrayObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tint typenum = 0;\n\n\t/* \n PyObject *args;\n args = Py_BuildValue(\"O\",op2);\n\tPy_DELEGATE_ARGS(((PyObject *)op1), searchsorted, args);\n Py_XDECREF(args);\n\t*/\n\n\ttypenum = PyArray_ObjectType((PyObject *)op1, 0);\n\ttypenum = PyArray_ObjectType(op2, typenum);\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op1, \n\t\t\t\t\t\t\t typenum, \n\t\t\t\t\t\t\t 1, 1);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap2->ob_type, ap2->nd, \n\t\t\t\t\t ap2->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, ap2);\n\tif (ret == NULL) goto fail;\n\n\tif (ap2->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tlocal_where(ap1, ap2, ret); \n\t\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ret);\n\treturn NULL;\n}\n\n\n\n/* Could perhaps be redone to not make contiguous arrays \n */\n\nstatic PyObject *\nPyArray_InnerProduct(PyObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tintp i, j, l, i1, i2, n1, n2;\n\tint typenum;\n\tintp is1, is2, os;\n\tchar *ip1, *ip2, *op;\n\tintp dimensions[MAX_DIMS], nd;\n\tPyArray_DotFunc *dot;\n\tPyTypeObject *subtype;\n double prior1, prior2;\n\t\n\ttypenum = PyArray_ObjectType(op1, 0); \n\ttypenum = PyArray_ObjectType(op2, typenum);\n\t\t\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject(op1, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tif (ap1->nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\t\n\tif (ap2->dimensions[ap2->nd-1] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"matrices are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\n\n\t/* Need to choose an output array that can hold a sum \n\t -- use priority to determine which subtype.\n\t */\n prior2 = PyArray_GetPriority((PyObject *)ap2, 0.0);\n prior1 = PyArray_GetPriority((PyObject *)ap1, 0.0);\n subtype = (prior2 > prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = (ret->descr->dotfunc);\n\t\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\n\t\n\tis1 = ap1->strides[ap1->nd-1]; \n\tis2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\tif (ap2->nd > 1) {\n\t\tmatchDim = ap2->nd - 2;\n\t\totherDim = ap2->nd - 1;\n\t}\n\telse {\n\t\tmatchDim = 0;\n\t\totherDim = 0;\n\t}\n\n\tif (ap2->dimensions[matchDim] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"objects are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-2; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\tif(ap2->nd > 1) {\n\t\tdimensions[j++] = ap2->dimensions[ap2->nd-1];\n\t}\n\t/*\n\tfprintf(stderr, \"nd=%d dimensions=\", nd);\n\t for(i=0; i prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\t\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[matchDim];\n\tif(ap1->nd > 1)\n\t\tis1r = ap1->strides[ap1->nd-2];\n\telse\n\t\tis1r = ap1->strides[ap1->nd-1];\n\tis2r = ap2->strides[otherDim];\n\n\top = ret->data; os = ret->itemsize;\n\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2ob_type, 2, dims, PyArray_TYPE(arr),\n\t\t\t NULL, NULL, elsize, 0, (PyArrayObject *)arr);\n\n\tif (ret == NULL) {\n\t\tPy_DECREF(arr);\n\t\treturn NULL;\n\t}\n\t/* do 2-d loop */\n\toptr = PyArray_DATA(ret);\n\tstr2 = elsize*dims[0];\n\tfor (i=0; idimensions[ap1->nd-1];\n\tn2 = ap2->dimensions[ap2->nd-1];\n\n\tif (n1 < n2) { \n\t\tret = ap1; ap1 = ap2; ap2 = ret; \n\t\tret = NULL; i = n1;n1=n2;n2=i;\n\t}\n\tlength = n1;\n\tn = n2;\n\tswitch(mode) {\n\tcase 0:\t\n\t\tlength = length-n+1;\n\t\tn_left = n_right = 0;\n\t\tbreak;\n\tcase 1:\n\t\tn_left = (int)(n/2);\n\t\tn_right = n-n_left-1;\n\t\tbreak;\n\tcase 2:\n\t\tn_right = n-1;\n\t\tn_left = n-1;\n\t\tlength = length+n-1;\n\t\tbreak;\n\tdefault:\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"mode must be 0,1, or 2\");\n\t\tgoto fail;\n\t}\n\t\n\tret = (PyArrayObject *)PyArray_New(ap1->ob_type, 1,\n\t\t\t\t\t &length, typenum, \n\t\t\t\t\t NULL, NULL, 0, 0, ap1);\n\tif (ret == NULL) goto fail;\n\n\t\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"function not available for this type\");\n\t\tgoto fail;\n\t}\n\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data; ip2 = ap2->data+n_left*is2;\n\tn = n-n_left;\n\tfor(i=0; idescr->argmax;\n\tif (arg_func == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"data type not ordered\");\n\t\tgoto fail;\n\t}\n\n\trp = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd-1,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, ap);\n\tif (rp == NULL) goto fail;\n\n\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) {\n\t\tPyErr_SetString(MultiArrayError, \n\t\t\t\t\"Attempt to get argmax/argmin \"\\\n\t\t\t\t\"of an empty sequence??\");\n\t\tgoto fail;\n\t}\n\tn = PyArray_SIZE(ap)/m;\n\trptr = (intp *)rp->data;\n\tfor (ip = ap->data, i=0; ind + indices->nd - 1;\n for (i=0; i< nd; i++) {\n if (i < axis) {\n shape[i] = self->dimensions[i];\n n *= shape[i];\n } else {\n if (i < axis+indices->nd) {\n shape[i] = indices->dimensions[i-axis];\n m *= shape[i];\n } else {\n shape[i] = self->dimensions[i-indices->nd+1];\n chunk *= shape[i];\n }\n }\n }\n ret = (PyArrayObject *)PyArray_New(self->ob_type, nd, shape, \n\t\t\t\t\t self->descr->type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, self);\n\t\n if (ret == NULL) goto fail;\n\t\n max_item = self->dimensions[axis];\n chunk = chunk * ret->itemsize;\n src = self->data;\n dest = ret->data;\n\t\n for(i=0; idata))[j];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"Index out of range for \"\\\n\t\t\t\t\t\t\"array\");\n goto fail;\n }\n memmove(dest, src+tmp*chunk, chunk);\n dest += chunk;\n }\n src += chunk*max_item;\n }\n\t\n PyArray_INCREF(ret);\n\n Py_XDECREF(indices);\n Py_XDECREF(self);\n\n return (PyObject *)ret;\n\t\n\t\n fail:\n Py_XDECREF(ret);\n Py_XDECREF(indices);\n Py_XDECREF(self);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Put(PyArrayObject *self, PyObject *indices0, PyObject* values0) \n{\n PyArrayObject *indices, *values;\n int i, chunk, ni, max_item, nv, tmp; \n char *src, *dest;\n\n indices = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be contiguous\");\n return NULL;\n }\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n indices = (PyArrayObject *)PyArray_ContiguousFromObject(indices0, PyArray_INTP, 0, 0);\n if (indices == NULL) goto fail;\n ni = PyArray_SIZE(indices);\n\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, self->descr->type_num, \n\t\t\t\t\t 0, 0);\n if (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\n if (nv > 0) { /* nv == 0 for a null array */\n for(i=0; idata + chunk * (i % nv);\n tmp = ((intp *)(indices->data))[i];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \"Index out of range for array\");\n goto fail;\n }\n memmove(dest + tmp * chunk, src, chunk);\n }\n }\n\n Py_XDECREF(values);\n Py_XDECREF(indices);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(indices);\n Py_XDECREF(values);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_PutMask(PyArrayObject *self, PyObject *mask0, PyObject* values0) \n{\n PyArrayObject *mask, *values;\n int i, chunk, ni, max_item, nv, tmp, thistype;\n char *src, *dest;\n\n mask = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must \"\\\n\t\t\t\t\"be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must be contiguous\");\n return NULL;\n }\n\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n mask = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(mask0, PyArray_BOOL, 0, 0);\n if (mask == NULL) goto fail;\n ni = PyArray_SIZE(mask);\n if (ni != max_item) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: mask and data must be \"\\\n\t\t\t\t\"the same size.\");\n goto fail;\n }\n\n\tthistype = self->descr->type_num;\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, thistype, 0, 0);\n\tif (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\t /* zero if null array */\n if (nv > 0) {\n\t\tfor(i=0; idata + chunk * (i % nv);\n\t\t\ttmp = ((Bool *)(mask->data))[i];\n\t\t\tif (tmp) {\n\t\t\t\tmemmove(dest + i * chunk, src, chunk);\n\t\t\t\tif (thistype == PyArray_OBJECT)\n\t\t\t\t\tPy_INCREF(*((PyObject **)src));\n\t\t\t}\n\t\t}\n }\n\n Py_XDECREF(values);\n Py_XDECREF(mask);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(mask);\n Py_XDECREF(values);\n return NULL;\n}\n\n\n/* This conversion function can be used with the \"O&\" argument for\n PyArg_ParseTuple. It will immediately return an object of array type\n or will convert to a CARRAY any other object. \n\n If you use PyArray_Converter, you must DECREF the array when finished\n as you get a new reference to it.\n*/\n \nstatic int \nPyArray_Converter(PyObject *object, PyObject **address) \n{\n if (PyArray_Check(object)) {\n *address = object;\n\t\tPy_INCREF(object);\n return PY_SUCCEED;\n }\n else {\n\t\t*address = PyArray_FromAny(object, NULL, 0, 0, CARRAY_FLAGS);\n\t\tif (*address == NULL) return PY_FAIL;\n\t\treturn PY_SUCCEED;\n }\n}\n\nstatic int\nPyArray_BoolConverter(PyObject *object, Bool *val)\n{\n\tif (PyObject_IsTrue(object)) *val=TRUE;\n\telse *val=FALSE;\n\tif (PyErr_Occurred()) return PY_FAIL;\n\treturn PY_SUCCEED;\n}\n\n\nstatic int\nPyArray_TypestrConvert(int itemsize, int gentype)\n{\n\tregister int newtype = gentype;\n\t\n\tif (gentype == PyArray_SIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_INT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_INT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_INT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_INT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_INT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\n\t}\n\n\telse if (gentype == PyArray_UNSIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_UINT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_UINT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_UINT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_UINT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_UINT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t\tbreak;\n\t\t}\n\t}\n\telse if (gentype == PyArray_FLOATINGLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 4:\n\t\t\tnewtype = PyArray_FLOAT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_FLOAT64;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 10:\n\t\t\tnewtype = PyArray_FLOAT80;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 12:\n\t\t\tnewtype = PyArray_FLOAT96;\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_FLOAT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\t\n\telse if (gentype == PyArray_COMPLEXLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 8:\n\t\t\tnewtype = PyArray_COMPLEX64;\n\t\t\tbreak;\n\t\tcase 16:\n\t\t\tnewtype = PyArray_COMPLEX128;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 20:\n\t\t\tnewtype = PyArray_COMPLEX160;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 24:\n\t\t\tnewtype = PyArray_COMPLEX192;\t\t\t\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 32:\n\t\t\tnewtype = PyArray_COMPLEX256;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\n\treturn newtype;\n}\n\n\n/* this function takes a Python object which exposes the (single-segment)\n buffer interface and returns a pointer to the data segment\n \n You should increment the reference count by one of buf->base\n if you will hang on to a reference\n\n You only get a borrowed reference to the object. Do not free the\n memory...\n*/\n\n\nstatic int\nPyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf)\n{\n int buflen;\n\n buf->ptr = NULL;\n buf->flags = WRITEABLE;\n buf->base = NULL;\n\n\tif (obj == Py_None)\n\t\treturn PY_SUCCEED;\n\n if (PyObject_AsWriteBuffer(obj, &(buf->ptr), &buflen) < 0) {\n PyErr_Clear();\n buf->flags &= ~WRITEABLE;\n if (PyObject_AsReadBuffer(obj, (const void **)&(buf->ptr), \n &buflen) < 0)\n return PY_FAIL;\n }\n buf->len = (intp) buflen;\n \n /* Point to the base of the buffer object if present */\n if (PyBuffer_Check(obj)) buf->base = ((PyArray_Chunk *)obj)->base;\n if (buf->base == NULL) buf->base = obj;\n \n return PY_SUCCEED; \n}\n\n\n\n/* This function takes a Python sequence object and allocates and\n fills in an intp array with the converted values.\n\n **Remember to free the pointer seq.ptr when done using\n PyDimMem_FREE(seq.ptr)**\n*/\n\nstatic int\nPyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq)\n{\n int len;\n int nd;\n\n seq->ptr = NULL;\n if (obj == Py_None) return PY_SUCCEED;\n len = PySequence_Size(obj);\n if (len == -1) { /* Check to see if it is a number */\n if (PyNumber_Check(obj)) len = 1;\n }\n if (len < 0) {\n PyErr_SetString(PyExc_TypeError, \n \"Expected sequence object with len >= 0\");\n return PY_FAIL;\n }\n if (len > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError, \"Sequence too large, \" \\\n \"must be smaller than %d\", MAX_DIMS);\n return PY_FAIL;\n }\n\tif (len > 0) {\n\t\tseq->ptr = PyDimMem_NEW(len);\n\t\tif (seq->ptr == NULL) {\n\t\t\tPyErr_NoMemory();\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n seq->len = len;\n nd = PyArray_IntpFromSequence(obj, (intp *)seq->ptr, len);\n if (nd == -1 || nd != len) goto fail;\n return PY_SUCCEED;\n\n fail:\n\tPyDimMem_FREE(seq->ptr);\n\treturn PY_FAIL;\n}\n\n/* This function takes a Python object representing a type and converts it \n to a C type_num and an itemsize (elements of PyArray_Typecode structure)\n \n Many objects can be used to represent a type.\n */\n\nstatic int\nPyArray_TypecodeConverter(PyObject *obj, PyArray_Typecode *at)\n{\n char *type;\n PyArray_Descr *descr;\n int check_num=PyArray_NOTYPE+10;\n\tint len;\n\tPyObject *item, *attr=NULL;\n\n\tat->itemsize = 0;\n if (obj == Py_None) {\n at->type_num = PyArray_NOTYPE;\n return PY_SUCCEED;\n }\n\n if (PyType_Check(obj) && PyType_IsSubtype((PyTypeObject *)obj, \n &PyGenericArrType_Type)) {\n PyArray_TypecodeFromTypeObject(obj, at);\n return PY_SUCCEED;\n }\n\n\n\t/* type object could be an array */\n\tif (PyArray_Check(obj)) {\n\t\tat->type_num = PyArray_TYPE(obj);\n\t\tat->itemsize = PyArray_ITEMSIZE(obj);\n\t\treturn PY_SUCCEED;\n\t}\n\n\t/* or an array scalar */\n if (PyArray_IsScalar(obj, Generic)) {\n PyArray_TypecodeFromScalar(obj, at);\n return PY_SUCCEED;\n }\n\n\t/* or a typecode string */\n\n\tif (PyString_Check(obj)) {\n\t\t/* Check for a string typecode. */\n\t\ttype = PyString_AS_STRING(obj);\n\t\tlen = PyString_GET_SIZE(obj);\t\t\n\t\tif (len > 0) {\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tif (len > 1) {\n\t\t\tat->itemsize = atoi(type+1);\n\t\t\t/* When specifying length of UNICODE\n\t\t\t the number of characters is given to match \n\t\t\t the STRING interface. Each character can be\n\t\t\t more than one byte and itemsize must be\n\t\t\t the number of bytes.\n\t\t\t*/\n\t\t\tif (check_num == PyArray_UNICODELTR ||\t\\\n\t\t\t check_num == PyArray_UNICODE) \n\t\t\t at->itemsize *= sizeof(Py_UNICODE);\n\n\t\t\t/* Support for generic processing */\n\t\t\telse if ((check_num != PyArray_STRINGLTR) &&\n\t\t\t\t (check_num != PyArray_VOIDLTR) &&\n\t\t\t\t (check_num != PyArray_STRING) &&\n\t\t\t\t (check_num != PyArray_VOID)) {\n\t\t\t\tcheck_num = \\\n\t\t\t\t\tPyArray_TypestrConvert(at->itemsize, \n\t\t\t\t\t\t\t check_num);\n\t\t\t at->itemsize = 0;\n\t\t\t\tif (check_num == PyArray_NOTYPE) goto fail;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Arbitray object with dtypenum and itemsize attributes. */\n\telse if (PyObject_HasAttrString(obj, \"dtypenum\") && \n\t PyObject_HasAttrString(obj, \"itemsize\")) {\n\t\tattr = PyObject_GetAttrString(obj, \"dtypenum\");\n\t\tcheck_num = PyInt_AsLong(attr);\n\t\tif (PyErr_Occurred()) { /* not an integer, try character */\n\t\t\tPyErr_Clear();\n\t\t\ttype = PyString_AsString(attr);\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tPy_XDECREF(attr);\n\t\tif (!PyErr_Occurred()) {\n\t\t\tattr = PyObject_GetAttrString(obj, \"itemsize\");\n\t\t\tat->itemsize = PyInt_AsLong(attr);\n\t\t\tPy_XDECREF(attr);\n\t\t}\t\t\t\n\t}\t\t\n\telse if (PyType_Check(obj)) {\n\t\tcheck_num = PyArray_OBJECT;\n\t\tif (obj == (PyObject *)(&PyInt_Type)) \n\t\t\tcheck_num = PyArray_LONG;\n\t\telse if (obj == (PyObject *)(&PyBool_Type))\n\t\t\tcheck_num = PyArray_BOOL;\n\t\telse if (obj == (PyObject *)(&PyFloat_Type)) \n\t\t\tcheck_num = PyArray_DOUBLE;\n\t\telse if (obj == (PyObject *)(&PyComplex_Type)) \n\t\t\tcheck_num = PyArray_CDOUBLE;\n else if (obj == (PyObject *)(&PyString_Type))\n check_num = PyArray_STRING;\n else if (obj == (PyObject *)(&PyUnicode_Type))\n check_num = PyArray_UNICODE;\n\t}\t\n else { /* Default -- try integer conversion */\n check_num = PyInt_AsLong(obj);\n\t}\n\n\tif (PyErr_Occurred()) goto fail;\n\n\t/*\n\tif (check_num == PyArray_NOTYPE) return PY_FAIL;\n\t*/\n\tif (check_num == PyArray_NOTYPE) {\n\t\tat->type_num = PyArray_NOTYPE;\n\t\tat->itemsize = 0;\n\t\treturn PY_SUCCEED;\n\t}\n\n if ((descr = PyArray_DescrFromType(check_num))==NULL) {\n\t\t/* Now check to see if the object is registered\n\t\t in typeDict */\n\t\tif (typeDict != NULL) {\n\t\t\titem = PyDict_GetItem(typeDict, obj);\n\t\t\tif (item) {\n\t\t\t\tPyArray_TypecodeFromTypeObject(obj, at);\n\t\t\t\tPyErr_Clear();\n\t\t\t\treturn PY_SUCCEED;\n\t\t\t}\n\t\t}\n return PY_FAIL;\n\t}\n\t\n at->type_num = descr->type_num;\n\tif (at->itemsize == 0) at->itemsize = descr->elsize;\n\t\n return PY_SUCCEED;\n fail:\n\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\"data type not understood\");\n\treturn PY_FAIL;\n}\t\n\n\n/* This function returns true if the two typecodes are \n equivalent (same basic kind and same itemsize).\n*/\n\nstatic Bool\nPyArray_EquivalentTypes(PyArray_Typecode *typ1, PyArray_Typecode *typ2)\n{\n\tregister int typenum1=typ1->type_num;\n\tregister int typenum2=typ2->type_num;\n\tregister int size1=typ1->itemsize;\n\tregister int size2=typ2->itemsize;\n\n\tif (size1 != size2) return FALSE;\n\tif (typenum1==typenum2) return TRUE;\n\n\t/* If we are here then size1 == size2 */\n\tif (typenum1 < PyArray_FLOAT) {\n\t\tif (PyTypeNum_ISBOOL(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISBOOL(typenum2));\n\t\telse if (PyTypeNum_ISUNSIGNED(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISUNSIGNED(typenum2));\n\t\telse \n\t\t\treturn (Bool)(PyTypeNum_ISSIGNED(typenum2));\n\t}\n\telse {\n\t\tif (PyTypeNum_ISFLOAT(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISFLOAT(typenum2));\n\t\telse if (PyTypeNum_ISCOMPLEX(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISCOMPLEX(typenum2));\n\t}\n\t/* Default size1 != size2 and typenum1 != typenum2 */\n\treturn FALSE;\t\n}\n\nstatic Bool \nPyArray_EquivArrTypes(PyArrayObject *a1, PyArrayObject *a2)\n{\n PyArray_Typecode type1={PyArray_TYPE(a1), PyArray_ITEMSIZE(a1), 0};\n PyArray_Typecode type2={PyArray_TYPE(a2), PyArray_ITEMSIZE(a2), 0};\n \n return PyArray_EquivalentTypes(&type1, &type2);\n}\n\n\n/*** END C-API FUNCTIONS **/\n\n\n#define _ARET(x) PyArray_Return((PyArrayObject *)(x))\n\nstatic char doc_fromobject[] = \"array(object, dtype=None, copy=1, fortran=0) will return a new array formed from the given object type given. Object can anything with an __array__ method, or any (nested) sequence. If no type is given, then the type will be determined as the minimum type required to hold the objects in the sequence. If copy is zero and sequence is already an array with the right type, a reference will be returned. If the sequence is an array, type can be used only to upcast the array. For downcasting use .astype(t) method.\";\n\nstatic PyObject *\n_array_fromobject(PyObject *ignored, PyObject *args, PyObject *kws)\n{\n\tPyObject *op, *ret=NULL;\n\tstatic char *kwd[]= {\"object\", \"dtype\", \"copy\", \"fortran\", NULL};\n\tBool copy=TRUE;\n\tPyArray_Typecode type = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode oldtype = {PyArray_NOTYPE, 0, 0};\n\tint type_num;\n\tBool fortran=FALSE;\n\tint flags=0;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|O&O&O&\", kwd, &op, \n\t\t\t\t\tPyArray_TypecodeConverter,\n &type, \n\t\t\t\t\tPyArray_BoolConverter, ©, \n\t\t\t\t\tPyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\ttype_num = type.type_num;\n\n\t/* fast exit if simple call */\n\tif (PyArray_Check(op) && (copy==0) &&\t\t\t\\\n\t (fortran == PyArray_CHKFLAGS(op, FORTRAN))) {\n\t\tif (type_num == PyArray_NOTYPE) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t\t/* One more chance */\n\t\toldtype.type_num = PyArray_TYPE(op);\n\t\toldtype.itemsize = PyArray_ITEMSIZE(op);\n\t\tif (PyArray_EquivalentTypes(&oldtype, &type)) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t}\n\n\ttype.fortran = fortran; \n\tif (copy) {\n\t\tflags = ENSURECOPY;\n\t}\n\n\tif ((ret = PyArray_FromAny(op, &type, 0, 0, flags)) == NULL) \n\t\treturn NULL;\n\n\treturn _ARET(ret);\n}\n\nstatic PyObject *\nPyArray_Empty(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n \n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n PyArray_FillObjectArray(ret, Py_None);\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic char doc_empty[] = \"empty((d1,...,dn),dtype=intp,fortran=0) will return a new array\\n of shape (d1,...,dn) and given type with all its entries uninitialized. This can be faster than zeros.\";\n\nstatic PyObject *\narray_empty(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Empty(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_scalar[] = \"scalar(dtypestr,obj) will return a new scalar array of the given type initialized with obj. Mainly for pickle support. typestr must be a valid data typestr (complete with < > or |). If dtypestr is object, then obj can be any object, otherwise obj must be a string. If obj is not given it will be interpreted as None for object type and zeros for all other types.\";\n\nstatic PyObject *\narray_scalar(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"dtypestr\",\"obj\", NULL};\n\tPyArray_Typecode typecode;\n\tPyObject *obj=NULL;\n\tchar *typestr;\n\tint typestrlen;\n\tint swap, alloc=0;\n\tvoid *dptr;\n\tPyObject *ret;\n\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"z#|O\",\n\t\t\t\t\t kwlist, &typestr, &typestrlen,\n\t\t\t\t\t &obj)) \n\t\treturn NULL;\n\t\n\tif (_array_typecode_fromstr(typestr, &swap, &typecode) < 0) \n\t\treturn NULL;\n\t\n\tif (typecode.itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\t\t\\\n\t\t\t\t\"itemsize cannot be zero\");\n\t\treturn NULL;\n\t}\n\n\tif (typecode.type_num == PyArray_OBJECT) {\n\t\tif (obj == NULL) obj = Py_None;\n\t\tdptr = &obj;\n\t\tswap = 0;\n\t}\n\telse {\n\t\tif (obj == NULL) {\n\t\t\tdptr = malloc(typecode.itemsize);\n\t\t\tif (dptr == NULL) {\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tmemset(dptr, '\\0', typecode.itemsize);\n\t\t\talloc = 1;\n\t\t}\n\t\telse {\n\t\t\tif (!PyString_Check(obj)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"initializing object must \"\\\n\t\t\t\t\t\t\"be a string.\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (PyString_GET_SIZE(obj) < typecode.itemsize) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"initialization string is too\"\\\n\t\t\t\t\t\t\" small\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = PyString_AS_STRING(obj);\n\t\t}\n\t}\n\n\tret = PyArray_Scalar(dptr, typecode.type_num,\n\t\t\t typecode.itemsize, swap); \n\n\t/* free dptr which contains zeros */\n\tif (alloc) free(dptr);\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_Zeros(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n\t\tPyObject *zero = PyInt_FromLong(0);\n PyArray_FillObjectArray(ret, zero);\n Py_DECREF(zero);\n\t}\n\telse {\t\t\n\t\tmemset(ret->data, 0, n*(ret->itemsize));\n\t}\n\treturn (PyObject *)ret;\n\n}\n\nstatic char doc_zeros[] = \"zeros((d1,...,dn),dtype=intp,fortran=0) will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero.\";\n\n\nstatic PyObject *\narray_zeros(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Zeros(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_set_typeDict[] = \"set_typeDict(dict) set the internal \"\\\n\t\"dictionary that can look up an array type using a registered \"\\\n\t\"code\";\n\nstatic PyObject *\narray_set_typeDict(PyObject *ignored, PyObject *args)\n{\n\tPyObject *dict;\n\tif (!PyArg_ParseTuple(args, \"O\", &dict)) return NULL;\n\tPy_XDECREF(typeDict); /* Decrement old reference (if any)*/\n\ttypeDict = dict;\n\tPy_INCREF(dict); /* Create an internal reference to it */\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char doc_fromString[] = \"fromstring(string, dtype=intp, count=-1, swap=False) returns a new 1d array initialized from the raw binary data in string. If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.\";\n\nstatic PyObject *\narray_fromString(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyArrayObject *ret; \n\tchar *data;\n\tlonglong nin=-1;\n\tintp s, n;\n\tstatic char *kwlist[] = {\"string\", \"dtype\", \"count\", \"swap\",NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint itemsize;\n\tint swapped=FALSE;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"s#|O&LO&\", kwlist, \n\t\t\t\t\t &data, &s, \n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &swapped)) {\n\t\treturn NULL;\n\t}\n\t\n\tn = (intp) nin;\n\n\titemsize = type.itemsize;\n\tif (itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \"zero-valued itemsize.\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype.type_num, NULL, \n\t\t\t\t\t\tNULL, itemsize, 0,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\t\n\tmemcpy(ret->data, data, n*ret->itemsize);\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPyArray_INCREF(ret);\n\treturn (PyObject *)ret;\n}\n\n\n/* This needs an open file object and reads it in directly. \n memory-mapped files handled differently through buffer interface.\n\nfile pointer number in resulting 1d array \n(can easily reshape later, -1 for to end of file)\ntype of array\nsep is a separator string for character-based data (or NULL for binary)\n \" \" means whitespace\n*/\n\nstatic char doc_fromfile[] = \"\";\n\nstatic int\n_fill_in_itemsize(PyArray_Typecode *typecode)\n{\n\tPyArray_Descr *descr;\n\tdescr = PyArray_DescrFromType(typecode->type_num);\n\tif (descr==NULL) return -1;\n\ttypecode->itemsize = descr->elsize;\n\treturn 0;\n}\n\n\nstatic PyObject *\nPyArray_FromFile(FILE *fp, PyArray_Typecode *typecode, intp num, char *sep)\n{\n\tPyArrayObject *r;\n\tsize_t nread = 0;\n\tPyArray_ScanFunc *scan;\n\n\tif (typecode->itemsize == 0) {\n\t\tif (_fill_in_itemsize(typecode) < 0) \n\t\t\treturn NULL;\n\t}\n\n\tif (num == -1 && sep == NULL) { /* Get size for binary file*/\n\t\tintp start, numbytes;\n\t\tstart = (intp )ftell(fp);\n\t\tfseek(fp, 0, SEEK_END);\n\t\tnumbytes = (intp )ftell(fp) - start;\n\t\tfseek(fp, (long) start, SEEK_SET);\n\t\tif (numbytes == -1) {\n\t\t\tPyErr_SetString(PyExc_IOError, \"Could not seek in file.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tif (typecode->itemsize == 0) {\n\t\t\ttypecode->itemsize = numbytes;\n\t\t\tnum = 1;\n\t\t}\n\t\telse {\n\t\t\tnum = numbytes / typecode->itemsize;\n\t\t}\n\t}\n\t\n\tif (sep==NULL) { /* binary data */\n\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &num, \n\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t typecode->itemsize, 0, NULL);\n\t\tif (r==NULL) return NULL;\n\t\tnread = fread(r->data, typecode->itemsize, num, fp);\n\t}\n\telse { /* character reading */\n\t\tintp i;\n\t\tchar *dptr;\n\n\t\tif (num != -1) { /* number to read is known */\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &num, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = r->data;\n\t\t\tfor (i=0; i < num-1; i++) {\n\t\t\t\tif (scan(fp, dptr, r->itemsize, sep, NULL))\n\t\t\t\t\tbreak;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (!(scan(fp, dptr, r->itemsize, NULL, NULL)))\n\t\t\t\tnread += 1;\n\t\t}\n\t\telse { /* we have to watch for the end of the file and \n\t\t\t reallocate at the end */\n#define _FILEBUFNUM 4096\n\t\t\tintp thisbuf=0;\n\t\t\tintp size = _FILEBUFNUM;\n\t\t\tintp bytes;\n\t\t\tintp totalbytes;\n\t\t\tint done=0;\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &size, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\ttotalbytes = bytes = size * typecode->itemsize;\n\t\t\tdptr = r->data;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\twhile (!done) {\n\t\t\t\tdone = scan(fp, dptr, r->itemsize, sep, NULL);\n\t\t\t\t/* end of file reached trying to \n\t\t\t\t scan value \n\t\t\t\t*/\n\t\t\t\tif (done == 1 || done < 0) break;\n\t\t\t\n\t\t\t\tthisbuf += 1;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t\tif (!done && thisbuf == size) {\n\t\t\t\t\ttotalbytes += bytes;\n\t\t\t\t\tr->data = PyDataMem_RENEW(r->data, \n\t\t\t\t\t\t\t\t totalbytes);\n\t\t\t\t\tdptr = r->data + (totalbytes - bytes);\n\t\t\t\t\tthisbuf = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr->data = PyDataMem_RENEW(r->data, nread*r->itemsize);\n\t\t\tPyArray_DIM(r,0) = nread;\n\t\t\tnum = nread;\n#undef _FILEBUFNUM\n\t\t}\n\t}\n\tif (nread < num) {\n\t\tchar msg[80];\n\t\tsnprintf(msg, 80, \n\t\t\t \"%ld items requested only %ld read\", (long) num, \n (long) nread);\n\t\tif (PyErr_Warn(PyExc_RuntimeWarning, msg) < 0) {\n\t\t\tPy_DECREF(r);\n\t\t\treturn NULL;\n\t\t}\n\t\tr->data = PyDataMem_RENEW(r->data, nread * r->itemsize);\n\t\tPyArray_DIM(r,0) = nread;\n\t}\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_fromfile(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *file=NULL, *ret;\n\tFILE *fp;\n\tchar *sep=\"\";\n\tchar *mode=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"file\", \"dtype\", \"count\", \"sep\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Ls\", kwlist, \n\t\t\t\t\t &file,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &sep)) {\n\t\treturn NULL;\n\t}\n\n\tif (PyString_Check(file)) {\n\t\tif (sep == \"\") mode=\"rb\";\n\t\telse mode=\"r\";\n\t\tfile = PyFile_FromString(PyString_AS_STRING(file), mode);\n\t\tif (file==NULL) return NULL;\n\t}\n\telse {\n\t\tPy_INCREF(file);\n\t}\n\tfp = PyFile_AsFile(file);\n\tif (fp == NULL) {\n\t\tPyErr_SetString(PyExc_IOError, \"First argument must be an open file\");\n\t\tPy_DECREF(file);\n\t\treturn NULL;\n\t}\n\tret = PyArray_FromFile(fp, &type, (intp) nin, sep);\n\tPy_DECREF(file);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_FromBuffer(PyObject *buf, PyArray_Typecode *type, \n\t\t intp count, int swapped) \n{\n\tPyArrayObject *ret;\n\tchar *data;\n\tint ts;\n\tintp s, n;\n\tint itemsize;\n\tint write=1;\n\n\tif (type->type_num == PyArray_OBJECT) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Cannot create an OBJECT array from memory\"\\\n\t\t\t\t\" buffer.\");\n\t\treturn NULL;\n\t}\n\tif (type->itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Itemsize cannot be zero in type\");\n\t\treturn NULL;\n\t}\n\n\tif (PyObject_AsWriteBuffer(buf, (void *)&data, &ts)==-1) {\n\t\twrite = 0;\n\t\tPyErr_Clear();\n\t\tif (PyObject_AsReadBuffer(buf, (void *)&data, &ts)==-1) {\n\t\t\treturn NULL;\n\t\t}\n\t}\n\ts = (intp)ts;\t\n\tn = (intp)count;\n\titemsize = type->itemsize;\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype->type_num, NULL, \n\t\t\t\t\t\tdata, itemsize, DEFAULT_FLAGS,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\n\tif (!write) ret->flags &= ~WRITEABLE;\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPy_INCREF(buf);\n\t/* Store a reference for decref on deallocation */\n\tret->base = buf;\n\tPyArray_UpdateFlags(ret, ALIGNED);\n\treturn (PyObject *)ret; \t\n}\n\nstatic char doc_frombuffer[] = \"\";\n\nstatic PyObject *\narray_frombuffer(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *obj=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"buffer\", \"dtype\", \"count\", \n\t\t\t\t \"swap\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint swapped=0;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Li\", kwlist, \n\t\t\t\t\t &obj,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &swapped)) {\n\t\treturn NULL;\n\t}\n\n\treturn PyArray_FromBuffer(obj, &type, (intp)nin, swapped);\n}\n\n\n\nstatic char doc_concatenate[] = \"concatenate((a1,a2,...),axis=None).\";\n\nstatic PyObject *\narray_concatenate(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *a0;\n\tint axis=0;\n\tstatic char *kwlist[] = {\"seq\", \"axis\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist,\n\t\t\t\t\t &a0,\n\t\t\t\t\t PyArray_AxisConverter, &axis))\n\t\treturn NULL;\n\treturn PyArray_Concatenate(a0, axis);\n}\n\nstatic char doc_innerproduct[] = \\\n\t\"inner(a,b) returns the dot product of two arrays, which has\\n\"\\\n\t\"shape a.shape[:-1] + b.shape[:-1] with elements computed by\\n\" \\\n\t\"the product of the elements from the last dimensions of a and b.\";\n\nstatic PyObject *array_innerproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *b0, *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a0, &b0)) return NULL;\n\t\n\treturn _ARET(PyArray_InnerProduct(a0, b0));\n}\n\nstatic char doc_matrixproduct[] = \\\n\t\"dot(a,v) returns matrix-multiplication between a and b. \\n\"\\\n\t\"The product-sum is over the last dimension of a and the \\n\"\\\n\t\"second-to-last dimension of b.\";\n\nstatic PyObject *array_matrixproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *v, *a;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a, &v)) return NULL;\n\t\n\treturn _ARET(PyArray_MatrixProduct(a, v));\n}\n\nstatic char doc_fastCopyAndTranspose[] = \"_fastCopyAndTranspose(a)\";\n\nstatic PyObject *array_fastCopyAndTranspose(PyObject *dummy, PyObject *args) {\n\tPyObject *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &a0)) return NULL;\n\t\n\treturn _ARET(PyArray_CopyAndTranspose(a0));\n}\n\nstatic char doc_correlate[] = \"cross_correlate(a,v, mode=0)\";\n\nstatic PyObject *array_correlate(PyObject *dummy, PyObject *args, PyObject *kwds) {\n\tPyObject *shape, *a0;\n\tint mode=0;\n\tstatic char *kwlist[] = {\"a\", \"v\", \"mode\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|i\", kwlist, \n\t\t\t\t\t &a0, &shape, &mode)) return NULL;\n\t\n\treturn PyArray_Correlate(a0, shape, mode);\n}\n\n\nstatic PyObject *\nPyArray_Arange(double start, double stop, double step, int type_num)\n{\n\tintp length, i;\n\tPyObject *range;\n\tchar *rptr;\n\tint elsize, type;\n\tdouble value;\n\tPyArray_Descr *dbl_descr;\n\n\tlength = (intp ) ceil((stop - start)/step);\n \n\tif (length <= 0) {\n\t\tlength = 0;\n\t\treturn PyArray_New(&PyArray_Type, 1, &length, type_num,\n\t\t\t\t NULL, NULL, 0, 0, NULL);\n\t}\n\n\trange = PyArray_New(&PyArray_Type, 1, &length, type_num, \n\t\t\t NULL, NULL, 0, 0, NULL);\n\tif (range == NULL) return NULL;\n\tdbl_descr = PyArray_DescrFromType(PyArray_DOUBLE);\n \n\trptr = ((PyArrayObject *)range)->data;\n\telsize = ((PyArrayObject *)range)->itemsize;\n\ttype = ((PyArrayObject *)range)->descr->type_num;\n\tfor (i=0; i < length; i++) {\n\t\tvalue = start + i*step;\n\t\tdbl_descr->cast[type]((char*)&value, rptr, 1, NULL, \n\t\t\t\t (PyArrayObject *)range);\n\t\trptr += elsize;\n\t}\n \n\treturn range;\n}\n\n\nstatic char doc_arange[] = \"arange(start, stop=None, step=1, dtype=intp)\\n\\n Just like range() except it returns an array whose type can be\\n specified by the keyword argument typecode.\";\n\nstatic PyObject *\narray_arange(PyObject *ignored, PyObject *args, PyObject *kws) {\n\tPyObject *o_start=NULL, *o_stop=Py_None, *o_step=NULL;\n\tstatic char *kwd[]= {\"start\", \"stop\", \"step\", \"dtype\", NULL};\n\tdouble start, stop, step;\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0};\n\tint type_num;\n\tint deftype = PyArray_INTP;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|OOO&\", kwd, &o_start,\n\t\t\t\t\t&o_stop, &o_step, \n\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t&typecode)) \n\t\treturn NULL;\n\n\tdeftype = PyArray_ObjectType(o_start, deftype);\n\tif (o_stop != Py_None) {\n\t\tdeftype = PyArray_ObjectType(o_stop, deftype);\n\t}\n\tif (o_step != NULL) {\n\t\tdeftype = PyArray_ObjectType(o_step, deftype);\n\t}\n\n\ttype_num = typecode.type_num;\n\tif (type_num == PyArray_NOTYPE) {\n\t\ttype_num = deftype;\n\t}\n\n\tstart = PyFloat_AsDouble(o_start);\n\tif error_converting(start) return NULL;\n\n\tif (o_step == NULL) {\n\t\tstep = 1;\n\t}\n\telse {\n\t\tstep = PyFloat_AsDouble(o_step);\n\t\tif error_converting(step) return NULL;\n\t}\n\n\tif (o_stop == Py_None) {\n\t\tstop = start;\n\t\tstart = 0;\n\t}\n\telse {\n\t\tstop = PyFloat_AsDouble(o_stop);\n\t\tif error_converting(stop) return NULL;\n\t}\n\n\treturn PyArray_Arange(start, stop, step, type_num);\n}\n\n#undef _ARET\n\n/*****\n static char doc_arrayMap[] = \"arrayMap(func, [a1,...,an])\";\n\n static PyObject *array_arrayMap(PyObject *dummy, PyObject *args) {\n PyObject *shape, *a0;\n \n if (PyArg_ParseTuple(args, \"OO\", &a0, &shape) == NULL) return NULL;\n\t\n return PyArray_Map(a0, shape);\n }\n*****/\n\nstatic char \ndoc_set_string_function[] = \"set_string_function(f, repr=1) sets the python function f to be the function used to obtain a pretty printable string version of a array whenever a array is printed. f(M) should expect a array argument M, and should return a string consisting of the desired representation of M for printing.\";\n\nstatic PyObject *\narray_set_string_function(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *op;\n\tint repr=1;\n\tstatic char *kwlist[] = {\"f\", \"repr\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|i\", kwlist, \n\t\t\t\t\t&op, &repr)) return NULL; \n\tPyArray_SetStringFunction(op, repr);\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char \ndoc_set_ops_function[] = \"set_numeric_ops(op=func, ...) sets some or all of the number methods for all array objects. Don't forget **dict can be used as the argument list. Returns the functions that were replaced -- can be stored and set later.\";\n\nstatic PyObject *\narray_set_ops_function(PyObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *oldops=NULL;\n\t\n\tif ((oldops = PyArray_GetNumericOps())==NULL) return NULL;\n\n\t/* Should probably ensure that objects are at least callable */\n\t/* Leave this to the caller for now --- error will be raised\n\t later when use is attempted \n\t*/\n\tif (PyArray_SetNumericOps(kwds) == -1) {\n\t\tPy_DECREF(oldops);\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"One or more objects is not callable.\");\n\t\treturn NULL;\n\t}\n\treturn oldops;\n}\n\n\nstatic PyObject *\nPyArray_Where(PyObject *condition, PyObject *x, PyObject *y)\n{\n\tPyArrayObject *arr;\n\tPyObject *tup=NULL, *obj=NULL;\n\tPyObject *ret=NULL, *zero=NULL;\n\n\tif ((x==NULL) || (y==NULL)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"either both or neither\"\n\t\t\t\t\"of x and y should be given.\");\n\t\treturn NULL;\n\t}\n\n\tarr = (PyArrayObject *)PyArray_FromAny(condition, NULL, 0, 0, 0);\n\tif (arr == NULL) return NULL;\n\n\tif ((x==NULL) && (y==NULL)) {\n\t\tret = PyArray_Nonzero(arr);\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\n\n\tzero = PyInt_FromLong((long) 0);\n\n\tobj = PyArray_EnsureArray(PyArray_GenericBinaryFunction(arr, zero, n_ops.not_equal));\n\tPy_DECREF(zero);\n\tPy_DECREF(arr);\n\tif (obj == NULL) return NULL;\n\n\ttup = Py_BuildValue(\"(OO)\", y, x);\n\tif (tup == NULL) {Py_DECREF(obj); return NULL;}\n\n\tret = PyArray_Choose((PyAO *)obj, tup);\n\n\tPy_DECREF(obj);\n\tPy_DECREF(tup);\n\treturn ret;\n}\n\nstatic char doc_where[] = \"where(condition, | x, y) is shaped like condition\"\\\n\t\" and has elements of x and y where condition is respectively true or\"\\\n\t\" false. If x or y are not given, then it is equivalent to\"\\\n\t\" nonzero(condition).\";\n\nstatic PyObject *\narray_where(PyObject *ignored, PyObject *args)\n{\n\tPyObject *obj=NULL, *x=NULL, *y=NULL;\n\t\n\tif (!PyArg_ParseTuple(args, \"O|OO\", &obj, &x, &y)) return NULL;\n\n\treturn PyArray_Where(obj, x, y);\n\n}\n\nstatic char doc_register_dtype[] = \\\n\t\"register_dtype(a) registers a new type object -- gives it a typenum\";\n\nstatic PyObject *\narray_register_dtype(PyObject *dummy, PyObject *args)\n{\n\tPyObject *dtype;\n\tint ret;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &dtype)) return NULL;\n\t\n\tret = PyArray_RegisterDataType((PyTypeObject *)dtype);\n\tif (ret < 0)\n\t\treturn NULL;\n\treturn PyInt_FromLong((long) ret);\n}\n\nstatic char doc_can_cast_safely[] = \\\n\t\"can_cast_safely(from=d1, to=d2) returns True if data type d1 \"\\\n\t\"can be cast to data type d2 without losing precision.\";\n\nstatic PyObject *\narray_can_cast_safely(PyObject *dummy, PyObject *args, PyObject *kwds)\n{\n\tPyArray_Typecode d1={PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode d2={PyArray_NOTYPE, 0, 0};\n\tBool ret;\n\tPyObject *retobj;\n\tstatic char *kwlist[] = {\"from\", \"to\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O&O&\", kwlist, \n\t\t\t\t\tPyArray_TypecodeConverter, &d1,\n\t\t\t\t\tPyArray_TypecodeConverter, &d2))\n\t\treturn NULL;\n\tif (d1.type_num == PyArray_NOTYPE || \\\n\t d2.type_num == PyArray_NOTYPE) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"did not understand one of the types. \"\\\n\t\t\t\t\"'None' not accepted.\");\n\t\treturn NULL;\n\t}\n\t\t\n\tret = PyArray_CanCastTo(&d1, &d2);\n\tretobj = (ret ? Py_True : Py_False);\n\tPy_INCREF(retobj);\n\treturn retobj;\n}\n\n\nstatic struct PyMethodDef array_module_methods[] = {\n\t{\"set_string_function\", (PyCFunction)array_set_string_function, \n\t METH_VARARGS|METH_KEYWORDS, doc_set_string_function},\n\t{\"set_numeric_ops\", (PyCFunction)array_set_ops_function,\n\t METH_VARARGS|METH_KEYWORDS, doc_set_ops_function},\n\t{\"set_typeDict\", (PyCFunction)array_set_typeDict,\n\t METH_VARARGS, doc_set_typeDict},\n\n\t{\"array\",\t(PyCFunction)_array_fromobject, \n\t METH_VARARGS|METH_KEYWORDS, doc_fromobject},\n\t{\"arange\", (PyCFunction)array_arange, \n\t METH_VARARGS|METH_KEYWORDS, doc_arange},\n\t{\"zeros\",\t(PyCFunction)array_zeros, \n\t METH_VARARGS|METH_KEYWORDS, doc_zeros},\n\t{\"empty\",\t(PyCFunction)array_empty, \n\t METH_VARARGS|METH_KEYWORDS, doc_empty},\n\t{\"scalar\", (PyCFunction)array_scalar,\n\t METH_VARARGS|METH_KEYWORDS, doc_scalar},\n\t{\"where\", (PyCFunction)array_where,\n\t METH_VARARGS, doc_where},\n\t{\"fromstring\",(PyCFunction)array_fromString,\n\t METH_VARARGS|METH_KEYWORDS, doc_fromString},\n\t{\"concatenate\", (PyCFunction)array_concatenate, \n\t METH_VARARGS|METH_KEYWORDS, doc_concatenate},\n\t{\"inner\", (PyCFunction)array_innerproduct, \n\t METH_VARARGS, doc_innerproduct}, \n\t{\"dot\", (PyCFunction)array_matrixproduct, \n\t METH_VARARGS, doc_matrixproduct}, \n\t{\"_fastCopyAndTranspose\", (PyCFunction)array_fastCopyAndTranspose, \n\t METH_VARARGS, doc_fastCopyAndTranspose},\n\t{\"correlate\", (PyCFunction)array_correlate, \n\t METH_VARARGS | METH_KEYWORDS, doc_correlate},\n\t{\"frombuffer\", (PyCFunction)array_frombuffer,\n\t METH_VARARGS | METH_KEYWORDS, doc_frombuffer},\n\t{\"fromfile\", (PyCFunction)array_fromfile,\n\t METH_VARARGS | METH_KEYWORDS, doc_fromfile},\n\t{\"register_dtype\", (PyCFunction)array_register_dtype,\n\t METH_VARARGS, doc_register_dtype},\n\t{\"can_cast\", (PyCFunction)array_can_cast_safely,\n\t METH_VARARGS | METH_KEYWORDS, doc_can_cast_safely},\t\t\n\t/* {\"arrayMap\",\t(PyCFunction)array_arrayMap, \n\t METH_VARARGS, doc_arrayMap},*/\n\t\n\t{NULL,\t\tNULL, 0}\t\t/* sentinel */\n};\n\n#include \"__multiarray_api.c\"\n\n/* Establish scalar-type hierarchy */\n\n/* For dual inheritance we need to make sure that the objects being\n inherited from have the tp->mro object initialized. This is\n not necessarily true for the basic type objects of Python (it is \n checked for single inheritance but not dual in PyType_Ready).\n\n Thus, we call PyType_Ready on the standard Python Types, here.\n*/ \nstatic int\nsetup_scalartypes(PyObject *dict)\n{\n\n\tinitialize_numeric_types();\n\n if (PyType_Ready(&PyBool_Type) < 0) return -1;\n if (PyType_Ready(&PyInt_Type) < 0) return -1;\n if (PyType_Ready(&PyFloat_Type) < 0) return -1;\n if (PyType_Ready(&PyComplex_Type) < 0) return -1;\n if (PyType_Ready(&PyString_Type) < 0) return -1;\n if (PyType_Ready(&PyUnicode_Type) < 0) return -1;\n\n#define SINGLE_INHERIT(child, parent) \\\n Py##child##ArrType_Type.tp_base = &Py##parent##ArrType_Type;\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) {\t\t\\\n PyErr_Print(); \\\n PyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Tyupe\", \\\n #child); \\\n return -1;\t\t\t\t\t\t\\\n }\n \n if (PyType_Ready(&PyGenericArrType_Type) < 0)\n return -1;\n\n SINGLE_INHERIT(Numeric, Generic);\n SINGLE_INHERIT(Integer, Numeric);\n SINGLE_INHERIT(Inexact, Numeric);\n SINGLE_INHERIT(SignedInteger, Integer);\n SINGLE_INHERIT(UnsignedInteger, Integer);\n SINGLE_INHERIT(Floating, Inexact);\n SINGLE_INHERIT(ComplexFloating, Inexact);\n SINGLE_INHERIT(Flexible, Generic);\n SINGLE_INHERIT(Character, Flexible);\n\t\n#define DUAL_INHERIT(child, parent1, parent2) \\\n Py##child##ArrType_Type.tp_base = &Py##parent2##ArrType_Type;\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent2##ArrType_Type,\t\\\n\t\t\t &Py##parent1##_Type);\t\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n#define DUAL_INHERIT2(child, parent1, parent2)\t\t\t\t\\\n Py##child##ArrType_Type.tp_base = &Py##parent1##_Type;\t\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent1##_Type,\t\t\\\n\t\t\t &Py##parent2##ArrType_Type);\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n SINGLE_INHERIT(Bool, Generic);\n SINGLE_INHERIT(Byte, SignedInteger);\n SINGLE_INHERIT(Short, SignedInteger);\n#if SIZEOF_INT == SIZEOF_LONG\n DUAL_INHERIT(Int, Int, SignedInteger);\n#else\n SINGLE_INHERIT(Int, SignedInteger);\n#endif\n DUAL_INHERIT(Long, Int, SignedInteger);\n#if SIZEOF_LONGLONG == SIZEOF_LONG\n DUAL_INHERIT(LongLong, Int, SignedInteger);\n#else\n SINGLE_INHERIT(LongLong, SignedInteger);\n#endif\n\n SINGLE_INHERIT(UByte, UnsignedInteger);\n SINGLE_INHERIT(UShort, UnsignedInteger);\n SINGLE_INHERIT(UInt, UnsignedInteger);\n SINGLE_INHERIT(ULong, UnsignedInteger);\n SINGLE_INHERIT(ULongLong, UnsignedInteger);\n\n SINGLE_INHERIT(Float, Floating);\n DUAL_INHERIT(Double, Float, Floating);\n SINGLE_INHERIT(LongDouble, Floating);\n\n SINGLE_INHERIT(CFloat, ComplexFloating);\n DUAL_INHERIT(CDouble, Complex, ComplexFloating);\n SINGLE_INHERIT(CLongDouble, ComplexFloating);\n\n DUAL_INHERIT2(String, String, Character);\n DUAL_INHERIT2(Unicode, Unicode, Character);\n\t\n SINGLE_INHERIT(Void, Flexible);\n \n SINGLE_INHERIT(Object, Generic);\n\n return 0;\n\n#undef SINGLE_INHERIT\n#undef DUAL_INHERIT\n\n\t/* Clean up string and unicode array types so they act more like\n\t strings -- get their tables from the standard types.\n\t \n\t \n\t*/\n}\n\n/* place a flag dictionary in d */\n\nstatic void\nset_flaginfo(PyObject *d)\n{\n PyObject *s;\n PyObject *newd;\n \n newd = PyDict_New();\n\n PyDict_SetItemString(newd, \"OWNDATA\", s=PyInt_FromLong(OWNDATA));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"FORTRAN\", s=PyInt_FromLong(FORTRAN));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"CONTIGUOUS\", s=PyInt_FromLong(CONTIGUOUS));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"ALIGNED\", s=PyInt_FromLong(ALIGNED));\n Py_DECREF(s);\n\n PyDict_SetItemString(newd, \"NOTSWAPPED\", s=PyInt_FromLong(NOTSWAPPED));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"UPDATEIFCOPY\", s=PyInt_FromLong(UPDATEIFCOPY));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"WRITEABLE\", s=PyInt_FromLong(WRITEABLE));\n Py_DECREF(s);\n \n PyDict_SetItemString(d, \"_flagdict\", newd);\n Py_DECREF(newd);\n return;\n}\n\n\n/* Initialization function for the module */\n\nDL_EXPORT(void) initmultiarray(void) {\n\tPyObject *m, *d, *s;\n\tPyObject *c_api;\n\t\n\t/* Create the module and add the functions */\n\tm = Py_InitModule(\"multiarray\", array_module_methods);\n\tif (!m) goto err;\n\n\t/* Add some symbolic constants to the module */\n\td = PyModule_GetDict(m);\n\tif (!d) goto err; \n\n\t/* Create the module and add the functions */\n\tif (PyType_Ready(&PyBigArray_Type) < 0) \n\t\treturn;\n\n PyArray_Type.tp_base = &PyBigArray_Type;\n\n PyArray_Type.tp_as_mapping = &array_as_mapping;\n\t/* Even though, this would be inherited, it needs to be set now\n\t so that the __getitem__ will map to the as_mapping descriptor\n\t*/\n PyArray_Type.tp_as_number = &array_as_number; \n\t/* For good measure */\n\tPyArray_Type.tp_as_sequence = &array_as_sequence;\n\tPyArray_Type.tp_as_buffer = &array_as_buffer;\t\n PyArray_Type.tp_flags = (Py_TPFLAGS_DEFAULT \n\t\t\t\t | Py_TPFLAGS_BASETYPE\n\t\t\t\t | Py_TPFLAGS_CHECKTYPES);\n PyArray_Type.tp_doc = Arraytype__doc__;\n\n\tif (PyType_Ready(&PyArray_Type) < 0)\n return;\n\n if (setup_scalartypes(d) < 0) goto err;\n\n\tif (PyType_Ready(&PyArrayIter_Type) < 0)\n\t\treturn; \n \n\tif (PyType_Ready(&PyArrayMapIter_Type) < 0)\n return; \n\n\tc_api = PyCObject_FromVoidPtr((void *)PyArray_API, NULL);\n\tif (PyErr_Occurred()) goto err;\n\tPyDict_SetItemString(d, \"_ARRAY_API\", c_api);\n\tPy_DECREF(c_api);\n\tif (PyErr_Occurred()) goto err;\n\n\tMultiArrayError = PyString_FromString (\"multiarray.error\");\n\tPyDict_SetItemString (d, \"error\", MultiArrayError);\n\t\n\ts = PyString_FromString(\"3.0\");\n\tPyDict_SetItemString(d, \"__version__\", s);\n\tPy_DECREF(s);\n Py_INCREF(&PyBigArray_Type);\n\tPyDict_SetItemString(d, \"bigndarray\", (PyObject *)&PyBigArray_Type);\n Py_INCREF(&PyArray_Type);\n\tPyDict_SetItemString(d, \"ndarray\", (PyObject *)&PyArray_Type);\n Py_INCREF(&PyArrayIter_Type);\n\tPyDict_SetItemString(d, \"flatiter\", (PyObject *)&PyArrayIter_Type);\n Py_INCREF(&PyArrayMapIter_Type);\n\tPyDict_SetItemString(d, \"mapiter\", (PyObject *)&PyArrayMapIter_Type);\n\n set_flaginfo(d);\n\n\tif (set_typeinfo(d) == 0) \n return; /* otherwise there is an error */\n\n\n err:\t\n\t/* Check for errors */\n\tif (PyErr_Occurred())\n PyErr_Print();\n\t\tPy_FatalError(\"can't initialize module multiarray\");\n\n\treturn;\n}\n\n", "methods": [ { "name": "PyArray_MultiplyList", "long_name": "PyArray_MultiplyList( intp * l1 , int n)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 2, "token_count": 42, "parameters": [ "l1", "n" ], "start_line": 51, "end_line": 57, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_AxisConverter", "long_name": "PyArray_AxisConverter( PyObject * obj , int * axis)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 53, "parameters": [ "obj", "axis" ], "start_line": 61, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_CompareLists", "long_name": "PyArray_CompareLists( intp * l1 , intp * l2 , int n)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 3, "token_count": 51, "parameters": [ "l1", "l2", "n" ], "start_line": 76, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_View", "long_name": "PyArray_View( PyArrayObject * self , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 9, "token_count": 245, "parameters": [ "self", "type" ], "start_line": 86, "end_line": 134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "PyArray_Ravel", "long_name": "PyArray_Ravel( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 14, "complexity": 4, "token_count": 87, "parameters": [ "a", "fortran" ], "start_line": 137, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "PyArray_Flatten", "long_name": "PyArray_Flatten( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 32, "complexity": 5, "token_count": 162, "parameters": [ "a", "fortran" ], "start_line": 154, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Reshape", "long_name": "PyArray_Reshape( PyArrayObject * self , PyObject * shape)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 53, "parameters": [ "self", "shape" ], "start_line": 195, "end_line": 204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Newshape", "long_name": "PyArray_Newshape( PyArrayObject * self , PyArray_Dims * newdims)", "filename": "multiarraymodule.c", "nloc": 68, "complexity": 15, "token_count": 366, "parameters": [ "self", "newdims" ], "start_line": 212, "end_line": 291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 80, "top_nesting_level": 0 }, { "name": "PyArray_Squeeze", "long_name": "PyArray_Squeeze( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 4, "token_count": 192, "parameters": [ "self" ], "start_line": 299, "end_line": 330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyArray_Mean", "long_name": "PyArray_Mean( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 19, "complexity": 4, "token_count": 139, "parameters": [ "self", "axis", "rtype" ], "start_line": 334, "end_line": 355, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_Std", "long_name": "PyArray_Std( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 43, "complexity": 12, "token_count": 433, "parameters": [ "self", "axis", "rtype" ], "start_line": 358, "end_line": 413, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_Sum", "long_name": "PyArray_Sum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 417, "end_line": 427, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Prod", "long_name": "PyArray_Prod( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 430, "end_line": 440, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumSum", "long_name": "PyArray_CumSum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 443, "end_line": 453, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumProd", "long_name": "PyArray_CumProd( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 456, "end_line": 467, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Any", "long_name": "PyArray_Any( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 470, "end_line": 481, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_All", "long_name": "PyArray_All( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 484, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Compress", "long_name": "PyArray_Compress( PyArrayObject * self , PyObject * condition , int axis)", "filename": "multiarraymodule.c", "nloc": 18, "complexity": 3, "token_count": 110, "parameters": [ "self", "condition", "axis" ], "start_line": 499, "end_line": 519, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_Nonzero", "long_name": "PyArray_Nonzero( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 13, "token_count": 403, "parameters": [ "self" ], "start_line": 522, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "PyArray_Clip", "long_name": "PyArray_Clip( PyArrayObject * self , PyObject * min , PyObject * max)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 6, "token_count": 241, "parameters": [ "self", "min", "max" ], "start_line": 583, "end_line": 616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Conjugate", "long_name": "PyArray_Conjugate( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 9, "token_count": 225, "parameters": [ "self" ], "start_line": 619, "end_line": 655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_Trace", "long_name": "PyArray_Trace( PyArrayObject * self , int offset , int axis1 , int axis2 , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 81, "parameters": [ "self", "offset", "axis1", "axis2", "rtype" ], "start_line": 658, "end_line": 668, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Diagonal", "long_name": "PyArray_Diagonal( PyArrayObject * self , int offset , int axis1 , int axis2)", "filename": "multiarraymodule.c", "nloc": 104, "complexity": 24, "token_count": 798, "parameters": [ "self", "offset", "axis1", "axis2" ], "start_line": 671, "end_line": 789, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 119, "top_nesting_level": 0 }, { "name": "PyArray_AsCArray", "long_name": "PyArray_AsCArray( PyObject ** op , * ptr , intp * dims , int nd , int type_num)", "filename": "multiarraymodule.c", "nloc": 54, "complexity": 13, "token_count": 426, "parameters": [ "op", "ptr", "dims", "nd", "type_num" ], "start_line": 806, "end_line": 861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_As1D", "long_name": "PyArray_As1D( PyObject ** op , char ** ptr , int * d1 , int typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 60, "parameters": [ "op", "ptr", "d1", "typecode" ], "start_line": 866, "end_line": 874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_As2D", "long_name": "PyArray_As2D( PyObject ** op , char ** * ptr , int * d1 , int * d2 , int typecode)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 81, "parameters": [ "op", "ptr", "d1", "d2", "typecode" ], "start_line": 878, "end_line": 888, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Free", "long_name": "PyArray_Free( PyObject * op , * ptr)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 4, "token_count": 67, "parameters": [ "op", "ptr" ], "start_line": 893, "end_line": 904, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "_swap_and_concat", "long_name": "_swap_and_concat( PyObject * op , int axis , int n)", "filename": "multiarraymodule.c", "nloc": 27, "complexity": 6, "token_count": 185, "parameters": [ "op", "axis", "n" ], "start_line": 908, "end_line": 936, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_Concatenate", "long_name": "PyArray_Concatenate( PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 113, "complexity": 24, "token_count": 765, "parameters": [ "op", "axis" ], "start_line": 945, "end_line": 1072, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 128, "top_nesting_level": 0 }, { "name": "PyArray_SwapAxes", "long_name": "PyArray_SwapAxes( PyArrayObject * ap , int a1 , int a2)", "filename": "multiarraymodule.c", "nloc": 37, "complexity": 12, "token_count": 227, "parameters": [ "ap", "a1", "a2" ], "start_line": 1075, "end_line": 1114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_Transpose", "long_name": "PyArray_Transpose( PyArrayObject * ap , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 49, "complexity": 15, "token_count": 403, "parameters": [ "ap", "op" ], "start_line": 1118, "end_line": 1177, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "PyArray_Repeat", "long_name": "PyArray_Repeat( PyArrayObject * aop , PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 75, "complexity": 15, "token_count": 520, "parameters": [ "aop", "op", "axis" ], "start_line": 1180, "end_line": 1272, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 93, "top_nesting_level": 0 }, { "name": "PyArray_Choose", "long_name": "PyArray_Choose( PyArrayObject * ip , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 89, "complexity": 18, "token_count": 650, "parameters": [ "ip", "op" ], "start_line": 1276, "end_line": 1388, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 113, "top_nesting_level": 0 }, { "name": "qsortCompare", "long_name": "qsortCompare( const * a , const * b)", "filename": "multiarraymodule.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "a", "b" ], "start_line": 1396, "end_line": 1399, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "PyArray_Sort", "long_name": "PyArray_Sort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 7, "token_count": 250, "parameters": [ "op", "axis" ], "start_line": 1421, "end_line": 1470, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "argsort_static_compare", "long_name": "argsort_static_compare( const * ip1 , const * ip2)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 1, "token_count": 63, "parameters": [ "ip1", "ip2" ], "start_line": 1476, "end_line": 1484, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_ArgSort", "long_name": "PyArray_ArgSort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 48, "complexity": 8, "token_count": 350, "parameters": [ "op", "axis" ], "start_line": 1487, "end_line": 1546, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "local_where", "long_name": "local_where( PyArrayObject * ap1 , PyArrayObject * ap2 , PyArrayObject * ret)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 7, "token_count": 243, "parameters": [ "ap1", "ap2", "ret" ], "start_line": 1549, "end_line": 1584, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_SearchSorted", "long_name": "PyArray_SearchSorted( PyArrayObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 33, "complexity": 5, "token_count": 223, "parameters": [ "op1", "op2" ], "start_line": 1587, "end_line": 1632, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "PyArray_InnerProduct", "long_name": "PyArray_InnerProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 83, "complexity": 17, "token_count": 657, "parameters": [ "op1", "op2" ], "start_line": 1640, "end_line": 1743, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 104, "top_nesting_level": 0 }, { "name": "PyArray_MatrixProduct", "long_name": "PyArray_MatrixProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 99, "complexity": 20, "token_count": 760, "parameters": [ "op1", "op2" ], "start_line": 1748, "end_line": 1870, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "PyArray_CopyAndTranspose", "long_name": "PyArray_CopyAndTranspose( PyObject * op)", "filename": "multiarraymodule.c", "nloc": 44, "complexity": 6, "token_count": 278, "parameters": [ "op" ], "start_line": 1873, "end_line": 1924, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "PyArray_Correlate", "long_name": "PyArray_Correlate( PyObject * op1 , PyObject * op2 , int mode)", "filename": "multiarraymodule.c", "nloc": 87, "complexity": 13, "token_count": 602, "parameters": [ "op1", "op2", "mode" ], "start_line": 1927, "end_line": 2023, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 97, "top_nesting_level": 0 }, { "name": "PyArray_ArgMin", "long_name": "PyArray_ArgMin( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 5, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2026, "end_line": 2051, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_Max", "long_name": "PyArray_Max( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2054, "end_line": 2065, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Min", "long_name": "PyArray_Min( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2068, "end_line": 2079, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Ptp", "long_name": "PyArray_Ptp( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 4, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2082, "end_line": 2105, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "PyArray_ArgMax", "long_name": "PyArray_ArgMax( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 47, "complexity": 7, "token_count": 322, "parameters": [ "op", "axis" ], "start_line": 2109, "end_line": 2166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_Take", "long_name": "PyArray_Take( PyArrayObject * self0 , PyObject * indices0 , int axis)", "filename": "multiarraymodule.c", "nloc": 62, "complexity": 12, "token_count": 468, "parameters": [ "self0", "indices0", "axis" ], "start_line": 2170, "end_line": 2242, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 73, "top_nesting_level": 0 }, { "name": "PyArray_Put", "long_name": "PyArray_Put( PyArrayObject * self , PyObject * indices0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 47, "complexity": 10, "token_count": 319, "parameters": [ "self", "indices0", "values0" ], "start_line": 2245, "end_line": 2297, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "PyArray_PutMask", "long_name": "PyArray_PutMask( PyArrayObject * self , PyObject * mask0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 10, "token_count": 334, "parameters": [ "self", "mask0", "values0" ], "start_line": 2300, "end_line": 2362, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_Converter", "long_name": "PyArray_Converter( PyObject * object , PyObject ** address)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 66, "parameters": [ "object", "address" ], "start_line": 2374, "end_line": 2386, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_BoolConverter", "long_name": "PyArray_BoolConverter( PyObject * object , Bool * val)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 3, "token_count": 42, "parameters": [ "object", "val" ], "start_line": 2389, "end_line": 2395, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_TypestrConvert", "long_name": "PyArray_TypestrConvert( int itemsize , int gentype)", "filename": "multiarraymodule.c", "nloc": 90, "complexity": 33, "token_count": 284, "parameters": [ "itemsize", "gentype" ], "start_line": 2399, "end_line": 2508, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "PyArray_BufferConverter", "long_name": "PyArray_BufferConverter( PyObject * obj , PyArray_Chunk * buf)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 6, "token_count": 147, "parameters": [ "obj", "buf" ], "start_line": 2523, "end_line": 2548, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_IntpConverter", "long_name": "PyArray_IntpConverter( PyObject * obj , PyArray_Dims * seq)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 10, "token_count": 186, "parameters": [ "obj", "seq" ], "start_line": 2560, "end_line": 2596, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_TypecodeConverter", "long_name": "PyArray_TypecodeConverter( PyObject * obj , PyArray_Typecode * at)", "filename": "multiarraymodule.c", "nloc": 108, "complexity": 33, "token_count": 639, "parameters": [ "obj", "at" ], "start_line": 2605, "end_line": 2743, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "PyArray_EquivalentTypes", "long_name": "PyArray_EquivalentTypes( PyArray_Typecode * typ1 , PyArray_Typecode * typ2)", "filename": "multiarraymodule.c", "nloc": 24, "complexity": 8, "token_count": 162, "parameters": [ "typ1", "typ2" ], "start_line": 2751, "end_line": 2778, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyArray_EquivArrTypes", "long_name": "PyArray_EquivArrTypes( PyArrayObject * a1 , PyArrayObject * a2)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 1, "token_count": 56, "parameters": [ "a1", "a2" ], "start_line": 2781, "end_line": 2787, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "_array_fromobject", "long_name": "_array_fromobject( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 38, "complexity": 9, "token_count": 254, "parameters": [ "ignored", "args", "kws" ], "start_line": 2798, "end_line": 2842, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_Empty", "long_name": "PyArray_Empty( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 15, "complexity": 3, "token_count": 99, "parameters": [ "nd", "dims", "type" ], "start_line": 2845, "end_line": 2861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "array_empty", "long_name": "array_empty( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2867, "end_line": 2891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_scalar", "long_name": "array_scalar( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 11, "token_count": 290, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2896, "end_line": 2960, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 65, "top_nesting_level": 0 }, { "name": "PyArray_Zeros", "long_name": "PyArray_Zeros( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 3, "token_count": 133, "parameters": [ "nd", "dims", "type" ], "start_line": 2964, "end_line": 2986, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_zeros", "long_name": "array_zeros( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2992, "end_line": 3016, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_set_typeDict", "long_name": "array_set_typeDict( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "ignored", "args" ], "start_line": 3023, "end_line": 3032, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_fromString", "long_name": "array_fromString( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 8, "token_count": 283, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3037, "end_line": 3092, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "_fill_in_itemsize", "long_name": "_fill_in_itemsize( PyArray_Typecode * typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 42, "parameters": [ "typecode" ], "start_line": 3108, "end_line": 3115, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_FromFile", "long_name": "PyArray_FromFile( FILE * fp , PyArray_Typecode * typecode , intp num , char * sep)", "filename": "multiarraymodule.c", "nloc": 130, "complexity": 26, "token_count": 764, "parameters": [ "fp", "typecode", "num", "sep" ], "start_line": 3119, "end_line": 3259, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 141, "top_nesting_level": 0 }, { "name": "array_fromfile", "long_name": "array_fromfile( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 34, "complexity": 6, "token_count": 221, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3262, "end_line": 3297, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_FromBuffer", "long_name": "PyArray_FromBuffer( PyObject * buf , PyArray_Typecode * type , intp count , int swapped)", "filename": "multiarraymodule.c", "nloc": 58, "complexity": 11, "token_count": 306, "parameters": [ "buf", "type", "count", "swapped" ], "start_line": 3300, "end_line": 3363, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "array_frombuffer", "long_name": "array_frombuffer( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 16, "complexity": 2, "token_count": 115, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3368, "end_line": 3385, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_concatenate", "long_name": "array_concatenate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 73, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3392, "end_line": 3403, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_innerproduct", "long_name": "array_innerproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3410, "end_line": 3416, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_matrixproduct", "long_name": "array_matrixproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3423, "end_line": 3429, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_fastCopyAndTranspose", "long_name": "array_fastCopyAndTranspose( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 41, "parameters": [ "dummy", "args" ], "start_line": 3433, "end_line": 3439, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_correlate", "long_name": "array_correlate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 81, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3443, "end_line": 3452, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Arange", "long_name": "PyArray_Arange( double start , double stop , double step , int type_num)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 4, "token_count": 229, "parameters": [ "start", "stop", "step", "type_num" ], "start_line": 3456, "end_line": 3489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_arange", "long_name": "array_arange( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 10, "token_count": 258, "parameters": [ "ignored", "args", "kws" ], "start_line": 3495, "end_line": 3543, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "array_set_string_function", "long_name": "array_set_string_function( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 78, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3563, "end_line": 3574, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_set_ops_function", "long_name": "array_set_ops_function( PyObject * self , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 12, "complexity": 3, "token_count": 67, "parameters": [ "self", "args", "kwds" ], "start_line": 3580, "end_line": 3597, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Where", "long_name": "PyArray_Where( PyObject * condition , PyObject * x , PyObject * y)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 8, "token_count": 226, "parameters": [ "condition", "x", "y" ], "start_line": 3601, "end_line": 3637, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "array_where", "long_name": "array_where( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 2, "token_count": 60, "parameters": [ "ignored", "args" ], "start_line": 3645, "end_line": 3653, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_register_dtype", "long_name": "array_register_dtype( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 3, "token_count": 64, "parameters": [ "dummy", "args" ], "start_line": 3659, "end_line": 3670, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_can_cast_safely", "long_name": "array_can_cast_safely( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 5, "token_count": 145, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3677, "end_line": 3701, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "setup_scalartypes", "long_name": "setup_scalartypes( PyObject * dict)", "filename": "multiarraymodule.c", "nloc": 45, "complexity": 10, "token_count": 351, "parameters": [ "dict" ], "start_line": 3762, "end_line": 3871, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "set_flaginfo", "long_name": "set_flaginfo( PyObject * d)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 1, "token_count": 171, "parameters": [ "d" ], "start_line": 3876, "end_line": 3902, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "initmultiarray", "long_name": "initmultiarray()", "filename": "multiarraymodule.c", "nloc": 52, "complexity": 12, "token_count": 361, "parameters": [], "start_line": 3907, "end_line": 3983, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyArray_MultiplyList", "long_name": "PyArray_MultiplyList( intp * l1 , int n)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 2, "token_count": 42, "parameters": [ "l1", "n" ], "start_line": 51, "end_line": 57, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_AxisConverter", "long_name": "PyArray_AxisConverter( PyObject * obj , int * axis)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 53, "parameters": [ "obj", "axis" ], "start_line": 61, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_CompareLists", "long_name": "PyArray_CompareLists( intp * l1 , intp * l2 , int n)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 3, "token_count": 51, "parameters": [ "l1", "l2", "n" ], "start_line": 76, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_View", "long_name": "PyArray_View( PyArrayObject * self , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 9, "token_count": 241, "parameters": [ "self", "type" ], "start_line": 86, "end_line": 134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "PyArray_Ravel", "long_name": "PyArray_Ravel( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 14, "complexity": 4, "token_count": 87, "parameters": [ "a", "fortran" ], "start_line": 137, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "PyArray_Flatten", "long_name": "PyArray_Flatten( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 32, "complexity": 5, "token_count": 158, "parameters": [ "a", "fortran" ], "start_line": 154, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Reshape", "long_name": "PyArray_Reshape( PyArrayObject * self , PyObject * shape)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 53, "parameters": [ "self", "shape" ], "start_line": 195, "end_line": 204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Newshape", "long_name": "PyArray_Newshape( PyArrayObject * self , PyArray_Dims * newdims)", "filename": "multiarraymodule.c", "nloc": 68, "complexity": 15, "token_count": 362, "parameters": [ "self", "newdims" ], "start_line": 212, "end_line": 291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 80, "top_nesting_level": 0 }, { "name": "PyArray_Squeeze", "long_name": "PyArray_Squeeze( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 4, "token_count": 188, "parameters": [ "self" ], "start_line": 299, "end_line": 330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyArray_Mean", "long_name": "PyArray_Mean( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 19, "complexity": 4, "token_count": 139, "parameters": [ "self", "axis", "rtype" ], "start_line": 334, "end_line": 355, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_Std", "long_name": "PyArray_Std( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 43, "complexity": 12, "token_count": 433, "parameters": [ "self", "axis", "rtype" ], "start_line": 358, "end_line": 413, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_Sum", "long_name": "PyArray_Sum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 417, "end_line": 427, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Prod", "long_name": "PyArray_Prod( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 430, "end_line": 440, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumSum", "long_name": "PyArray_CumSum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 443, "end_line": 453, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumProd", "long_name": "PyArray_CumProd( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 456, "end_line": 467, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Any", "long_name": "PyArray_Any( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 470, "end_line": 481, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_All", "long_name": "PyArray_All( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 484, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Compress", "long_name": "PyArray_Compress( PyArrayObject * self , PyObject * condition , int axis)", "filename": "multiarraymodule.c", "nloc": 18, "complexity": 3, "token_count": 110, "parameters": [ "self", "condition", "axis" ], "start_line": 499, "end_line": 519, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_Nonzero", "long_name": "PyArray_Nonzero( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 13, "token_count": 395, "parameters": [ "self" ], "start_line": 522, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "PyArray_Clip", "long_name": "PyArray_Clip( PyArrayObject * self , PyObject * min , PyObject * max)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 6, "token_count": 241, "parameters": [ "self", "min", "max" ], "start_line": 583, "end_line": 616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Conjugate", "long_name": "PyArray_Conjugate( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 9, "token_count": 225, "parameters": [ "self" ], "start_line": 619, "end_line": 655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_Trace", "long_name": "PyArray_Trace( PyArrayObject * self , int offset , int axis1 , int axis2 , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 81, "parameters": [ "self", "offset", "axis1", "axis2", "rtype" ], "start_line": 658, "end_line": 668, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Diagonal", "long_name": "PyArray_Diagonal( PyArrayObject * self , int offset , int axis1 , int axis2)", "filename": "multiarraymodule.c", "nloc": 104, "complexity": 24, "token_count": 798, "parameters": [ "self", "offset", "axis1", "axis2" ], "start_line": 671, "end_line": 789, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 119, "top_nesting_level": 0 }, { "name": "PyArray_AsCArray", "long_name": "PyArray_AsCArray( PyObject ** op , * ptr , intp * dims , int nd , int type_num)", "filename": "multiarraymodule.c", "nloc": 54, "complexity": 13, "token_count": 426, "parameters": [ "op", "ptr", "dims", "nd", "type_num" ], "start_line": 806, "end_line": 861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_As1D", "long_name": "PyArray_As1D( PyObject ** op , char ** ptr , int * d1 , int typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 60, "parameters": [ "op", "ptr", "d1", "typecode" ], "start_line": 866, "end_line": 874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_As2D", "long_name": "PyArray_As2D( PyObject ** op , char ** * ptr , int * d1 , int * d2 , int typecode)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 81, "parameters": [ "op", "ptr", "d1", "d2", "typecode" ], "start_line": 878, "end_line": 888, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Free", "long_name": "PyArray_Free( PyObject * op , * ptr)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 4, "token_count": 67, "parameters": [ "op", "ptr" ], "start_line": 893, "end_line": 904, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "_swap_and_concat", "long_name": "_swap_and_concat( PyObject * op , int axis , int n)", "filename": "multiarraymodule.c", "nloc": 27, "complexity": 6, "token_count": 185, "parameters": [ "op", "axis", "n" ], "start_line": 908, "end_line": 936, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_Concatenate", "long_name": "PyArray_Concatenate( PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 112, "complexity": 24, "token_count": 761, "parameters": [ "op", "axis" ], "start_line": 945, "end_line": 1071, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 127, "top_nesting_level": 0 }, { "name": "PyArray_SwapAxes", "long_name": "PyArray_SwapAxes( PyArrayObject * ap , int a1 , int a2)", "filename": "multiarraymodule.c", "nloc": 37, "complexity": 12, "token_count": 227, "parameters": [ "ap", "a1", "a2" ], "start_line": 1074, "end_line": 1113, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_Transpose", "long_name": "PyArray_Transpose( PyArrayObject * ap , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 49, "complexity": 15, "token_count": 399, "parameters": [ "ap", "op" ], "start_line": 1117, "end_line": 1176, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "PyArray_Repeat", "long_name": "PyArray_Repeat( PyArrayObject * aop , PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 75, "complexity": 15, "token_count": 516, "parameters": [ "aop", "op", "axis" ], "start_line": 1179, "end_line": 1271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 93, "top_nesting_level": 0 }, { "name": "PyArray_Choose", "long_name": "PyArray_Choose( PyArrayObject * ip , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 89, "complexity": 18, "token_count": 646, "parameters": [ "ip", "op" ], "start_line": 1275, "end_line": 1387, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 113, "top_nesting_level": 0 }, { "name": "qsortCompare", "long_name": "qsortCompare( const * a , const * b)", "filename": "multiarraymodule.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "a", "b" ], "start_line": 1395, "end_line": 1398, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "PyArray_Sort", "long_name": "PyArray_Sort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 7, "token_count": 250, "parameters": [ "op", "axis" ], "start_line": 1420, "end_line": 1469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "argsort_static_compare", "long_name": "argsort_static_compare( const * ip1 , const * ip2)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 1, "token_count": 63, "parameters": [ "ip1", "ip2" ], "start_line": 1475, "end_line": 1483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_ArgSort", "long_name": "PyArray_ArgSort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 48, "complexity": 8, "token_count": 346, "parameters": [ "op", "axis" ], "start_line": 1486, "end_line": 1545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "local_where", "long_name": "local_where( PyArrayObject * ap1 , PyArrayObject * ap2 , PyArrayObject * ret)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 7, "token_count": 243, "parameters": [ "ap1", "ap2", "ret" ], "start_line": 1548, "end_line": 1583, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_SearchSorted", "long_name": "PyArray_SearchSorted( PyArrayObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 33, "complexity": 5, "token_count": 219, "parameters": [ "op1", "op2" ], "start_line": 1586, "end_line": 1631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "PyArray_InnerProduct", "long_name": "PyArray_InnerProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 82, "complexity": 17, "token_count": 653, "parameters": [ "op1", "op2" ], "start_line": 1639, "end_line": 1741, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 103, "top_nesting_level": 0 }, { "name": "PyArray_MatrixProduct", "long_name": "PyArray_MatrixProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 98, "complexity": 20, "token_count": 756, "parameters": [ "op1", "op2" ], "start_line": 1746, "end_line": 1867, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 122, "top_nesting_level": 0 }, { "name": "PyArray_CopyAndTranspose", "long_name": "PyArray_CopyAndTranspose( PyObject * op)", "filename": "multiarraymodule.c", "nloc": 44, "complexity": 6, "token_count": 282, "parameters": [ "op" ], "start_line": 1870, "end_line": 1921, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "PyArray_Correlate", "long_name": "PyArray_Correlate( PyObject * op1 , PyObject * op2 , int mode)", "filename": "multiarraymodule.c", "nloc": 86, "complexity": 13, "token_count": 598, "parameters": [ "op1", "op2", "mode" ], "start_line": 1924, "end_line": 2019, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "PyArray_ArgMin", "long_name": "PyArray_ArgMin( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 5, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2022, "end_line": 2047, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_Max", "long_name": "PyArray_Max( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2050, "end_line": 2061, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Min", "long_name": "PyArray_Min( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2064, "end_line": 2075, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Ptp", "long_name": "PyArray_Ptp( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 4, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2078, "end_line": 2101, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "PyArray_ArgMax", "long_name": "PyArray_ArgMax( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 46, "complexity": 7, "token_count": 318, "parameters": [ "op", "axis" ], "start_line": 2105, "end_line": 2161, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 57, "top_nesting_level": 0 }, { "name": "PyArray_Take", "long_name": "PyArray_Take( PyArrayObject * self0 , PyObject * indices0 , int axis)", "filename": "multiarraymodule.c", "nloc": 61, "complexity": 12, "token_count": 464, "parameters": [ "self0", "indices0", "axis" ], "start_line": 2165, "end_line": 2236, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_Put", "long_name": "PyArray_Put( PyArrayObject * self , PyObject * indices0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 47, "complexity": 10, "token_count": 319, "parameters": [ "self", "indices0", "values0" ], "start_line": 2239, "end_line": 2291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "PyArray_PutMask", "long_name": "PyArray_PutMask( PyArrayObject * self , PyObject * mask0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 10, "token_count": 334, "parameters": [ "self", "mask0", "values0" ], "start_line": 2294, "end_line": 2356, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_Converter", "long_name": "PyArray_Converter( PyObject * object , PyObject ** address)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 66, "parameters": [ "object", "address" ], "start_line": 2368, "end_line": 2380, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_BoolConverter", "long_name": "PyArray_BoolConverter( PyObject * object , Bool * val)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 3, "token_count": 42, "parameters": [ "object", "val" ], "start_line": 2383, "end_line": 2389, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_TypestrConvert", "long_name": "PyArray_TypestrConvert( int itemsize , int gentype)", "filename": "multiarraymodule.c", "nloc": 90, "complexity": 33, "token_count": 284, "parameters": [ "itemsize", "gentype" ], "start_line": 2393, "end_line": 2502, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "PyArray_BufferConverter", "long_name": "PyArray_BufferConverter( PyObject * obj , PyArray_Chunk * buf)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 6, "token_count": 147, "parameters": [ "obj", "buf" ], "start_line": 2517, "end_line": 2542, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_IntpConverter", "long_name": "PyArray_IntpConverter( PyObject * obj , PyArray_Dims * seq)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 10, "token_count": 186, "parameters": [ "obj", "seq" ], "start_line": 2554, "end_line": 2590, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_TypecodeConverter", "long_name": "PyArray_TypecodeConverter( PyObject * obj , PyArray_Typecode * at)", "filename": "multiarraymodule.c", "nloc": 108, "complexity": 33, "token_count": 639, "parameters": [ "obj", "at" ], "start_line": 2599, "end_line": 2737, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "PyArray_EquivalentTypes", "long_name": "PyArray_EquivalentTypes( PyArray_Typecode * typ1 , PyArray_Typecode * typ2)", "filename": "multiarraymodule.c", "nloc": 24, "complexity": 8, "token_count": 162, "parameters": [ "typ1", "typ2" ], "start_line": 2745, "end_line": 2772, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyArray_EquivArrTypes", "long_name": "PyArray_EquivArrTypes( PyArrayObject * a1 , PyArrayObject * a2)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 1, "token_count": 56, "parameters": [ "a1", "a2" ], "start_line": 2775, "end_line": 2781, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "_array_fromobject", "long_name": "_array_fromobject( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 38, "complexity": 9, "token_count": 254, "parameters": [ "ignored", "args", "kws" ], "start_line": 2792, "end_line": 2836, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_Empty", "long_name": "PyArray_Empty( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 15, "complexity": 3, "token_count": 99, "parameters": [ "nd", "dims", "type" ], "start_line": 2839, "end_line": 2855, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "array_empty", "long_name": "array_empty( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2861, "end_line": 2885, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_scalar", "long_name": "array_scalar( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 11, "token_count": 290, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2890, "end_line": 2954, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 65, "top_nesting_level": 0 }, { "name": "PyArray_Zeros", "long_name": "PyArray_Zeros( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 3, "token_count": 133, "parameters": [ "nd", "dims", "type" ], "start_line": 2958, "end_line": 2980, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_zeros", "long_name": "array_zeros( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2986, "end_line": 3010, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_set_typeDict", "long_name": "array_set_typeDict( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "ignored", "args" ], "start_line": 3017, "end_line": 3026, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_fromString", "long_name": "array_fromString( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 8, "token_count": 283, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3031, "end_line": 3086, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "_fill_in_itemsize", "long_name": "_fill_in_itemsize( PyArray_Typecode * typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 42, "parameters": [ "typecode" ], "start_line": 3102, "end_line": 3109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_FromFile", "long_name": "PyArray_FromFile( FILE * fp , PyArray_Typecode * typecode , intp num , char * sep)", "filename": "multiarraymodule.c", "nloc": 130, "complexity": 26, "token_count": 764, "parameters": [ "fp", "typecode", "num", "sep" ], "start_line": 3113, "end_line": 3253, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 141, "top_nesting_level": 0 }, { "name": "array_fromfile", "long_name": "array_fromfile( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 34, "complexity": 6, "token_count": 221, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3256, "end_line": 3291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_FromBuffer", "long_name": "PyArray_FromBuffer( PyObject * buf , PyArray_Typecode * type , intp count , int swapped)", "filename": "multiarraymodule.c", "nloc": 58, "complexity": 11, "token_count": 306, "parameters": [ "buf", "type", "count", "swapped" ], "start_line": 3294, "end_line": 3357, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "array_frombuffer", "long_name": "array_frombuffer( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 16, "complexity": 2, "token_count": 115, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3362, "end_line": 3379, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_concatenate", "long_name": "array_concatenate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 73, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3386, "end_line": 3397, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_innerproduct", "long_name": "array_innerproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3404, "end_line": 3410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_matrixproduct", "long_name": "array_matrixproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3417, "end_line": 3423, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_fastCopyAndTranspose", "long_name": "array_fastCopyAndTranspose( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 41, "parameters": [ "dummy", "args" ], "start_line": 3427, "end_line": 3433, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_correlate", "long_name": "array_correlate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 81, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3437, "end_line": 3446, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Arange", "long_name": "PyArray_Arange( double start , double stop , double step , int type_num)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 4, "token_count": 229, "parameters": [ "start", "stop", "step", "type_num" ], "start_line": 3450, "end_line": 3483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_arange", "long_name": "array_arange( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 10, "token_count": 258, "parameters": [ "ignored", "args", "kws" ], "start_line": 3489, "end_line": 3537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "array_set_string_function", "long_name": "array_set_string_function( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 78, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3557, "end_line": 3568, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_set_ops_function", "long_name": "array_set_ops_function( PyObject * self , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 12, "complexity": 3, "token_count": 67, "parameters": [ "self", "args", "kwds" ], "start_line": 3574, "end_line": 3591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Where", "long_name": "PyArray_Where( PyObject * condition , PyObject * x , PyObject * y)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 8, "token_count": 226, "parameters": [ "condition", "x", "y" ], "start_line": 3595, "end_line": 3631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "array_where", "long_name": "array_where( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 2, "token_count": 60, "parameters": [ "ignored", "args" ], "start_line": 3639, "end_line": 3647, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_register_dtype", "long_name": "array_register_dtype( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 3, "token_count": 64, "parameters": [ "dummy", "args" ], "start_line": 3653, "end_line": 3664, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_can_cast_safely", "long_name": "array_can_cast_safely( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 5, "token_count": 145, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3671, "end_line": 3695, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "setup_scalartypes", "long_name": "setup_scalartypes( PyObject * dict)", "filename": "multiarraymodule.c", "nloc": 45, "complexity": 10, "token_count": 351, "parameters": [ "dict" ], "start_line": 3756, "end_line": 3865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "set_flaginfo", "long_name": "set_flaginfo( PyObject * d)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 1, "token_count": 171, "parameters": [ "d" ], "start_line": 3870, "end_line": 3896, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "initmultiarray", "long_name": "initmultiarray()", "filename": "multiarraymodule.c", "nloc": 52, "complexity": 12, "token_count": 361, "parameters": [], "start_line": 3901, "end_line": 3977, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "PyArray_ArgMax", "long_name": "PyArray_ArgMax( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 47, "complexity": 7, "token_count": 322, "parameters": [ "op", "axis" ], "start_line": 2109, "end_line": 2166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_Take", "long_name": "PyArray_Take( PyArrayObject * self0 , PyObject * indices0 , int axis)", "filename": "multiarraymodule.c", "nloc": 62, "complexity": 12, "token_count": 468, "parameters": [ "self0", "indices0", "axis" ], "start_line": 2170, "end_line": 2242, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 73, "top_nesting_level": 0 }, { "name": "PyArray_CopyAndTranspose", "long_name": "PyArray_CopyAndTranspose( PyObject * op)", "filename": "multiarraymodule.c", "nloc": 44, "complexity": 6, "token_count": 278, "parameters": [ "op" ], "start_line": 1873, "end_line": 1924, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "PyArray_Transpose", "long_name": "PyArray_Transpose( PyArrayObject * ap , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 49, "complexity": 15, "token_count": 403, "parameters": [ "ap", "op" ], "start_line": 1118, "end_line": 1177, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "PyArray_InnerProduct", "long_name": "PyArray_InnerProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 83, "complexity": 17, "token_count": 657, "parameters": [ "op1", "op2" ], "start_line": 1640, "end_line": 1743, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 104, "top_nesting_level": 0 }, { "name": "PyArray_Nonzero", "long_name": "PyArray_Nonzero( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 13, "token_count": 403, "parameters": [ "self" ], "start_line": 522, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "PyArray_Concatenate", "long_name": "PyArray_Concatenate( PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 113, "complexity": 24, "token_count": 765, "parameters": [ "op", "axis" ], "start_line": 945, "end_line": 1072, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 128, "top_nesting_level": 0 }, { "name": "PyArray_ArgSort", "long_name": "PyArray_ArgSort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 48, "complexity": 8, "token_count": 350, "parameters": [ "op", "axis" ], "start_line": 1487, "end_line": 1546, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "PyArray_Squeeze", "long_name": "PyArray_Squeeze( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 4, "token_count": 192, "parameters": [ "self" ], "start_line": 299, "end_line": 330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyArray_View", "long_name": "PyArray_View( PyArrayObject * self , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 9, "token_count": 245, "parameters": [ "self", "type" ], "start_line": 86, "end_line": 134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "PyArray_Correlate", "long_name": "PyArray_Correlate( PyObject * op1 , PyObject * op2 , int mode)", "filename": "multiarraymodule.c", "nloc": 87, "complexity": 13, "token_count": 602, "parameters": [ "op1", "op2", "mode" ], "start_line": 1927, "end_line": 2023, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 97, "top_nesting_level": 0 }, { "name": "PyArray_MatrixProduct", "long_name": "PyArray_MatrixProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 99, "complexity": 20, "token_count": 760, "parameters": [ "op1", "op2" ], "start_line": 1748, "end_line": 1870, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "PyArray_SearchSorted", "long_name": "PyArray_SearchSorted( PyArrayObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 33, "complexity": 5, "token_count": 223, "parameters": [ "op1", "op2" ], "start_line": 1587, "end_line": 1632, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "PyArray_Newshape", "long_name": "PyArray_Newshape( PyArrayObject * self , PyArray_Dims * newdims)", "filename": "multiarraymodule.c", "nloc": 68, "complexity": 15, "token_count": 366, "parameters": [ "self", "newdims" ], "start_line": 212, "end_line": 291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 80, "top_nesting_level": 0 }, { "name": "PyArray_Flatten", "long_name": "PyArray_Flatten( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 32, "complexity": 5, "token_count": 162, "parameters": [ "a", "fortran" ], "start_line": 154, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Choose", "long_name": "PyArray_Choose( PyArrayObject * ip , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 89, "complexity": 18, "token_count": 650, "parameters": [ "ip", "op" ], "start_line": 1276, "end_line": 1388, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 113, "top_nesting_level": 0 }, { "name": "PyArray_Repeat", "long_name": "PyArray_Repeat( PyArrayObject * aop , PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 75, "complexity": 15, "token_count": 520, "parameters": [ "aop", "op", "axis" ], "start_line": 1180, "end_line": 1272, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 93, "top_nesting_level": 0 } ], "nloc": 3082, "complexity": 636, "token_count": 20237, "diff_parsed": { "added": [ "\t\t\t self->flags, (PyObject *)self);", "\t\t\t 0, (PyObject *)a);", "\t\t\t\t self->flags, (PyObject *)self);", "\t\t\t (PyObject *)self);", "\t\t\t\t NULL, NULL, 0, 0, (PyObject *)self);", "\t\t\t\t\t (PyObject *)self);", "\t\t\t\t\t type_num, NULL, NULL, 0, 0,", " (PyObject *)ret);", "\t\t\t\t\t (PyObject *)ap);", "\t\t\t\t\t (PyObject *)aop);", "\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap);", "\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap);", "\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap2);", " (PyObject *)", " (PyObject *)", "\t\t\t NULL, NULL, elsize, 0, arr);", "\t\t\t\t\t NULL, NULL, 0, 0,", " (PyObject *)ap1);", "\t\t\t\t\t NULL, NULL, 0, 0,", " (PyObject *)ap);", "\t\t\t\t\t NULL, NULL, 0, 0,", " (PyObject *)self);" ], "deleted": [ "\t\t\t self->flags, self);", "\t\t\t 0, a);", "\t\t\t\t self->flags, self);", "\t\t\t self);", "\t\t\t\t NULL, NULL, 0, 0, self);", "\t\t\t\t\t self);", "\t\t\t\t\t type_num, NULL, NULL, 0, 0, ret);", "\t\t\t\t\t ap);", "\t\t\t\t\t aop);", "\t\t\t\t\t NULL, NULL, 0, 0, ap);", "\t\t\t\t\t NULL, NULL, 0, 0, ap);", "\t\t\t\t\t NULL, NULL, 0, 0, ap2);", "\t\t\t NULL, NULL, elsize, 0, (PyArrayObject *)arr);", "\t\t\t\t\t NULL, NULL, 0, 0, ap1);", "\t\t\t\t\t NULL, NULL, 0, 0, ap);", "\t\t\t\t\t NULL, NULL, 0, 0, self);" ] } } ] }, { "hash": "c5e4fbaf18c01b35faa523005d68e4b10319e77a", "msg": "Fixed up one change in PyArray_New", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T18:30:23+00:00", "author_timezone": 0, "committer_date": "2005-10-07T18:30:23+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "3f0cd73d77fafad5a41748b288863ab0b37628d8" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 3, "insertions": 3, "lines": 6, "files": 1, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": "scipy/base/src/ufuncobject.c", "new_path": "scipy/base/src/ufuncobject.c", "filename": "ufuncobject.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -1603,12 +1603,12 @@ construct_reduce(PyUFuncObject *self, PyArrayObject **arr, int axis,\n \t\t}\n \t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n \t\t\tPyArray_New(aar->ob_type, aar->nd-1, loop_i, otype, \n-\t\t\t\t NULL, NULL, 0, 0, aar);\n+\t\t\t\t NULL, NULL, 0, 0, (PyObject *)aar);\n \t\tbreak;\n \tcase UFUNC_ACCUMULATE:\n \t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n \t\t\tPyArray_New(aar->ob_type, aar->nd, aar->dimensions, \n-\t\t\t\t otype, NULL, NULL, 0, 0, aar);\n+\t\t\t\t otype, NULL, NULL, 0, 0, (PyObject *)aar);\n \t\tbreak;\n \tcase UFUNC_REDUCEAT:\n \t\tmemcpy(loop_i, aar->dimensions, nd*sizeof(intp));\n@@ -1616,7 +1616,7 @@ construct_reduce(PyUFuncObject *self, PyArrayObject **arr, int axis,\n \t\tloop_i[axis] = ind_size; \n \t\tloop->ret = (PyArrayObject *)\\\n \t\t\tPyArray_New(aar->ob_type, aar->nd, loop_i, otype,\n-\t\t\t\t NULL, NULL, 0, 0, aar);\n+\t\t\t\t NULL, NULL, 0, 0, (PyObject *)aar);\n \t\tif (loop->ret == NULL) goto fail;\n \t\tif (ind_size == 0) {\n \t\t\tloop->meth = ZERODIM_REDUCELOOP;\n", "added_lines": 3, "deleted_lines": 3, "source_code": "\n/*\n Python Universal Functions Object -- Math for all types, plus fast \n arrays math\n \n Full description\n \n This supports mathematical (and Boolean) functions on arrays and other python\n objects. Math on large arrays of basic C types is rather efficient.\n\n Travis E. Oliphant (2005)\n Assistant Professor\n Brigham Young University\n\n based on the \n\n Original Implementation: \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n with inspiration and code from\n Numarray\n Space Science Telescope Institute\n J. Todd Miller\n Perry Greenfield\n \n*/\n\n\ntypedef double (DoubleBinaryFunc)(double x, double y);\ntypedef float (FloatBinaryFunc)(float x, float y);\ntypedef longdouble (LongdoubleBinaryFunc)(longdouble x, longdouble y);\n\ntypedef void (CdoubleBinaryFunc)(cdouble *x, cdouble *y, cdouble *res);\ntypedef void (CfloatBinaryFunc)(cfloat *x, cfloat *y, cfloat *res);\ntypedef void (ClongdoubleBinaryFunc)(clongdouble *x, clongdouble *y, \\\n\t\t\t\t clongdouble *res);\n\nstatic void\nPyUFunc_ff_f_As_dd_d(char **args, intp *dimensions, intp *steps, void *func)\n{\n\tregister intp i, n=dimensions[0];\n\tregister intp is1=steps[0],is2=steps[1],os=steps[2];\n\tchar *ip1=args[0], *ip2=args[1], *op=args[2];\n\t\n\tfor(i=0; inin, nout=data->nout;\n int ntot;\n PyObject *tocall = data->callable; \n char *ptrs[MAX_ARGS];\n PyObject *arglist, *result;\n PyObject *in, **op;\n\n ntot = nin+nout;\n\n for (j=0; j < ntot; j++) ptrs[j] = args[j];\n\tfor(i=0; i> UFUNC_SHIFT_##NAME, \\\n\t\t\t\t\t errobj, str, retstatus) < 0) \\\n\t\t\t\treturn -1;\t\t \\\n\t\t\t}}\n\n\tif (errmask && retstatus) {\n\t\tHANDLEIT(DIVIDEBYZERO, \"divide by zero\");\n\t\tHANDLEIT(OVERFLOW, \"overflow\");\n\t\tHANDLEIT(UNDERFLOW, \"underflow\");\n\t\tHANDLEIT(INVALID, \"invalid\");\n\t}\n\n#undef HANDLEIT\n\n\treturn 0;\n}\n\n\n/* Checking the status flag clears it */\nstatic void\nPyUFunc_clearfperr()\n{\n\tint retstatus;\n\n\tUFUNC_CHECK_STATUS(retstatus)\n}\n\n\n#define UFUNC_NOSCALAR 0\n#define UFUNC_BOOL_SCALAR 1\n#define UFUNC_INTPOS_SCALAR 2\n#define UFUNC_INTNEG_SCALAR 3\n#define UFUNC_FLOAT_SCALAR 4\n#define UFUNC_COMPLEX_SCALAR 5\n#define UFUNC_OBJECT_SCALAR 6\n\n#define NO_UFUNCLOOP 0\n#define ZERODIM_REDUCELOOP 0\n#define ONE_UFUNCLOOP 1\n#define ONEDIM_REDUCELOOP 1\n#define NOBUFFER_UFUNCLOOP 2\n#define NOBUFFER_REDUCELOOP 2\n#define BUFFER_UFUNCLOOP 3\n#define BUFFER_REDUCELOOP 3\n\n\n#define UFUNC_REDUCE 0\n#define UFUNC_ACCUMULATE 1\n#define UFUNC_REDUCEAT 2\n#define UFUNC_OUTER 3\n\n\n\n\nstatic char\n_lowest_type(char intype)\n{\n switch(intype) {\n\t/* case PyArray_BYTE */\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\treturn PyArray_BYTE;\n\t/* case PyArray_UBYTE */\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\treturn PyArray_UBYTE;\n\t/* case PyArray_FLOAT:*/\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\treturn PyArray_FLOAT;\n\t/* case PyArray_CFLOAT:*/\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn PyArray_CFLOAT;\n default:\n return intype;\n }\n}\n\nstatic int \n_cancoerce(char thistype, char neededtype, char scalar) \n{\n\n\tswitch(scalar) {\n\tcase UFUNC_NOSCALAR:\n\tcase UFUNC_BOOL_SCALAR:\n\tcase UFUNC_OBJECT_SCALAR:\n\t\treturn PyArray_CanCastSafely(thistype, neededtype);\n\tcase UFUNC_INTPOS_SCALAR:\n\t\treturn (neededtype >= PyArray_UBYTE);\n\tcase UFUNC_INTNEG_SCALAR:\n\t\treturn (neededtype >= PyArray_BYTE) &&\t\t\\\n\t\t\t!(PyTypeNum_ISUNSIGNED(neededtype));\n\tcase UFUNC_FLOAT_SCALAR:\n\t\treturn (neededtype >= PyArray_FLOAT);\n\tcase UFUNC_COMPLEX_SCALAR:\n\t\treturn (neededtype >= PyArray_CFLOAT);\n\t}\n\tfprintf(stderr, \"\\n**Error** coerce fall through: %d %d %d\\n\\n\", \n\t\tthistype, neededtype, scalar);\n\treturn 1; /* should never get here... */ \n}\n\n\nstatic int \nselect_types(PyUFuncObject *self, int *arg_types, \n PyUFuncGenericFunction *function, void **data,\n\t char *scalars)\n{\n\n\tint i=0, j;\n\tchar start_type;\n\t\n\tif (PyTypeNum_ISUSERDEF((arg_types[0]))) {\n\t\tPyObject *key, *obj;\n\t\tfor (i=0; inin; i++) {\n\t\t\tif (arg_types[i] != arg_types[0]) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\t\t\"ufuncs on user defined\" \\\n\t\t\t\t\t\t\" types don't support \"\\\n\t\t\t\t\t\t\"coercion.\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfor (i=self->nin; inargs; i++) {\n\t\t\targ_types[i] = arg_types[0];\n\t\t}\n\t\t\n\t\tkey = PyInt_FromLong((long) arg_types[0]);\n\t\tif (key == NULL) return -1;\n\t\tobj = PyDict_GetItem(self->userloops, key);\n\t\tif (obj == NULL) {\n\t\t\tPy_DECREF(key);\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"no registered loop for this \"\t\\\n\t\t\t\t\t\"user-defined type.\");\n\t\t\treturn -1;\t\t\t\n\t\t}\n\t\tif PyTuple_Check(obj) {\n\t\t\t*function = (PyUFuncGenericFunction) \\\n\t\t\t\tPyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 0));\n\t\t\t*data = PyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 1));\n\t\t}\n\t\telse {\n\t\t\t*function = (PyUFuncGenericFunction)\t\\\n\t\t\t\tPyCObject_AsVoidPtr(obj);\n\t\t\t*data = NULL;\n\t\t}\n\t\tPy_DECREF(key);\n\t\treturn 0;\n\t}\n\t\n\n\tstart_type = arg_types[0];\n\t/* If the first argument is a scalar we need to place \n\t the start type as the lowest type in the class\n\t*/\n\tif (scalars[0] != UFUNC_NOSCALAR) {\n\t\tstart_type = _lowest_type(start_type);\n\t}\n\n\twhile (intypes && start_type > self->types[i*self->nargs]) \n\t\ti++;\n\n\tfor(;intypes; i++) {\n\t\tfor(j=0; jnin; j++) {\n\t\t\tif (!_cancoerce(arg_types[j], \n\t\t\t\t\tself->types[i*self->nargs+j],\n\t\t\t\t\tscalars[j]))\n\t\t\t\tbreak;\n\t\t}\n\t\tif (j == self->nin) break;\n\t}\n\tif(i>=self->ntypes) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"function not supported for these types, \"\\\n\t\t\t\t\"and can't coerce safely to supported types\");\n\t\treturn -1;\n\t}\n\tfor(j=0; jnargs; j++) \n\t\targ_types[j] = self->types[i*self->nargs+j];\n\n\t*data = self->data[i];\n\t*function = self->functions[i];\n\n\treturn 0;\n}\n\n\n\nstatic int\n_getintfromvar(char *str, int deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tint retval=deflt;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n thedict = PyEval_GetGlobals();\n ref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = (int) PyInt_AsLong(ref);\n if (ref == NULL || retval == -1) retval = deflt;\n PyErr_Clear();\n\treturn retval;\n}\n\nstatic PyObject *\n_getfuncfromvar(char *str, PyObject *deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tPyObject *retval;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n\t\tthedict = PyEval_GetGlobals();\n\t\tref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = ref;\n\telse retval = deflt;\n\tif (retval != Py_None && !PyCallable_Check(retval)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"%s if provided must be callable\", str);\n\t\treturn NULL;\n\t}\n\tPy_INCREF(retval);\n\treturn retval;\n}\n\n\nstatic char\n_scalar_kind(int typenum, PyArrayObject **arr) \n{\n\tif (PyTypeNum_ISSIGNED(typenum)) return UFUNC_INTNEG_SCALAR;\n\tif (PyTypeNum_ISFLOAT(typenum)) return UFUNC_FLOAT_SCALAR;\n\tif (PyTypeNum_ISCOMPLEX(typenum)) return UFUNC_COMPLEX_SCALAR;\n\tif (PyTypeNum_ISUNSIGNED(typenum)) return UFUNC_INTPOS_SCALAR;\n\tif (PyTypeNum_ISBOOL(typenum)) return UFUNC_BOOL_SCALAR;\n\treturn UFUNC_OBJECT_SCALAR;\n}\n\n\n/* Create copies for any arrays that are less than loop->bufsize\n in total size and are mis-behaved or in need\n of casting.\n*/\n\nstatic int\n_create_copies(PyUFuncLoopObject *loop, int *arg_types, PyArrayObject **mps)\n{\n\tint nin = loop->ufunc->nin;\n\tint i;\n\tintp size;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\n\tfor (i=0; ielsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\t\tif (size < loop->bufsize) {\n\t\t\tif (!(PyArray_ISBEHAVED_RO(mps[i])) ||\t\t\\\n\t\t\t PyArray_TYPE(mps[i]) != arg_types[i]) {\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST |\t\\\n\t\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\nstatic int\nconstruct_matrices(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps)\n{\n int nargs, i, cnt, cntcast, maxsize;\n int arg_types[MAX_ARGS];\n\tchar scalars[MAX_ARGS];\n\tPyUFuncObject *self=loop->ufunc;\n\tBool allscalars=TRUE;\n\tPyTypeObject *subtype=&PyArray_Type;\n\n /* Check number of arguments */\n nargs = PyTuple_Size(args);\n if ((nargs != self->nin) && (nargs != self->nargs)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of arguments\");\n return -1;\n }\n\n\n /* Get each input argument */\n for (i=0; inin; i++) {\n mps[i] = (PyArrayObject *)\\\n\t\t\tPyArray_FromAny(PyTuple_GET_ITEM(args,i), \n\t\t\t\t\tNULL, 0, 0, 0);\n if (mps[i] == NULL) return -1;\n arg_types[i] = PyArray_TYPE(mps[i]);\n if (PyTypeNum_ISFLEXIBLE(arg_types[i])) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"ufuncs do not support\"\t\\\n \" flexible arrays\");\n return -1;\n }\n\t\t/*\n\t\tfprintf(stderr, \"array %d has reference %d\\n\", i, \n\t\t (mps[i])->ob_refcnt);\n\t\t*/\n\n\t\t/* Scalars are 0-dimensional arrays\n\t\t at this point\n\t\t*/\n\t\tif (mps[i]->nd > 0) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t\tallscalars=FALSE;\n\t\t}\n\t\telse scalars[i] = _scalar_kind(arg_types[i], &(mps[i]));\n\n\t\t/* If any input is a big-array */\n\t\tif (!PyType_IsSubtype(mps[i]->ob_type, &PyArray_Type)) {\n\t\t\tsubtype = &PyBigArray_Type;\n\t\t}\n }\n\n\t/* If everything is a scalar, then use normal coercion rules */\n\tif (allscalars) {\n\t\tfor (i=0; inin; i++) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t}\n\t}\n \n /* Select an appropriate function for these argument types. */\n if (select_types(loop->ufunc, arg_types, &(loop->function), \n &(loop->funcdata), scalars) == -1)\n\t\treturn -1;\n\n\t/* This is the buffer size in number of elements.*/\n loop->bufsize = _getintfromvar(UFUNC_BUFSIZE_NAME, PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \"The buffer size (%d) is not \" \\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\treturn -1;\n\t}\n\t\n\t/* Create copies for some of the arrays if appropriate */\n\tif (_create_copies(loop, arg_types, mps) < 0) return -1;\n\t\n\t/* Create Iterators for the Inputs */\n\tfor (i=0; inin; i++) {\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n\t}\n \n /* Broadcast the result */\n loop->numiter = self->nin;\n if (PyArray_Broadcast((PyArrayMultiIterObject *)loop) < 0)\n\t\treturn -1;\n\t\n /* Get any return arguments */\n for (i=self->nin; idimensions, \n\t\t\t\t\t loop->dimensions, loop->nd)) {\n PyErr_SetString(PyExc_ValueError, \n \"invalid return array shape\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n if (!PyArray_ISWRITEABLE(mps[i])) {\n PyErr_SetString(PyExc_ValueError, \n \"return array is not writeable\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n }\n\n /* construct any missing return arrays and make output iterators */\n \n for (i=self->nin; inargs; i++) {\n\t\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\n if (mps[i] == NULL) {\n mps[i] = (PyArrayObject *)PyArray_New(subtype,\n loop->nd, \n loop->dimensions,\n arg_types[i], \n NULL, NULL,\n 0, 0, NULL);\n if (mps[i] == NULL) return -1;\n }\n\n\n\t\t/* reset types for outputs that are equivalent \n\t\t -- no sense casting uselessly\n\t\t*/\n\t\tif (mps[i]->descr->type_num != arg_types[i]) {\n\t\t\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\t\t\tntype.type_num = PyArray_TYPE(mps[i]);\n\t\t\tntype.itemsize = PyArray_ITEMSIZE(mps[i]);\n\t\t\tatype.type_num = arg_types[i];\n\t\t\tatype.itemsize = \\\n\t\t\t\tPyArray_DescrFromType(arg_types[i])->elsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\n\t\t/* still not the same -- or will we have to use buffers?*/\n\t\tif (mps[i]->descr->type_num != arg_types[i] ||\n\t\t !PyArray_ISBEHAVED_RO(mps[i])) {\n\t\t\tif (loop->size < loop->bufsize) {\n\t\t\t\tPyObject *new;\n\t\t\t\t/* Copy the array to a temporary copy \n\t\t\t\t and set the UPDATEIFCOPY flag\n\t\t\t\t*/\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST | \n\t\t\t\t\t\t BEHAVED_FLAGS_RO |\n\t\t\t\t\t\t UPDATEIFCOPY);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t\t\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n }\n\n\n /* If any of different type, or misaligned or swapped\n then must use buffers */\n\n loop->bufcnt = 0;\n\n loop->obj = 0;\n\n /* Determine looping method needed */\n loop->meth = NO_UFUNCLOOP;\n\n\tcnt = cntcast = 0; /* keeps track of bytes to allocate */\n\tmaxsize = 0;\n for (i=0; inargs; i++) {\n\t\tcnt += mps[i]->itemsize;\n if (arg_types[i] != mps[i]->descr->type_num) {\n\t\t\tPyArray_Descr *descr;\n\n loop->meth = BUFFER_UFUNCLOOP;\n\t\t\tdescr = PyArray_DescrFromType(arg_types[i]);\n\t\t\tcntcast += descr->elsize;\n if (i < self->nin) {\n loop->cast[i] = \\\n\t\t\t\t\tmps[i]->descr->cast[arg_types[i]];\n\t\t\t}\n else {\n loop->cast[i] = descr->\\\n\t\t\t\t\tcast[mps[i]->descr->type_num];\n\t\t\t}\n\n }\n loop->swap[i] = !(PyArray_ISNOTSWAPPED(mps[i]));\n if (!PyArray_ISBEHAVED_RO(mps[i])) {\n loop->meth = BUFFER_UFUNCLOOP;\n }\n if (!loop->obj && mps[i]->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n }\n \n if (loop->meth == NO_UFUNCLOOP) {\n \n loop->meth = ONE_UFUNCLOOP;\n\n /* All correct type and BEHAVED */\n /* Check for non-uniform stridedness */\n\n for (i=0; inargs; i++) {\n if (!(loop->iters[i]->contiguous)) {\n\t\t\t\t/* may still have uniform stride\n\t\t\t\t if (broadcated result) <= 1-d */\n\t\t\t\tif (mps[i]->nd != 0 &&\t\t\t\\\n\t\t\t\t (loop->iters[i]->nd_m1 > 0)) {\n\t\t\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n }\n\t\tif (loop->meth == ONE_UFUNCLOOP) {\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tloop->bufptr[i] = mps[i]->data;\n\t\t\t}\n\t\t}\n }\n\n loop->numiter = self->nargs;\n\n /* Fill in steps */\n if (loop->meth == NOBUFFER_UFUNCLOOP) {\n\t\tint ldim = 0;\n\t\tintp maxdim=-1;\n\t\tPyArrayIterObject *it;\n\n /* Fix iterators */\n\n /* Find the **largest** dimension */\n \n\t\tmaxdim = -1;\n\t\tfor (i=loop->nd - 1; i>=0; i--) {\n\t\t\tif (loop->dimensions[i] > maxdim) {\n\t\t\t\tldim = i;\n\t\t\t\tmaxdim = loop->dimensions[i];\n\t\t\t}\n\t\t}\n\n\t\tloop->size /= maxdim;\n loop->bufcnt = maxdim;\n\n /* Fix the iterators so the inner loop occurs over the \n\t\t largest dimensions -- This can be done by \n\t\t setting the size to 1 in that dimension \n\t\t (just in the iterators)\n */\n\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = loop->iters[i];\n it->contiguous = 0;\n\t\t\tit->size /= (it->dims_m1[ldim]+1);\n\t\t\tit->dims_m1[ldim] = 0;\n\t\t\tit->backstrides[ldim] = 0;\n\n\t\t\t/* (won't fix factors because we\n\t\t\t don't use PyArray_ITER_GOTO1D \n\t\t\t so don't change them) */\n\n\n\t\t\t/* Set the steps to the strides in that dimension */\n loop->steps[i] = it->strides[ldim];\n\t\t}\n\n }\n else if (loop->meth == BUFFER_UFUNCLOOP) {\n for (i=0; inargs; i++) {\n\t\t\tloop->steps[i] = mps[i]->itemsize; \n\t\t}\n }\n\telse { /* uniformly-strided case ONE_UFUNCLOOP */\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (mps[i]->nd == 0)\n\t\t\t\tloop->steps[i] = 0;\n\t\t\telse \n\t\t\t\tloop->steps[i] = mps[i]->strides[mps[i]->nd-1];\n\t\t}\n\t}\n \n\n\t/* Finally, create memory for buffers if we need them */\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\t\tchar *castptr;\n\t\tint oldsize=0;\n\t\tloop->buffer[0] = (char *)malloc(loop->bufsize*(cnt+cntcast));\n\t\t/* fprintf(stderr, \"Allocated buffer at %p of size %d, cnt=%d, cntcast=%d\\n\", loop->buffer[0], loop->bufsize * (cnt + cntcast), cnt, cntcast); */\n\t\tif (loop->buffer[0] == NULL) return -1;\n\t\tcastptr = loop->buffer[0] + loop->bufsize*cnt;\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (i > 0)\n\t\t\t\tloop->buffer[i] = loop->buffer[i-1] + \\\n\t\t\t\t\tloop->bufsize * mps[i-1]->itemsize;\n\t\t\t/* fprintf(stderr, \"buffer[%d] = %p\\n\", i, loop->buffer[i]); */\n\t\t\tif (loop->cast[i]) {\n\t\t\t\tloop->castbuf[i] = castptr + \n\t\t\t\t\tloop->bufsize*oldsize;\n\t\t\t\t/* fprintf(stderr, \"castbuf[%d] = %p\\n\", i, loop->castbuf[i]); */\n#define _PyD PyArray_DescrFromType\n\t\t\t\toldsize = _PyD(arg_types[i])->elsize;\n#undef _PyD\n\t\t\t\tloop->bufptr[i] = loop->castbuf[i];\n\t\t\t\tcastptr = loop->castbuf[i];\n\t\t\t\tloop->steps[i] = oldsize;\n\t\t\t}\n\t\t\telse\n\t\t\t\tloop->bufptr[i] = loop->buffer[i];\n\t\t\tloop->dptr[i] = loop->buffer[i];\n\t\t}\n\t}\n\n return nargs;\n}\n\nstatic PyTypeObject PyUFuncLoop_Type;\n\nstatic void ufuncloop_dealloc(PyUFuncLoopObject *);\n\nstatic PyUFuncLoopObject *\nconstruct_loop(PyUFuncObject *self, PyObject *args, PyArrayObject **mps)\n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\t\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\n\n\tif ((loop=PyObject_NEW(PyUFuncLoopObject, &PyUFuncLoop_Type)) == NULL)\n\t\treturn NULL;\n\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n\tloop->buffer[0] = NULL;\n for (i=0; inargs; i++) {\n loop->iters[i] = NULL;\n loop->cast[i] = NULL;\n }\n\tloop->errobj = NULL;\n\n\t/* Setup the matrices */\n\tif (construct_matrices(loop, args, mps) < 0) goto fail;\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString((self->name ? \\\n self->name : \"\")), \n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n\tPyUFunc_clearfperr();\n\n\treturn loop;\n\n fail:\n\tufuncloop_dealloc(loop);\n\treturn NULL;\n}\n\n\n/* \nstatic void\n_printbytebuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing byte buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %d\\n\", *(((byte *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbufptr(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->bufptr[bufnum]))+i));\n\t} \n}\n\n\n \nstatic void\n_printcastbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->castbuf[bufnum]))+i));\n\t} \n}\n\n*/\n\n\n\n\n/* currently generic ufuncs cannot be built for use on flexible arrays.\n\n The cast functions in the generic loop would need to be fixed to pass \n something besides NULL, NULL \n\n*/\n\n/* This generic function is called with the ufunc object, the arguments to it,\n and an array of (pointers to) PyArrayObjects which are NULL. The \n arguments are parsed and placed in mps in construct_loop (construct_matrices)\n*/\n\nstatic int \nPyUFunc_GenericFunction(PyUFuncObject *self, PyObject *args, \n\t\t\tPyArrayObject **mps) \n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\tint temp;\n BEGIN_THREADS_DEF\n\n\tif (!(loop = construct_loop(self, args, mps))) return -1;\n\n\tLOOP_BEGIN_THREADS\n\n\tswitch(loop->meth) {\n\tcase ONE_UFUNCLOOP:\n\t\t/* Everything is contiguous, notswapped, aligned,\n\t\t and of the right type. -- Fastest.\n\t\t Or if not contiguous, then a single-stride\n\t\t increment moves through the entire array. \n\t\t*/\n /* fprintf(stderr, \"ONE...%d\\n\", loop->size);*/\n\t\tloop->function((char **)loop->bufptr, &(loop->size), \n\t\t\t loop->steps, loop->funcdata);\n\t\tUFUNC_CHECK_ERROR();\n\t\tbreak;\n\tcase NOBUFFER_UFUNCLOOP:\n\t\t/* Everything is notswapped, aligned and of the \n\t\t right type but not contiguous. -- Almost as fast.\n\t\t*/\n /* fprintf(stderr, \"NOBUFFER...%d\\n\", loop->size);*/\n\t\twhile (loop->index < loop->size) {\n\t\t\tfor (i=0; inargs; i++) \n\t\t\t\tloop->bufptr[i] = loop->iters[i]->dataptr;\n\n\t\t\tloop->function((char **)loop->bufptr, &(loop->bufcnt),\n\t\t\t\t loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tPyArray_ITER_NEXT(loop->iters[i]);\n\t\t\t}\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\tcase BUFFER_UFUNCLOOP: {\n\t\t/* Make local copies of all loop variables */\n\t\t/* Optimizations needed:\n\t\t 1) move data better into the buffer better\n\t\t --- not one at a time -- this requires some \n pre-analysis and is only possible over \n the largest dimension.\n\t\t*/\n\n\t\tPyArray_CopySwapNFunc *copyswapn[MAX_ARGS];\n\t\tPyArrayIterObject **iters=loop->iters;\n\t\tint *swap=loop->swap;\n\t\tvoid **dptr=loop->dptr;\n\t\tint mpselsize[MAX_ARGS];\n\t\tintp index=loop->index, size=loop->size;\n\t\tint bufcnt=loop->bufcnt, bufsize=loop->bufsize;\n\t\tvoid **bufptr = loop->bufptr;\n\t\tvoid **buffer = loop->buffer;\n\t\tvoid **castbuf = loop->castbuf;\n\t\tintp *steps = loop->steps;\n\t\tBool pyobject[MAX_ARGS];\n\t\t\n\t\tfor (i=0; inargs; i++) {\n\t\t\tcopyswapn[i] = mps[i]->descr->copyswapn;\n\t\t\tmpselsize[i] = mps[i]->itemsize;\n\t\t\tpyobject[i] = (loop->obj && \\\n (mps[i]->descr->type_num == PyArray_OBJECT));\n\t\t}\n\t\t/* Do generic buffered looping here (works for any kind of\n\t\t arrays): Everything uses a buffer. \n\n\t\t 1. fill the input buffers.\n\t\t 2. If buffer is filled then \n\t\t a. cast any input buffers needing it. \n\t\t b. call inner function (which loops over the buffer).\n\t\t\t c. cast any output buffers needing it.\n\t\t\t d. copy output buffer back to output arrays.\n 3. goto next position\n\t\t*/ \n\t\tfprintf(stderr, \"BUFFER...%d\\n\", loop->size);\n\t\t/*\n\t\tfor (i=0; inargs; i++) {\n\t\t\tfprintf(stderr, \"iters[%d]->dataptr = %p, %p of size %d\\n\", i, \n\t\t\t\titers[i], iters[i]->ao->data, PyArray_NBYTES(iters[i]->ao));\n\t\t}\n\t\t*/\n\t\twhile (index < size) {\n\t\t\t/*copy input data */\n\t\t\tfor (i=0; inin; i++) {\n\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\tPy_INCREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t}\n\t\t\t\t/*\t\t\t\tfprintf(stderr, \"index = %d, i=%d, writing to %p\\n\", index, i, dptr[i]); */\n\t\t\t\tmemcpy(dptr[i], iters[i]->dataptr,\n\t\t\t\t mpselsize[i]);\n\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t}\n\t\t\tbufcnt++;\n\t\t\tindex++; \n\t\t\tif ((bufcnt == bufsize) || \\\n\t\t\t (index == size)) {\n\t\t\t\t\n\t\t\t\tfor (i=0; inin; i++) {\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping...\\n\");*/\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](buffer[i],\n\t\t\t\t\t\t\t castbuf[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t\tloop->function((char **)bufptr, \n\t\t\t\t\t &bufcnt, \n\t\t\t\t\t steps, loop->funcdata);\n \n\t\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\t\tfor (i=self->nin; inargs; i++) {\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](castbuf[i],\n\t\t\t\t\t\t\t buffer[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping back...\\n\"); */\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tfor (temp = 0; temp < bufcnt; temp++) {\n\t\t\t\t\t\t/* fprintf(stderr, \"temp=%d, i=%d; reading from %p\\n\", temp, i, dptr[i]);*/\n\t\t\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\t\t\tPy_XDECREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t\t\t\tPy_INCREF(*((PyObject **)dptr[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmemcpy(iters[i]->dataptr,\n\t\t\t\t\t\t dptr[i], mpselsize[i]);\n\t\t\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbufcnt = 0;\n\t\t\t\tfor (i=0; inargs; i++) \n\t\t\t\t\tdptr[i] = buffer[i];\n\t\t\t\t\n\t\t\t} \n\t\t}\n\t}\n\t}\t\n\t\n LOOP_END_THREADS\n\t\n Py_DECREF(loop);\n\treturn 0;\n\n fail:\n LOOP_END_THREADS\n \n\tPy_XDECREF(loop);\n\treturn -1;\n }\n\nstatic PyArrayObject *\n_getidentity(PyUFuncObject *self, int otype, char *str)\n{\n PyObject *obj, *arr;\n PyArray_Typecode typecode = {otype, 0, 0};\n\n if (self->identity == PyUFunc_None) {\n PyErr_Format(PyExc_ValueError, \n \"zero-size array to ufunc.%s \" \\\n \"without identity\", str);\n return NULL;\n }\n if (self->identity == PyUFunc_One) {\n obj = PyInt_FromLong((long) 1);\n } else {\n obj = PyInt_FromLong((long) 0);\n }\n\t\n arr = PyArray_FromAny(obj, &typecode, 0, 0, CARRAY_FLAGS);\n Py_DECREF(obj);\n return (PyArrayObject *)arr;\n}\n\nstatic int\n_create_reduce_copy(PyUFuncReduceObject *loop, PyArrayObject **arr, int rtype)\n{\n\tintp maxsize;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {rtype, 0, 0};\n\t\n\tmaxsize = PyArray_SIZE(*arr);\n\t\n\tif (maxsize < loop->bufsize) {\n\t\tif (!(PyArray_ISBEHAVED_RO(*arr)) ||\t\\\n\t\t PyArray_TYPE(*arr) != rtype) {\n\t\t\tnew = PyArray_FromAny((PyObject *)(*arr), \n\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t FORCECAST |\t\t\\\n\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\tif (new == NULL) return -1;\n\t\t\t*arr = (PyArrayObject *)new;\n\t\t\tloop->decref = new;\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\n\n\nstatic PyTypeObject PyUFuncReduce_Type;\n\nstatic void ufuncreduce_dealloc(PyUFuncReduceObject *);\n\nstatic PyUFuncReduceObject *\nconstruct_reduce(PyUFuncObject *self, PyArrayObject **arr, int axis, \n\t\t int otype, int operation, intp ind_size, char *str)\n{\n PyUFuncReduceObject *loop;\n PyArrayObject *idarr;\n\tPyArrayObject *aar;\n intp loop_i[MAX_DIMS];\n int arg_types[3] = {otype, otype, otype};\n\tchar scalars[3] = {UFUNC_NOSCALAR, UFUNC_NOSCALAR, UFUNC_NOSCALAR};\n\tint i, j;\n\tint nd = (*arr)->nd;\n\t/* Reduce type is the type requested of the input \n\t during reduction */\n\n\tif ((loop=PyObject_NEW(PyUFuncReduceObject, \n\t\t\t &PyUFuncReduce_Type)) == NULL)\n\t\treturn NULL;\n\n\n loop->swap = 0;\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n loop->cast = NULL;\n loop->buffer = NULL;\n loop->ret = NULL;\n\tloop->it = NULL;\n\tloop->rit = NULL;\n\tloop->errobj = NULL;\n\tloop->decref=NULL; \n loop->N = (*arr)->dimensions[axis];\n\tloop->instrides = (*arr)->strides[axis];\n\n\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t &(loop->funcdata), scalars) == -1) goto fail; \n\t\n\t/* output type may change -- if it does \n\t reduction is forced into that type \n\t and we need to select the reduction function again\n\t*/\n\tif (otype != arg_types[2]) {\n\t\totype = arg_types[2];\n\t\targ_types[0] = otype;\n\t\targ_types[1] = otype;\n\t\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t\t &(loop->funcdata), scalars) == -1) \n\t\t\tgoto fail; \t\t\n\t}\n\n\t/* Make bufsize depend on a local then module-level variable */\n\tloop->bufsize = _getintfromvar(\"UFUNC_BUFSIZE\", \n\t\t\t\t PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"The buffer size (%d) is not \"\t\\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\tgoto fail;\n\t}\n\t\n\t/* Make copy if misbehaved or not otype for small arrays */\n\tif (_create_reduce_copy(loop, arr, otype) < 0) goto fail; \n\taar = *arr;\n\t\n if (loop->N == 0) {\n loop->meth = ZERODIM_REDUCELOOP;\n }\n else if (PyArray_ISBEHAVED_RO(aar) &&\t\t\\\n otype == (aar)->descr->type_num) {\n\t\tif (loop->N == 1) {\n\t\t\tloop->meth = ONEDIM_REDUCELOOP;\n\t\t}\n\t\telse {\n\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\tloop->steps[0] = (aar)->strides[axis];\n\t\t\tloop->N -= 1;\n\t\t}\n }\n else {\n loop->meth = BUFFER_UFUNCLOOP;\n loop->swap = !(PyArray_ISNOTSWAPPED(aar));\n }\n\n if (loop->meth == ZERODIM_REDUCELOOP) {\n idarr = _getidentity(self, otype, str);\n if (idarr == NULL) goto fail;\n if (idarr->itemsize > UFUNC_MAXIDENTITY) {\n PyErr_Format(PyExc_RuntimeError, \n\t\t\t\t \"UFUNC_MAXIDENTITY (%d)\"\t\t\\\n \" is too small (needs to be at least %d)\",\n UFUNC_MAXIDENTITY, idarr->itemsize);\n Py_DECREF(idarr);\n goto fail;\n }\n memcpy(loop->idptr, idarr->data, idarr->itemsize);\n Py_DECREF(idarr);\n }\n\t\n /* Construct return array */\n\tswitch(operation) {\n\tcase UFUNC_REDUCE:\n\t\tfor (j=0, i=0; idimensions[i];\n\t\t\t\n\t\t}\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd-1, loop_i, otype, \n\t\t\t\t NULL, NULL, 0, 0, (PyObject *)aar);\n\t\tbreak;\n\tcase UFUNC_ACCUMULATE:\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, aar->dimensions, \n\t\t\t\t otype, NULL, NULL, 0, 0, (PyObject *)aar);\n\t\tbreak;\n\tcase UFUNC_REDUCEAT:\n\t\tmemcpy(loop_i, aar->dimensions, nd*sizeof(intp));\n\t\t/* Index is 1-d array */\n\t\tloop_i[axis] = ind_size; \n\t\tloop->ret = (PyArrayObject *)\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, loop_i, otype,\n\t\t\t\t NULL, NULL, 0, 0, (PyObject *)aar);\n\t\tif (loop->ret == NULL) goto fail;\n\t\tif (ind_size == 0) {\n\t\t\tloop->meth = ZERODIM_REDUCELOOP;\n\t\t\treturn loop;\n\t\t}\n\t\tif (loop->meth == ONEDIM_REDUCELOOP)\n\t\t\tloop->meth = NOBUFFER_REDUCELOOP;\n\t\tbreak;\n\t}\n if (loop->ret == NULL) goto fail;\n loop->insize = aar->itemsize;\n loop->outsize = loop->ret->itemsize;\n loop->bufptr[1] = loop->ret->data;\n\n\tif (loop->meth == ZERODIM_REDUCELOOP) {\n\t\tloop->size = PyArray_SIZE(loop->ret);\n\t\treturn loop;\n\t}\n\n\tloop->it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)aar);\n if (loop->it == NULL) return NULL;\n\n\tif (loop->meth == ONEDIM_REDUCELOOP) {\n\t\tloop->size = loop->it->size;\t\t\n\t\treturn loop;\n\t}\n\n /* Fix iterator to loop over correct dimension */\n\t/* Set size in axis dimension to 1 */\n \n loop->it->contiguous = 0;\n loop->it->size /= (loop->it->dims_m1[axis]+1);\n loop->it->dims_m1[axis] = 0;\n loop->it->backstrides[axis] = 0;\n\n\n loop->size = loop->it->size;\n\n\tif (operation == UFUNC_REDUCE) {\n\t\tloop->steps[1] = 0;\n\t}\n\telse {\n\t\tloop->rit = (PyArrayIterObject *)\t\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)(loop->ret));\n\t\tif (loop->rit == NULL) return NULL;\t\t\n\n\t\t/* Fix iterator to loop over correct dimension */\n\t\t/* Set size in axis dimension to 1 */\n\t\t\n\t\tloop->rit->contiguous = 0;\n\t\tloop->rit->size /= (loop->rit->dims_m1[axis]+1);\n\t\tloop->rit->dims_m1[axis] = 0;\n\t\tloop->rit->backstrides[axis] = 0;\n\n\t\tif (operation == UFUNC_ACCUMULATE)\n\t\t\tloop->steps[1] = loop->ret->strides[axis];\n\t\telse \n\t\t\tloop->steps[1] = 0;\n\t}\n\tloop->steps[2] = loop->steps[1];\n\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[2];\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\n\t\tloop->steps[0] = loop->outsize;\n if (otype != aar->descr->type_num) {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n (loop->outsize + \\\n aar->itemsize));\n if (loop->buffer == NULL) goto fail;\n loop->castbuf = loop->buffer + \\\n loop->bufsize*aar->itemsize;\n loop->bufptr[0] = loop->castbuf; \n loop->cast = aar->descr->cast[otype];\n }\n else {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n loop->outsize);\n if (loop->buffer == NULL) goto fail;\n loop->bufptr[0] = loop->buffer;\n }\n\t}\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \\\n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t\t\t \n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString(str),\n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n /* Determine if object arrays are involved */\n if (otype == PyArray_OBJECT || aar->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n else\n loop->obj = 0;\n\n\tPyUFunc_clearfperr();\n\treturn loop;\n\n fail:\n ufuncreduce_dealloc(loop);\n\treturn NULL;\t\n}\n\n\n/* We have two basic kinds of loops */\n/* One is used when arr is not-swapped and aligned and output type\n is the same as input type.\n and another using buffers when one of these is not satisfied.\n\n Zero-length and one-length axes-to-be-reduced are handled separately.\n*/\n\nstatic PyObject *\nPyUFunc_Reduce(PyUFuncObject *self, PyArrayObject *arr, int axis, int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n BEGIN_THREADS_DEF\n \t\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCE, 0,\n\t\t\t\t\"reduce\");\n\tif (!loop) return NULL;\n\n LOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP:\n\t\t/*fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP:\n\t\t/*fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it)\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1];\n loop->index++; \n\t\t\tif (PyErr_Occurred()) goto fail;\n }\n break;\n case BUFFER_UFUNCLOOP:\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy first item over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %d\\n\", loop->size, \n\t\t loop->swap); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1]; \n loop->index++;\n }\n }\n\n LOOP_END_THREADS\n\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n LOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n\nstatic PyObject *\nPyUFunc_Accumulate(PyUFuncObject *self, PyArrayObject *arr, int axis, \n\t\t int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n \n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_ACCUMULATE, 0,\n\t\t\t\t\"accumulate\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n break;\n case BUFFER_UFUNCLOOP: /* Accumulate */\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy identity over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %p\\n\", loop->size, \n\t\t loop->cast); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n }\n\n\tLOOP_END_THREADS\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n\tLOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n/* Reduceat performs a reduce over an axis using the indices as a guide\n\nop.reduceat(array,indices) computes\nop.reduce(array[indices[i]:indices[i+1]] \n for i=0..end with an implicit indices[i+1]=len(array)\n assumed when i=end-1\n\nif indices[i+1] <= indices[i]+1 \n then the result is array[indices[i]] for that value\n\nop.accumulate(array) is the same as\nop.reduceat(array,indices)[::2]\nwhere indices is range(len(array)-1) with a zero placed in every other sample\n indices = zeros(len(array)*2-1)\n indices[1::2] = range(1,len(array))\n\noutput shape is based on the size of indices\n */\n\nstatic PyObject *\nPyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, \n int axis, int otype)\n{\t\n\tPyArrayObject *ret;\n PyUFuncReduceObject *loop;\n\tintp *ptr=(intp *)ind->data;\n\tintp nn=ind->dimensions[0];\t\t\n\tintp mm=arr->dimensions[axis]-1;\n\tintp n, i;\n\tint j;\n\tchar *dptr;\n\n\t/* Check for out-of-bounds values in indices array */\t\t\n\tfor (i=0; i mm)) {\n\t\t\tPyErr_Format(PyExc_IndexError, \n\t\t\t\t \"index out-of-bounds (0, %d)\", mm);\n\t\t\treturn NULL;\n\t\t}\n\t\tptr++;\n\t}\n\t\n\tptr = (intp *)ind->data;\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCEAT, nn,\n\t\t\t\t\"reduceat\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n\tswitch(loop->meth) {\n\t/* zero-length index -- return array immediately */\n\tcase ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..\\n\"); */\n\t\tbreak;\n\n\t/* NOBUFFER -- behaved array and same type */\n\tcase NOBUFFER_UFUNCLOOP: \t /* Reduceat */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[0] = loop->it->dataptr +\t\\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\tmemcpy(loop->bufptr[1], loop->bufptr[0],\n\t\t\t\t loop->outsize);\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis]-*ptr : \\\n\t\t\t\t *(ptr+1) - *ptr) - 1;\n\t\t\t\tif (mm > 0) {\n\t\t\t\t\tloop->bufptr[0] += loop->instrides;\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &mm, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t}\t\n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\n\t/* BUFFER -- misbehaved array or different types */ \n\tcase BUFFER_UFUNCLOOP: /* Reduceat */\n\t\t/* fprintf(stderr, \"BUFFERED..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[1], loop->idptr, \n\t\t\t\t loop->outsize);\n\t\t\t\tn = 0;\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis] - *ptr :\\\n\t\t\t\t *(ptr+1) - *ptr);\n\t\t\t\tif (mm < 1) mm = 1;\n\t\t\t\tloop->inptr = loop->it->dataptr + \\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\twhile (n < mm) {\n\t\t\t\t\t/* Copy up to loop->bufsize elements\n\t\t\t\t\t to buffer */\n\t\t\t\t\tdptr = loop->buffer;\n\t\t\t\t\tfor (j=0; jbufsize; j++, n++) {\n\t\t\t\t\t\tif (n == mm) break;\n\t\t\t\t\t\tarr->descr->copyswap\\\n\t\t\t\t\t\t\t(dptr,\n\t\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t\t loop->insize);\n\t\t\t\t\t\tloop->inptr += loop->instrides;\n\t\t\t\t\t\tdptr += loop->insize;\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast)\n\t\t\t\t\t\tloop->cast(loop->buffer,\n\t\t\t\t\t\t\t loop->castbuf,\n\t\t\t\t\t\t\t j, NULL, NULL);\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &j, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t} \n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\t}\n\n\tLOOP_END_THREADS\n\t\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\t\n fail:\n\tLOOP_END_THREADS\n\n\tPy_XDECREF(loop);\n\treturn NULL;\n}\n\n\n/* This code handles reduce, reduceat, and accumulate \n (accumulate and reduce are special cases of the more general reduceat \n but they are handled separately for speed) \n*/\n\nstatic PyObject * \nPyUFunc_GenericReduction(PyUFuncObject *self, PyObject *args, \n PyObject *kwds, int operation) \n{\n\tint axis=0;\n\tPyArrayObject *mp, *ret = NULL;\n\tPyObject *op, *res=NULL;\n\tPyObject *obj_ind; \n\tPyArrayObject *indices = NULL;\n\tPyArray_Typecode otype= {PyArray_NOTYPE, 0, 0};\n PyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tstatic char *kwlist1[] = {\"array\", \"axis\", \"rtype\", NULL};\n\tstatic char *kwlist2[] = {\"array\", \"indices\", \"axis\", \"rtype\", NULL}; \n static char *_reduce_type[] = {\"reduce\", \"accumulate\", \\\n\t\t\t\t \"reduceat\", NULL};\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\t\n\n\tif (self->nin != 2) {\n\t\tPyErr_Format(PyExc_ValueError, \n \"%s only supported for binary functions\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\tif (self->nout != 1) {\n\t\tPyErr_Format(PyExc_ValueError,\n \"%s only supported for functions \" \\\n \"returning a single value\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\n\tif (operation == UFUNC_REDUCEAT) {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|iO&\", kwlist2, \n\t\t\t\t\t\t&op, &obj_ind, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n indices = (PyArrayObject *)PyArray_FromAny(obj_ind, &indtype, \n\t\t\t\t\t\t\t 1, 1, CARRAY_FLAGS);\n if (indices == NULL) return NULL;\n\n\t}\n\telse {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|iO&\", kwlist1,\n\t\t\t\t\t\t&op, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n\t}\n\t\n\t/* Ensure input is an array */\t\n\tmp = (PyArrayObject *)PyArray_FromAny(op, NULL, 0, 0, 0);\n\tif (mp == NULL) return NULL;\n\n /* Check to see if input is zero-dimensional */\n if (mp->nd == 0) {\n PyErr_Format(PyExc_ValueError, \"cannot %s on a scalar\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL; \n }\n\n /* Check to see that type (and otype) is not FLEXIBLE */\n\tif (PyArray_ISFLEXIBLE(mp) || PyTypeNum_ISFLEXIBLE(otype.type_num)) {\n PyErr_Format(PyExc_ValueError, \n\t\t\t \"cannot perform %s with flexible type\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL;\n }\n\n\tif (axis < 0) axis += mp->nd;\n\tif (axis < 0 || axis >= mp->nd) {\n\t\tPyErr_SetString(PyExc_ValueError, \"axis not in array\");\n Py_DECREF(mp);\n\t\treturn NULL;\n\t}\n\n\n if (otype.type_num == PyArray_NOTYPE)\n otype.type_num = mp->descr->type_num;\n\n switch(operation) {\n case UFUNC_REDUCE:\n ret = (PyArrayObject *)PyUFunc_Reduce(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_ACCUMULATE:\n ret = (PyArrayObject *)PyUFunc_Accumulate(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_REDUCEAT:\n ret = (PyArrayObject *)PyUFunc_Reduceat(self, mp, indices, \n axis, otype.type_num);\n Py_DECREF(indices);\n\t\tbreak;\n }\n Py_DECREF(mp);\n\tif (ret==NULL) return NULL;\n\tif (op->ob_type != ret->ob_type) {\n\t\tres = PyObject_CallMethod(op, \"__array_wrap__\", \"O\", ret);\n\t}\n\tif (res == NULL) PyErr_Clear();\n\telse if (res == Py_None) Py_DECREF(res);\n\telse {\n\t\tPy_DECREF(ret);\n\t\treturn res;\n\t}\t\n\treturn PyArray_Return(ret);\n\t\n}\n\n\n\n/* ---------- */\n\nstatic PyObject *\n_find_array_wrap(PyObject *args)\n{\n\tint nargs, i;\n\tint np = 0;\n\tint argmax = 0;\n\tint val;\n\tdouble priority[MAX_ARGS];\n\tdouble maxpriority = PyArray_SUBTYPE_PRIORITY;\n\tPyObject *with_wrap[MAX_ARGS];\n\tPyObject *attr;\n\tPyObject *obj;\n\n\tnargs = PyTuple_Size(args);\n\tfor (i=0; i maxpriority) {\n\t\t\tmaxpriority = priority[i];\n\t\t\targmax = i;\n\t\t}\n\t}\n\n\treturn with_wrap[argmax];\n}\n\nstatic PyObject *\nufunc_generic_call(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyTupleObject *ret;\n\tPyArrayObject *mps[MAX_ARGS];\n\tPyObject *retobj[MAX_ARGS];\n\tPyObject *res;\n\tPyObject *obj;\n\t\n\t/* Initialize all array objects to NULL to make cleanup easier \n\t if something goes wrong. */\n\tfor(i=0; inargs; i++) mps[i] = NULL;\n\t\n\tif (PyUFunc_GenericFunction(self, args, mps) == -1) {\n\t\tfor(i=0; inargs; i++) Py_XDECREF(mps[i]);\n\t\treturn NULL;\n\t}\n\t\n\tfor(i=0; inin; i++) Py_DECREF(mps[i]);\n\n\t/* Use __array_wrap__ on all outputs \n\t if present on one of the input arguments.\n\t If present for multiple inputs:\n\t use __array_wrap__ of input object with largest \n\t\t__array_priority__ (default = 0.0)\n\t */\n\tobj = _find_array_wrap(args);\n\t\n\t/* wrap outputs */\n\tfor (i=0; inout; i++) {\n\t\tint j=self->nin+i;\n\t\t/* check to see if any UPDATEIFCOPY flags are set \n\t\t which meant that a temporary output was generated \n\t\t*/\n\t\tif (mps[j]->flags & UPDATEIFCOPY) {\n\t\t\tPyObject *old = mps[j]->base;\n\t\t\tPy_INCREF(old); /* we want to hang on to this */\n\t\t\tPy_DECREF(mps[j]); /* should trigger the copy \n\t\t\t\t\t back into old */\n\t\t\tmps[j] = (PyArrayObject *)old;\n\t\t}\n\t\tif (obj != NULL) {\n\t\t\tres = PyObject_CallMethod(obj, \"__array_wrap__\",\n\t\t\t\t\t\t \"O\", mps[j]);\n\t\t\tif (res == NULL) PyErr_Clear();\n\t\t\telse if (res == Py_None) Py_DECREF(res);\n\t\t\telse {\n\t\t\t\tPy_DECREF(mps[j]);\n\t\t\t\tretobj[i] = res;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tretobj[i] = PyArray_Return(mps[j]);\n\t}\n\t\n\tif (self->nout == 1) { \n\t\treturn retobj[0];\n\t} else { \n\t\tret = (PyTupleObject *)PyTuple_New(self->nout);\n\t\tfor(i=0; inout; i++) {\n\t\t\tPyTuple_SET_ITEM(ret, i, retobj[i]);\n\t\t}\n\t\treturn (PyObject *)ret;\n\t}\t\n\n}\n\nstatic PyUFuncGenericFunction pyfunc_functions[] = {PyUFunc_On_Om};\n\nstatic char \ndoc_frompyfunc[] = \"frompyfunc(func, nin, nout) take an arbitrary python function that takes nin objects as input and returns nout objects and return a universal function (ufunc). This ufunc always returns PyObject arrays\";\n\nstatic PyObject *\nufunc_frompyfunc(PyObject *dummy, PyObject *args, PyObject *kwds) {\n /* Keywords are ignored for now */\n \n PyObject *function, *pyname=NULL;\n int nin, nout, i;\n PyUFunc_PyFuncData *fdata;\n PyUFuncObject *self;\n char *fname, *str;\n int fname_len=-1;\n\n if (!PyArg_ParseTuple(args, \"Oii\", &function, &nin, &nout)) return NULL;\n\n if (!PyCallable_Check(function)) {\n PyErr_SetString(PyExc_TypeError, \"Function must be callable.\");\n return NULL;\n }\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\n\tself->userloops = NULL;\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = PyUFunc_None;\t\n\tself->functions = pyfunc_functions;\n\n\tself->ntypes = 1;\n\tself->check_return = 0;\n\n pyname = PyObject_GetAttrString(function, \"__name__\");\n if (pyname)\n (void) PyString_AsStringAndSize(pyname, &fname, &fname_len);\n \n if (PyErr_Occurred()) {\n fname = \"?\";\n fname_len = 1;\n PyErr_Clear();\n } \n Py_XDECREF(pyname);\n\n\n self->ptr = malloc((self->nargs)+sizeof(PyUFunc_PyFuncData)+sizeof(void *)+(fname_len+14));\n \n\tif (self->ptr == NULL) return PyErr_NoMemory();\n Py_INCREF(function);\n self->obj = function;\n\tfdata = (PyUFunc_PyFuncData *)(self->ptr + (nin+nout) + sizeof(void *));\n fdata->nin = nin;\n fdata->nout = nout;\n fdata->callable = function;\n \n self->data = (void **)(self->ptr + (nin+nout));\n self->data[0] = (void *)fdata;\n\n\n\tself->types = (char *)self->ptr;\n for (i=0; inargs; i++) self->types[i] = PyArray_OBJECT;\n\n str = (char *)(fdata + 1);\n memcpy(str, fname, fname_len);\n memcpy(str+fname_len, \" (vectorized)\", 14);\n \n self->name = str;\n\n /* Do a better job someday */\n self->doc = \"dynamic ufunc based on a python function\";\n \n\t\n\treturn (PyObject *)self;\n}\n\n\nstatic PyObject *\nPyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void **data, \n\t\t\tchar *types, int ntypes,\n\t\t\tint nin, int nout, int identity, \n\t\t\tchar *name, char *doc, int check_return) \n{\n\tPyUFuncObject *self;\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = identity;\n\t\n\tself->functions = func;\n\tself->data = data;\n\tself->types = types;\n\tself->ntypes = ntypes;\n\tself->check_return = check_return;\n self->ptr = NULL;\n self->obj = NULL;\n\tself->userloops=NULL;\n\t\n\tif (name == NULL) self->name = \"?\";\n\telse self->name = name;\n\t\n if (doc == NULL) self->doc = \"NULL\";\n\telse self->doc = doc;\n\t\n\treturn (PyObject *)self;\n}\n\nstatic int\nPyUFunc_RegisterLoopForType(PyUFuncObject *ufunc, \n\t\t\t int usertype,\n\t\t\t PyUFuncGenericFunction function,\n\t\t\t void *data)\n{\n\tPyArray_Descr *descr=PyArray_DescrFromType(usertype);\n \tPyObject *key, *cobj;\n\tint ret;\t\n\t\n\tif ((usertype < PyArray_USERDEF) || (descr==NULL)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Cannot register typenumber\");\n\t\treturn -1;\n\t}\n\tif (ufunc->userloops == NULL) {\n\t\tufunc->userloops = PyDict_New();\n\t}\n\tkey = PyInt_FromLong(usertype);\n\tif (key == NULL) return -1;\n\tcobj = PyCObject_FromVoidPtr((void *)function, NULL);\n\tif (cobj == NULL) {Py_DECREF(key); return -1;}\n\tif (data == NULL) {\n\t\tret = PyDict_SetItem(ufunc->userloops, key, cobj);\n\t\tPy_DECREF(cobj);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n\telse {\n\t\tPyObject *cobj2, *tmp;\n\t\tcobj2 = PyCObject_FromVoidPtr(data, NULL);\n\t\tif (cobj2 == NULL) {\n\t\t\tPy_DECREF(cobj); \n\t\t\tPy_DECREF(key);\n\t\t\treturn -1;\n\t\t}\n\t\ttmp=Py_BuildValue(\"NN\", cobj, cobj2);\n\t\tret = PyDict_SetItem(ufunc->userloops, key, tmp);\n\t\tPy_DECREF(tmp);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n}\n\nstatic void\nufuncreduce_dealloc(PyUFuncReduceObject *self)\n{\n if (self->ufunc) {\n Py_XDECREF(self->it);\n\t\tPy_XDECREF(self->rit);\n Py_XDECREF(self->ret);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_XDECREF(self->decref);\n if (self->buffer) free(self->buffer);\n Py_DECREF(self->ufunc);\n }\n PyObject_DEL(self);\n}\n\nstatic void\nufuncloop_dealloc(PyUFuncLoopObject *self)\n{\n\tint i;\n\t\n\tif (self->ufunc != NULL) {\n\t\tfor (i=0; iufunc->nargs; i++)\n\t\t\tPy_XDECREF(self->iters[i]);\n\t\tif (self->buffer[0]) free(self->buffer[0]);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_DECREF(self->ufunc);\n\t}\n\tPyObject_DEL(self);\n}\n\n\nstatic void\nufunc_dealloc(PyUFuncObject *self)\n{\n if (self->ptr) free(self->ptr);\n\tPy_XDECREF(self->userloops);\n Py_XDECREF(self->obj);\n\tPyObject_DEL(self);\n}\n\nstatic PyObject *\nufunc_repr(PyUFuncObject *self)\n{\n\tchar buf[100];\n\t\n\tsprintf(buf, \"\", self->name);\n\t\n\treturn PyString_FromString(buf);\n}\n\n\n/* -------------------------------------------------------- */\n\n/* op.outer(a,b) is equivalent to op(a[:,NewAxis,NewAxis,etc.],b)\n where a has b.ndim NewAxis terms appended.\n\n The result has dimensions a.ndim + b.ndim\n */\n\nstatic PyObject *\nufunc_outer(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyObject *ret;\n\tPyArrayObject *ap1=NULL, *ap2=NULL, *ap_new=NULL;\n\tPyObject *new_args, *tmp;\n\tPyObject *shape1, *shape2, *newshape;\n\n\tif(self->nin != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"outer product only supported \"\\\n\t\t\t\t\"for binary functions\");\n\t\treturn NULL;\n\t}\n\t\n\tif (PySequence_Length(args) != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"exactly two arguments expected\");\n\t\treturn NULL;\n\t}\n\t\n\ttmp = PySequence_GetItem(args, 0);\n\tif (tmp == NULL) return NULL;\n\tap1 = (PyArrayObject *)\t\t\t\t\t\\\n\t\tPyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap1 == NULL) return NULL;\n\t\n\ttmp = PySequence_GetItem(args, 1);\n\tif (tmp == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap2 == NULL) {Py_DECREF(ap1); return NULL;}\n\n\t/* Construct new shape tuple */\n\tshape1 = PyTuple_New(ap1->nd);\n\tif (shape1 == NULL) goto fail;\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape1, i, \n\t\t\t\t PyLong_FromLongLong((longlong)ap1->\t\\\n\t\t\t\t\t\t dimensions[i]));\n\t\n\tshape2 = PyTuple_New(ap2->nd);\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape2, i, PyInt_FromLong((long) 1));\n\tif (shape2 == NULL) {Py_DECREF(shape1); goto fail;}\n\tnewshape = PyNumber_Add(shape1, shape2);\n\tPy_DECREF(shape1);\n\tPy_DECREF(shape2);\n\tif (newshape == NULL) goto fail;\n\t\n\tap_new = (PyArrayObject *)PyArray_Reshape(ap1, newshape);\n\tPy_DECREF(newshape);\n\tif (ap_new == NULL) goto fail;\n\t\n\tnew_args = Py_BuildValue(\"(OO)\", ap_new, ap2);\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\tPy_DECREF(ap_new);\t\n\tret = ufunc_generic_call(self, new_args);\n\tPy_DECREF(new_args);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ap_new);\n\treturn NULL;\n\n}\n\n\nstatic PyObject *\nufunc_reduce(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCE);\n}\n\nstatic PyObject *\nufunc_accumulate(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_ACCUMULATE);\n}\n\nstatic PyObject *\nufunc_reduceat(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCEAT);\n}\n\n\nstatic struct PyMethodDef ufunc_methods[] = {\n\t{\"reduce\", (PyCFunction)ufunc_reduce, METH_VARARGS | METH_KEYWORDS},\n\t{\"accumulate\", (PyCFunction)ufunc_accumulate, \n\t METH_VARARGS | METH_KEYWORDS},\n\t{\"reduceat\", (PyCFunction)ufunc_reduceat, \n\t METH_VARARGS | METH_KEYWORDS},\t\n\t{\"outer\", (PyCFunction)ufunc_outer, METH_VARARGS},\n\t{NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\n\n/* construct the string\n y1,y2,...,yn\n*/\n\nstatic void\n_makeargs(int num, char ltr, char *str) \n{\n\tint ind=0;\n\tint k;\n\tstatic char *digits=\"123456789ABCDE\";\n\n\tif (num == 1) {\n\t\tstr[0] = ltr;\n\t\tind = 1;\n\t}\n\telse {\n\t\tfor (k=0; ktype)\n\nstatic PyObject *\nufunc_getattr(PyUFuncObject *self, char *name)\n{\n\tPyObject *obj;\n\t/* Put docstring first or FindMethod finds it...*/\n\t/* could so some introspection on name and nin + nout */\n\t/* to automate the first part of it */\n\t/* the doc string shouldn't need the calling convention */\n\tif (strcmp(name, \"__doc__\") == 0) {\n\t\tstatic char doc[256];\n\t\tstatic char tmp1[3*MAX_ARGS+2];\n\t\tstatic char tmp2[3*MAX_ARGS+2];\n\t\t/* construct \n\t\t y1,y2,,... = name(x1,x2,...) __doc__\n\t\t*/\t\t\n\t\t_makeargs(self->nout, 'y', tmp1);\n\t\t_makeargs(self->nin, 'x', tmp2);\n\t\tsnprintf(doc, 256, \"%s = %s(%s) %s\", tmp1, self->name, \n\t\t\t tmp2, self->doc);\n\t\treturn PyString_FromString(doc);\n\t}\n\tobj = Py_FindMethod(ufunc_methods, (PyObject *)self, name);\n\tif (obj != NULL) return obj;\n\tPyErr_Clear();\n\tif (strcmp(name, \"nin\") == 0) {\n\t\treturn PyInt_FromLong(self->nin);\n\t}\n\telse if (strcmp(name, \"nout\") == 0) {\n\t\treturn PyInt_FromLong(self->nout);\n\t}\n\telse if (strcmp(name, \"nargs\") == 0) {\n\t\treturn PyInt_FromLong(self->nargs);\n\t}\n\telse if (strcmp(name, \"ntypes\") == 0) {\n\t\treturn PyInt_FromLong(self->ntypes);\n\t}\n\telse if (strcmp(name, \"types\") == 0) {\n\t\t/* return a list with types grouped\n\t\t input->output */\n\t\tPyObject *list;\n\t\tPyObject *str;\n\t\tint k, j, n, nt=self->ntypes;\n\t\tint ni = self->nin;\n\t\tint no = self->nout;\n\t\tchar *t;\n\t\tlist = PyList_New(nt);\n\t\tif (list == NULL) return NULL;\n\t\tt = malloc(no+ni+2);\n\t\tn = 0;\n\t\tfor (k=0; ktypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tt[ni] = '-';\n\t\t\tt[ni+1] = '>';\n\t\t\tfor (j=0; jtypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tstr = PyString_FromStringAndSize(t, no+ni+2);\n\t\t\tPyList_SET_ITEM(list, k, str);\n\t\t}\n\t\tfree(t);\n\t\treturn list;\n\t\t\n\t}\n\telse if (strcmp(name, \"__name__\") == 0) {\n\t\treturn PyString_FromString(self->name);\n\t}\n\telse if (strcmp(name, \"identity\") == 0) {\n\t\tswitch(self->identity) {\n\t\tcase PyUFunc_One:\n\t\t\treturn PyInt_FromLong(1);\n\t\tcase PyUFunc_Zero:\n\t\t\treturn PyInt_FromLong(0);\n\t\tdefault:\n\t\t\tPy_INCREF(Py_None);\n\t\t\treturn Py_None;\n\t\t}\n\t}\n\tPyErr_SetString(PyExc_AttributeError, name);\n\treturn NULL;\n}\n\n#undef _typecharfromnum\n\nstatic int\nufunc_setattr(PyUFuncObject *self, char *name, PyObject *v) \n{\n\treturn -1;\n}\n\nstatic char Ufunctype__doc__[] = \n\t\"Optimized functions make it possible to implement arithmetic \"\\\n\t\"with arrays efficiently\";\n\nstatic PyTypeObject PyUFunc_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufunc\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncObject),\t\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufunc_dealloc,\t/*tp_dealloc*/\n\t(printfunc)0,\t\t /*tp_print*/\n\t(getattrfunc)ufunc_getattr,\t/*tp_getattr*/\n\t(setattrfunc)ufunc_setattr,\t/*tp_setattr*/\n\t(cmpfunc)0,\t \t/*tp_compare*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_repr*/\n\t0,\t\t\t /*tp_as_number*/\n\t0,\t\t /*tp_as_sequence*/\n\t0,\t\t /*tp_as_mapping*/\n\t(hashfunc)0,\t\t/*tp_hash*/\n\t(ternaryfunc)ufunc_generic_call,\t\t/*tp_call*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_str*/\n\t\t\n\t/* Space for future expansion */\n\t0L,0L,0L,0L,\n\tUfunctype__doc__ /* Documentation string */\n};\n\nstatic PyTypeObject PyUFuncLoop_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncloop\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncLoopObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncloop_dealloc\t/*tp_dealloc*/\n};\n\nstatic PyTypeObject PyUFuncReduce_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncreduce\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncReduceObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncreduce_dealloc\t/*tp_dealloc*/\n};\n\n\n/* End of code for ufunc objects */\n/* -------------------------------------------------------- */\n", "source_code_before": "\n/*\n Python Universal Functions Object -- Math for all types, plus fast \n arrays math\n \n Full description\n \n This supports mathematical (and Boolean) functions on arrays and other python\n objects. Math on large arrays of basic C types is rather efficient.\n\n Travis E. Oliphant (2005)\n Assistant Professor\n Brigham Young University\n\n based on the \n\n Original Implementation: \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n with inspiration and code from\n Numarray\n Space Science Telescope Institute\n J. Todd Miller\n Perry Greenfield\n \n*/\n\n\ntypedef double (DoubleBinaryFunc)(double x, double y);\ntypedef float (FloatBinaryFunc)(float x, float y);\ntypedef longdouble (LongdoubleBinaryFunc)(longdouble x, longdouble y);\n\ntypedef void (CdoubleBinaryFunc)(cdouble *x, cdouble *y, cdouble *res);\ntypedef void (CfloatBinaryFunc)(cfloat *x, cfloat *y, cfloat *res);\ntypedef void (ClongdoubleBinaryFunc)(clongdouble *x, clongdouble *y, \\\n\t\t\t\t clongdouble *res);\n\nstatic void\nPyUFunc_ff_f_As_dd_d(char **args, intp *dimensions, intp *steps, void *func)\n{\n\tregister intp i, n=dimensions[0];\n\tregister intp is1=steps[0],is2=steps[1],os=steps[2];\n\tchar *ip1=args[0], *ip2=args[1], *op=args[2];\n\t\n\tfor(i=0; inin, nout=data->nout;\n int ntot;\n PyObject *tocall = data->callable; \n char *ptrs[MAX_ARGS];\n PyObject *arglist, *result;\n PyObject *in, **op;\n\n ntot = nin+nout;\n\n for (j=0; j < ntot; j++) ptrs[j] = args[j];\n\tfor(i=0; i> UFUNC_SHIFT_##NAME, \\\n\t\t\t\t\t errobj, str, retstatus) < 0) \\\n\t\t\t\treturn -1;\t\t \\\n\t\t\t}}\n\n\tif (errmask && retstatus) {\n\t\tHANDLEIT(DIVIDEBYZERO, \"divide by zero\");\n\t\tHANDLEIT(OVERFLOW, \"overflow\");\n\t\tHANDLEIT(UNDERFLOW, \"underflow\");\n\t\tHANDLEIT(INVALID, \"invalid\");\n\t}\n\n#undef HANDLEIT\n\n\treturn 0;\n}\n\n\n/* Checking the status flag clears it */\nstatic void\nPyUFunc_clearfperr()\n{\n\tint retstatus;\n\n\tUFUNC_CHECK_STATUS(retstatus)\n}\n\n\n#define UFUNC_NOSCALAR 0\n#define UFUNC_BOOL_SCALAR 1\n#define UFUNC_INTPOS_SCALAR 2\n#define UFUNC_INTNEG_SCALAR 3\n#define UFUNC_FLOAT_SCALAR 4\n#define UFUNC_COMPLEX_SCALAR 5\n#define UFUNC_OBJECT_SCALAR 6\n\n#define NO_UFUNCLOOP 0\n#define ZERODIM_REDUCELOOP 0\n#define ONE_UFUNCLOOP 1\n#define ONEDIM_REDUCELOOP 1\n#define NOBUFFER_UFUNCLOOP 2\n#define NOBUFFER_REDUCELOOP 2\n#define BUFFER_UFUNCLOOP 3\n#define BUFFER_REDUCELOOP 3\n\n\n#define UFUNC_REDUCE 0\n#define UFUNC_ACCUMULATE 1\n#define UFUNC_REDUCEAT 2\n#define UFUNC_OUTER 3\n\n\n\n\nstatic char\n_lowest_type(char intype)\n{\n switch(intype) {\n\t/* case PyArray_BYTE */\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\treturn PyArray_BYTE;\n\t/* case PyArray_UBYTE */\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\treturn PyArray_UBYTE;\n\t/* case PyArray_FLOAT:*/\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\treturn PyArray_FLOAT;\n\t/* case PyArray_CFLOAT:*/\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn PyArray_CFLOAT;\n default:\n return intype;\n }\n}\n\nstatic int \n_cancoerce(char thistype, char neededtype, char scalar) \n{\n\n\tswitch(scalar) {\n\tcase UFUNC_NOSCALAR:\n\tcase UFUNC_BOOL_SCALAR:\n\tcase UFUNC_OBJECT_SCALAR:\n\t\treturn PyArray_CanCastSafely(thistype, neededtype);\n\tcase UFUNC_INTPOS_SCALAR:\n\t\treturn (neededtype >= PyArray_UBYTE);\n\tcase UFUNC_INTNEG_SCALAR:\n\t\treturn (neededtype >= PyArray_BYTE) &&\t\t\\\n\t\t\t!(PyTypeNum_ISUNSIGNED(neededtype));\n\tcase UFUNC_FLOAT_SCALAR:\n\t\treturn (neededtype >= PyArray_FLOAT);\n\tcase UFUNC_COMPLEX_SCALAR:\n\t\treturn (neededtype >= PyArray_CFLOAT);\n\t}\n\tfprintf(stderr, \"\\n**Error** coerce fall through: %d %d %d\\n\\n\", \n\t\tthistype, neededtype, scalar);\n\treturn 1; /* should never get here... */ \n}\n\n\nstatic int \nselect_types(PyUFuncObject *self, int *arg_types, \n PyUFuncGenericFunction *function, void **data,\n\t char *scalars)\n{\n\n\tint i=0, j;\n\tchar start_type;\n\t\n\tif (PyTypeNum_ISUSERDEF((arg_types[0]))) {\n\t\tPyObject *key, *obj;\n\t\tfor (i=0; inin; i++) {\n\t\t\tif (arg_types[i] != arg_types[0]) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\t\t\"ufuncs on user defined\" \\\n\t\t\t\t\t\t\" types don't support \"\\\n\t\t\t\t\t\t\"coercion.\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfor (i=self->nin; inargs; i++) {\n\t\t\targ_types[i] = arg_types[0];\n\t\t}\n\t\t\n\t\tkey = PyInt_FromLong((long) arg_types[0]);\n\t\tif (key == NULL) return -1;\n\t\tobj = PyDict_GetItem(self->userloops, key);\n\t\tif (obj == NULL) {\n\t\t\tPy_DECREF(key);\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"no registered loop for this \"\t\\\n\t\t\t\t\t\"user-defined type.\");\n\t\t\treturn -1;\t\t\t\n\t\t}\n\t\tif PyTuple_Check(obj) {\n\t\t\t*function = (PyUFuncGenericFunction) \\\n\t\t\t\tPyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 0));\n\t\t\t*data = PyCObject_AsVoidPtr(PyTuple_GET_ITEM(obj, 1));\n\t\t}\n\t\telse {\n\t\t\t*function = (PyUFuncGenericFunction)\t\\\n\t\t\t\tPyCObject_AsVoidPtr(obj);\n\t\t\t*data = NULL;\n\t\t}\n\t\tPy_DECREF(key);\n\t\treturn 0;\n\t}\n\t\n\n\tstart_type = arg_types[0];\n\t/* If the first argument is a scalar we need to place \n\t the start type as the lowest type in the class\n\t*/\n\tif (scalars[0] != UFUNC_NOSCALAR) {\n\t\tstart_type = _lowest_type(start_type);\n\t}\n\n\twhile (intypes && start_type > self->types[i*self->nargs]) \n\t\ti++;\n\n\tfor(;intypes; i++) {\n\t\tfor(j=0; jnin; j++) {\n\t\t\tif (!_cancoerce(arg_types[j], \n\t\t\t\t\tself->types[i*self->nargs+j],\n\t\t\t\t\tscalars[j]))\n\t\t\t\tbreak;\n\t\t}\n\t\tif (j == self->nin) break;\n\t}\n\tif(i>=self->ntypes) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"function not supported for these types, \"\\\n\t\t\t\t\"and can't coerce safely to supported types\");\n\t\treturn -1;\n\t}\n\tfor(j=0; jnargs; j++) \n\t\targ_types[j] = self->types[i*self->nargs+j];\n\n\t*data = self->data[i];\n\t*function = self->functions[i];\n\n\treturn 0;\n}\n\n\n\nstatic int\n_getintfromvar(char *str, int deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tint retval=deflt;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n thedict = PyEval_GetGlobals();\n ref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = (int) PyInt_AsLong(ref);\n if (ref == NULL || retval == -1) retval = deflt;\n PyErr_Clear();\n\treturn retval;\n}\n\nstatic PyObject *\n_getfuncfromvar(char *str, PyObject *deflt)\n{\n PyObject *thedict;\n PyObject *ref;\n\tPyObject *retval;\n\n thedict = PyEval_GetLocals();\n ref = PyDict_GetItemString(thedict, str);\n if (ref == NULL) {\n\t\tthedict = PyEval_GetGlobals();\n\t\tref = PyDict_GetItemString(thedict, str);\n }\n if (ref == NULL) {\n thedict = PyEval_GetBuiltins();\n ref = PyDict_GetItemString(thedict, str);\n\t}\n if (ref != NULL) retval = ref;\n\telse retval = deflt;\n\tif (retval != Py_None && !PyCallable_Check(retval)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"%s if provided must be callable\", str);\n\t\treturn NULL;\n\t}\n\tPy_INCREF(retval);\n\treturn retval;\n}\n\n\nstatic char\n_scalar_kind(int typenum, PyArrayObject **arr) \n{\n\tif (PyTypeNum_ISSIGNED(typenum)) return UFUNC_INTNEG_SCALAR;\n\tif (PyTypeNum_ISFLOAT(typenum)) return UFUNC_FLOAT_SCALAR;\n\tif (PyTypeNum_ISCOMPLEX(typenum)) return UFUNC_COMPLEX_SCALAR;\n\tif (PyTypeNum_ISUNSIGNED(typenum)) return UFUNC_INTPOS_SCALAR;\n\tif (PyTypeNum_ISBOOL(typenum)) return UFUNC_BOOL_SCALAR;\n\treturn UFUNC_OBJECT_SCALAR;\n}\n\n\n/* Create copies for any arrays that are less than loop->bufsize\n in total size and are mis-behaved or in need\n of casting.\n*/\n\nstatic int\n_create_copies(PyUFuncLoopObject *loop, int *arg_types, PyArrayObject **mps)\n{\n\tint nin = loop->ufunc->nin;\n\tint i;\n\tintp size;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\n\tfor (i=0; ielsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\t\tif (size < loop->bufsize) {\n\t\t\tif (!(PyArray_ISBEHAVED_RO(mps[i])) ||\t\t\\\n\t\t\t PyArray_TYPE(mps[i]) != arg_types[i]) {\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST |\t\\\n\t\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\nstatic int\nconstruct_matrices(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps)\n{\n int nargs, i, cnt, cntcast, maxsize;\n int arg_types[MAX_ARGS];\n\tchar scalars[MAX_ARGS];\n\tPyUFuncObject *self=loop->ufunc;\n\tBool allscalars=TRUE;\n\tPyTypeObject *subtype=&PyArray_Type;\n\n /* Check number of arguments */\n nargs = PyTuple_Size(args);\n if ((nargs != self->nin) && (nargs != self->nargs)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of arguments\");\n return -1;\n }\n\n\n /* Get each input argument */\n for (i=0; inin; i++) {\n mps[i] = (PyArrayObject *)\\\n\t\t\tPyArray_FromAny(PyTuple_GET_ITEM(args,i), \n\t\t\t\t\tNULL, 0, 0, 0);\n if (mps[i] == NULL) return -1;\n arg_types[i] = PyArray_TYPE(mps[i]);\n if (PyTypeNum_ISFLEXIBLE(arg_types[i])) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"ufuncs do not support\"\t\\\n \" flexible arrays\");\n return -1;\n }\n\t\t/*\n\t\tfprintf(stderr, \"array %d has reference %d\\n\", i, \n\t\t (mps[i])->ob_refcnt);\n\t\t*/\n\n\t\t/* Scalars are 0-dimensional arrays\n\t\t at this point\n\t\t*/\n\t\tif (mps[i]->nd > 0) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t\tallscalars=FALSE;\n\t\t}\n\t\telse scalars[i] = _scalar_kind(arg_types[i], &(mps[i]));\n\n\t\t/* If any input is a big-array */\n\t\tif (!PyType_IsSubtype(mps[i]->ob_type, &PyArray_Type)) {\n\t\t\tsubtype = &PyBigArray_Type;\n\t\t}\n }\n\n\t/* If everything is a scalar, then use normal coercion rules */\n\tif (allscalars) {\n\t\tfor (i=0; inin; i++) {\n\t\t\tscalars[i] = UFUNC_NOSCALAR;\n\t\t}\n\t}\n \n /* Select an appropriate function for these argument types. */\n if (select_types(loop->ufunc, arg_types, &(loop->function), \n &(loop->funcdata), scalars) == -1)\n\t\treturn -1;\n\n\t/* This is the buffer size in number of elements.*/\n loop->bufsize = _getintfromvar(UFUNC_BUFSIZE_NAME, PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \"The buffer size (%d) is not \" \\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\treturn -1;\n\t}\n\t\n\t/* Create copies for some of the arrays if appropriate */\n\tif (_create_copies(loop, arg_types, mps) < 0) return -1;\n\t\n\t/* Create Iterators for the Inputs */\n\tfor (i=0; inin; i++) {\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n\t}\n \n /* Broadcast the result */\n loop->numiter = self->nin;\n if (PyArray_Broadcast((PyArrayMultiIterObject *)loop) < 0)\n\t\treturn -1;\n\t\n /* Get any return arguments */\n for (i=self->nin; idimensions, \n\t\t\t\t\t loop->dimensions, loop->nd)) {\n PyErr_SetString(PyExc_ValueError, \n \"invalid return array shape\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n if (!PyArray_ISWRITEABLE(mps[i])) {\n PyErr_SetString(PyExc_ValueError, \n \"return array is not writeable\");\n\t\t\tPy_DECREF(mps[i]);\n return -1;\n }\n }\n\n /* construct any missing return arrays and make output iterators */\n \n for (i=self->nin; inargs; i++) {\n\t\tPyArray_Typecode ntype = {PyArray_NOTYPE, 0, 0};\n\n if (mps[i] == NULL) {\n mps[i] = (PyArrayObject *)PyArray_New(subtype,\n loop->nd, \n loop->dimensions,\n arg_types[i], \n NULL, NULL,\n 0, 0, NULL);\n if (mps[i] == NULL) return -1;\n }\n\n\n\t\t/* reset types for outputs that are equivalent \n\t\t -- no sense casting uselessly\n\t\t*/\n\t\tif (mps[i]->descr->type_num != arg_types[i]) {\n\t\t\tPyArray_Typecode atype = {PyArray_NOTYPE, 0, 0};\n\t\t\tntype.type_num = PyArray_TYPE(mps[i]);\n\t\t\tntype.itemsize = PyArray_ITEMSIZE(mps[i]);\n\t\t\tatype.type_num = arg_types[i];\n\t\t\tatype.itemsize = \\\n\t\t\t\tPyArray_DescrFromType(arg_types[i])->elsize;\n\t\t\tif (PyArray_EquivalentTypes(&atype, &ntype)) {\n\t\t\t\targ_types[i] = PyArray_TYPE(mps[i]);\n\t\t\t}\n\t\t}\n\n\t\t/* still not the same -- or will we have to use buffers?*/\n\t\tif (mps[i]->descr->type_num != arg_types[i] ||\n\t\t !PyArray_ISBEHAVED_RO(mps[i])) {\n\t\t\tif (loop->size < loop->bufsize) {\n\t\t\t\tPyObject *new;\n\t\t\t\t/* Copy the array to a temporary copy \n\t\t\t\t and set the UPDATEIFCOPY flag\n\t\t\t\t*/\n\t\t\t\tntype.type_num = arg_types[i];\n\t\t\t\tntype.itemsize = 0;\n\t\t\t\tnew = PyArray_FromAny((PyObject *)mps[i], \n\t\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t\t FORCECAST | \n\t\t\t\t\t\t BEHAVED_FLAGS_RO |\n\t\t\t\t\t\t UPDATEIFCOPY);\n\t\t\t\tif (new == NULL) return -1;\n\t\t\t\tPy_DECREF(mps[i]);\n\t\t\t\tmps[i] = (PyArrayObject *)new;\n\t\t\t}\n\t\t}\n\t\t\n loop->iters[i] = (PyArrayIterObject *)\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)mps[i]);\n if (loop->iters[i] == NULL) return -1;\n }\n\n\n /* If any of different type, or misaligned or swapped\n then must use buffers */\n\n loop->bufcnt = 0;\n\n loop->obj = 0;\n\n /* Determine looping method needed */\n loop->meth = NO_UFUNCLOOP;\n\n\tcnt = cntcast = 0; /* keeps track of bytes to allocate */\n\tmaxsize = 0;\n for (i=0; inargs; i++) {\n\t\tcnt += mps[i]->itemsize;\n if (arg_types[i] != mps[i]->descr->type_num) {\n\t\t\tPyArray_Descr *descr;\n\n loop->meth = BUFFER_UFUNCLOOP;\n\t\t\tdescr = PyArray_DescrFromType(arg_types[i]);\n\t\t\tcntcast += descr->elsize;\n if (i < self->nin) {\n loop->cast[i] = \\\n\t\t\t\t\tmps[i]->descr->cast[arg_types[i]];\n\t\t\t}\n else {\n loop->cast[i] = descr->\\\n\t\t\t\t\tcast[mps[i]->descr->type_num];\n\t\t\t}\n\n }\n loop->swap[i] = !(PyArray_ISNOTSWAPPED(mps[i]));\n if (!PyArray_ISBEHAVED_RO(mps[i])) {\n loop->meth = BUFFER_UFUNCLOOP;\n }\n if (!loop->obj && mps[i]->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n }\n \n if (loop->meth == NO_UFUNCLOOP) {\n \n loop->meth = ONE_UFUNCLOOP;\n\n /* All correct type and BEHAVED */\n /* Check for non-uniform stridedness */\n\n for (i=0; inargs; i++) {\n if (!(loop->iters[i]->contiguous)) {\n\t\t\t\t/* may still have uniform stride\n\t\t\t\t if (broadcated result) <= 1-d */\n\t\t\t\tif (mps[i]->nd != 0 &&\t\t\t\\\n\t\t\t\t (loop->iters[i]->nd_m1 > 0)) {\n\t\t\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n }\n\t\tif (loop->meth == ONE_UFUNCLOOP) {\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tloop->bufptr[i] = mps[i]->data;\n\t\t\t}\n\t\t}\n }\n\n loop->numiter = self->nargs;\n\n /* Fill in steps */\n if (loop->meth == NOBUFFER_UFUNCLOOP) {\n\t\tint ldim = 0;\n\t\tintp maxdim=-1;\n\t\tPyArrayIterObject *it;\n\n /* Fix iterators */\n\n /* Find the **largest** dimension */\n \n\t\tmaxdim = -1;\n\t\tfor (i=loop->nd - 1; i>=0; i--) {\n\t\t\tif (loop->dimensions[i] > maxdim) {\n\t\t\t\tldim = i;\n\t\t\t\tmaxdim = loop->dimensions[i];\n\t\t\t}\n\t\t}\n\n\t\tloop->size /= maxdim;\n loop->bufcnt = maxdim;\n\n /* Fix the iterators so the inner loop occurs over the \n\t\t largest dimensions -- This can be done by \n\t\t setting the size to 1 in that dimension \n\t\t (just in the iterators)\n */\n\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = loop->iters[i];\n it->contiguous = 0;\n\t\t\tit->size /= (it->dims_m1[ldim]+1);\n\t\t\tit->dims_m1[ldim] = 0;\n\t\t\tit->backstrides[ldim] = 0;\n\n\t\t\t/* (won't fix factors because we\n\t\t\t don't use PyArray_ITER_GOTO1D \n\t\t\t so don't change them) */\n\n\n\t\t\t/* Set the steps to the strides in that dimension */\n loop->steps[i] = it->strides[ldim];\n\t\t}\n\n }\n else if (loop->meth == BUFFER_UFUNCLOOP) {\n for (i=0; inargs; i++) {\n\t\t\tloop->steps[i] = mps[i]->itemsize; \n\t\t}\n }\n\telse { /* uniformly-strided case ONE_UFUNCLOOP */\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (mps[i]->nd == 0)\n\t\t\t\tloop->steps[i] = 0;\n\t\t\telse \n\t\t\t\tloop->steps[i] = mps[i]->strides[mps[i]->nd-1];\n\t\t}\n\t}\n \n\n\t/* Finally, create memory for buffers if we need them */\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\t\tchar *castptr;\n\t\tint oldsize=0;\n\t\tloop->buffer[0] = (char *)malloc(loop->bufsize*(cnt+cntcast));\n\t\t/* fprintf(stderr, \"Allocated buffer at %p of size %d, cnt=%d, cntcast=%d\\n\", loop->buffer[0], loop->bufsize * (cnt + cntcast), cnt, cntcast); */\n\t\tif (loop->buffer[0] == NULL) return -1;\n\t\tcastptr = loop->buffer[0] + loop->bufsize*cnt;\n\t\tfor (i=0; inargs; i++) {\n\t\t\tif (i > 0)\n\t\t\t\tloop->buffer[i] = loop->buffer[i-1] + \\\n\t\t\t\t\tloop->bufsize * mps[i-1]->itemsize;\n\t\t\t/* fprintf(stderr, \"buffer[%d] = %p\\n\", i, loop->buffer[i]); */\n\t\t\tif (loop->cast[i]) {\n\t\t\t\tloop->castbuf[i] = castptr + \n\t\t\t\t\tloop->bufsize*oldsize;\n\t\t\t\t/* fprintf(stderr, \"castbuf[%d] = %p\\n\", i, loop->castbuf[i]); */\n#define _PyD PyArray_DescrFromType\n\t\t\t\toldsize = _PyD(arg_types[i])->elsize;\n#undef _PyD\n\t\t\t\tloop->bufptr[i] = loop->castbuf[i];\n\t\t\t\tcastptr = loop->castbuf[i];\n\t\t\t\tloop->steps[i] = oldsize;\n\t\t\t}\n\t\t\telse\n\t\t\t\tloop->bufptr[i] = loop->buffer[i];\n\t\t\tloop->dptr[i] = loop->buffer[i];\n\t\t}\n\t}\n\n return nargs;\n}\n\nstatic PyTypeObject PyUFuncLoop_Type;\n\nstatic void ufuncloop_dealloc(PyUFuncLoopObject *);\n\nstatic PyUFuncLoopObject *\nconstruct_loop(PyUFuncObject *self, PyObject *args, PyArrayObject **mps)\n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\t\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\n\n\tif ((loop=PyObject_NEW(PyUFuncLoopObject, &PyUFuncLoop_Type)) == NULL)\n\t\treturn NULL;\n\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n\tloop->buffer[0] = NULL;\n for (i=0; inargs; i++) {\n loop->iters[i] = NULL;\n loop->cast[i] = NULL;\n }\n\tloop->errobj = NULL;\n\n\t/* Setup the matrices */\n\tif (construct_matrices(loop, args, mps) < 0) goto fail;\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString((self->name ? \\\n self->name : \"\")), \n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n\tPyUFunc_clearfperr();\n\n\treturn loop;\n\n fail:\n\tufuncloop_dealloc(loop);\n\treturn NULL;\n}\n\n\n/* \nstatic void\n_printbytebuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing byte buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %d\\n\", *(((byte *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->buffer[bufnum]))+i));\n\t} \n}\n\nstatic void\n_printlongbufptr(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->bufptr[bufnum]))+i));\n\t} \n}\n\n\n \nstatic void\n_printcastbuf(PyUFuncLoopObject *loop, int bufnum) \n{ \n\tint i;\n\t\n \tfprintf(stderr, \"Printing long buffer %d\\n\", bufnum);\n for (i=0; ibufcnt; i++) {\n\t \tfprintf(stderr, \" %ld\\n\", *(((long *)(loop->castbuf[bufnum]))+i));\n\t} \n}\n\n*/\n\n\n\n\n/* currently generic ufuncs cannot be built for use on flexible arrays.\n\n The cast functions in the generic loop would need to be fixed to pass \n something besides NULL, NULL \n\n*/\n\n/* This generic function is called with the ufunc object, the arguments to it,\n and an array of (pointers to) PyArrayObjects which are NULL. The \n arguments are parsed and placed in mps in construct_loop (construct_matrices)\n*/\n\nstatic int \nPyUFunc_GenericFunction(PyUFuncObject *self, PyObject *args, \n\t\t\tPyArrayObject **mps) \n{\n\tPyUFuncLoopObject *loop;\n\tint i;\n\tint temp;\n BEGIN_THREADS_DEF\n\n\tif (!(loop = construct_loop(self, args, mps))) return -1;\n\n\tLOOP_BEGIN_THREADS\n\n\tswitch(loop->meth) {\n\tcase ONE_UFUNCLOOP:\n\t\t/* Everything is contiguous, notswapped, aligned,\n\t\t and of the right type. -- Fastest.\n\t\t Or if not contiguous, then a single-stride\n\t\t increment moves through the entire array. \n\t\t*/\n /* fprintf(stderr, \"ONE...%d\\n\", loop->size);*/\n\t\tloop->function((char **)loop->bufptr, &(loop->size), \n\t\t\t loop->steps, loop->funcdata);\n\t\tUFUNC_CHECK_ERROR();\n\t\tbreak;\n\tcase NOBUFFER_UFUNCLOOP:\n\t\t/* Everything is notswapped, aligned and of the \n\t\t right type but not contiguous. -- Almost as fast.\n\t\t*/\n /* fprintf(stderr, \"NOBUFFER...%d\\n\", loop->size);*/\n\t\twhile (loop->index < loop->size) {\n\t\t\tfor (i=0; inargs; i++) \n\t\t\t\tloop->bufptr[i] = loop->iters[i]->dataptr;\n\n\t\t\tloop->function((char **)loop->bufptr, &(loop->bufcnt),\n\t\t\t\t loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\tfor (i=0; inargs; i++) {\n\t\t\t\tPyArray_ITER_NEXT(loop->iters[i]);\n\t\t\t}\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\tcase BUFFER_UFUNCLOOP: {\n\t\t/* Make local copies of all loop variables */\n\t\t/* Optimizations needed:\n\t\t 1) move data better into the buffer better\n\t\t --- not one at a time -- this requires some \n pre-analysis and is only possible over \n the largest dimension.\n\t\t*/\n\n\t\tPyArray_CopySwapNFunc *copyswapn[MAX_ARGS];\n\t\tPyArrayIterObject **iters=loop->iters;\n\t\tint *swap=loop->swap;\n\t\tvoid **dptr=loop->dptr;\n\t\tint mpselsize[MAX_ARGS];\n\t\tintp index=loop->index, size=loop->size;\n\t\tint bufcnt=loop->bufcnt, bufsize=loop->bufsize;\n\t\tvoid **bufptr = loop->bufptr;\n\t\tvoid **buffer = loop->buffer;\n\t\tvoid **castbuf = loop->castbuf;\n\t\tintp *steps = loop->steps;\n\t\tBool pyobject[MAX_ARGS];\n\t\t\n\t\tfor (i=0; inargs; i++) {\n\t\t\tcopyswapn[i] = mps[i]->descr->copyswapn;\n\t\t\tmpselsize[i] = mps[i]->itemsize;\n\t\t\tpyobject[i] = (loop->obj && \\\n (mps[i]->descr->type_num == PyArray_OBJECT));\n\t\t}\n\t\t/* Do generic buffered looping here (works for any kind of\n\t\t arrays): Everything uses a buffer. \n\n\t\t 1. fill the input buffers.\n\t\t 2. If buffer is filled then \n\t\t a. cast any input buffers needing it. \n\t\t b. call inner function (which loops over the buffer).\n\t\t\t c. cast any output buffers needing it.\n\t\t\t d. copy output buffer back to output arrays.\n 3. goto next position\n\t\t*/ \n\t\tfprintf(stderr, \"BUFFER...%d\\n\", loop->size);\n\t\t/*\n\t\tfor (i=0; inargs; i++) {\n\t\t\tfprintf(stderr, \"iters[%d]->dataptr = %p, %p of size %d\\n\", i, \n\t\t\t\titers[i], iters[i]->ao->data, PyArray_NBYTES(iters[i]->ao));\n\t\t}\n\t\t*/\n\t\twhile (index < size) {\n\t\t\t/*copy input data */\n\t\t\tfor (i=0; inin; i++) {\n\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\tPy_INCREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t}\n\t\t\t\t/*\t\t\t\tfprintf(stderr, \"index = %d, i=%d, writing to %p\\n\", index, i, dptr[i]); */\n\t\t\t\tmemcpy(dptr[i], iters[i]->dataptr,\n\t\t\t\t mpselsize[i]);\n\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t}\n\t\t\tbufcnt++;\n\t\t\tindex++; \n\t\t\tif ((bufcnt == bufsize) || \\\n\t\t\t (index == size)) {\n\t\t\t\t\n\t\t\t\tfor (i=0; inin; i++) {\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping...\\n\");*/\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](buffer[i],\n\t\t\t\t\t\t\t castbuf[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t\tloop->function((char **)bufptr, \n\t\t\t\t\t &bufcnt, \n\t\t\t\t\t steps, loop->funcdata);\n \n\t\t\t\tUFUNC_CHECK_ERROR();\n\n\t\t\t\tfor (i=self->nin; inargs; i++) {\n\t\t\t\t\tif (loop->cast[i]) {\n\t\t\t\t\t\tloop->cast[i](castbuf[i],\n\t\t\t\t\t\t\t buffer[i],\n\t\t\t\t\t\t\t bufcnt,\n\t\t\t\t\t\t\t NULL, NULL);\n\t\t\t\t\t}\n\t\t\t\t\tif (swap[i]) {\n\t\t\t\t\t\t/* fprintf(stderr, \"swapping back...\\n\"); */\n\t\t\t\t\t\tcopyswapn[i](buffer[i], NULL,\n\t\t\t\t\t\t\t bufcnt, 1, \n\t\t\t\t\t\t\t mpselsize[i]);\n\t\t\t\t\t}\n\t\t\t\t\tfor (temp = 0; temp < bufcnt; temp++) {\n\t\t\t\t\t\t/* fprintf(stderr, \"temp=%d, i=%d; reading from %p\\n\", temp, i, dptr[i]);*/\n\t\t\t\t\t\tif (pyobject[i]) {\n\t\t\t\t\t\t\tPy_XDECREF(*((PyObject **)iters[i]->dataptr));\n\t\t\t\t\t\t\tPy_INCREF(*((PyObject **)dptr[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmemcpy(iters[i]->dataptr,\n\t\t\t\t\t\t dptr[i], mpselsize[i]);\n\t\t\t\t\t\tPyArray_ITER_NEXT(iters[i]);\n\t\t\t\t\t\tdptr[i] += mpselsize[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbufcnt = 0;\n\t\t\t\tfor (i=0; inargs; i++) \n\t\t\t\t\tdptr[i] = buffer[i];\n\t\t\t\t\n\t\t\t} \n\t\t}\n\t}\n\t}\t\n\t\n LOOP_END_THREADS\n\t\n Py_DECREF(loop);\n\treturn 0;\n\n fail:\n LOOP_END_THREADS\n \n\tPy_XDECREF(loop);\n\treturn -1;\n }\n\nstatic PyArrayObject *\n_getidentity(PyUFuncObject *self, int otype, char *str)\n{\n PyObject *obj, *arr;\n PyArray_Typecode typecode = {otype, 0, 0};\n\n if (self->identity == PyUFunc_None) {\n PyErr_Format(PyExc_ValueError, \n \"zero-size array to ufunc.%s \" \\\n \"without identity\", str);\n return NULL;\n }\n if (self->identity == PyUFunc_One) {\n obj = PyInt_FromLong((long) 1);\n } else {\n obj = PyInt_FromLong((long) 0);\n }\n\t\n arr = PyArray_FromAny(obj, &typecode, 0, 0, CARRAY_FLAGS);\n Py_DECREF(obj);\n return (PyArrayObject *)arr;\n}\n\nstatic int\n_create_reduce_copy(PyUFuncReduceObject *loop, PyArrayObject **arr, int rtype)\n{\n\tintp maxsize;\n\tPyObject *new;\n\tPyArray_Typecode ntype = {rtype, 0, 0};\n\t\n\tmaxsize = PyArray_SIZE(*arr);\n\t\n\tif (maxsize < loop->bufsize) {\n\t\tif (!(PyArray_ISBEHAVED_RO(*arr)) ||\t\\\n\t\t PyArray_TYPE(*arr) != rtype) {\n\t\t\tnew = PyArray_FromAny((PyObject *)(*arr), \n\t\t\t\t\t &ntype, 0, 0,\n\t\t\t\t\t FORCECAST |\t\t\\\n\t\t\t\t\t BEHAVED_FLAGS_RO);\n\t\t\tif (new == NULL) return -1;\n\t\t\t*arr = (PyArrayObject *)new;\n\t\t\tloop->decref = new;\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n\n\n\nstatic PyTypeObject PyUFuncReduce_Type;\n\nstatic void ufuncreduce_dealloc(PyUFuncReduceObject *);\n\nstatic PyUFuncReduceObject *\nconstruct_reduce(PyUFuncObject *self, PyArrayObject **arr, int axis, \n\t\t int otype, int operation, intp ind_size, char *str)\n{\n PyUFuncReduceObject *loop;\n PyArrayObject *idarr;\n\tPyArrayObject *aar;\n intp loop_i[MAX_DIMS];\n int arg_types[3] = {otype, otype, otype};\n\tchar scalars[3] = {UFUNC_NOSCALAR, UFUNC_NOSCALAR, UFUNC_NOSCALAR};\n\tint i, j;\n\tint nd = (*arr)->nd;\n\t/* Reduce type is the type requested of the input \n\t during reduction */\n\n\tif ((loop=PyObject_NEW(PyUFuncReduceObject, \n\t\t\t &PyUFuncReduce_Type)) == NULL)\n\t\treturn NULL;\n\n\n loop->swap = 0;\n\tloop->index = 0;\n\tloop->ufunc = self;\n Py_INCREF(self);\n loop->cast = NULL;\n loop->buffer = NULL;\n loop->ret = NULL;\n\tloop->it = NULL;\n\tloop->rit = NULL;\n\tloop->errobj = NULL;\n\tloop->decref=NULL; \n loop->N = (*arr)->dimensions[axis];\n\tloop->instrides = (*arr)->strides[axis];\n\n\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t &(loop->funcdata), scalars) == -1) goto fail; \n\t\n\t/* output type may change -- if it does \n\t reduction is forced into that type \n\t and we need to select the reduction function again\n\t*/\n\tif (otype != arg_types[2]) {\n\t\totype = arg_types[2];\n\t\targ_types[0] = otype;\n\t\targ_types[1] = otype;\n\t\tif (select_types(loop->ufunc, arg_types, &(loop->function), \n\t\t\t\t &(loop->funcdata), scalars) == -1) \n\t\t\tgoto fail; \t\t\n\t}\n\n\t/* Make bufsize depend on a local then module-level variable */\n\tloop->bufsize = _getintfromvar(\"UFUNC_BUFSIZE\", \n\t\t\t\t PyArray_BUFSIZE);\n\tif ((loop->bufsize < PyArray_MIN_BUFSIZE) ||\t\t\\\n\t (loop->bufsize > PyArray_MAX_BUFSIZE)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"The buffer size (%d) is not \"\t\\\n\t\t\t \"in range (%d - %d)\", \n\t\t\t loop->bufsize, PyArray_MIN_BUFSIZE, \n\t\t\t PyArray_MAX_BUFSIZE);\n\t\tgoto fail;\n\t}\n\t\n\t/* Make copy if misbehaved or not otype for small arrays */\n\tif (_create_reduce_copy(loop, arr, otype) < 0) goto fail; \n\taar = *arr;\n\t\n if (loop->N == 0) {\n loop->meth = ZERODIM_REDUCELOOP;\n }\n else if (PyArray_ISBEHAVED_RO(aar) &&\t\t\\\n otype == (aar)->descr->type_num) {\n\t\tif (loop->N == 1) {\n\t\t\tloop->meth = ONEDIM_REDUCELOOP;\n\t\t}\n\t\telse {\n\t\t\tloop->meth = NOBUFFER_UFUNCLOOP;\n\t\t\tloop->steps[0] = (aar)->strides[axis];\n\t\t\tloop->N -= 1;\n\t\t}\n }\n else {\n loop->meth = BUFFER_UFUNCLOOP;\n loop->swap = !(PyArray_ISNOTSWAPPED(aar));\n }\n\n if (loop->meth == ZERODIM_REDUCELOOP) {\n idarr = _getidentity(self, otype, str);\n if (idarr == NULL) goto fail;\n if (idarr->itemsize > UFUNC_MAXIDENTITY) {\n PyErr_Format(PyExc_RuntimeError, \n\t\t\t\t \"UFUNC_MAXIDENTITY (%d)\"\t\t\\\n \" is too small (needs to be at least %d)\",\n UFUNC_MAXIDENTITY, idarr->itemsize);\n Py_DECREF(idarr);\n goto fail;\n }\n memcpy(loop->idptr, idarr->data, idarr->itemsize);\n Py_DECREF(idarr);\n }\n\t\n /* Construct return array */\n\tswitch(operation) {\n\tcase UFUNC_REDUCE:\n\t\tfor (j=0, i=0; idimensions[i];\n\t\t\t\n\t\t}\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd-1, loop_i, otype, \n\t\t\t\t NULL, NULL, 0, 0, aar);\n\t\tbreak;\n\tcase UFUNC_ACCUMULATE:\n\t\tloop->ret = (PyArrayObject *)\t\t\t\t\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, aar->dimensions, \n\t\t\t\t otype, NULL, NULL, 0, 0, aar);\n\t\tbreak;\n\tcase UFUNC_REDUCEAT:\n\t\tmemcpy(loop_i, aar->dimensions, nd*sizeof(intp));\n\t\t/* Index is 1-d array */\n\t\tloop_i[axis] = ind_size; \n\t\tloop->ret = (PyArrayObject *)\\\n\t\t\tPyArray_New(aar->ob_type, aar->nd, loop_i, otype,\n\t\t\t\t NULL, NULL, 0, 0, aar);\n\t\tif (loop->ret == NULL) goto fail;\n\t\tif (ind_size == 0) {\n\t\t\tloop->meth = ZERODIM_REDUCELOOP;\n\t\t\treturn loop;\n\t\t}\n\t\tif (loop->meth == ONEDIM_REDUCELOOP)\n\t\t\tloop->meth = NOBUFFER_REDUCELOOP;\n\t\tbreak;\n\t}\n if (loop->ret == NULL) goto fail;\n loop->insize = aar->itemsize;\n loop->outsize = loop->ret->itemsize;\n loop->bufptr[1] = loop->ret->data;\n\n\tif (loop->meth == ZERODIM_REDUCELOOP) {\n\t\tloop->size = PyArray_SIZE(loop->ret);\n\t\treturn loop;\n\t}\n\n\tloop->it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)aar);\n if (loop->it == NULL) return NULL;\n\n\tif (loop->meth == ONEDIM_REDUCELOOP) {\n\t\tloop->size = loop->it->size;\t\t\n\t\treturn loop;\n\t}\n\n /* Fix iterator to loop over correct dimension */\n\t/* Set size in axis dimension to 1 */\n \n loop->it->contiguous = 0;\n loop->it->size /= (loop->it->dims_m1[axis]+1);\n loop->it->dims_m1[axis] = 0;\n loop->it->backstrides[axis] = 0;\n\n\n loop->size = loop->it->size;\n\n\tif (operation == UFUNC_REDUCE) {\n\t\tloop->steps[1] = 0;\n\t}\n\telse {\n\t\tloop->rit = (PyArrayIterObject *)\t\t\t\\\n\t\t\tPyArray_IterNew((PyObject *)(loop->ret));\n\t\tif (loop->rit == NULL) return NULL;\t\t\n\n\t\t/* Fix iterator to loop over correct dimension */\n\t\t/* Set size in axis dimension to 1 */\n\t\t\n\t\tloop->rit->contiguous = 0;\n\t\tloop->rit->size /= (loop->rit->dims_m1[axis]+1);\n\t\tloop->rit->dims_m1[axis] = 0;\n\t\tloop->rit->backstrides[axis] = 0;\n\n\t\tif (operation == UFUNC_ACCUMULATE)\n\t\t\tloop->steps[1] = loop->ret->strides[axis];\n\t\telse \n\t\t\tloop->steps[1] = 0;\n\t}\n\tloop->steps[2] = loop->steps[1];\n\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[2];\n\t\n\tif (loop->meth == BUFFER_UFUNCLOOP) {\n\n\t\tloop->steps[0] = loop->outsize;\n if (otype != aar->descr->type_num) {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n (loop->outsize + \\\n aar->itemsize));\n if (loop->buffer == NULL) goto fail;\n loop->castbuf = loop->buffer + \\\n loop->bufsize*aar->itemsize;\n loop->bufptr[0] = loop->castbuf; \n loop->cast = aar->descr->cast[otype];\n }\n else {\n loop->buffer = (char *)malloc(loop->bufsize*\\\n loop->outsize);\n if (loop->buffer == NULL) goto fail;\n loop->bufptr[0] = loop->buffer;\n }\n\t}\n\t\n\tloop->errormask = _getintfromvar(UFUNC_ERRMASK_NAME,\n\t\t\t\t\t UFUNC_ERR_DEFAULT);\n\tif (loop->errormask < 0) {\n\t\tPyErr_Format(PyExc_ValueError, \\\n\t\t\t \"Invalid error mask (%d)\", \n\t\t\t loop->errormask);\n\t\tgoto fail;\n\t\t\t \n\t}\n\n\tloop->errobj = Py_BuildValue(\"NN\", \n\t\t\t\t PyString_FromString(str),\n\t\t\t\t _getfuncfromvar(UFUNC_ERRFUNC_NAME,\n\t\t\t\t\t\t Py_None));\n\tif (loop->errobj == NULL) goto fail;\n\n /* Determine if object arrays are involved */\n if (otype == PyArray_OBJECT || aar->descr->type_num == PyArray_OBJECT)\n loop->obj = 1;\n else\n loop->obj = 0;\n\n\tPyUFunc_clearfperr();\n\treturn loop;\n\n fail:\n ufuncreduce_dealloc(loop);\n\treturn NULL;\t\n}\n\n\n/* We have two basic kinds of loops */\n/* One is used when arr is not-swapped and aligned and output type\n is the same as input type.\n and another using buffers when one of these is not satisfied.\n\n Zero-length and one-length axes-to-be-reduced are handled separately.\n*/\n\nstatic PyObject *\nPyUFunc_Reduce(PyUFuncObject *self, PyArrayObject *arr, int axis, int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n BEGIN_THREADS_DEF\n \t\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCE, 0,\n\t\t\t\t\"reduce\");\n\tif (!loop) return NULL;\n\n LOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP:\n\t\t/*fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP:\n\t\t/*fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it)\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1];\n loop->index++; \n\t\t\tif (PyErr_Occurred()) goto fail;\n }\n break;\n case BUFFER_UFUNCLOOP:\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy first item over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %d\\n\", loop->size, \n\t\t loop->swap); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n loop->bufptr[1] += loop->outsize;\n loop->bufptr[2] = loop->bufptr[1]; \n loop->index++;\n }\n }\n\n LOOP_END_THREADS\n\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n LOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n\nstatic PyObject *\nPyUFunc_Accumulate(PyUFuncObject *self, PyArrayObject *arr, int axis, \n\t\t int otype)\n{\n PyArrayObject *ret=NULL;\n PyUFuncReduceObject *loop;\n intp i, n;\n char *dptr;\n \n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_ACCUMULATE, 0,\n\t\t\t\t\"accumulate\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n switch(loop->meth) {\n case ZERODIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ZERO..%d\\n\", loop->size); */\n\t\tfor(i=0; isize; i++) {\n\t\t\tmemcpy(loop->bufptr[1], loop->idptr, loop->outsize);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t} \n break;\n case ONEDIM_REDUCELOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"ONEDIM..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tloop->bufptr[1] += loop->outsize;\n\t\t\tloop->index++;\n\t\t}\t\t\n\t\tbreak;\n case NOBUFFER_UFUNCLOOP: /* Accumulate */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n while(loop->index < loop->size) {\n\t\t\t/* Copy first element to output */\n memcpy(loop->bufptr[1], loop->it->dataptr, \n loop->outsize);\n\t\t\t/* Adjust input pointer */\n loop->bufptr[0] = loop->it->dataptr+loop->steps[0];\n loop->function((char **)loop->bufptr, \n\t\t\t\t &(loop->N),\n loop->steps, loop->funcdata);\n\t\t\tUFUNC_CHECK_ERROR();\n\n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n break;\n case BUFFER_UFUNCLOOP: /* Accumulate */\n /* use buffer for arr */\n /* \n For each row to reduce\n 1. copy identity over to output (casting if necessary)\n 2. Fill inner buffer \n 3. When buffer is filled or end of row\n a. Cast input buffers if needed\n b. Call inner function.\n 4. Repeat 2 until row is done.\n */\n\t\t/* fprintf(stderr, \"BUFFERED..%d %p\\n\", loop->size, \n\t\t loop->cast); */\n while(loop->index < loop->size) {\n loop->inptr = loop->it->dataptr;\t\t\t\n\t\t\t/* Copy (cast) First term over to output */\n\t\t\tif (loop->cast) {\n\t\t\t\t/* A little tricky because we need to\n\t\t\t\t cast it first */\n\t\t\t\tarr->descr->copyswap(loop->buffer,\n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t\tloop->cast(loop->buffer, loop->castbuf,\n\t\t\t\t\t 1, NULL, NULL);\n\t\t\t\tmemcpy(loop->bufptr[1], loop->castbuf,\n\t\t\t\t loop->outsize);\n\t\t\t}\n\t\t\telse { /* Simple copy */\n\t\t\t\tarr->descr->copyswap(loop->bufptr[1], \n\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t loop->insize);\n\t\t\t}\n\t\t\tloop->inptr += loop->instrides;\n n = 1;\n while(n < loop->N) {\n /* Copy up to loop->bufsize elements to \n buffer */\n dptr = loop->buffer;\n for (i=0; ibufsize; i++, n++) {\n if (n == loop->N) break;\n arr->descr->copyswap(dptr,\n loop->inptr,\n loop->swap,\n loop->insize);\n loop->inptr += loop->instrides;\n dptr += loop->insize;\n }\n if (loop->cast)\n loop->cast(loop->buffer,\n loop->castbuf,\n i, NULL, NULL);\n loop->function((char **)loop->bufptr,\n &i, \n\t\t\t\t\t loop->steps, loop->funcdata);\n\t\t\t\tUFUNC_CHECK_ERROR();\n } \n PyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n loop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->bufptr[2] = loop->bufptr[1] + loop->steps[1];\n loop->index++;\n }\n }\n\n\tLOOP_END_THREADS\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\n fail:\n\tLOOP_END_THREADS\n\n Py_XDECREF(loop);\n return NULL;\n}\n\n/* Reduceat performs a reduce over an axis using the indices as a guide\n\nop.reduceat(array,indices) computes\nop.reduce(array[indices[i]:indices[i+1]] \n for i=0..end with an implicit indices[i+1]=len(array)\n assumed when i=end-1\n\nif indices[i+1] <= indices[i]+1 \n then the result is array[indices[i]] for that value\n\nop.accumulate(array) is the same as\nop.reduceat(array,indices)[::2]\nwhere indices is range(len(array)-1) with a zero placed in every other sample\n indices = zeros(len(array)*2-1)\n indices[1::2] = range(1,len(array))\n\noutput shape is based on the size of indices\n */\n\nstatic PyObject *\nPyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, \n int axis, int otype)\n{\t\n\tPyArrayObject *ret;\n PyUFuncReduceObject *loop;\n\tintp *ptr=(intp *)ind->data;\n\tintp nn=ind->dimensions[0];\t\t\n\tintp mm=arr->dimensions[axis]-1;\n\tintp n, i;\n\tint j;\n\tchar *dptr;\n\n\t/* Check for out-of-bounds values in indices array */\t\t\n\tfor (i=0; i mm)) {\n\t\t\tPyErr_Format(PyExc_IndexError, \n\t\t\t\t \"index out-of-bounds (0, %d)\", mm);\n\t\t\treturn NULL;\n\t\t}\n\t\tptr++;\n\t}\n\t\n\tptr = (intp *)ind->data;\n /* Construct loop object */\n loop = construct_reduce(self, &arr, axis, otype, UFUNC_REDUCEAT, nn,\n\t\t\t\t\"reduceat\");\n\tif (!loop) return NULL;\n\n\tLOOP_BEGIN_THREADS\n\tswitch(loop->meth) {\n\t/* zero-length index -- return array immediately */\n\tcase ZERODIM_REDUCELOOP:\n\t\t/* fprintf(stderr, \"ZERO..\\n\"); */\n\t\tbreak;\n\n\t/* NOBUFFER -- behaved array and same type */\n\tcase NOBUFFER_UFUNCLOOP: \t /* Reduceat */\n\t\t/* fprintf(stderr, \"NOBUFFER..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[0] = loop->it->dataptr +\t\\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\tmemcpy(loop->bufptr[1], loop->bufptr[0],\n\t\t\t\t loop->outsize);\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis]-*ptr : \\\n\t\t\t\t *(ptr+1) - *ptr) - 1;\n\t\t\t\tif (mm > 0) {\n\t\t\t\t\tloop->bufptr[0] += loop->instrides;\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &mm, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t}\t\n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\n\t/* BUFFER -- misbehaved array or different types */ \n\tcase BUFFER_UFUNCLOOP: /* Reduceat */\n\t\t/* fprintf(stderr, \"BUFFERED..%d\\n\", loop->size); */\n\t\twhile(loop->index < loop->size) {\n\t\t\tptr = (intp *)ind->data;\n\t\t\tfor (i=0; ibufptr[1], loop->idptr, \n\t\t\t\t loop->outsize);\n\t\t\t\tn = 0;\n\t\t\t\tmm = (i==nn-1 ? arr->dimensions[axis] - *ptr :\\\n\t\t\t\t *(ptr+1) - *ptr);\n\t\t\t\tif (mm < 1) mm = 1;\n\t\t\t\tloop->inptr = loop->it->dataptr + \\\n\t\t\t\t\t(*ptr)*loop->instrides;\n\t\t\t\twhile (n < mm) {\n\t\t\t\t\t/* Copy up to loop->bufsize elements\n\t\t\t\t\t to buffer */\n\t\t\t\t\tdptr = loop->buffer;\n\t\t\t\t\tfor (j=0; jbufsize; j++, n++) {\n\t\t\t\t\t\tif (n == mm) break;\n\t\t\t\t\t\tarr->descr->copyswap\\\n\t\t\t\t\t\t\t(dptr,\n\t\t\t\t\t\t\t loop->inptr,\n\t\t\t\t\t\t\t loop->swap,\n\t\t\t\t\t\t\t loop->insize);\n\t\t\t\t\t\tloop->inptr += loop->instrides;\n\t\t\t\t\t\tdptr += loop->insize;\n\t\t\t\t\t}\n\t\t\t\t\tif (loop->cast)\n\t\t\t\t\t\tloop->cast(loop->buffer,\n\t\t\t\t\t\t\t loop->castbuf,\n\t\t\t\t\t\t\t j, NULL, NULL);\n\t\t\t\t\tloop->bufptr[2] = loop->bufptr[1];\n\t\t\t\t\tloop->function((char **)loop->bufptr,\n\t\t\t\t\t\t &j, loop->steps,\n\t\t\t\t\t\t loop->funcdata);\n\t\t\t\t\tUFUNC_CHECK_ERROR();\n\t\t\t\t} \n\t\t\t\tloop->bufptr[1] += loop->ret->strides[axis];\n\t\t\t\tptr++;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(loop->it);\n\t\t\tPyArray_ITER_NEXT(loop->rit);\n\t\t\tloop->bufptr[1] = loop->rit->dataptr;\n\t\t\tloop->index++;\n\t\t}\n\t\tbreak;\n\t}\n\n\tLOOP_END_THREADS\n\t\n ret = loop->ret;\n\t/* Hang on to this reference -- will be decref'd with loop */\n Py_INCREF(ret); \n Py_DECREF(loop);\n return (PyObject *)ret;\n\t\n fail:\n\tLOOP_END_THREADS\n\n\tPy_XDECREF(loop);\n\treturn NULL;\n}\n\n\n/* This code handles reduce, reduceat, and accumulate \n (accumulate and reduce are special cases of the more general reduceat \n but they are handled separately for speed) \n*/\n\nstatic PyObject * \nPyUFunc_GenericReduction(PyUFuncObject *self, PyObject *args, \n PyObject *kwds, int operation) \n{\n\tint axis=0;\n\tPyArrayObject *mp, *ret = NULL;\n\tPyObject *op, *res=NULL;\n\tPyObject *obj_ind; \n\tPyArrayObject *indices = NULL;\n\tPyArray_Typecode otype= {PyArray_NOTYPE, 0, 0};\n PyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tstatic char *kwlist1[] = {\"array\", \"axis\", \"rtype\", NULL};\n\tstatic char *kwlist2[] = {\"array\", \"indices\", \"axis\", \"rtype\", NULL}; \n static char *_reduce_type[] = {\"reduce\", \"accumulate\", \\\n\t\t\t\t \"reduceat\", NULL};\n\tif (self == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \"function not supported\");\n\t\treturn NULL;\n\t}\t\n\n\tif (self->nin != 2) {\n\t\tPyErr_Format(PyExc_ValueError, \n \"%s only supported for binary functions\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\tif (self->nout != 1) {\n\t\tPyErr_Format(PyExc_ValueError,\n \"%s only supported for functions \" \\\n \"returning a single value\",\n _reduce_type[operation]);\n\t\treturn NULL;\n\t}\n\n\tif (operation == UFUNC_REDUCEAT) {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|iO&\", kwlist2, \n\t\t\t\t\t\t&op, &obj_ind, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n indices = (PyArrayObject *)PyArray_FromAny(obj_ind, &indtype, \n\t\t\t\t\t\t\t 1, 1, CARRAY_FLAGS);\n if (indices == NULL) return NULL;\n\n\t}\n\telse {\n\t\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|iO&\", kwlist1,\n\t\t\t\t\t\t&op, &axis, \n\t\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t\t&otype)) return NULL;\n\t}\n\t\n\t/* Ensure input is an array */\t\n\tmp = (PyArrayObject *)PyArray_FromAny(op, NULL, 0, 0, 0);\n\tif (mp == NULL) return NULL;\n\n /* Check to see if input is zero-dimensional */\n if (mp->nd == 0) {\n PyErr_Format(PyExc_ValueError, \"cannot %s on a scalar\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL; \n }\n\n /* Check to see that type (and otype) is not FLEXIBLE */\n\tif (PyArray_ISFLEXIBLE(mp) || PyTypeNum_ISFLEXIBLE(otype.type_num)) {\n PyErr_Format(PyExc_ValueError, \n\t\t\t \"cannot perform %s with flexible type\",\n _reduce_type[operation]);\n Py_DECREF(mp);\n return NULL;\n }\n\n\tif (axis < 0) axis += mp->nd;\n\tif (axis < 0 || axis >= mp->nd) {\n\t\tPyErr_SetString(PyExc_ValueError, \"axis not in array\");\n Py_DECREF(mp);\n\t\treturn NULL;\n\t}\n\n\n if (otype.type_num == PyArray_NOTYPE)\n otype.type_num = mp->descr->type_num;\n\n switch(operation) {\n case UFUNC_REDUCE:\n ret = (PyArrayObject *)PyUFunc_Reduce(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_ACCUMULATE:\n ret = (PyArrayObject *)PyUFunc_Accumulate(self, mp, axis, \n otype.type_num);\n\t\tbreak;\n case UFUNC_REDUCEAT:\n ret = (PyArrayObject *)PyUFunc_Reduceat(self, mp, indices, \n axis, otype.type_num);\n Py_DECREF(indices);\n\t\tbreak;\n }\n Py_DECREF(mp);\n\tif (ret==NULL) return NULL;\n\tif (op->ob_type != ret->ob_type) {\n\t\tres = PyObject_CallMethod(op, \"__array_wrap__\", \"O\", ret);\n\t}\n\tif (res == NULL) PyErr_Clear();\n\telse if (res == Py_None) Py_DECREF(res);\n\telse {\n\t\tPy_DECREF(ret);\n\t\treturn res;\n\t}\t\n\treturn PyArray_Return(ret);\n\t\n}\n\n\n\n/* ---------- */\n\nstatic PyObject *\n_find_array_wrap(PyObject *args)\n{\n\tint nargs, i;\n\tint np = 0;\n\tint argmax = 0;\n\tint val;\n\tdouble priority[MAX_ARGS];\n\tdouble maxpriority = PyArray_SUBTYPE_PRIORITY;\n\tPyObject *with_wrap[MAX_ARGS];\n\tPyObject *attr;\n\tPyObject *obj;\n\n\tnargs = PyTuple_Size(args);\n\tfor (i=0; i maxpriority) {\n\t\t\tmaxpriority = priority[i];\n\t\t\targmax = i;\n\t\t}\n\t}\n\n\treturn with_wrap[argmax];\n}\n\nstatic PyObject *\nufunc_generic_call(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyTupleObject *ret;\n\tPyArrayObject *mps[MAX_ARGS];\n\tPyObject *retobj[MAX_ARGS];\n\tPyObject *res;\n\tPyObject *obj;\n\t\n\t/* Initialize all array objects to NULL to make cleanup easier \n\t if something goes wrong. */\n\tfor(i=0; inargs; i++) mps[i] = NULL;\n\t\n\tif (PyUFunc_GenericFunction(self, args, mps) == -1) {\n\t\tfor(i=0; inargs; i++) Py_XDECREF(mps[i]);\n\t\treturn NULL;\n\t}\n\t\n\tfor(i=0; inin; i++) Py_DECREF(mps[i]);\n\n\t/* Use __array_wrap__ on all outputs \n\t if present on one of the input arguments.\n\t If present for multiple inputs:\n\t use __array_wrap__ of input object with largest \n\t\t__array_priority__ (default = 0.0)\n\t */\n\tobj = _find_array_wrap(args);\n\t\n\t/* wrap outputs */\n\tfor (i=0; inout; i++) {\n\t\tint j=self->nin+i;\n\t\t/* check to see if any UPDATEIFCOPY flags are set \n\t\t which meant that a temporary output was generated \n\t\t*/\n\t\tif (mps[j]->flags & UPDATEIFCOPY) {\n\t\t\tPyObject *old = mps[j]->base;\n\t\t\tPy_INCREF(old); /* we want to hang on to this */\n\t\t\tPy_DECREF(mps[j]); /* should trigger the copy \n\t\t\t\t\t back into old */\n\t\t\tmps[j] = (PyArrayObject *)old;\n\t\t}\n\t\tif (obj != NULL) {\n\t\t\tres = PyObject_CallMethod(obj, \"__array_wrap__\",\n\t\t\t\t\t\t \"O\", mps[j]);\n\t\t\tif (res == NULL) PyErr_Clear();\n\t\t\telse if (res == Py_None) Py_DECREF(res);\n\t\t\telse {\n\t\t\t\tPy_DECREF(mps[j]);\n\t\t\t\tretobj[i] = res;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tretobj[i] = PyArray_Return(mps[j]);\n\t}\n\t\n\tif (self->nout == 1) { \n\t\treturn retobj[0];\n\t} else { \n\t\tret = (PyTupleObject *)PyTuple_New(self->nout);\n\t\tfor(i=0; inout; i++) {\n\t\t\tPyTuple_SET_ITEM(ret, i, retobj[i]);\n\t\t}\n\t\treturn (PyObject *)ret;\n\t}\t\n\n}\n\nstatic PyUFuncGenericFunction pyfunc_functions[] = {PyUFunc_On_Om};\n\nstatic char \ndoc_frompyfunc[] = \"frompyfunc(func, nin, nout) take an arbitrary python function that takes nin objects as input and returns nout objects and return a universal function (ufunc). This ufunc always returns PyObject arrays\";\n\nstatic PyObject *\nufunc_frompyfunc(PyObject *dummy, PyObject *args, PyObject *kwds) {\n /* Keywords are ignored for now */\n \n PyObject *function, *pyname=NULL;\n int nin, nout, i;\n PyUFunc_PyFuncData *fdata;\n PyUFuncObject *self;\n char *fname, *str;\n int fname_len=-1;\n\n if (!PyArg_ParseTuple(args, \"Oii\", &function, &nin, &nout)) return NULL;\n\n if (!PyCallable_Check(function)) {\n PyErr_SetString(PyExc_TypeError, \"Function must be callable.\");\n return NULL;\n }\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\n\tself->userloops = NULL;\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = PyUFunc_None;\t\n\tself->functions = pyfunc_functions;\n\n\tself->ntypes = 1;\n\tself->check_return = 0;\n\n pyname = PyObject_GetAttrString(function, \"__name__\");\n if (pyname)\n (void) PyString_AsStringAndSize(pyname, &fname, &fname_len);\n \n if (PyErr_Occurred()) {\n fname = \"?\";\n fname_len = 1;\n PyErr_Clear();\n } \n Py_XDECREF(pyname);\n\n\n self->ptr = malloc((self->nargs)+sizeof(PyUFunc_PyFuncData)+sizeof(void *)+(fname_len+14));\n \n\tif (self->ptr == NULL) return PyErr_NoMemory();\n Py_INCREF(function);\n self->obj = function;\n\tfdata = (PyUFunc_PyFuncData *)(self->ptr + (nin+nout) + sizeof(void *));\n fdata->nin = nin;\n fdata->nout = nout;\n fdata->callable = function;\n \n self->data = (void **)(self->ptr + (nin+nout));\n self->data[0] = (void *)fdata;\n\n\n\tself->types = (char *)self->ptr;\n for (i=0; inargs; i++) self->types[i] = PyArray_OBJECT;\n\n str = (char *)(fdata + 1);\n memcpy(str, fname, fname_len);\n memcpy(str+fname_len, \" (vectorized)\", 14);\n \n self->name = str;\n\n /* Do a better job someday */\n self->doc = \"dynamic ufunc based on a python function\";\n \n\t\n\treturn (PyObject *)self;\n}\n\n\nstatic PyObject *\nPyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void **data, \n\t\t\tchar *types, int ntypes,\n\t\t\tint nin, int nout, int identity, \n\t\t\tchar *name, char *doc, int check_return) \n{\n\tPyUFuncObject *self;\n\t\n\tif ((self = PyObject_NEW(PyUFuncObject, &PyUFunc_Type)) == NULL) \n\t\treturn NULL;\n\t\n\tself->nin = nin;\n\tself->nout = nout;\n\tself->nargs = nin+nout;\n\tself->identity = identity;\n\t\n\tself->functions = func;\n\tself->data = data;\n\tself->types = types;\n\tself->ntypes = ntypes;\n\tself->check_return = check_return;\n self->ptr = NULL;\n self->obj = NULL;\n\tself->userloops=NULL;\n\t\n\tif (name == NULL) self->name = \"?\";\n\telse self->name = name;\n\t\n if (doc == NULL) self->doc = \"NULL\";\n\telse self->doc = doc;\n\t\n\treturn (PyObject *)self;\n}\n\nstatic int\nPyUFunc_RegisterLoopForType(PyUFuncObject *ufunc, \n\t\t\t int usertype,\n\t\t\t PyUFuncGenericFunction function,\n\t\t\t void *data)\n{\n\tPyArray_Descr *descr=PyArray_DescrFromType(usertype);\n \tPyObject *key, *cobj;\n\tint ret;\t\n\t\n\tif ((usertype < PyArray_USERDEF) || (descr==NULL)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Cannot register typenumber\");\n\t\treturn -1;\n\t}\n\tif (ufunc->userloops == NULL) {\n\t\tufunc->userloops = PyDict_New();\n\t}\n\tkey = PyInt_FromLong(usertype);\n\tif (key == NULL) return -1;\n\tcobj = PyCObject_FromVoidPtr((void *)function, NULL);\n\tif (cobj == NULL) {Py_DECREF(key); return -1;}\n\tif (data == NULL) {\n\t\tret = PyDict_SetItem(ufunc->userloops, key, cobj);\n\t\tPy_DECREF(cobj);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n\telse {\n\t\tPyObject *cobj2, *tmp;\n\t\tcobj2 = PyCObject_FromVoidPtr(data, NULL);\n\t\tif (cobj2 == NULL) {\n\t\t\tPy_DECREF(cobj); \n\t\t\tPy_DECREF(key);\n\t\t\treturn -1;\n\t\t}\n\t\ttmp=Py_BuildValue(\"NN\", cobj, cobj2);\n\t\tret = PyDict_SetItem(ufunc->userloops, key, tmp);\n\t\tPy_DECREF(tmp);\n\t\tPy_DECREF(key);\n\t\treturn ret;\n\t}\n}\n\nstatic void\nufuncreduce_dealloc(PyUFuncReduceObject *self)\n{\n if (self->ufunc) {\n Py_XDECREF(self->it);\n\t\tPy_XDECREF(self->rit);\n Py_XDECREF(self->ret);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_XDECREF(self->decref);\n if (self->buffer) free(self->buffer);\n Py_DECREF(self->ufunc);\n }\n PyObject_DEL(self);\n}\n\nstatic void\nufuncloop_dealloc(PyUFuncLoopObject *self)\n{\n\tint i;\n\t\n\tif (self->ufunc != NULL) {\n\t\tfor (i=0; iufunc->nargs; i++)\n\t\t\tPy_XDECREF(self->iters[i]);\n\t\tif (self->buffer[0]) free(self->buffer[0]);\n\t\tPy_XDECREF(self->errobj);\n\t\tPy_DECREF(self->ufunc);\n\t}\n\tPyObject_DEL(self);\n}\n\n\nstatic void\nufunc_dealloc(PyUFuncObject *self)\n{\n if (self->ptr) free(self->ptr);\n\tPy_XDECREF(self->userloops);\n Py_XDECREF(self->obj);\n\tPyObject_DEL(self);\n}\n\nstatic PyObject *\nufunc_repr(PyUFuncObject *self)\n{\n\tchar buf[100];\n\t\n\tsprintf(buf, \"\", self->name);\n\t\n\treturn PyString_FromString(buf);\n}\n\n\n/* -------------------------------------------------------- */\n\n/* op.outer(a,b) is equivalent to op(a[:,NewAxis,NewAxis,etc.],b)\n where a has b.ndim NewAxis terms appended.\n\n The result has dimensions a.ndim + b.ndim\n */\n\nstatic PyObject *\nufunc_outer(PyUFuncObject *self, PyObject *args) \n{\n\tint i;\n\tPyObject *ret;\n\tPyArrayObject *ap1=NULL, *ap2=NULL, *ap_new=NULL;\n\tPyObject *new_args, *tmp;\n\tPyObject *shape1, *shape2, *newshape;\n\n\tif(self->nin != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"outer product only supported \"\\\n\t\t\t\t\"for binary functions\");\n\t\treturn NULL;\n\t}\n\t\n\tif (PySequence_Length(args) != 2) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"exactly two arguments expected\");\n\t\treturn NULL;\n\t}\n\t\n\ttmp = PySequence_GetItem(args, 0);\n\tif (tmp == NULL) return NULL;\n\tap1 = (PyArrayObject *)\t\t\t\t\t\\\n\t\tPyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap1 == NULL) return NULL;\n\t\n\ttmp = PySequence_GetItem(args, 1);\n\tif (tmp == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_FromObject(tmp, PyArray_NOTYPE, 0, 0);\n\tPy_DECREF(tmp);\n\tif (ap2 == NULL) {Py_DECREF(ap1); return NULL;}\n\n\t/* Construct new shape tuple */\n\tshape1 = PyTuple_New(ap1->nd);\n\tif (shape1 == NULL) goto fail;\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape1, i, \n\t\t\t\t PyLong_FromLongLong((longlong)ap1->\t\\\n\t\t\t\t\t\t dimensions[i]));\n\t\n\tshape2 = PyTuple_New(ap2->nd);\n\tfor (i=0; ind; i++) \n\t\tPyTuple_SET_ITEM(shape2, i, PyInt_FromLong((long) 1));\n\tif (shape2 == NULL) {Py_DECREF(shape1); goto fail;}\n\tnewshape = PyNumber_Add(shape1, shape2);\n\tPy_DECREF(shape1);\n\tPy_DECREF(shape2);\n\tif (newshape == NULL) goto fail;\n\t\n\tap_new = (PyArrayObject *)PyArray_Reshape(ap1, newshape);\n\tPy_DECREF(newshape);\n\tif (ap_new == NULL) goto fail;\n\t\n\tnew_args = Py_BuildValue(\"(OO)\", ap_new, ap2);\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\tPy_DECREF(ap_new);\t\n\tret = ufunc_generic_call(self, new_args);\n\tPy_DECREF(new_args);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ap_new);\n\treturn NULL;\n\n}\n\n\nstatic PyObject *\nufunc_reduce(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCE);\n}\n\nstatic PyObject *\nufunc_accumulate(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\n\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_ACCUMULATE);\n}\n\nstatic PyObject *\nufunc_reduceat(PyUFuncObject *self, PyObject *args, PyObject *kwds) \n{\t\n\treturn PyUFunc_GenericReduction(self, args, kwds, UFUNC_REDUCEAT);\n}\n\n\nstatic struct PyMethodDef ufunc_methods[] = {\n\t{\"reduce\", (PyCFunction)ufunc_reduce, METH_VARARGS | METH_KEYWORDS},\n\t{\"accumulate\", (PyCFunction)ufunc_accumulate, \n\t METH_VARARGS | METH_KEYWORDS},\n\t{\"reduceat\", (PyCFunction)ufunc_reduceat, \n\t METH_VARARGS | METH_KEYWORDS},\t\n\t{\"outer\", (PyCFunction)ufunc_outer, METH_VARARGS},\n\t{NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\n\n/* construct the string\n y1,y2,...,yn\n*/\n\nstatic void\n_makeargs(int num, char ltr, char *str) \n{\n\tint ind=0;\n\tint k;\n\tstatic char *digits=\"123456789ABCDE\";\n\n\tif (num == 1) {\n\t\tstr[0] = ltr;\n\t\tind = 1;\n\t}\n\telse {\n\t\tfor (k=0; ktype)\n\nstatic PyObject *\nufunc_getattr(PyUFuncObject *self, char *name)\n{\n\tPyObject *obj;\n\t/* Put docstring first or FindMethod finds it...*/\n\t/* could so some introspection on name and nin + nout */\n\t/* to automate the first part of it */\n\t/* the doc string shouldn't need the calling convention */\n\tif (strcmp(name, \"__doc__\") == 0) {\n\t\tstatic char doc[256];\n\t\tstatic char tmp1[3*MAX_ARGS+2];\n\t\tstatic char tmp2[3*MAX_ARGS+2];\n\t\t/* construct \n\t\t y1,y2,,... = name(x1,x2,...) __doc__\n\t\t*/\t\t\n\t\t_makeargs(self->nout, 'y', tmp1);\n\t\t_makeargs(self->nin, 'x', tmp2);\n\t\tsnprintf(doc, 256, \"%s = %s(%s) %s\", tmp1, self->name, \n\t\t\t tmp2, self->doc);\n\t\treturn PyString_FromString(doc);\n\t}\n\tobj = Py_FindMethod(ufunc_methods, (PyObject *)self, name);\n\tif (obj != NULL) return obj;\n\tPyErr_Clear();\n\tif (strcmp(name, \"nin\") == 0) {\n\t\treturn PyInt_FromLong(self->nin);\n\t}\n\telse if (strcmp(name, \"nout\") == 0) {\n\t\treturn PyInt_FromLong(self->nout);\n\t}\n\telse if (strcmp(name, \"nargs\") == 0) {\n\t\treturn PyInt_FromLong(self->nargs);\n\t}\n\telse if (strcmp(name, \"ntypes\") == 0) {\n\t\treturn PyInt_FromLong(self->ntypes);\n\t}\n\telse if (strcmp(name, \"types\") == 0) {\n\t\t/* return a list with types grouped\n\t\t input->output */\n\t\tPyObject *list;\n\t\tPyObject *str;\n\t\tint k, j, n, nt=self->ntypes;\n\t\tint ni = self->nin;\n\t\tint no = self->nout;\n\t\tchar *t;\n\t\tlist = PyList_New(nt);\n\t\tif (list == NULL) return NULL;\n\t\tt = malloc(no+ni+2);\n\t\tn = 0;\n\t\tfor (k=0; ktypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tt[ni] = '-';\n\t\t\tt[ni+1] = '>';\n\t\t\tfor (j=0; jtypes[n]);\n\t\t\t\tn++;\n\t\t\t}\n\t\t\tstr = PyString_FromStringAndSize(t, no+ni+2);\n\t\t\tPyList_SET_ITEM(list, k, str);\n\t\t}\n\t\tfree(t);\n\t\treturn list;\n\t\t\n\t}\n\telse if (strcmp(name, \"__name__\") == 0) {\n\t\treturn PyString_FromString(self->name);\n\t}\n\telse if (strcmp(name, \"identity\") == 0) {\n\t\tswitch(self->identity) {\n\t\tcase PyUFunc_One:\n\t\t\treturn PyInt_FromLong(1);\n\t\tcase PyUFunc_Zero:\n\t\t\treturn PyInt_FromLong(0);\n\t\tdefault:\n\t\t\tPy_INCREF(Py_None);\n\t\t\treturn Py_None;\n\t\t}\n\t}\n\tPyErr_SetString(PyExc_AttributeError, name);\n\treturn NULL;\n}\n\n#undef _typecharfromnum\n\nstatic int\nufunc_setattr(PyUFuncObject *self, char *name, PyObject *v) \n{\n\treturn -1;\n}\n\nstatic char Ufunctype__doc__[] = \n\t\"Optimized functions make it possible to implement arithmetic \"\\\n\t\"with arrays efficiently\";\n\nstatic PyTypeObject PyUFunc_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufunc\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncObject),\t\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufunc_dealloc,\t/*tp_dealloc*/\n\t(printfunc)0,\t\t /*tp_print*/\n\t(getattrfunc)ufunc_getattr,\t/*tp_getattr*/\n\t(setattrfunc)ufunc_setattr,\t/*tp_setattr*/\n\t(cmpfunc)0,\t \t/*tp_compare*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_repr*/\n\t0,\t\t\t /*tp_as_number*/\n\t0,\t\t /*tp_as_sequence*/\n\t0,\t\t /*tp_as_mapping*/\n\t(hashfunc)0,\t\t/*tp_hash*/\n\t(ternaryfunc)ufunc_generic_call,\t\t/*tp_call*/\n\t(reprfunc)ufunc_repr,\t\t/*tp_str*/\n\t\t\n\t/* Space for future expansion */\n\t0L,0L,0L,0L,\n\tUfunctype__doc__ /* Documentation string */\n};\n\nstatic PyTypeObject PyUFuncLoop_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncloop\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncLoopObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncloop_dealloc\t/*tp_dealloc*/\n};\n\nstatic PyTypeObject PyUFuncReduce_Type = {\n\tPyObject_HEAD_INIT(0)\n\t0,\t\t\t\t/*ob_size*/\n\t\"ufuncreduce\",\t\t\t/*tp_name*/\n\tsizeof(PyUFuncReduceObject),\t/*tp_basicsize*/\n\t0,\t\t\t\t/*tp_itemsize*/\n\t/* methods */\n\t(destructor)ufuncreduce_dealloc\t/*tp_dealloc*/\n};\n\n\n/* End of code for ufunc objects */\n/* -------------------------------------------------------- */\n", "methods": [ { "name": "PyUFunc_ff_f_As_dd_d", "long_name": "PyUFunc_ff_f_As_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 146, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 39, "end_line": 49, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_ff_f", "long_name": "PyUFunc_ff_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 52, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_dd_d", "long_name": "PyUFunc_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 137, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 66, "end_line": 77, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_gg_g", "long_name": "PyUFunc_gg_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 80, "end_line": 90, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F_As_DD_D", "long_name": "PyUFunc_FF_F_As_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 225, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 94, "end_line": 107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_DD_D", "long_name": "PyUFunc_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 110, "end_line": 123, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F", "long_name": "PyUFunc_FF_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 126, "end_line": 139, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_GG_G", "long_name": "PyUFunc_GG_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 142, "end_line": 157, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_OO_O", "long_name": "PyUFunc_OO_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 239, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 160, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f_As_d_d", "long_name": "PyUFunc_f_f_As_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 106, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 198, "end_line": 205, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_d_d", "long_name": "PyUFunc_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 208, "end_line": 215, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f", "long_name": "PyUFunc_f_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 218, "end_line": 225, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_g_g", "long_name": "PyUFunc_g_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 2, "token_count": 94, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 228, "end_line": 236, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F_As_D_D", "long_name": "PyUFunc_F_F_As_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 164, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 240, "end_line": 251, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F", "long_name": "PyUFunc_F_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 254, "end_line": 265, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_D_D", "long_name": "PyUFunc_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 269, "end_line": 280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_G_G", "long_name": "PyUFunc_G_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 284, "end_line": 295, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O", "long_name": "PyUFunc_O_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 18, "complexity": 5, "token_count": 152, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 298, "end_line": 318, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O_method", "long_name": "PyUFunc_O_O_method( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 24, "complexity": 6, "token_count": 193, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 321, "end_line": 348, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_On_Om", "long_name": "PyUFunc_On_Om( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 47, "complexity": 11, "token_count": 357, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 357, "end_line": 405, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "_error_handler", "long_name": "_error_handler( int method , PyObject * errobj , char * errtype , int retstatus)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 211, "parameters": [ "method", "errobj", "errtype", "retstatus" ], "start_line": 429, "end_line": 475, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "PyUFunc_checkfperr", "long_name": "PyUFunc_checkfperr( int errmask , PyObject * errobj)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 60, "parameters": [ "errmask", "errobj" ], "start_line": 479, "end_line": 508, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyUFunc_clearfperr", "long_name": "PyUFunc_clearfperr()", "filename": "ufuncobject.c", "nloc": 5, "complexity": 1, "token_count": 12, "parameters": [], "start_line": 513, "end_line": 518, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "_lowest_type", "long_name": "_lowest_type( char intype)", "filename": "ufuncobject.c", "nloc": 23, "complexity": 13, "token_count": 66, "parameters": [ "intype" ], "start_line": 548, "end_line": 574, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_cancoerce", "long_name": "_cancoerce( char thistype , char neededtype , char scalar)", "filename": "ufuncobject.c", "nloc": 21, "complexity": 9, "token_count": 101, "parameters": [ "thistype", "neededtype", "scalar" ], "start_line": 577, "end_line": 598, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "select_types", "long_name": "select_types( PyUFuncObject * self , int * arg_types , PyUFuncGenericFunction * function , ** data , char * scalars)", "filename": "ufuncobject.c", "nloc": 70, "complexity": 17, "token_count": 455, "parameters": [ "self", "arg_types", "function", "data", "scalars" ], "start_line": 602, "end_line": 683, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 82, "top_nesting_level": 0 }, { "name": "_getintfromvar", "long_name": "_getintfromvar( char * str , int deflt)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 6, "token_count": 123, "parameters": [ "str", "deflt" ], "start_line": 688, "end_line": 708, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_getfuncfromvar", "long_name": "_getfuncfromvar( char * str , PyObject * deflt)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 134, "parameters": [ "str", "deflt" ], "start_line": 711, "end_line": 736, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "_scalar_kind", "long_name": "_scalar_kind( int typenum , PyArrayObject ** arr)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 6, "token_count": 64, "parameters": [ "typenum", "arr" ], "start_line": 740, "end_line": 748, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "_create_copies", "long_name": "_create_copies( PyUFuncLoopObject * loop , int * arg_types , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 37, "complexity": 8, "token_count": 285, "parameters": [ "loop", "arg_types", "mps" ], "start_line": 757, "end_line": 799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "construct_matrices", "long_name": "construct_matrices( PyUFuncLoopObject * loop , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 246, "complexity": 59, "token_count": 1912, "parameters": [ "loop", "args", "mps" ], "start_line": 802, "end_line": 1144, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 343, "top_nesting_level": 0 }, { "name": "construct_loop", "long_name": "construct_loop( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 40, "complexity": 8, "token_count": 238, "parameters": [ "self", "args", "mps" ], "start_line": 1151, "end_line": 1200, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericFunction", "long_name": "PyUFunc_GenericFunction( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 117, "complexity": 24, "token_count": 838, "parameters": [ "self", "args", "mps" ], "start_line": 1268, "end_line": 1439, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 172, "top_nesting_level": 0 }, { "name": "_getidentity", "long_name": "_getidentity( PyUFuncObject * self , int otype , char * str)", "filename": "ufuncobject.c", "nloc": 19, "complexity": 3, "token_count": 118, "parameters": [ "self", "otype", "str" ], "start_line": 1442, "end_line": 1462, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_create_reduce_copy", "long_name": "_create_reduce_copy( PyUFuncReduceObject * loop , PyArrayObject ** arr , int rtype)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 5, "token_count": 127, "parameters": [ "loop", "arr", "rtype" ], "start_line": 1465, "end_line": 1487, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "construct_reduce", "long_name": "construct_reduce( PyUFuncObject * self , PyArrayObject ** arr , int axis , int otype , int operation , intp ind_size , char * str)", "filename": "ufuncobject.c", "nloc": 191, "complexity": 38, "token_count": 1420, "parameters": [ "self", "arr", "axis", "otype", "operation", "ind_size", "str" ], "start_line": 1496, "end_line": 1731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 236, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduce", "long_name": "PyUFunc_Reduce( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 100, "complexity": 16, "token_count": 660, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1743, "end_line": 1873, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Accumulate", "long_name": "PyUFunc_Accumulate( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 101, "complexity": 15, "token_count": 683, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1877, "end_line": 2007, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduceat", "long_name": "PyUFunc_Reduceat( PyUFuncObject * self , PyArrayObject * arr , PyArrayObject * ind , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 108, "complexity": 20, "token_count": 763, "parameters": [ "self", "arr", "ind", "axis", "otype" ], "start_line": 2029, "end_line": 2156, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 128, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericReduction", "long_name": "PyUFunc_GenericReduction( PyUFuncObject * self , PyObject * args , PyObject * kwds , int operation)", "filename": "ufuncobject.c", "nloc": 97, "complexity": 23, "token_count": 613, "parameters": [ "self", "args", "kwds", "operation" ], "start_line": 2165, "end_line": 2275, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 111, "top_nesting_level": 0 }, { "name": "_find_array_wrap", "long_name": "_find_array_wrap( PyObject * args)", "filename": "ufuncobject.c", "nloc": 49, "complexity": 12, "token_count": 260, "parameters": [ "args" ], "start_line": 2282, "end_line": 2334, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "ufunc_generic_call", "long_name": "ufunc_generic_call( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 46, "complexity": 12, "token_count": 356, "parameters": [ "self", "args" ], "start_line": 2337, "end_line": 2402, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 66, "top_nesting_level": 0 }, { "name": "ufunc_frompyfunc", "long_name": "ufunc_frompyfunc( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 50, "complexity": 8, "token_count": 432, "parameters": [ "dummy", "args", "kwds" ], "start_line": 2410, "end_line": 2481, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyUFunc_FromFuncAndData", "long_name": "PyUFunc_FromFuncAndData( PyUFuncGenericFunction * func , ** data , char * types , int ntypes , int nin , int nout , int identity , char * name , char * doc , int check_return)", "filename": "ufuncobject.c", "nloc": 26, "complexity": 4, "token_count": 181, "parameters": [ "func", "data", "types", "ntypes", "nin", "nout", "identity", "name", "doc", "check_return" ], "start_line": 2485, "end_line": 2516, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyUFunc_RegisterLoopForType", "long_name": "PyUFunc_RegisterLoopForType( PyUFuncObject * ufunc , int usertype , PyUFuncGenericFunction function , * data)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 241, "parameters": [ "ufunc", "usertype", "function", "data" ], "start_line": 2519, "end_line": 2560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "ufuncreduce_dealloc", "long_name": "ufuncreduce_dealloc( PyUFuncReduceObject * self)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 76, "parameters": [ "self" ], "start_line": 2563, "end_line": 2575, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufuncloop_dealloc", "long_name": "ufuncloop_dealloc( PyUFuncLoopObject * self)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 4, "token_count": 86, "parameters": [ "self" ], "start_line": 2578, "end_line": 2590, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufunc_dealloc", "long_name": "ufunc_dealloc( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 7, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 2594, "end_line": 2600, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "ufunc_repr", "long_name": "ufunc_repr( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 6, "complexity": 1, "token_count": 31, "parameters": [ "self" ], "start_line": 2603, "end_line": 2610, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "ufunc_outer", "long_name": "ufunc_outer( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 59, "complexity": 13, "token_count": 428, "parameters": [ "self", "args" ], "start_line": 2622, "end_line": 2691, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "ufunc_reduce", "long_name": "ufunc_reduce( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2695, "end_line": 2699, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_accumulate", "long_name": "ufunc_accumulate( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2702, "end_line": 2706, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_reduceat", "long_name": "ufunc_reduceat( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2709, "end_line": 2712, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "_makeargs", "long_name": "_makeargs( int num , char ltr , char * str)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 3, "token_count": 117, "parameters": [ "num", "ltr", "str" ], "start_line": 2732, "end_line": 2754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "ufunc_getattr", "long_name": "ufunc_getattr( PyUFuncObject * self , char * name)", "filename": "ufuncobject.c", "nloc": 74, "complexity": 16, "token_count": 520, "parameters": [ "self", "name" ], "start_line": 2759, "end_line": 2842, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 84, "top_nesting_level": 0 }, { "name": "ufunc_setattr", "long_name": "ufunc_setattr( PyUFuncObject * self , char * name , PyObject * v)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self", "name", "v" ], "start_line": 2847, "end_line": 2850, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyUFunc_ff_f_As_dd_d", "long_name": "PyUFunc_ff_f_As_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 146, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 39, "end_line": 49, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_ff_f", "long_name": "PyUFunc_ff_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 52, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_dd_d", "long_name": "PyUFunc_dd_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 137, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 66, "end_line": 77, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_gg_g", "long_name": "PyUFunc_gg_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 10, "complexity": 2, "token_count": 136, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 80, "end_line": 90, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F_As_DD_D", "long_name": "PyUFunc_FF_F_As_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 225, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 94, "end_line": 107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_DD_D", "long_name": "PyUFunc_DD_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 110, "end_line": 123, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_FF_F", "long_name": "PyUFunc_FF_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 126, "end_line": 139, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "PyUFunc_GG_G", "long_name": "PyUFunc_GG_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 15, "complexity": 2, "token_count": 219, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 142, "end_line": 157, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyUFunc_OO_O", "long_name": "PyUFunc_OO_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 239, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 160, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f_As_d_d", "long_name": "PyUFunc_f_f_As_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 106, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 198, "end_line": 205, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_d_d", "long_name": "PyUFunc_d_d( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 208, "end_line": 215, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_f_f", "long_name": "PyUFunc_f_f( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 8, "complexity": 2, "token_count": 93, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 218, "end_line": 225, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyUFunc_g_g", "long_name": "PyUFunc_g_g( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 2, "token_count": 94, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 228, "end_line": 236, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F_As_D_D", "long_name": "PyUFunc_F_F_As_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 164, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 240, "end_line": 251, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_F_F", "long_name": "PyUFunc_F_F( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 254, "end_line": 265, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_D_D", "long_name": "PyUFunc_D_D( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 269, "end_line": 280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_G_G", "long_name": "PyUFunc_G_G( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 2, "token_count": 150, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 284, "end_line": 295, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O", "long_name": "PyUFunc_O_O( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 18, "complexity": 5, "token_count": 152, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 298, "end_line": 318, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyUFunc_O_O_method", "long_name": "PyUFunc_O_O_method( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 24, "complexity": 6, "token_count": 193, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 321, "end_line": 348, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyUFunc_On_Om", "long_name": "PyUFunc_On_Om( char ** args , intp * dimensions , intp * steps , * func)", "filename": "ufuncobject.c", "nloc": 47, "complexity": 11, "token_count": 357, "parameters": [ "args", "dimensions", "steps", "func" ], "start_line": 357, "end_line": 405, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "_error_handler", "long_name": "_error_handler( int method , PyObject * errobj , char * errtype , int retstatus)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 211, "parameters": [ "method", "errobj", "errtype", "retstatus" ], "start_line": 429, "end_line": 475, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "PyUFunc_checkfperr", "long_name": "PyUFunc_checkfperr( int errmask , PyObject * errobj)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 60, "parameters": [ "errmask", "errobj" ], "start_line": 479, "end_line": 508, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyUFunc_clearfperr", "long_name": "PyUFunc_clearfperr()", "filename": "ufuncobject.c", "nloc": 5, "complexity": 1, "token_count": 12, "parameters": [], "start_line": 513, "end_line": 518, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "_lowest_type", "long_name": "_lowest_type( char intype)", "filename": "ufuncobject.c", "nloc": 23, "complexity": 13, "token_count": 66, "parameters": [ "intype" ], "start_line": 548, "end_line": 574, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_cancoerce", "long_name": "_cancoerce( char thistype , char neededtype , char scalar)", "filename": "ufuncobject.c", "nloc": 21, "complexity": 9, "token_count": 101, "parameters": [ "thistype", "neededtype", "scalar" ], "start_line": 577, "end_line": 598, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "select_types", "long_name": "select_types( PyUFuncObject * self , int * arg_types , PyUFuncGenericFunction * function , ** data , char * scalars)", "filename": "ufuncobject.c", "nloc": 70, "complexity": 17, "token_count": 455, "parameters": [ "self", "arg_types", "function", "data", "scalars" ], "start_line": 602, "end_line": 683, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 82, "top_nesting_level": 0 }, { "name": "_getintfromvar", "long_name": "_getintfromvar( char * str , int deflt)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 6, "token_count": 123, "parameters": [ "str", "deflt" ], "start_line": 688, "end_line": 708, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_getfuncfromvar", "long_name": "_getfuncfromvar( char * str , PyObject * deflt)", "filename": "ufuncobject.c", "nloc": 25, "complexity": 6, "token_count": 134, "parameters": [ "str", "deflt" ], "start_line": 711, "end_line": 736, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "_scalar_kind", "long_name": "_scalar_kind( int typenum , PyArrayObject ** arr)", "filename": "ufuncobject.c", "nloc": 9, "complexity": 6, "token_count": 64, "parameters": [ "typenum", "arr" ], "start_line": 740, "end_line": 748, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "_create_copies", "long_name": "_create_copies( PyUFuncLoopObject * loop , int * arg_types , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 37, "complexity": 8, "token_count": 285, "parameters": [ "loop", "arg_types", "mps" ], "start_line": 757, "end_line": 799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "construct_matrices", "long_name": "construct_matrices( PyUFuncLoopObject * loop , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 246, "complexity": 59, "token_count": 1912, "parameters": [ "loop", "args", "mps" ], "start_line": 802, "end_line": 1144, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 343, "top_nesting_level": 0 }, { "name": "construct_loop", "long_name": "construct_loop( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 40, "complexity": 8, "token_count": 238, "parameters": [ "self", "args", "mps" ], "start_line": 1151, "end_line": 1200, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericFunction", "long_name": "PyUFunc_GenericFunction( PyUFuncObject * self , PyObject * args , PyArrayObject ** mps)", "filename": "ufuncobject.c", "nloc": 117, "complexity": 24, "token_count": 838, "parameters": [ "self", "args", "mps" ], "start_line": 1268, "end_line": 1439, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 172, "top_nesting_level": 0 }, { "name": "_getidentity", "long_name": "_getidentity( PyUFuncObject * self , int otype , char * str)", "filename": "ufuncobject.c", "nloc": 19, "complexity": 3, "token_count": 118, "parameters": [ "self", "otype", "str" ], "start_line": 1442, "end_line": 1462, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_create_reduce_copy", "long_name": "_create_reduce_copy( PyUFuncReduceObject * loop , PyArrayObject ** arr , int rtype)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 5, "token_count": 127, "parameters": [ "loop", "arr", "rtype" ], "start_line": 1465, "end_line": 1487, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "construct_reduce", "long_name": "construct_reduce( PyUFuncObject * self , PyArrayObject ** arr , int axis , int otype , int operation , intp ind_size , char * str)", "filename": "ufuncobject.c", "nloc": 191, "complexity": 38, "token_count": 1408, "parameters": [ "self", "arr", "axis", "otype", "operation", "ind_size", "str" ], "start_line": 1496, "end_line": 1731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 236, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduce", "long_name": "PyUFunc_Reduce( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 100, "complexity": 16, "token_count": 660, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1743, "end_line": 1873, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Accumulate", "long_name": "PyUFunc_Accumulate( PyUFuncObject * self , PyArrayObject * arr , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 101, "complexity": 15, "token_count": 683, "parameters": [ "self", "arr", "axis", "otype" ], "start_line": 1877, "end_line": 2007, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 131, "top_nesting_level": 0 }, { "name": "PyUFunc_Reduceat", "long_name": "PyUFunc_Reduceat( PyUFuncObject * self , PyArrayObject * arr , PyArrayObject * ind , int axis , int otype)", "filename": "ufuncobject.c", "nloc": 108, "complexity": 20, "token_count": 763, "parameters": [ "self", "arr", "ind", "axis", "otype" ], "start_line": 2029, "end_line": 2156, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 128, "top_nesting_level": 0 }, { "name": "PyUFunc_GenericReduction", "long_name": "PyUFunc_GenericReduction( PyUFuncObject * self , PyObject * args , PyObject * kwds , int operation)", "filename": "ufuncobject.c", "nloc": 97, "complexity": 23, "token_count": 613, "parameters": [ "self", "args", "kwds", "operation" ], "start_line": 2165, "end_line": 2275, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 111, "top_nesting_level": 0 }, { "name": "_find_array_wrap", "long_name": "_find_array_wrap( PyObject * args)", "filename": "ufuncobject.c", "nloc": 49, "complexity": 12, "token_count": 260, "parameters": [ "args" ], "start_line": 2282, "end_line": 2334, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "ufunc_generic_call", "long_name": "ufunc_generic_call( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 46, "complexity": 12, "token_count": 356, "parameters": [ "self", "args" ], "start_line": 2337, "end_line": 2402, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 66, "top_nesting_level": 0 }, { "name": "ufunc_frompyfunc", "long_name": "ufunc_frompyfunc( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 50, "complexity": 8, "token_count": 432, "parameters": [ "dummy", "args", "kwds" ], "start_line": 2410, "end_line": 2481, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyUFunc_FromFuncAndData", "long_name": "PyUFunc_FromFuncAndData( PyUFuncGenericFunction * func , ** data , char * types , int ntypes , int nin , int nout , int identity , char * name , char * doc , int check_return)", "filename": "ufuncobject.c", "nloc": 26, "complexity": 4, "token_count": 181, "parameters": [ "func", "data", "types", "ntypes", "nin", "nout", "identity", "name", "doc", "check_return" ], "start_line": 2485, "end_line": 2516, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyUFunc_RegisterLoopForType", "long_name": "PyUFunc_RegisterLoopForType( PyUFuncObject * ufunc , int usertype , PyUFuncGenericFunction function , * data)", "filename": "ufuncobject.c", "nloc": 41, "complexity": 8, "token_count": 241, "parameters": [ "ufunc", "usertype", "function", "data" ], "start_line": 2519, "end_line": 2560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "ufuncreduce_dealloc", "long_name": "ufuncreduce_dealloc( PyUFuncReduceObject * self)", "filename": "ufuncobject.c", "nloc": 13, "complexity": 3, "token_count": 76, "parameters": [ "self" ], "start_line": 2563, "end_line": 2575, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufuncloop_dealloc", "long_name": "ufuncloop_dealloc( PyUFuncLoopObject * self)", "filename": "ufuncobject.c", "nloc": 12, "complexity": 4, "token_count": 86, "parameters": [ "self" ], "start_line": 2578, "end_line": 2590, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "ufunc_dealloc", "long_name": "ufunc_dealloc( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 7, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 2594, "end_line": 2600, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "ufunc_repr", "long_name": "ufunc_repr( PyUFuncObject * self)", "filename": "ufuncobject.c", "nloc": 6, "complexity": 1, "token_count": 31, "parameters": [ "self" ], "start_line": 2603, "end_line": 2610, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "ufunc_outer", "long_name": "ufunc_outer( PyUFuncObject * self , PyObject * args)", "filename": "ufuncobject.c", "nloc": 59, "complexity": 13, "token_count": 428, "parameters": [ "self", "args" ], "start_line": 2622, "end_line": 2691, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "ufunc_reduce", "long_name": "ufunc_reduce( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2695, "end_line": 2699, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_accumulate", "long_name": "ufunc_accumulate( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2702, "end_line": 2706, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "ufunc_reduceat", "long_name": "ufunc_reduceat( PyUFuncObject * self , PyObject * args , PyObject * kwds)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "self", "args", "kwds" ], "start_line": 2709, "end_line": 2712, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "_makeargs", "long_name": "_makeargs( int num , char ltr , char * str)", "filename": "ufuncobject.c", "nloc": 20, "complexity": 3, "token_count": 117, "parameters": [ "num", "ltr", "str" ], "start_line": 2732, "end_line": 2754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "ufunc_getattr", "long_name": "ufunc_getattr( PyUFuncObject * self , char * name)", "filename": "ufuncobject.c", "nloc": 74, "complexity": 16, "token_count": 520, "parameters": [ "self", "name" ], "start_line": 2759, "end_line": 2842, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 84, "top_nesting_level": 0 }, { "name": "ufunc_setattr", "long_name": "ufunc_setattr( PyUFuncObject * self , char * name , PyObject * v)", "filename": "ufuncobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self", "name", "v" ], "start_line": 2847, "end_line": 2850, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "construct_reduce", "long_name": "construct_reduce( PyUFuncObject * self , PyArrayObject ** arr , int axis , int otype , int operation , intp ind_size , char * str)", "filename": "ufuncobject.c", "nloc": 191, "complexity": 38, "token_count": 1420, "parameters": [ "self", "arr", "axis", "otype", "operation", "ind_size", "str" ], "start_line": 1496, "end_line": 1731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 236, "top_nesting_level": 0 } ], "nloc": 2136, "complexity": 438, "token_count": 15674, "diff_parsed": { "added": [ "\t\t\t\t NULL, NULL, 0, 0, (PyObject *)aar);", "\t\t\t\t otype, NULL, NULL, 0, 0, (PyObject *)aar);", "\t\t\t\t NULL, NULL, 0, 0, (PyObject *)aar);" ], "deleted": [ "\t\t\t\t NULL, NULL, 0, 0, aar);", "\t\t\t\t otype, NULL, NULL, 0, 0, aar);", "\t\t\t\t NULL, NULL, 0, 0, aar);" ] } } ] }, { "hash": "ab3e2b4f7a684c55b5ae9eecf6caabbcde6ec398", "msg": "Fixed formatting.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T18:36:20+00:00", "author_timezone": 0, "committer_date": "2005-10-07T18:36:20+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "c5e4fbaf18c01b35faa523005d68e4b10319e77a" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 39, "insertions": 66, "lines": 105, "files": 1, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": "doc/CAPI.txt", "new_path": "doc/CAPI.txt", "filename": "CAPI.txt", "extension": "txt", "change_type": "MODIFY", "diff": "@@ -4,21 +4,24 @@ The CAPI of SciPy is (mostly) backward compatible with Numeric.\n There are a few non-standard API Numeric usages that will need to be changed:\n \n * If you used any of the function pointers in the PyArray_Descr\n- structure you will have to modify your usage of those. The casting functions\n- have eliminated the strides argument (use PyArray_CastTo if you need strided casting). \n- All functions have one or two PyArrayObject * arguments at the end. This allows\n- the flexible arrays and mis-behaved arrays to be handled. \n+ structure you will have to modify your usage of those. The\n+ casting functions have eliminated the strides argument (use\n+ PyArray_CastTo if you need strided casting). All functions have\n+ one or two PyArrayObject * arguments at the end. This allows the\n+ flexible arrays and mis-behaved arrays to be handled.\n \n * The descr->zero and descr->one constants have been replaced with\n function calls, PyArray_Zero, and PyArray_One.\n \n- * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to get the itemsize of an\n- object (for flexible arrays descr->elsize is 0).\n+ * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to\n+ get the itemsize of an object (for flexible arrays descr->elsize\n+ is 0).\n \n \n The header files arrayobject.h and ufuncobject.h contain many defines\n that you may find useful. The files __ufunc_api.h and\n-__multiarray_api.h contain the available C-API function calls with their function signatures.\n+__multiarray_api.h contain the available C-API function calls with\n+their function signatures.\n \n All of these headers are installed to \n \n@@ -37,44 +40,62 @@ PyObject * PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type,\n PyObject *obj);\n \n \n-subtype : The subtype that should be created (either pass in\n- &PyArray_Type, &PyBigArray_Type, or obj->ob_type,\n- where obj is a subtype (or subclass) of PyBigArray_Type).\n+subtype : The subtype that should be created (either pass in\n+ &PyArray_Type, &PyBigArray_Type, or obj->ob_type,\n+ where obj is a subtype (or subclass) of PyBigArray_Type).\n \n nd : The number of dimensions (base member of the returned array to the Python object. You are \n- responsible for setting the base object. Failure to do so will create a memory leak.\n+\n+*strides : The strides this array should have. For new arrays created\n+ by this routine, this should be NULL. If you pass in\n+ memory for this array to use, then you should pass in the\n+ strides information as well. I\n+\n+*data : NULL for creating brand-new memory. If you want this array\n+ to wrap another memory area, then pass the pointer here.\n+ You are responsible for deleting the memory in that case,\n+ but do not do so until the new array object has been\n+ deleted. The best way to handle that is to get the memory\n+ from another Python object, INCREF that Python object after\n+ passing it's data pointer to this routine, and set the\n+ ->base member of the returned array to the Python object.\n+ You are responsible for setting the base object. Failure\n+ to do so will create a memory leak.\n \n- If you pass in a data buffer, the flags argument will be the flags of the new array. \n- If you create a new array, a non-zero flags argument indicates that you want the\n- array to be in FORTRAN order.\n+ If you pass in a data buffer, the flags argument will be\n+ the flags of the new array. If you create a new array, a\n+ non-zero flags argument indicates that you want the array\n+ to be in FORTRAN order.\n+\n+\n+itemsize : Indicates the itemsize for the new array. This can be 0\n+ if it is a fixed-size array type. It is only used for\n+ flexible array types and must be set in that case.\n \n-itemsize : Indicates the itemsize for the new array. This can be 0 if it is a fixed-size array type.\n- It is only used for flexible array types and must be set in that case.\n \n-flags : Either the flags showing how to interpret the data buffer passed in. Or if a new array \n- is created, nonzero to indicate a FORTRAN order array.\n+flags : Either the flags showing how to interpret the data buffer\n+ passed in. Or if a new array is created, nonzero to\n+ indicate a FORTRAN order array.\n \n-obj : If subtypes is &PyArray_Type or &PyBigArray_Type, this argument is ignored. Otherwise,\n- the __array_finalize__ method of the subtype is called (if present) and passed this\n- object. This is usually an array of the type to be created (so the __array_finalize__ \n- method must handle an array argument. But, it can be anything...)\n \n-Note: The returned array object will be unitialized unless the type is PyArray_OBJECT. \n+obj : If subtypes is &PyArray_Type or &PyBigArray_Type, this\n+ argument is ignored. Otherwise, the __array_finalize__\n+ method of the subtype is called (if present) and passed\n+ this object. This is usually an array of the type to be\n+ created (so the __array_finalize__ method must handle an\n+ array argument. But, it can be anything...)\n \n+Note: The returned array object will be unitialized unless the type is\n+PyArray_OBJECT.\n \n-The PyArray_FromDims and family of functions are still available and are loose wrappers around \n-this function. \n+\n+The PyArray_FromDims and family of functions are still available and\n+are loose wrappers around this function.\n \n \n Getting an arrayobject from an arbitrary Python object: PyArray_FromAny\n@@ -89,12 +110,18 @@ PyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth,\n \n \n op : The Python object to \"convert\" to an array object\n-typecode : A typecode structure filled with the data type and itemsize of the desired data type.\n- This can be NULL, if the type should be determined from the object.\n- Unless FORCECAST is present in flags, this call will generate an error\n- if the data type cannot be safely obtained from the object.\n+\n+typecode : A typecode structure filled with the data type and\n+ itemsize of the desired data type. This can be NULL, if\n+ the type should be determined from the object. Unless\n+ FORCECAST is present in flags, this call will generate\n+ an error if the data type cannot be safely obtained from\n+ the object.\n+\n min_depth : The minimum depth of array needed or 0 if doesn't matter\n+\n max_depth : The maximum depth of array allowed or 0 if doesn't matter\n+\n requires : A flag indicating the \"requirements\" of the returned array. \n \n \n", "added_lines": 66, "deleted_lines": 39, "source_code": "\nThe CAPI of SciPy is (mostly) backward compatible with Numeric. \n\nThere are a few non-standard API Numeric usages that will need to be changed:\n\n * If you used any of the function pointers in the PyArray_Descr\n structure you will have to modify your usage of those. The\n casting functions have eliminated the strides argument (use\n PyArray_CastTo if you need strided casting). All functions have\n one or two PyArrayObject * arguments at the end. This allows the\n flexible arrays and mis-behaved arrays to be handled.\n\n * The descr->zero and descr->one constants have been replaced with\n function calls, PyArray_Zero, and PyArray_One.\n\n * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to\n get the itemsize of an object (for flexible arrays descr->elsize\n is 0).\n\n\nThe header files arrayobject.h and ufuncobject.h contain many defines\nthat you may find useful. The files __ufunc_api.h and\n__multiarray_api.h contain the available C-API function calls with\ntheir function signatures.\n\nAll of these headers are installed to \n\n/site-packages/scipy/base/include\n\n\nGetting arrays in C-code\n=========================\n\nAll new arrays can be created using PyArray_New.\n\nThis is a very flexible function. \n\nPyObject * PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type, \n intp *strides, char *data, int itemsize, int flags, \n PyObject *obj);\n\n\nsubtype : The subtype that should be created (either pass in\n &PyArray_Type, &PyBigArray_Type, or obj->ob_type,\n where obj is a subtype (or subclass) of PyBigArray_Type).\n\nnd : The number of dimensions (base member of the returned array to the Python object.\n You are responsible for setting the base object. Failure\n to do so will create a memory leak.\n \n If you pass in a data buffer, the flags argument will be\n the flags of the new array. If you create a new array, a\n non-zero flags argument indicates that you want the array\n to be in FORTRAN order.\n\n\nitemsize : Indicates the itemsize for the new array. This can be 0\n if it is a fixed-size array type. It is only used for\n flexible array types and must be set in that case.\n\n\nflags : Either the flags showing how to interpret the data buffer\n passed in. Or if a new array is created, nonzero to\n indicate a FORTRAN order array.\n\n\nobj : If subtypes is &PyArray_Type or &PyBigArray_Type, this\n argument is ignored. Otherwise, the __array_finalize__\n method of the subtype is called (if present) and passed\n this object. This is usually an array of the type to be\n created (so the __array_finalize__ method must handle an\n array argument. But, it can be anything...)\n\nNote: The returned array object will be unitialized unless the type is\nPyArray_OBJECT.\n\n\nThe PyArray_FromDims and family of functions are still available and\nare loose wrappers around this function.\n\n\nGetting an arrayobject from an arbitrary Python object: PyArray_FromAny\n\nThis function replaces PyArray_ContiguousFromObject and friends (those\nfunction calls still remain but they are loose wrappers around the\nPyArray_FromAny call).\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n\n\nop : The Python object to \"convert\" to an array object\n\ntypecode : A typecode structure filled with the data type and\n itemsize of the desired data type. This can be NULL, if\n the type should be determined from the object. Unless\n FORCECAST is present in flags, this call will generate\n an error if the data type cannot be safely obtained from\n the object.\n\nmin_depth : The minimum depth of array needed or 0 if doesn't matter\n\nmax_depth : The maximum depth of array allowed or 0 if doesn't matter\n\nrequires : A flag indicating the \"requirements\" of the returned array. \n\n\nFrom the code comments, the requires flag is explained.\n\nrequires can be any of \n\n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, \n and WRITEABLE and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, if the object is an array and requires is 0, \n the array will just be INCREF'd and returned. \n \n typecode->fortran can be set to request a\n fortran-contiguous array (or just | FORTRAN to the requires flags).\n Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. This is useful, \n if you don't want to deal with a possibly mis-behaved array, but want\n to update it easily using a local contiguous copy. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n\n\nPyArray_Typecode structure\n{\n int type_num;\n int itemsize;\n int fortran --- used to indicate a fortran array is desired.\n}\n\n\nPassing Data Type information to C-code\n============================================\n\nTo get a Typecode structure from Python use the\nPyArray_TypecodeConverter function. This will return a typecode\nstructure filled appropriately based on a wide variety of user inputs.\n\nSee the arraymethods.c and multiarraymodule.c files for many examples of usage.\n\n\nGetting at the structure of the array.\n\nYou should use the #defines provided to access array structure portions:\n\nPyArray_DATA(obj)\nPyArray_ITEMSIZE(obj)\nPyArray_NDIM(obj)\nPyArray_DIMS(obj)\nPyArray_DIM(obj, n)\nPyArray_STRIDES(obj)\nPyArray_STRIDE(obj,n)\n\n\nsee more in arrayobject.h\n\n\nThere are more C-API enhancements which you can discover in the code, \n or buy the book (http://www.trelgol.com)\n\n\n", "source_code_before": "\nThe CAPI of SciPy is (mostly) backward compatible with Numeric. \n\nThere are a few non-standard API Numeric usages that will need to be changed:\n\n * If you used any of the function pointers in the PyArray_Descr\n structure you will have to modify your usage of those. The casting functions\n have eliminated the strides argument (use PyArray_CastTo if you need strided casting). \n All functions have one or two PyArrayObject * arguments at the end. This allows\n the flexible arrays and mis-behaved arrays to be handled. \n\n * The descr->zero and descr->one constants have been replaced with\n function calls, PyArray_Zero, and PyArray_One.\n\n * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to get the itemsize of an\n object (for flexible arrays descr->elsize is 0).\n\n\nThe header files arrayobject.h and ufuncobject.h contain many defines\nthat you may find useful. The files __ufunc_api.h and\n__multiarray_api.h contain the available C-API function calls with their function signatures.\n\nAll of these headers are installed to \n\n/site-packages/scipy/base/include\n\n\nGetting arrays in C-code\n=========================\n\nAll new arrays can be created using PyArray_New.\n\nThis is a very flexible function. \n\nPyObject * PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type, \n intp *strides, char *data, int itemsize, int flags, \n PyObject *obj);\n\n\nsubtype : The subtype that should be created (either pass in\n &PyArray_Type, &PyBigArray_Type, or obj->ob_type,\n where obj is a subtype (or subclass) of PyBigArray_Type).\n\nnd : The number of dimensions (base member of the returned array to the Python object. You are \n responsible for setting the base object. Failure to do so will create a memory leak.\n \n If you pass in a data buffer, the flags argument will be the flags of the new array. \n If you create a new array, a non-zero flags argument indicates that you want the\n array to be in FORTRAN order.\n\nitemsize : Indicates the itemsize for the new array. This can be 0 if it is a fixed-size array type.\n It is only used for flexible array types and must be set in that case.\n\nflags : Either the flags showing how to interpret the data buffer passed in. Or if a new array \n is created, nonzero to indicate a FORTRAN order array.\n\nobj : If subtypes is &PyArray_Type or &PyBigArray_Type, this argument is ignored. Otherwise,\n the __array_finalize__ method of the subtype is called (if present) and passed this\n object. This is usually an array of the type to be created (so the __array_finalize__ \n method must handle an array argument. But, it can be anything...)\n\nNote: The returned array object will be unitialized unless the type is PyArray_OBJECT. \n\n\nThe PyArray_FromDims and family of functions are still available and are loose wrappers around \nthis function. \n\n\nGetting an arrayobject from an arbitrary Python object: PyArray_FromAny\n\nThis function replaces PyArray_ContiguousFromObject and friends (those\nfunction calls still remain but they are loose wrappers around the\nPyArray_FromAny call).\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n\n\nop : The Python object to \"convert\" to an array object\ntypecode : A typecode structure filled with the data type and itemsize of the desired data type.\n This can be NULL, if the type should be determined from the object.\n Unless FORCECAST is present in flags, this call will generate an error\n if the data type cannot be safely obtained from the object.\nmin_depth : The minimum depth of array needed or 0 if doesn't matter\nmax_depth : The maximum depth of array allowed or 0 if doesn't matter\nrequires : A flag indicating the \"requirements\" of the returned array. \n\n\nFrom the code comments, the requires flag is explained.\n\nrequires can be any of \n\n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, \n and WRITEABLE and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, if the object is an array and requires is 0, \n the array will just be INCREF'd and returned. \n \n typecode->fortran can be set to request a\n fortran-contiguous array (or just | FORTRAN to the requires flags).\n Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. This is useful, \n if you don't want to deal with a possibly mis-behaved array, but want\n to update it easily using a local contiguous copy. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n\n\nPyArray_Typecode structure\n{\n int type_num;\n int itemsize;\n int fortran --- used to indicate a fortran array is desired.\n}\n\n\nPassing Data Type information to C-code\n============================================\n\nTo get a Typecode structure from Python use the\nPyArray_TypecodeConverter function. This will return a typecode\nstructure filled appropriately based on a wide variety of user inputs.\n\nSee the arraymethods.c and multiarraymodule.c files for many examples of usage.\n\n\nGetting at the structure of the array.\n\nYou should use the #defines provided to access array structure portions:\n\nPyArray_DATA(obj)\nPyArray_ITEMSIZE(obj)\nPyArray_NDIM(obj)\nPyArray_DIMS(obj)\nPyArray_DIM(obj, n)\nPyArray_STRIDES(obj)\nPyArray_STRIDE(obj,n)\n\n\nsee more in arrayobject.h\n\n\nThere are more C-API enhancements which you can discover in the code, \n or buy the book (http://www.trelgol.com)\n\n\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ " structure you will have to modify your usage of those. The", " casting functions have eliminated the strides argument (use", " PyArray_CastTo if you need strided casting). All functions have", " one or two PyArrayObject * arguments at the end. This allows the", " flexible arrays and mis-behaved arrays to be handled.", " * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to", " get the itemsize of an object (for flexible arrays descr->elsize", " is 0).", "__multiarray_api.h contain the available C-API function calls with", "their function signatures.", "subtype : The subtype that should be created (either pass in", " &PyArray_Type, &PyBigArray_Type, or obj->ob_type,", " where obj is a subtype (or subclass) of PyBigArray_Type).", "", "*dims : A pointer to the size in each dimension. Information will be", " copied from here.", "", "", "*strides : The strides this array should have. For new arrays created", " by this routine, this should be NULL. If you pass in", " memory for this array to use, then you should pass in the", " strides information as well. I", "", "*data : NULL for creating brand-new memory. If you want this array", " to wrap another memory area, then pass the pointer here.", " You are responsible for deleting the memory in that case,", " but do not do so until the new array object has been", " deleted. The best way to handle that is to get the memory", " from another Python object, INCREF that Python object after", " passing it's data pointer to this routine, and set the", " ->base member of the returned array to the Python object.", " You are responsible for setting the base object. Failure", " to do so will create a memory leak.", " If you pass in a data buffer, the flags argument will be", " the flags of the new array. If you create a new array, a", " non-zero flags argument indicates that you want the array", " to be in FORTRAN order.", "", "", "itemsize : Indicates the itemsize for the new array. This can be 0", " if it is a fixed-size array type. It is only used for", " flexible array types and must be set in that case.", "flags : Either the flags showing how to interpret the data buffer", " passed in. Or if a new array is created, nonzero to", " indicate a FORTRAN order array.", "obj : If subtypes is &PyArray_Type or &PyBigArray_Type, this", " argument is ignored. Otherwise, the __array_finalize__", " method of the subtype is called (if present) and passed", " this object. This is usually an array of the type to be", " created (so the __array_finalize__ method must handle an", " array argument. But, it can be anything...)", "Note: The returned array object will be unitialized unless the type is", "PyArray_OBJECT.", "", "The PyArray_FromDims and family of functions are still available and", "are loose wrappers around this function.", "", "typecode : A typecode structure filled with the data type and", " itemsize of the desired data type. This can be NULL, if", " the type should be determined from the object. Unless", " FORCECAST is present in flags, this call will generate", " an error if the data type cannot be safely obtained from", " the object.", "", "", "" ], "deleted": [ " structure you will have to modify your usage of those. The casting functions", " have eliminated the strides argument (use PyArray_CastTo if you need strided casting).", " All functions have one or two PyArrayObject * arguments at the end. This allows", " the flexible arrays and mis-behaved arrays to be handled.", " * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to get the itemsize of an", " object (for flexible arrays descr->elsize is 0).", "__multiarray_api.h contain the available C-API function calls with their function signatures.", "subtype : The subtype that should be created (either pass in", " &PyArray_Type, &PyBigArray_Type, or obj->ob_type,", " where obj is a subtype (or subclass) of PyBigArray_Type).", "*dims : A pointer to the size in each dimension. Information will be copied from here.", "*strides : The strides this array should have. For new arrays created by this routine, this", " should be NULL. If you pass in memory for this array to use, then you should pass", " in the strides information as well. I", "*data : NULL for creating brand-new memory. If you want this array to wrap another memory", " area, then pass the pointer here. You are responsible for deleting the memory in that", " case, but do not do so until the new array object has been deleted. The best way to", " handle that is to get the memory from another Python object,", " INCREF that Python object after passing it's data pointer to this routine, and", " set the ->base member of the returned array to the Python object. You are", " responsible for setting the base object. Failure to do so will create a memory leak.", " If you pass in a data buffer, the flags argument will be the flags of the new array.", " If you create a new array, a non-zero flags argument indicates that you want the", " array to be in FORTRAN order.", "itemsize : Indicates the itemsize for the new array. This can be 0 if it is a fixed-size array type.", " It is only used for flexible array types and must be set in that case.", "flags : Either the flags showing how to interpret the data buffer passed in. Or if a new array", " is created, nonzero to indicate a FORTRAN order array.", "obj : If subtypes is &PyArray_Type or &PyBigArray_Type, this argument is ignored. Otherwise,", " the __array_finalize__ method of the subtype is called (if present) and passed this", " object. This is usually an array of the type to be created (so the __array_finalize__", " method must handle an array argument. But, it can be anything...)", "Note: The returned array object will be unitialized unless the type is PyArray_OBJECT.", "The PyArray_FromDims and family of functions are still available and are loose wrappers around", "this function.", "typecode : A typecode structure filled with the data type and itemsize of the desired data type.", " This can be NULL, if the type should be determined from the object.", " Unless FORCECAST is present in flags, this call will generate an error", " if the data type cannot be safely obtained from the object." ] } } ] }, { "hash": "4d0a78f748058792ab4b2d9cb394589372d0e740", "msg": "Minor formatting changes.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T18:45:37+00:00", "author_timezone": 0, "committer_date": "2005-10-07T18:45:37+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "ab3e2b4f7a684c55b5ae9eecf6caabbcde6ec398" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 2, "insertions": 5, "lines": 7, "files": 1, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": "THANKS.txt", "new_path": "THANKS.txt", "filename": "THANKS.txt", "extension": "txt", "change_type": "MODIFY", "diff": "@@ -1,6 +1,8 @@\n Travis Oliphant for the majority of code adaptation\n-Jim Hugunin, Paul Dubois, Konrad Hinsen, David Ascher, and many others for Numeric on which the code is based.\n-Perry Greenfield, J Todd Miller, Rick White, Paul Barrett for Numarray which gave much inspiration.\n+Jim Hugunin, Paul Dubois, Konrad Hinsen, David Ascher, and many others for \n+ Numeric on which the code is based.\n+Perry Greenfield, J Todd Miller, Rick White, Paul Barrett for Numarray\n+ which gave much inspiration and showed the way forward.\n Pearu Peterson for f2py and distutils\n Eric Jones for weave\n Robert Kern for mtrand, bug fixes and help with distutils.\n@@ -9,3 +11,4 @@ John Hunter for code snippets (from matplotlib)\n Chris Hanley for help with records.py, testing, and bug fixes.\n Travis Vaught and Joe Cooper for administration of scipy.org web site and SVN \n Eric Firing for bugfixes.\n+Arnd Baecker for 64-bit testing\n", "added_lines": 5, "deleted_lines": 2, "source_code": "Travis Oliphant for the majority of code adaptation\nJim Hugunin, Paul Dubois, Konrad Hinsen, David Ascher, and many others for \n Numeric on which the code is based.\nPerry Greenfield, J Todd Miller, Rick White, Paul Barrett for Numarray\n which gave much inspiration and showed the way forward.\nPearu Peterson for f2py and distutils\nEric Jones for weave\nRobert Kern for mtrand, bug fixes and help with distutils.\nFernando Perez for code snippets and ideas\nJohn Hunter for code snippets (from matplotlib)\nChris Hanley for help with records.py, testing, and bug fixes.\nTravis Vaught and Joe Cooper for administration of scipy.org web site and SVN \nEric Firing for bugfixes.\nArnd Baecker for 64-bit testing\n", "source_code_before": "Travis Oliphant for the majority of code adaptation\nJim Hugunin, Paul Dubois, Konrad Hinsen, David Ascher, and many others for Numeric on which the code is based.\nPerry Greenfield, J Todd Miller, Rick White, Paul Barrett for Numarray which gave much inspiration.\nPearu Peterson for f2py and distutils\nEric Jones for weave\nRobert Kern for mtrand, bug fixes and help with distutils.\nFernando Perez for code snippets and ideas\nJohn Hunter for code snippets (from matplotlib)\nChris Hanley for help with records.py, testing, and bug fixes.\nTravis Vaught and Joe Cooper for administration of scipy.org web site and SVN \nEric Firing for bugfixes.\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ "Jim Hugunin, Paul Dubois, Konrad Hinsen, David Ascher, and many others for", " Numeric on which the code is based.", "Perry Greenfield, J Todd Miller, Rick White, Paul Barrett for Numarray", " which gave much inspiration and showed the way forward.", "Arnd Baecker for 64-bit testing" ], "deleted": [ "Jim Hugunin, Paul Dubois, Konrad Hinsen, David Ascher, and many others for Numeric on which the code is based.", "Perry Greenfield, J Todd Miller, Rick White, Paul Barrett for Numarray which gave much inspiration." ] } } ] }, { "hash": "52c686c981609fdb2e0e45aba16626a7e14cc3d4", "msg": "Moved extra modules to basic", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T20:19:55+00:00", "author_timezone": 0, "committer_date": "2005-10-07T20:19:55+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "4d0a78f748058792ab4b2d9cb394589372d0e740" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 17, "insertions": 22, "lines": 39, "files": 12, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.0, "dmm_unit_interfacing": 0.0, "modified_files": [ { "old_path": "scipy/__init__.py", "new_path": "scipy/__init__.py", "filename": "__init__.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -1,20 +1,18 @@\n-\"\"\"SciPy \n+\"\"\"SciPy Core\n \n-You can support the development of scipy by purchasing documentation at\n+You can support the development of SciPy by purchasing documentation at\n \n http://www.trelgol.com\n \n-Ironically, you can help make the documentation free by purchasing a copy today.\n+It is being distributed for a fee for a limited time to try and raise money for\n+development.\n \"\"\"\n \n-\n try: # For installation purposes only \n from scipy.base import *\n- import scipy.linalg as linalg\n- import scipy.fftpack as fftpack\n- from scipy.fftpack import fft, ifft\n- import scipy.random as random\n- from scipy.random import rand, randn\n+ import scipy.basic as basic\n+ from scipy.basic.fft import fft, ifft\n+ from scipy.basic.random import rand, randn\n from core_version import version as __version__\n from scipy.test.testing import ScipyTest\n test = ScipyTest('scipy').test\n", "added_lines": 7, "deleted_lines": 9, "source_code": "\"\"\"SciPy Core\n\nYou can support the development of SciPy by purchasing documentation at\n\nhttp://www.trelgol.com\n\nIt is being distributed for a fee for a limited time to try and raise money for\ndevelopment.\n\"\"\"\n\ntry: # For installation purposes only \n from scipy.base import *\n import scipy.basic as basic\n from scipy.basic.fft import fft, ifft\n from scipy.basic.random import rand, randn\n from core_version import version as __version__\n from scipy.test.testing import ScipyTest\n test = ScipyTest('scipy').test\n\nexcept AttributeError, inst:\n if inst.args[0] == \"'module' object has no attribute 'typeinfo'\":\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\nexcept ImportError, inst:\n if inst.args[0] == 'No module named multiarray':\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\n\n", "source_code_before": "\"\"\"SciPy \n\nYou can support the development of scipy by purchasing documentation at\n\nhttp://www.trelgol.com\n\nIronically, you can help make the documentation free by purchasing a copy today.\n\"\"\"\n\n\ntry: # For installation purposes only \n from scipy.base import *\n import scipy.linalg as linalg\n import scipy.fftpack as fftpack\n from scipy.fftpack import fft, ifft\n import scipy.random as random\n from scipy.random import rand, randn\n from core_version import version as __version__\n from scipy.test.testing import ScipyTest\n test = ScipyTest('scipy').test\n\nexcept AttributeError, inst:\n if inst.args[0] == \"'module' object has no attribute 'typeinfo'\":\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\nexcept ImportError, inst:\n if inst.args[0] == 'No module named multiarray':\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\n\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": 27, "complexity": 0, "token_count": 97, "diff_parsed": { "added": [ "\"\"\"SciPy Core", "You can support the development of SciPy by purchasing documentation at", "It is being distributed for a fee for a limited time to try and raise money for", "development.", " import scipy.basic as basic", " from scipy.basic.fft import fft, ifft", " from scipy.basic.random import rand, randn" ], "deleted": [ "\"\"\"SciPy", "You can support the development of scipy by purchasing documentation at", "Ironically, you can help make the documentation free by purchasing a copy today.", "", " import scipy.linalg as linalg", " import scipy.fftpack as fftpack", " from scipy.fftpack import fft, ifft", " import scipy.random as random", " from scipy.random import rand, randn" ] } }, { "old_path": "scipy/base/convertcode.py", "new_path": "scipy/base/convertcode.py", "filename": "convertcode.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -120,11 +120,11 @@ def fromstr(filestr):\n filestr, fromall1 = changeimports(filestr, 'Precision', 'scipy.base')\n filestr, fromall2 = changeimports(filestr, 'numerix', 'scipy.base')\n filestr, fromall3 = changeimports(filestr, 'scipy_base', 'scipy.base')\n- filestr, fromall3 = changeimports(filestr, 'MLab', 'scipy.linalg')\n- filestr, fromall3 = changeimports(filestr, 'LinearAlgebra', 'scipy.linalg')\n- filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.random')\n- filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.random')\n- filestr, fromall3 = changeimports(filestr, 'FFT', 'scipy.fftpack')\n+ filestr, fromall3 = changeimports(filestr, 'MLab', 'scipy.basic.linalg')\n+ filestr, fromall3 = changeimports(filestr, 'LinearAlgebra', 'scipy.basic.linalg')\n+ filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.basic.random')\n+ filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.basic.random')\n+ filestr, fromall3 = changeimports(filestr, 'FFT', 'scipy.basdic.fft')\n filestr, fromall3 = changeimports(filestr, 'MA', 'scipy.base.ma')\n fromall = fromall1 or fromall2 or fromall3\n filestr = replaceattr(filestr)\n", "added_lines": 5, "deleted_lines": 5, "source_code": "\n# This module converts code written for Numeric to run with scipy.base\n\n# Makes the following changes:\n# * Converts typecharacters\n# * Changes import statements (warns of use of from Numeric import *)\n# * Changes import statements (using numerix) ...\n# * Makes search and replace changes to:\n# - .typecode()\n# - .iscontiguous()\n# - .byteswapped()\n# - .itemsize()\n# * Converts .flat to .ravel() except for .flat = xxx or .flat[xxx]\n# * Change typecode= to dtype=\n# * Eliminates savespace=xxx\n# * Replace xxx.spacesaver() with True\n# * Convert xx.savespace(?) to pass + ## xx.savespace(?)\n# * Convert a.shape = ? to a.reshape(?) \n# * Prints warning for use of bool, int, float, copmlex, object, and unicode\n#\n\n__all__ = ['fromfile', 'fromstr']\n\nimport sys\nimport os\nimport re\nimport warnings\n\nflatindex_re = re.compile('([.]flat(\\s*?[[=]))')\nint_re = re.compile('int\\s*[(][^)]*[)]')\nbool_re = re.compile('bool\\s*[(][^)]*[)]')\nfloat_re = re.compile('float\\s*[(][^)]*[)]')\ncomplex_re = re.compile('complex\\s*[(][^)]*[)]')\nunicode_re = re.compile('unicode\\s*[(][^)]*[)]')\n\ndef replacetypechars(astr):\n astr = astr.replace(\"'s'\",\"'h'\")\n astr = astr.replace(\"'c'\",\"'S1'\")\n astr = astr.replace(\"'b'\",\"'B'\")\n astr = astr.replace(\"'1'\",\"'b'\")\n astr = astr.replace(\"'w'\",\"'H'\")\n astr = astr.replace(\"'u'\",\"'I'\")\n return astr\n\ndef changeimports(fstr, name, newname):\n importstr = 'import %s' % name\n importasstr = 'import %s as ' % name\n fromstr = 'from %s import ' % name\n fromallstr = 'from %s import *' % name\n fromall=0\n\n fstr = fstr.replace(importasstr, 'import %s as ' % newname)\n fstr = fstr.replace(importstr, 'import %s as %s' % (newname,name))\n if (fstr.find(fromallstr) >= 0):\n warnings.warn('Usage of %s found.' % fromallstr)\n fstr = fstr.replace(fromallstr, 'from %s import *' % newname)\n fromall=1\n\n ind = 0\n Nlen = len(fromstr)\n Nlen2 = len(\"from %s import \" % newname)\n while 1:\n found = fstr.find(fromstr,ind)\n if (found < 0):\n break\n ind = found + Nlen\n if fstr[ind] == '*':\n continue\n fstr = \"%sfrom %s import %s\" % (fstr[:found], newname, fstr[ind:])\n ind += Nlen2 - Nlen\n return fstr, fromall\n\ndef replaceattr(astr):\n astr = astr.replace(\".typecode()\",\".dtypechar\")\n astr = astr.replace(\".iscontiguous()\",\".flags['CONTIGUOUS']\")\n astr = astr.replace(\".byteswapped()\",\".byteswap()\")\n astr = astr.replace(\".itemsize()\",\".itemsize\")\n\n # preserve uses of flat that should be o.k.\n tmpstr = flatindex_re.sub(\"@@@@\\\\2\",astr)\n # replace other uses of flat\n tmpstr = tmpstr.replace(\".flat\",\".ravel()\")\n # put back .flat where it was valid\n astr = tmpstr.replace(\"@@@@\", \".flat\")\n return astr\n\nsvspc = re.compile(r'(\\S+\\s*[(].+),\\s*savespace\\s*=.+\\s*[)]')\nsvspc2 = re.compile(r'([^,(\\s]+[.]spacesaver[(][)])')\nsvspc3 = re.compile(r'(\\S+[.]savespace[(].*[)])')\nshpe = re.compile(r'(\\S+\\s*)[.]shape\\s*=[^=]\\s*(.+)')\ndef replaceother(astr):\n astr = astr.replace(\"typecode=\",\"dtype=\")\n astr = astr.replace(\"UserArray\",\"ndarray\")\n astr = svspc.sub('\\\\1)',astr)\n astr = svspc2.sub('True',astr)\n astr = svspc3.sub('pass ## \\\\1', astr)\n astr = shpe.sub('\\\\1=\\\\1.reshape(\\\\2)', astr)\n return astr\n\ndef warnofnewtypes(filestr):\n if int_re.search(filestr) or \\\n float_re.search(filestr) or \\\n complex_re.search(filestr) or \\\n unicode_re.search(filestr) or \\\n bool_re.search(filestr):\n warnings.warn(\"Use of builtin bool, int, float, complex, or unicode\\n\" \\\n \"found when import * used -- these will be handled by\\n\" \\\n \"new array scalars under scipy\")\n \n return\n \nimport datetime\ndef fromstr(filestr):\n filestr = replacetypechars(filestr)\n filestr, fromall1 = changeimports(filestr, 'Numeric', 'scipy')\n filestr, fromall1 = changeimports(filestr, 'multiarray',\n 'scipy.base.multiarray')\n filestr, fromall1 = changeimports(filestr, 'umath',\n 'scipy.base.umath')\n filestr, fromall1 = changeimports(filestr, 'Precision', 'scipy.base')\n filestr, fromall2 = changeimports(filestr, 'numerix', 'scipy.base')\n filestr, fromall3 = changeimports(filestr, 'scipy_base', 'scipy.base')\n filestr, fromall3 = changeimports(filestr, 'MLab', 'scipy.basic.linalg')\n filestr, fromall3 = changeimports(filestr, 'LinearAlgebra', 'scipy.basic.linalg')\n filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.basic.random')\n filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.basic.random')\n filestr, fromall3 = changeimports(filestr, 'FFT', 'scipy.basdic.fft')\n filestr, fromall3 = changeimports(filestr, 'MA', 'scipy.base.ma')\n fromall = fromall1 or fromall2 or fromall3\n filestr = replaceattr(filestr)\n filestr = replaceother(filestr)\n if fromall:\n warnofnewtypes(filestr)\n today = datetime.date.today().strftime('%b %d, %Y')\n name = os.path.split(sys.argv[0])[-1]\n filestr = '## Automatically adapted for '\\\n 'scipy %s by %s\\n\\n%s' % (today, name, filestr)\n return filestr\n\ndef makenewfile(name, filestr):\n fid = file(name, 'w')\n fid.write(filestr)\n fid.close()\n\ndef getandcopy(name):\n fid = file(name)\n filestr = fid.read()\n fid.close()\n base, ext = os.path.splitext(name)\n makenewfile(base+'.orig', filestr)\n return filestr\n \ndef fromfile(args):\n filename = args[1]\n filestr = getandcopy(filename)\n filestr = fromstr(filestr)\n makenewfile(filename, filestr)\n\nif __name__ == '__main__':\n fromfile(sys.argv)\n \n \n\n", "source_code_before": "\n# This module converts code written for Numeric to run with scipy.base\n\n# Makes the following changes:\n# * Converts typecharacters\n# * Changes import statements (warns of use of from Numeric import *)\n# * Changes import statements (using numerix) ...\n# * Makes search and replace changes to:\n# - .typecode()\n# - .iscontiguous()\n# - .byteswapped()\n# - .itemsize()\n# * Converts .flat to .ravel() except for .flat = xxx or .flat[xxx]\n# * Change typecode= to dtype=\n# * Eliminates savespace=xxx\n# * Replace xxx.spacesaver() with True\n# * Convert xx.savespace(?) to pass + ## xx.savespace(?)\n# * Convert a.shape = ? to a.reshape(?) \n# * Prints warning for use of bool, int, float, copmlex, object, and unicode\n#\n\n__all__ = ['fromfile', 'fromstr']\n\nimport sys\nimport os\nimport re\nimport warnings\n\nflatindex_re = re.compile('([.]flat(\\s*?[[=]))')\nint_re = re.compile('int\\s*[(][^)]*[)]')\nbool_re = re.compile('bool\\s*[(][^)]*[)]')\nfloat_re = re.compile('float\\s*[(][^)]*[)]')\ncomplex_re = re.compile('complex\\s*[(][^)]*[)]')\nunicode_re = re.compile('unicode\\s*[(][^)]*[)]')\n\ndef replacetypechars(astr):\n astr = astr.replace(\"'s'\",\"'h'\")\n astr = astr.replace(\"'c'\",\"'S1'\")\n astr = astr.replace(\"'b'\",\"'B'\")\n astr = astr.replace(\"'1'\",\"'b'\")\n astr = astr.replace(\"'w'\",\"'H'\")\n astr = astr.replace(\"'u'\",\"'I'\")\n return astr\n\ndef changeimports(fstr, name, newname):\n importstr = 'import %s' % name\n importasstr = 'import %s as ' % name\n fromstr = 'from %s import ' % name\n fromallstr = 'from %s import *' % name\n fromall=0\n\n fstr = fstr.replace(importasstr, 'import %s as ' % newname)\n fstr = fstr.replace(importstr, 'import %s as %s' % (newname,name))\n if (fstr.find(fromallstr) >= 0):\n warnings.warn('Usage of %s found.' % fromallstr)\n fstr = fstr.replace(fromallstr, 'from %s import *' % newname)\n fromall=1\n\n ind = 0\n Nlen = len(fromstr)\n Nlen2 = len(\"from %s import \" % newname)\n while 1:\n found = fstr.find(fromstr,ind)\n if (found < 0):\n break\n ind = found + Nlen\n if fstr[ind] == '*':\n continue\n fstr = \"%sfrom %s import %s\" % (fstr[:found], newname, fstr[ind:])\n ind += Nlen2 - Nlen\n return fstr, fromall\n\ndef replaceattr(astr):\n astr = astr.replace(\".typecode()\",\".dtypechar\")\n astr = astr.replace(\".iscontiguous()\",\".flags['CONTIGUOUS']\")\n astr = astr.replace(\".byteswapped()\",\".byteswap()\")\n astr = astr.replace(\".itemsize()\",\".itemsize\")\n\n # preserve uses of flat that should be o.k.\n tmpstr = flatindex_re.sub(\"@@@@\\\\2\",astr)\n # replace other uses of flat\n tmpstr = tmpstr.replace(\".flat\",\".ravel()\")\n # put back .flat where it was valid\n astr = tmpstr.replace(\"@@@@\", \".flat\")\n return astr\n\nsvspc = re.compile(r'(\\S+\\s*[(].+),\\s*savespace\\s*=.+\\s*[)]')\nsvspc2 = re.compile(r'([^,(\\s]+[.]spacesaver[(][)])')\nsvspc3 = re.compile(r'(\\S+[.]savespace[(].*[)])')\nshpe = re.compile(r'(\\S+\\s*)[.]shape\\s*=[^=]\\s*(.+)')\ndef replaceother(astr):\n astr = astr.replace(\"typecode=\",\"dtype=\")\n astr = astr.replace(\"UserArray\",\"ndarray\")\n astr = svspc.sub('\\\\1)',astr)\n astr = svspc2.sub('True',astr)\n astr = svspc3.sub('pass ## \\\\1', astr)\n astr = shpe.sub('\\\\1=\\\\1.reshape(\\\\2)', astr)\n return astr\n\ndef warnofnewtypes(filestr):\n if int_re.search(filestr) or \\\n float_re.search(filestr) or \\\n complex_re.search(filestr) or \\\n unicode_re.search(filestr) or \\\n bool_re.search(filestr):\n warnings.warn(\"Use of builtin bool, int, float, complex, or unicode\\n\" \\\n \"found when import * used -- these will be handled by\\n\" \\\n \"new array scalars under scipy\")\n \n return\n \nimport datetime\ndef fromstr(filestr):\n filestr = replacetypechars(filestr)\n filestr, fromall1 = changeimports(filestr, 'Numeric', 'scipy')\n filestr, fromall1 = changeimports(filestr, 'multiarray',\n 'scipy.base.multiarray')\n filestr, fromall1 = changeimports(filestr, 'umath',\n 'scipy.base.umath')\n filestr, fromall1 = changeimports(filestr, 'Precision', 'scipy.base')\n filestr, fromall2 = changeimports(filestr, 'numerix', 'scipy.base')\n filestr, fromall3 = changeimports(filestr, 'scipy_base', 'scipy.base')\n filestr, fromall3 = changeimports(filestr, 'MLab', 'scipy.linalg')\n filestr, fromall3 = changeimports(filestr, 'LinearAlgebra', 'scipy.linalg')\n filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.random')\n filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.random')\n filestr, fromall3 = changeimports(filestr, 'FFT', 'scipy.fftpack')\n filestr, fromall3 = changeimports(filestr, 'MA', 'scipy.base.ma')\n fromall = fromall1 or fromall2 or fromall3\n filestr = replaceattr(filestr)\n filestr = replaceother(filestr)\n if fromall:\n warnofnewtypes(filestr)\n today = datetime.date.today().strftime('%b %d, %Y')\n name = os.path.split(sys.argv[0])[-1]\n filestr = '## Automatically adapted for '\\\n 'scipy %s by %s\\n\\n%s' % (today, name, filestr)\n return filestr\n\ndef makenewfile(name, filestr):\n fid = file(name, 'w')\n fid.write(filestr)\n fid.close()\n\ndef getandcopy(name):\n fid = file(name)\n filestr = fid.read()\n fid.close()\n base, ext = os.path.splitext(name)\n makenewfile(base+'.orig', filestr)\n return filestr\n \ndef fromfile(args):\n filename = args[1]\n filestr = getandcopy(filename)\n filestr = fromstr(filestr)\n makenewfile(filename, filestr)\n\nif __name__ == '__main__':\n fromfile(sys.argv)\n \n \n\n", "methods": [ { "name": "replacetypechars", "long_name": "replacetypechars( astr )", "filename": "convertcode.py", "nloc": 8, "complexity": 1, "token_count": 67, "parameters": [ "astr" ], "start_line": 36, "end_line": 43, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "changeimports", "long_name": "changeimports( fstr , name , newname )", "filename": "convertcode.py", "nloc": 25, "complexity": 5, "token_count": 175, "parameters": [ "fstr", "name", "newname" ], "start_line": 45, "end_line": 71, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "replaceattr", "long_name": "replaceattr( astr )", "filename": "convertcode.py", "nloc": 9, "complexity": 1, "token_count": 77, "parameters": [ "astr" ], "start_line": 73, "end_line": 85, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "replaceother", "long_name": "replaceother( astr )", "filename": "convertcode.py", "nloc": 8, "complexity": 1, "token_count": 67, "parameters": [ "astr" ], "start_line": 91, "end_line": 98, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "warnofnewtypes", "long_name": "warnofnewtypes( filestr )", "filename": "convertcode.py", "nloc": 10, "complexity": 6, "token_count": 56, "parameters": [ "filestr" ], "start_line": 100, "end_line": 110, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "fromstr", "long_name": "fromstr( filestr )", "filename": "convertcode.py", "nloc": 26, "complexity": 4, "token_count": 229, "parameters": [ "filestr" ], "start_line": 113, "end_line": 138, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "makenewfile", "long_name": "makenewfile( name , filestr )", "filename": "convertcode.py", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "name", "filestr" ], "start_line": 140, "end_line": 143, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "getandcopy", "long_name": "getandcopy( name )", "filename": "convertcode.py", "nloc": 7, "complexity": 1, "token_count": 45, "parameters": [ "name" ], "start_line": 145, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "fromfile", "long_name": "fromfile( args )", "filename": "convertcode.py", "nloc": 5, "complexity": 1, "token_count": 29, "parameters": [ "args" ], "start_line": 153, "end_line": 157, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 } ], "methods_before": [ { "name": "replacetypechars", "long_name": "replacetypechars( astr )", "filename": "convertcode.py", "nloc": 8, "complexity": 1, "token_count": 67, "parameters": [ "astr" ], "start_line": 36, "end_line": 43, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "changeimports", "long_name": "changeimports( fstr , name , newname )", "filename": "convertcode.py", "nloc": 25, "complexity": 5, "token_count": 175, "parameters": [ "fstr", "name", "newname" ], "start_line": 45, "end_line": 71, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "replaceattr", "long_name": "replaceattr( astr )", "filename": "convertcode.py", "nloc": 9, "complexity": 1, "token_count": 77, "parameters": [ "astr" ], "start_line": 73, "end_line": 85, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "replaceother", "long_name": "replaceother( astr )", "filename": "convertcode.py", "nloc": 8, "complexity": 1, "token_count": 67, "parameters": [ "astr" ], "start_line": 91, "end_line": 98, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "warnofnewtypes", "long_name": "warnofnewtypes( filestr )", "filename": "convertcode.py", "nloc": 10, "complexity": 6, "token_count": 56, "parameters": [ "filestr" ], "start_line": 100, "end_line": 110, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "fromstr", "long_name": "fromstr( filestr )", "filename": "convertcode.py", "nloc": 26, "complexity": 4, "token_count": 229, "parameters": [ "filestr" ], "start_line": 113, "end_line": 138, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "makenewfile", "long_name": "makenewfile( name , filestr )", "filename": "convertcode.py", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "name", "filestr" ], "start_line": 140, "end_line": 143, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "getandcopy", "long_name": "getandcopy( name )", "filename": "convertcode.py", "nloc": 7, "complexity": 1, "token_count": 45, "parameters": [ "name" ], "start_line": 145, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "fromfile", "long_name": "fromfile( args )", "filename": "convertcode.py", "nloc": 5, "complexity": 1, "token_count": 29, "parameters": [ "args" ], "start_line": 153, "end_line": 157, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "fromstr", "long_name": "fromstr( filestr )", "filename": "convertcode.py", "nloc": 26, "complexity": 4, "token_count": 229, "parameters": [ "filestr" ], "start_line": 113, "end_line": 138, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 } ], "nloc": 120, "complexity": 21, "token_count": 892, "diff_parsed": { "added": [ " filestr, fromall3 = changeimports(filestr, 'MLab', 'scipy.basic.linalg')", " filestr, fromall3 = changeimports(filestr, 'LinearAlgebra', 'scipy.basic.linalg')", " filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.basic.random')", " filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.basic.random')", " filestr, fromall3 = changeimports(filestr, 'FFT', 'scipy.basdic.fft')" ], "deleted": [ " filestr, fromall3 = changeimports(filestr, 'MLab', 'scipy.linalg')", " filestr, fromall3 = changeimports(filestr, 'LinearAlgebra', 'scipy.linalg')", " filestr, fromall3 = changeimports(filestr, 'RNG', 'scipy.random')", " filestr, fromall3 = changeimports(filestr, 'RandomArray', 'scipy.random')", " filestr, fromall3 = changeimports(filestr, 'FFT', 'scipy.fftpack')" ] } }, { "old_path": "scipy/base/matrix.py", "new_path": "scipy/base/matrix.py", "filename": "matrix.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -189,7 +189,7 @@ def getH(self):\n return self.transpose()\n \n def getI(self):\n- from scipy.linalg import inv\n+ from scipy.basic.linalg import inv\n return matrix(inv(self))\n \n A = property(getA, None, doc=\"base array\")\n", "added_lines": 1, "deleted_lines": 1, "source_code": "\nimport numeric as N\nfrom numeric import ArrayType, concatenate, integer, multiply, power\nfrom type_check import isscalar\nfrom function_base import binary_repr\nimport types\nimport string as str_\nimport sys\n\n__all__ = ['matrix', 'bmat', 'mat']\n\n# make translation table\n_table = [None]*256\nfor k in range(256):\n _table[k] = chr(k)\n_table = ''.join(_table)\n\n_numchars = str_.digits + \".-+jeEL\"\ndel str_\n_todelete = []\nfor k in _table:\n if k not in _numchars:\n _todelete.append(k)\n_todelete = ''.join(_todelete)\n\ndef _eval(astr):\n return eval(astr.translate(_table,_todelete))\n\ndef _convert_from_string(data):\n rows = data.split(';')\n newdata = []\n count = 0\n for row in rows:\n trow = row.split(',')\n newrow = []\n for col in trow:\n temp = col.split()\n newrow.extend(map(_eval,temp))\n if count == 0:\n Ncols = len(newrow)\n elif len(newrow) != Ncols:\n raise ValueError, \"Rows not the same size.\"\n count += 1\n newdata.append(newrow)\n return newdata\n\n\nclass matrix(N.ndarray):\n __array_priority__ = 10.0\n def __new__(self, data, dtype=None, copy=0):\n if isinstance(data, matrix):\n dtype2 = data.dtype\n if (dtype is None):\n dtype = dtype2\n if (dtype2 is dtype) and (not copy):\n return data\n return data.astype(dtype)\n\n if dtype is None:\n if isinstance(data, N.ndarray):\n dtype = data.dtype\n intype = N.obj2dtype(dtype)\n \n if isinstance(data, types.StringType):\n data = _convert_from_string(data)\n\n # now convert data to an array\n arr = N.array(data, dtype=intype, copy=copy)\n ndim = arr.ndim\n shape = arr.shape\n if (ndim > 2):\n raise ValueError, \"matrix must be 2-dimensional\"\n elif ndim == 0:\n shape = (1,1)\n elif ndim == 1:\n shape = (1,shape[0])\n\n fortran = False;\n if (ndim == 2) and arr.flags['FORTRAN']:\n fortran = True\n\n if not (fortran or arr.flags['CONTIGUOUS']):\n arr = arr.copy()\n\n ret = N.ndarray.__new__(matrix, shape, arr.dtype, buffer=arr,\n fortran=fortran,\n swap=(not arr.flags['NOTSWAPPED']))\n return ret; \n\n\n def __array_finalize__(self, obj):\n ndim = self.ndim\n if ndim == 0:\n self.shape = (1,1)\n elif ndim == 1:\n self.shape = (1, self.shape[0])\n return\n\n def __getitem__(self, index):\n out = N.ndarray.__getitem__(self, index)\n # Need to swap if slice is on first inde\n retscal = False\n try:\n n = len(index)\n if (n==2):\n if isinstance(index[0], types.SliceType):\n if (isscalar(index[1])):\n sh = out.shape\n out.shape = (sh[1], sh[0])\n else:\n if (isscalar(index[0])) and (isscalar(index[1])):\n retscal = True\n except TypeError:\n pass\n if retscal and out.shape == (1,1): # convert scalars\n return out.A[0,0]\n return out\n\n def __mul__(self, other):\n if isinstance(other, N.ndarray) and other.ndim == 0:\n return N.multiply(self, other)\n else:\n return N.dot(self, other)\n\n def __rmul__(self, other):\n if isinstance(other, N.ndarray) and other.ndim == 0:\n return N.multiply(other, self)\n else:\n return N.dot(other, self)\n\n def __pow__(self, other):\n if len(shape)!=2 or shape[0]!=shape[1]:\n raise TypeError, \"matrix is not square\"\n if type(other) in (type(1), type(1L)):\n if other==0:\n return matrix(N.identity(shape[0]))\n if other<0:\n x = self.I\n other=-other\n else:\n x=self\n result = x\n if other <= 3:\n while(other>1):\n result=result*x\n other=other-1\n return result\n # binary decomposition to reduce the number of Matrix\n # Multiplies for other > 3.\n beta = binary_repr(other)\n t = len(beta)\n Z,q = x.copy(),0\n while beta[t-q-1] == '0':\n Z *= Z\n q += 1\n result = Z.copy()\n for k in range(q+1,t):\n Z *= Z\n if beta[t-k-1] == '1':\n result *= Z\n return result\n else:\n raise TypeError, \"exponent must be an integer\"\n\n def __rpow__(self, other):\n raise NotImplementedError\n\n def __repr__(self):\n return repr(self.__array__()).replace('array','matrix')\n\n def __str__(self):\n return str(self.__array__())\n\n # Needed becase tolist method expects a[i] \n # to have dimension a.ndim-1\n def tolist(self):\n return self.__array__().tolist()\n \n def getA(self):\n return self.__array__()\n \n def getT(self):\n return self.transpose()\n\n def getH(self):\n if issubclass(self.dtype, N.complexfloating):\n return self.transpose(self.conjugate())\n else:\n return self.transpose()\n\n def getI(self):\n from scipy.basic.linalg import inv\n return matrix(inv(self))\n\n A = property(getA, None, doc=\"base array\")\n T = property(getT, None, doc=\"transpose\") \n H = property(getH, None, doc=\"hermitian (conjugate) transpose\")\n I = property(getI, None, doc=\"inverse\")\n\n\ndef _from_string(str,gdict,ldict):\n rows = str.split(';')\n rowtup = []\n for row in rows:\n trow = row.split(',')\n newrow = []\n for x in trow:\n newrow.extend(x.split())\n trow = newrow\n coltup = []\n for col in trow:\n col = col.strip()\n try:\n thismat = ldict[col]\n except KeyError:\n try:\n thismat = gdict[col]\n except KeyError:\n raise KeyError, \"%s not found\" % (col,)\n \n coltup.append(thismat)\n rowtup.append(concatenate(coltup,axis=-1))\n return concatenate(rowtup,axis=0)\n \n\ndef bmat(obj,ldict=None, gdict=None):\n \"\"\"Build a matrix object from string, nested sequence, or array.\n\n Ex: F = bmat('A, B; C, D') \n F = bmat([[A,B],[C,D]])\n F = bmat(r_[c_[A,B],c_[C,D]])\n\n all produce the same Matrix Object [ A B ]\n [ C D ]\n \n if A, B, C, and D are appropriately shaped 2-d arrays.\n \"\"\"\n if isinstance(obj, types.StringType):\n if gdict is None:\n # get previous frame\n frame = sys._getframe().f_back\n glob_dict = frame.f_globals\n loc_dict = frame.f_locals\n else:\n glob_dict = gdict\n loc_dict = ldict\n \n return matrix(_from_string(obj, glob_dict, loc_dict))\n \n if isinstance(obj, (types.TupleType, types.ListType)):\n # [[A,B],[C,D]]\n arr_rows = []\n for row in obj:\n if isinstance(row, ArrayType): # not 2-d\n return matrix(concatenate(obj,axis=-1))\n else:\n arr_rows.append(concatenate(row,axis=-1))\n return matrix(concatenate(arr_rows,axis=0))\n if isinstance(obj, ArrayType):\n return matrix(obj)\n\nmat = matrix\n\n \n", "source_code_before": "\nimport numeric as N\nfrom numeric import ArrayType, concatenate, integer, multiply, power\nfrom type_check import isscalar\nfrom function_base import binary_repr\nimport types\nimport string as str_\nimport sys\n\n__all__ = ['matrix', 'bmat', 'mat']\n\n# make translation table\n_table = [None]*256\nfor k in range(256):\n _table[k] = chr(k)\n_table = ''.join(_table)\n\n_numchars = str_.digits + \".-+jeEL\"\ndel str_\n_todelete = []\nfor k in _table:\n if k not in _numchars:\n _todelete.append(k)\n_todelete = ''.join(_todelete)\n\ndef _eval(astr):\n return eval(astr.translate(_table,_todelete))\n\ndef _convert_from_string(data):\n rows = data.split(';')\n newdata = []\n count = 0\n for row in rows:\n trow = row.split(',')\n newrow = []\n for col in trow:\n temp = col.split()\n newrow.extend(map(_eval,temp))\n if count == 0:\n Ncols = len(newrow)\n elif len(newrow) != Ncols:\n raise ValueError, \"Rows not the same size.\"\n count += 1\n newdata.append(newrow)\n return newdata\n\n\nclass matrix(N.ndarray):\n __array_priority__ = 10.0\n def __new__(self, data, dtype=None, copy=0):\n if isinstance(data, matrix):\n dtype2 = data.dtype\n if (dtype is None):\n dtype = dtype2\n if (dtype2 is dtype) and (not copy):\n return data\n return data.astype(dtype)\n\n if dtype is None:\n if isinstance(data, N.ndarray):\n dtype = data.dtype\n intype = N.obj2dtype(dtype)\n \n if isinstance(data, types.StringType):\n data = _convert_from_string(data)\n\n # now convert data to an array\n arr = N.array(data, dtype=intype, copy=copy)\n ndim = arr.ndim\n shape = arr.shape\n if (ndim > 2):\n raise ValueError, \"matrix must be 2-dimensional\"\n elif ndim == 0:\n shape = (1,1)\n elif ndim == 1:\n shape = (1,shape[0])\n\n fortran = False;\n if (ndim == 2) and arr.flags['FORTRAN']:\n fortran = True\n\n if not (fortran or arr.flags['CONTIGUOUS']):\n arr = arr.copy()\n\n ret = N.ndarray.__new__(matrix, shape, arr.dtype, buffer=arr,\n fortran=fortran,\n swap=(not arr.flags['NOTSWAPPED']))\n return ret; \n\n\n def __array_finalize__(self, obj):\n ndim = self.ndim\n if ndim == 0:\n self.shape = (1,1)\n elif ndim == 1:\n self.shape = (1, self.shape[0])\n return\n\n def __getitem__(self, index):\n out = N.ndarray.__getitem__(self, index)\n # Need to swap if slice is on first inde\n retscal = False\n try:\n n = len(index)\n if (n==2):\n if isinstance(index[0], types.SliceType):\n if (isscalar(index[1])):\n sh = out.shape\n out.shape = (sh[1], sh[0])\n else:\n if (isscalar(index[0])) and (isscalar(index[1])):\n retscal = True\n except TypeError:\n pass\n if retscal and out.shape == (1,1): # convert scalars\n return out.A[0,0]\n return out\n\n def __mul__(self, other):\n if isinstance(other, N.ndarray) and other.ndim == 0:\n return N.multiply(self, other)\n else:\n return N.dot(self, other)\n\n def __rmul__(self, other):\n if isinstance(other, N.ndarray) and other.ndim == 0:\n return N.multiply(other, self)\n else:\n return N.dot(other, self)\n\n def __pow__(self, other):\n if len(shape)!=2 or shape[0]!=shape[1]:\n raise TypeError, \"matrix is not square\"\n if type(other) in (type(1), type(1L)):\n if other==0:\n return matrix(N.identity(shape[0]))\n if other<0:\n x = self.I\n other=-other\n else:\n x=self\n result = x\n if other <= 3:\n while(other>1):\n result=result*x\n other=other-1\n return result\n # binary decomposition to reduce the number of Matrix\n # Multiplies for other > 3.\n beta = binary_repr(other)\n t = len(beta)\n Z,q = x.copy(),0\n while beta[t-q-1] == '0':\n Z *= Z\n q += 1\n result = Z.copy()\n for k in range(q+1,t):\n Z *= Z\n if beta[t-k-1] == '1':\n result *= Z\n return result\n else:\n raise TypeError, \"exponent must be an integer\"\n\n def __rpow__(self, other):\n raise NotImplementedError\n\n def __repr__(self):\n return repr(self.__array__()).replace('array','matrix')\n\n def __str__(self):\n return str(self.__array__())\n\n # Needed becase tolist method expects a[i] \n # to have dimension a.ndim-1\n def tolist(self):\n return self.__array__().tolist()\n \n def getA(self):\n return self.__array__()\n \n def getT(self):\n return self.transpose()\n\n def getH(self):\n if issubclass(self.dtype, N.complexfloating):\n return self.transpose(self.conjugate())\n else:\n return self.transpose()\n\n def getI(self):\n from scipy.linalg import inv\n return matrix(inv(self))\n\n A = property(getA, None, doc=\"base array\")\n T = property(getT, None, doc=\"transpose\") \n H = property(getH, None, doc=\"hermitian (conjugate) transpose\")\n I = property(getI, None, doc=\"inverse\")\n\n\ndef _from_string(str,gdict,ldict):\n rows = str.split(';')\n rowtup = []\n for row in rows:\n trow = row.split(',')\n newrow = []\n for x in trow:\n newrow.extend(x.split())\n trow = newrow\n coltup = []\n for col in trow:\n col = col.strip()\n try:\n thismat = ldict[col]\n except KeyError:\n try:\n thismat = gdict[col]\n except KeyError:\n raise KeyError, \"%s not found\" % (col,)\n \n coltup.append(thismat)\n rowtup.append(concatenate(coltup,axis=-1))\n return concatenate(rowtup,axis=0)\n \n\ndef bmat(obj,ldict=None, gdict=None):\n \"\"\"Build a matrix object from string, nested sequence, or array.\n\n Ex: F = bmat('A, B; C, D') \n F = bmat([[A,B],[C,D]])\n F = bmat(r_[c_[A,B],c_[C,D]])\n\n all produce the same Matrix Object [ A B ]\n [ C D ]\n \n if A, B, C, and D are appropriately shaped 2-d arrays.\n \"\"\"\n if isinstance(obj, types.StringType):\n if gdict is None:\n # get previous frame\n frame = sys._getframe().f_back\n glob_dict = frame.f_globals\n loc_dict = frame.f_locals\n else:\n glob_dict = gdict\n loc_dict = ldict\n \n return matrix(_from_string(obj, glob_dict, loc_dict))\n \n if isinstance(obj, (types.TupleType, types.ListType)):\n # [[A,B],[C,D]]\n arr_rows = []\n for row in obj:\n if isinstance(row, ArrayType): # not 2-d\n return matrix(concatenate(obj,axis=-1))\n else:\n arr_rows.append(concatenate(row,axis=-1))\n return matrix(concatenate(arr_rows,axis=0))\n if isinstance(obj, ArrayType):\n return matrix(obj)\n\nmat = matrix\n\n \n", "methods": [ { "name": "_eval", "long_name": "_eval( astr )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 17, "parameters": [ "astr" ], "start_line": 26, "end_line": 27, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "_convert_from_string", "long_name": "_convert_from_string( data )", "filename": "matrix.py", "nloc": 17, "complexity": 5, "token_count": 94, "parameters": [ "data" ], "start_line": 29, "end_line": 45, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "__new__", "long_name": "__new__( self , data , dtype = None , copy = 0 )", "filename": "matrix.py", "nloc": 32, "complexity": 15, "token_count": 247, "parameters": [ "self", "data", "dtype", "copy" ], "start_line": 50, "end_line": 88, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 1 }, { "name": "__array_finalize__", "long_name": "__array_finalize__( self , obj )", "filename": "matrix.py", "nloc": 7, "complexity": 3, "token_count": 46, "parameters": [ "self", "obj" ], "start_line": 91, "end_line": 97, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 1 }, { "name": "__getitem__", "long_name": "__getitem__( self , index )", "filename": "matrix.py", "nloc": 18, "complexity": 9, "token_count": 135, "parameters": [ "self", "index" ], "start_line": 99, "end_line": 117, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 1 }, { "name": "__mul__", "long_name": "__mul__( self , other )", "filename": "matrix.py", "nloc": 5, "complexity": 3, "token_count": 43, "parameters": [ "self", "other" ], "start_line": 119, "end_line": 123, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "__rmul__", "long_name": "__rmul__( self , other )", "filename": "matrix.py", "nloc": 5, "complexity": 3, "token_count": 43, "parameters": [ "self", "other" ], "start_line": 125, "end_line": 129, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "__pow__", "long_name": "__pow__( self , other )", "filename": "matrix.py", "nloc": 31, "complexity": 11, "token_count": 200, "parameters": [ "self", "other" ], "start_line": 131, "end_line": 163, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 1 }, { "name": "__rpow__", "long_name": "__rpow__( self , other )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [ "self", "other" ], "start_line": 165, "end_line": 166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "__repr__", "long_name": "__repr__( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 168, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "__str__", "long_name": "__str__( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 14, "parameters": [ "self" ], "start_line": 171, "end_line": 172, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "tolist", "long_name": "tolist( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 15, "parameters": [ "self" ], "start_line": 176, "end_line": 177, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getA", "long_name": "getA( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "self" ], "start_line": 179, "end_line": 180, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getT", "long_name": "getT( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "self" ], "start_line": 182, "end_line": 183, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getH", "long_name": "getH( self )", "filename": "matrix.py", "nloc": 5, "complexity": 2, "token_count": 36, "parameters": [ "self" ], "start_line": 185, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "getI", "long_name": "getI( self )", "filename": "matrix.py", "nloc": 3, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 191, "end_line": 193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 1 }, { "name": "_from_string", "long_name": "_from_string( str , gdict , ldict )", "filename": "matrix.py", "nloc": 22, "complexity": 6, "token_count": 132, "parameters": [ "str", "gdict", "ldict" ], "start_line": 201, "end_line": 223, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "bmat", "long_name": "bmat( obj , ldict = None , gdict = None )", "filename": "matrix.py", "nloc": 20, "complexity": 7, "token_count": 155, "parameters": [ "obj", "ldict", "gdict" ], "start_line": 226, "end_line": 260, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 } ], "methods_before": [ { "name": "_eval", "long_name": "_eval( astr )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 17, "parameters": [ "astr" ], "start_line": 26, "end_line": 27, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "_convert_from_string", "long_name": "_convert_from_string( data )", "filename": "matrix.py", "nloc": 17, "complexity": 5, "token_count": 94, "parameters": [ "data" ], "start_line": 29, "end_line": 45, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "__new__", "long_name": "__new__( self , data , dtype = None , copy = 0 )", "filename": "matrix.py", "nloc": 32, "complexity": 15, "token_count": 247, "parameters": [ "self", "data", "dtype", "copy" ], "start_line": 50, "end_line": 88, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 1 }, { "name": "__array_finalize__", "long_name": "__array_finalize__( self , obj )", "filename": "matrix.py", "nloc": 7, "complexity": 3, "token_count": 46, "parameters": [ "self", "obj" ], "start_line": 91, "end_line": 97, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 1 }, { "name": "__getitem__", "long_name": "__getitem__( self , index )", "filename": "matrix.py", "nloc": 18, "complexity": 9, "token_count": 135, "parameters": [ "self", "index" ], "start_line": 99, "end_line": 117, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 1 }, { "name": "__mul__", "long_name": "__mul__( self , other )", "filename": "matrix.py", "nloc": 5, "complexity": 3, "token_count": 43, "parameters": [ "self", "other" ], "start_line": 119, "end_line": 123, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "__rmul__", "long_name": "__rmul__( self , other )", "filename": "matrix.py", "nloc": 5, "complexity": 3, "token_count": 43, "parameters": [ "self", "other" ], "start_line": 125, "end_line": 129, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "__pow__", "long_name": "__pow__( self , other )", "filename": "matrix.py", "nloc": 31, "complexity": 11, "token_count": 200, "parameters": [ "self", "other" ], "start_line": 131, "end_line": 163, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 1 }, { "name": "__rpow__", "long_name": "__rpow__( self , other )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [ "self", "other" ], "start_line": 165, "end_line": 166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "__repr__", "long_name": "__repr__( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 168, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "__str__", "long_name": "__str__( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 14, "parameters": [ "self" ], "start_line": 171, "end_line": 172, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "tolist", "long_name": "tolist( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 15, "parameters": [ "self" ], "start_line": 176, "end_line": 177, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getA", "long_name": "getA( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "self" ], "start_line": 179, "end_line": 180, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getT", "long_name": "getT( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "self" ], "start_line": 182, "end_line": 183, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getH", "long_name": "getH( self )", "filename": "matrix.py", "nloc": 5, "complexity": 2, "token_count": 36, "parameters": [ "self" ], "start_line": 185, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "getI", "long_name": "getI( self )", "filename": "matrix.py", "nloc": 3, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 191, "end_line": 193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 1 }, { "name": "_from_string", "long_name": "_from_string( str , gdict , ldict )", "filename": "matrix.py", "nloc": 22, "complexity": 6, "token_count": 132, "parameters": [ "str", "gdict", "ldict" ], "start_line": 201, "end_line": 223, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "bmat", "long_name": "bmat( obj , ldict = None , gdict = None )", "filename": "matrix.py", "nloc": 20, "complexity": 7, "token_count": 155, "parameters": [ "obj", "ldict", "gdict" ], "start_line": 226, "end_line": 260, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "getI", "long_name": "getI( self )", "filename": "matrix.py", "nloc": 3, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 191, "end_line": 193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 1 } ], "nloc": 205, "complexity": 72, "token_count": 1443, "diff_parsed": { "added": [ " from scipy.basic.linalg import inv" ], "deleted": [ " from scipy.linalg import inv" ] } }, { "old_path": null, "new_path": "scipy/basic/__init__.py", "filename": "__init__.py", "extension": "py", "change_type": "ADD", "diff": "@@ -0,0 +1 @@\n+# To get sub-modules\n", "added_lines": 1, "deleted_lines": 0, "source_code": "# To get sub-modules\n", "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": 0, "complexity": 0, "token_count": 0, "diff_parsed": { "added": [ "# To get sub-modules" ], "deleted": [] } }, { "old_path": "scipy/linalg/basic_lite.py", "new_path": "scipy/basic/basic_lite.py", "filename": "basic_lite.py", "extension": "py", "change_type": "RENAME", "diff": "", "added_lines": 0, "deleted_lines": 0, "source_code": null, "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [], "deleted": [] } }, { "old_path": "scipy/fftpack/__init__.py", "new_path": "scipy/basic/fft.py", "filename": "fft.py", "extension": "py", "change_type": "RENAME", "diff": "", "added_lines": 0, "deleted_lines": 0, "source_code": null, "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [], "deleted": [] } }, { "old_path": "scipy/fftpack/fft_lite.py", "new_path": "scipy/basic/fft_lite.py", "filename": "fft_lite.py", "extension": "py", "change_type": "RENAME", "diff": "", "added_lines": 0, "deleted_lines": 0, "source_code": null, "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [], "deleted": [] } }, { "old_path": "scipy/fftpack/helper.py", "new_path": "scipy/basic/helper.py", "filename": "helper.py", "extension": "py", "change_type": "RENAME", "diff": "", "added_lines": 0, "deleted_lines": 0, "source_code": null, "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [], "deleted": [] } }, { "old_path": "scipy/linalg/__init__.py", "new_path": "scipy/basic/linalg.py", "filename": "linalg.py", "extension": "py", "change_type": "RENAME", "diff": "", "added_lines": 0, "deleted_lines": 0, "source_code": null, "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [], "deleted": [] } }, { "old_path": "scipy/random.py", "new_path": "scipy/basic/random.py", "filename": "random.py", "extension": "py", "change_type": "RENAME", "diff": "", "added_lines": 0, "deleted_lines": 0, "source_code": null, "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [], "deleted": [] } }, { "old_path": "scipy/core_version.py", "new_path": "scipy/core_version.py", "filename": "core_version.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -1 +1,8 @@\n version='0.4.2'\n+\n+try:\n+ import __svn_version__ as svn\n+ version += '.'+svn.version\n+except ImportError:\n+ pass\n+\n", "added_lines": 7, "deleted_lines": 0, "source_code": "version='0.4.2'\n\ntry:\n import __svn_version__ as svn\n version += '.'+svn.version\nexcept ImportError:\n pass\n\n", "source_code_before": "version='0.4.2'\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": 6, "complexity": 0, "token_count": 20, "diff_parsed": { "added": [ "", "try:", " import __svn_version__ as svn", " version += '.'+svn.version", "except ImportError:", " pass", "" ], "deleted": [] } }, { "old_path": "scipy/setup.py", "new_path": "scipy/setup.py", "filename": "setup.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -10,8 +10,7 @@ def configuration(parent_package='',top_path=None):\n config.add_subpackage('f2py2e') # installed as scipy.f2py\n config.add_subpackage('base')\n config.add_subpackage('corelib') # installed as scipy.lib\n- config.add_subpackage('fftpack')\n- config.add_subpackage('linalg')\n+ config.add_subpackage('basic')\n config.make_svn_version_py() # installs __svn_version__.py\n return config.todict()\n \n", "added_lines": 1, "deleted_lines": 2, "source_code": "#!/usr/bin/env python\nimport os\n\ndef configuration(parent_package='',top_path=None):\n from scipy.distutils.misc_util import Configuration\n config = Configuration('scipy',parent_package,top_path)\n config.add_subpackage('distutils')\n config.add_subpackage('weave')\n config.add_subpackage('test')\n config.add_subpackage('f2py2e') # installed as scipy.f2py\n config.add_subpackage('base')\n config.add_subpackage('corelib') # installed as scipy.lib\n config.add_subpackage('basic')\n config.make_svn_version_py() # installs __svn_version__.py\n return config.todict()\n\nif __name__ == '__main__':\n # Remove current working directory from sys.path\n # to avoid importing scipy.distutils as Python std. distutils:\n import os, sys\n sys.path.remove(os.getcwd())\n\n from scipy.distutils.core import setup\n setup(**configuration(top_path=''))\n", "source_code_before": "#!/usr/bin/env python\nimport os\n\ndef configuration(parent_package='',top_path=None):\n from scipy.distutils.misc_util import Configuration\n config = Configuration('scipy',parent_package,top_path)\n config.add_subpackage('distutils')\n config.add_subpackage('weave')\n config.add_subpackage('test')\n config.add_subpackage('f2py2e') # installed as scipy.f2py\n config.add_subpackage('base')\n config.add_subpackage('corelib') # installed as scipy.lib\n config.add_subpackage('fftpack')\n config.add_subpackage('linalg')\n config.make_svn_version_py() # installs __svn_version__.py\n return config.todict()\n\nif __name__ == '__main__':\n # Remove current working directory from sys.path\n # to avoid importing scipy.distutils as Python std. distutils:\n import os, sys\n sys.path.remove(os.getcwd())\n\n from scipy.distutils.core import setup\n setup(**configuration(top_path=''))\n", "methods": [ { "name": "configuration", "long_name": "configuration( parent_package = '' , top_path = None )", "filename": "setup.py", "nloc": 12, "complexity": 1, "token_count": 82, "parameters": [ "parent_package", "top_path" ], "start_line": 4, "end_line": 15, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 } ], "methods_before": [ { "name": "configuration", "long_name": "configuration( parent_package = '' , top_path = None )", "filename": "setup.py", "nloc": 13, "complexity": 1, "token_count": 88, "parameters": [ "parent_package", "top_path" ], "start_line": 4, "end_line": 16, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "configuration", "long_name": "configuration( parent_package = '' , top_path = None )", "filename": "setup.py", "nloc": 12, "complexity": 1, "token_count": 82, "parameters": [ "parent_package", "top_path" ], "start_line": 4, "end_line": 15, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 } ], "nloc": 18, "complexity": 1, "token_count": 124, "diff_parsed": { "added": [ " config.add_subpackage('basic')" ], "deleted": [ " config.add_subpackage('fftpack')", " config.add_subpackage('linalg')" ] } } ] }, { "hash": "1effbf88f59949aa8e1fe857c9f74c83236557ea", "msg": "Moving DISTUTILS.txt to newcore/doc.", "author": { "name": "Pearu Peterson", "email": "pearu.peterson@gmail.com" }, "committer": { "name": "Pearu Peterson", "email": "pearu.peterson@gmail.com" }, "author_date": "2005-10-07T22:04:01+00:00", "author_timezone": 0, "committer_date": "2005-10-07T22:04:01+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "52c686c981609fdb2e0e45aba16626a7e14cc3d4" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 0, "insertions": 338, "lines": 338, "files": 1, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": null, "new_path": "doc/DISTUTILS.txt", "filename": "DISTUTILS.txt", "extension": "txt", "change_type": "ADD", "diff": "@@ -0,0 +1,338 @@\n+.. -*- rest -*-\n+\n+Scipy Distutils - Users Guide\n+=============================\n+\n+:Author: Pearu Peterson \n+:Discussions to: scipy-dev@scipy.org\n+:Created: October 2005\n+\n+Scipy structure\n+---------------\n+\n+Currently Scipy project consists of two packages:\n+\n+- Scipy core --- it provides packages like:\n+\n+ + scipy.distutils - extension to Python distutils\n+ + scipy.f2py - a tool to bind Fortran/C codes to Python\n+ + scipy.weave - a tool to bind C++ codes to Python\n+ + scipy.base - future replacement of Numeric and numarray packages\n+ + etc\n+\n+- Scipy --- a collection of Scientific tools for Python.\n+\n+The aim of this document is to describe how to add new tools to Scipy.\n+\n+\n+Requirements for SciPy packages\n+-------------------------------\n+\n+Scipy consists of Python packages, called Scipy packages, that are\n+available to Python users via ``scipy`` name space. Each Scipy package\n+may contain other Scipy packages. And so on. So, Scipy directory tree\n+is a tree of packages with arbitrary depth and width. Any Scipy\n+package may depend on Scipy core packages but the dependence on other\n+Scipy packages should be kept minimal or zero.\n+\n+In order to add a Python package to Scipy, its building script (the\n+``setup.py`` file) must meet certain requirements. The minimal and the\n+most important one is that it must define a function\n+``configuration(parent_package='',top_path=None)`` that returns a\n+dictionary suitable for passing to ``scipy.distutils.core.setup(..)``\n+function. In order to simplify the construction of such an distionary,\n+``scipy.distutils.misc_util`` provides a class ``Configuration``, the\n+usage of will be described below.\n+\n+Scipy pure Python package example\n+---------------------------------\n+\n+Here follows a minimal example for a pure Python Scipy package\n+``setup.py`` file that will be explained in detail below::\n+\n+ #!/usr/bin/env python\n+ def configuration(parent_package='',top_path=None):\n+ from scipy.distutils.misc_util import Configuration\n+ config = Configuration('mypackage',parent_package,top_path)\n+ return config\n+\n+ if __name__ == \"__main__\":\n+ from scipy.distutils.core import setup\n+ setup(**configuration(top_path='').todict())\n+\n+The first argument ``parent_package`` of the main configuration\n+function will contain a name of the parent Scipy package and the\n+second argument ``top_path`` contains the name of the directory where\n+the main ``setup.py`` script is located. Both arguments should be\n+passed to the ``Configuration`` constructor after the name of the\n+current package.\n+\n+The ``Configuration`` constructor has also fourth optional argument,\n+``package_path``, that can be used when package files are located in\n+some other location than the directory of the ``setup.py`` file. \n+\n+Remaining ``Configuration`` arguments are all keyword arguments that will\n+be used to initialize attributes of ``Configuration``\n+instance. Usually, these keywords are the same as the ones that\n+``setup(..)`` function would expect, for example, ``packages``,\n+``ext_modules``, ``data_files``, ``include_dirs``, ``libraries``,\n+``headers``, ``scripts``, ``package_dir``, etc. However, the direct\n+specification of these keywords is not recommended as the content of\n+these keyword arguments will not be processed or checked for the\n+consistency of Scipy building system.\n+\n+Finally, ``Configuration`` has ``.todict()`` method that returns all\n+the configuration data as a dictionary suitable for passing on to the\n+``setup(..)`` function.\n+\n+``Configuration`` instance attributes\n+-------------------------------------\n+\n+In addition to attributes that can be specified via keyword arguments\n+to ``Configuration`` constructor, ``Configuration`` instance (let us\n+denote as ``config``) has the following attributes that can be useful\n+in writing setup scripts:\n+\n++ ``config.name`` - full name of the current package. The names of parent\n+ packages can be extracted as ``config.name.split('.')``.\n+\n++ ``config.local_path`` - path to the location of current ``setup.py`` file.\n+\n++ ``config.top_path`` - path to the location of main ``setup.py`` file.\n+\n+``Configuration`` instance methods\n+----------------------------------\n+\n++ ``config.todict()`` --- returns configuration distionary suitable for\n+ passing to ``scipy.distutils.core.setup(..)`` function.\n+\n++ ``config.paths(*paths) --- applies ``glob.glob(..)`` to items of\n+ ``paths`` if necessary. Fixes ``paths`` item that is relative to\n+ ``config.local_path``.\n+\n++ ``config.get_subpackage(subpackage_name,subpackage_path=None)`` ---\n+ returns Scipy subpackage configuration. Subpackage is looked in the\n+ current directory under the name ``subpackage_name`` but the path\n+ can be specified also via optional ``subpackage_path`` argument.\n+ If ``subpackage_name`` is specified as ``None`` then the subpackage\n+ name will be taken the basename of ``subpackage_path``.\n+\n++ ``config.add_subpackage(subpackage_name,subpackage_path=None)`` ---\n+ add Scipy subpackage configuration to the current one. The meaning\n+ and usage of arguments is explained above, see\n+ ``config.get_subpackage()`` method.\n+\n++ ``config.add_data_files(*files)`` --- prepend ``files`` to ``data_files``\n+ list. If ``files`` item is a tuple then its first element defines\n+ the suffix of where data files are copied relative to package installation\n+ directory and the second element specifies the path to data\n+ files. By default data files are copied under package installation\n+ directory. For example,\n+\n+ ::\n+\n+ config.add_data_files('foo.dat',\n+ ('fun',['gun.dat','nun/pun.dat','/tmp/sun.dat']),\n+ 'bar/car.dat'.\n+ '/full/path/to/can.dat',\n+ )\n+\n+ will install data files to the following locations::\n+\n+ /\n+ foo.dat\n+ fun/\n+ gun.dat\n+ nun/\n+ pun.dat\n+ sun.dat\n+ bar/\n+ car.dat\n+ can.dat \n+\n+ Path to data files can be a function taking no arguments and\n+ returning path(s) to data files -- this is a useful when data files\n+ are generated while building the package. (XXX: explain the step\n+ when this function are called exactly) \n+\n++ ``config.add_data_dir(data_path)`` --- add directory ``data_path``\n+ recursively to ``data_files``. The whole directory tree starting at\n+ ``data_path`` will be copied under package installation directory.\n+\n++ ``config.add_include_dirs(*paths)`` --- prepend ``paths`` to\n+ ``include_dirs`` list. This list will be visible to all extension\n+ modules of the current package.\n+\n++ ``config.add_headers(*files)`` --- prepend ``files`` to ``headers``\n+ list. By default, headers will be installed under \n+ ``/include/pythonX.X//``\n+ directory. If ``files`` item is a tuple then it's first argument\n+ specifies the installation suffix relative to\n+ ``/include/pythonX.X/`` path.\n+\n++ ``config.add_scripts(*files)`` --- prepend ``files`` to ``scripts``\n+ list. Scripts will be installed under ``/bin/`` directory.\n+\n++ ``config.add_extension(name,sources,*kw)`` --- create and add an\n+ ``Extension`` instance to ``ext_modules`` list. The first argument \n+ ``name`` defines the name of the extension module that will be\n+ installed under ``config.name`` package. The second argument is\n+ a list of sources. ``add_extension`` method takes also keyword\n+ arguments that are passed on to the ``Extension`` constructor.\n+ The list of allowed keywords is the following: ``include_dirs``,\n+ ``define_macros``, ``undef_macros``, ``library_dirs``, ``libraries``,\n+ ``runtime_library_dirs``, ``extra_objects``, ``extra_compile_args``,\n+ ``extra_link_args``, ``export_symbols``, ``swig_opts``, ``depends``,\n+ ``language``, ``f2py_options``, ``module_dirs``, ``extra_info``.\n+\n+ Note that ``config.paths`` method is applied to all lists that\n+ may contain paths. ``extra_info`` is a dictionary or a list\n+ of dictionaries that content will be appended to keyword arguments.\n+ The list ``depends`` contains paths to files or directories\n+ that the sources of the extension module depend on. If any path\n+ in the ``depends`` list is newer than the extension module, then\n+ the module will be rebuilt.\n+\n+ The list of sources may contain functions ('source generators')\n+ with a pattern ``def (ext, build_dir): return\n+ ``. If ``funcname`` returns ``None``, no sources\n+ are generated. And if the ``Extension`` instance has no sources\n+ after processing all source generators, no extension module will\n+ be built. This is the recommended way to conditionally define\n+ extension modules. Source generator functions are called by the\n+ ``build_src`` command of ``scipy.distutils``.\n+\n+ For example, here is a typical source generator function::\n+\n+ def generate_source(ext,build_dir):\n+ import os\n+ from distutils.dep_util import newer\n+ target = os.path.join(build_dir,'somesource.c')\n+ if newer(target,__file__):\n+ # create target file\n+ return target\n+\n+ The first argument contains the Extension instance that can be\n+ useful to access its attributes like ``depends``, ``sources``,\n+ etc. lists and modify them during the building process.\n+ The second argument gives a path to a build directory that must\n+ be used when creating files to a disk.\n+\n++ ``config.add_library(name, sources, **build_info)`` --- add\n+ a library to ``libraries`` list. Allowed keywords arguments\n+ are ``depends``, ``macros``, ``include_dirs``,\n+ ``extra_compiler_args``, ``f2py_options``. See ``.add_extension()``\n+ method for more information on arguments.\n+\n++ ``config.have_f77c()`` --- return True if Fortran 77 compiler is\n+ available (read: a simple Fortran 77 code compiled succesfully). \n+\n++ ``config.have_f90c()`` --- return True if Fortran 90 compiler is\n+ available (read: a simple Fortran 90 code compiled succesfully). \n+\n++ ``config.get_version()`` --- return version string of the current package,\n+ ``None`` if version information could not be detected. This methods\n+ scans files ``__version__.py``, ``_version.py``,\n+ ``version.py``, ``__svn_version__.py`` for string variables\n+ ``version``, ``__version__``, ``_version``.\n+\n++ ``config.make_svn_version_py()`` --- appends a data function to\n+ ``data_files`` list that will generate ``__svn_version__.py`` file\n+ to the current package directory. The file will be removed from\n+ the source directory when Python exits.\n+\n++ ``config.get_build_temp_dir()`` --- return a path to a temporary\n+ directory. This is the place where one should build temporary\n+ files.\n+\n++ ``config.get_distribution()`` --- return distutils ``Distribution``\n+ instance.\n+\n++ ``config.get_config_cmd()`` --- returns ``scipy.distutils`` config\n+ command instance.\n+\n+Template files\n+--------------\n+\n+XXX: Describe how files with extensions ``.f.src``, ``.pyf.src``,\n+``.c.src``, etc. are pre-processed by the ``build_src`` command.\n+\n+Useful functions in ``scipy.distutils.misc_util``\n+-------------------------------------------------\n+\n++ ``get_scipy_include_dirs()`` --- return a list of Scipy base\n+ include directories. Scipy base include directories contain\n+ header files such as ``scipy/arrayobject.h``, ``scipy/funcobject.h``\n+ etc. For installed Scipy core the returned list has length 1\n+ but when building Scipy core the list may contain more directories,\n+ for example, a path to ``config.h`` file that\n+ ``scipy/base/setup.py`` file generates and is used by ``scipy``\n+ header files.\n+\n++ ``append_path(prefix,path)`` --- smart append ``path`` to ``prefix``.\n+\n++ ``def get_cmd(cmdname,_cache={})`` --- returns ``scipy.distutils``\n+ command instance.\n+\n++ ``all_strings(lst)``\n+\n++ ``has_f_sources(sources)``\n+\n++ ``has_cxx_sources(sources)``\n+\n++ ``filter_sources(sources)`` --- return ``c_sources, cxx_sources,\n+ f_sources, fmodule_sources``\n+\n++ ``get_dependencies(sources)``\n+\n++ ``is_local_src_dir(directory)``\n+\n++ ``get_ext_source_files(ext)``\n+\n++ ``get_script_files(scripts)``\n+\n++ ``get_lib_source_files(lib)``\n+\n++ ``get_data_files(data)``\n+\n++ ``dot_join(*args)``\n+\n++ ``get_frame(level=0)``\n+\n++ ``cyg2win32(path)``\n+\n++ ``terminal_has_colors()``, ``red_text(s)``, ``green_text(s)``,\n+ ``yellow_text(s)``, ``blue_text(s)``, ``cyan_text(s)``\n+\n++ ``get_path(mod_name,parent_path=None)``\n+\n++ ``allpath(name)``\n+\n++ ``cxx_ext_match``, ``fortran_ext_match``, ``f90_ext_match``,\n+ ``f90_module_name_match``\n+\n+``scipy.distutils.system_info`` module\n+--------------------------------------\n+\n++ ``get_info(name,notfound_action=0)``\n++ ``combine_paths(*args,**kws)``\n++ ``show_all()``\n+\n+``scipy.distutils.cpuinfo`` module\n+----------------------------------\n+\n++ ``cpuinfo``\n+\n+``scipy.distutils.log`` module\n+------------------------------\n+\n++ ``set_verbosity(v)``\n+\n+\n+``scipy.distutils.exec_command`` module\n+---------------------------------------\n+\n++ ``get_pythonexe()``\n++ ``splitcmdline(line)``\n++ ``find_executable(exe, path=None)``\n++ ``exec_command( command, execute_in='', use_shell=None, use_tee=None, **env )``\n", "added_lines": 338, "deleted_lines": 0, "source_code": ".. -*- rest -*-\n\nScipy Distutils - Users Guide\n=============================\n\n:Author: Pearu Peterson \n:Discussions to: scipy-dev@scipy.org\n:Created: October 2005\n\nScipy structure\n---------------\n\nCurrently Scipy project consists of two packages:\n\n- Scipy core --- it provides packages like:\n\n + scipy.distutils - extension to Python distutils\n + scipy.f2py - a tool to bind Fortran/C codes to Python\n + scipy.weave - a tool to bind C++ codes to Python\n + scipy.base - future replacement of Numeric and numarray packages\n + etc\n\n- Scipy --- a collection of Scientific tools for Python.\n\nThe aim of this document is to describe how to add new tools to Scipy.\n\n\nRequirements for SciPy packages\n-------------------------------\n\nScipy consists of Python packages, called Scipy packages, that are\navailable to Python users via ``scipy`` name space. Each Scipy package\nmay contain other Scipy packages. And so on. So, Scipy directory tree\nis a tree of packages with arbitrary depth and width. Any Scipy\npackage may depend on Scipy core packages but the dependence on other\nScipy packages should be kept minimal or zero.\n\nIn order to add a Python package to Scipy, its building script (the\n``setup.py`` file) must meet certain requirements. The minimal and the\nmost important one is that it must define a function\n``configuration(parent_package='',top_path=None)`` that returns a\ndictionary suitable for passing to ``scipy.distutils.core.setup(..)``\nfunction. In order to simplify the construction of such an distionary,\n``scipy.distutils.misc_util`` provides a class ``Configuration``, the\nusage of will be described below.\n\nScipy pure Python package example\n---------------------------------\n\nHere follows a minimal example for a pure Python Scipy package\n``setup.py`` file that will be explained in detail below::\n\n #!/usr/bin/env python\n def configuration(parent_package='',top_path=None):\n from scipy.distutils.misc_util import Configuration\n config = Configuration('mypackage',parent_package,top_path)\n return config\n\n if __name__ == \"__main__\":\n from scipy.distutils.core import setup\n setup(**configuration(top_path='').todict())\n\nThe first argument ``parent_package`` of the main configuration\nfunction will contain a name of the parent Scipy package and the\nsecond argument ``top_path`` contains the name of the directory where\nthe main ``setup.py`` script is located. Both arguments should be\npassed to the ``Configuration`` constructor after the name of the\ncurrent package.\n\nThe ``Configuration`` constructor has also fourth optional argument,\n``package_path``, that can be used when package files are located in\nsome other location than the directory of the ``setup.py`` file. \n\nRemaining ``Configuration`` arguments are all keyword arguments that will\nbe used to initialize attributes of ``Configuration``\ninstance. Usually, these keywords are the same as the ones that\n``setup(..)`` function would expect, for example, ``packages``,\n``ext_modules``, ``data_files``, ``include_dirs``, ``libraries``,\n``headers``, ``scripts``, ``package_dir``, etc. However, the direct\nspecification of these keywords is not recommended as the content of\nthese keyword arguments will not be processed or checked for the\nconsistency of Scipy building system.\n\nFinally, ``Configuration`` has ``.todict()`` method that returns all\nthe configuration data as a dictionary suitable for passing on to the\n``setup(..)`` function.\n\n``Configuration`` instance attributes\n-------------------------------------\n\nIn addition to attributes that can be specified via keyword arguments\nto ``Configuration`` constructor, ``Configuration`` instance (let us\ndenote as ``config``) has the following attributes that can be useful\nin writing setup scripts:\n\n+ ``config.name`` - full name of the current package. The names of parent\n packages can be extracted as ``config.name.split('.')``.\n\n+ ``config.local_path`` - path to the location of current ``setup.py`` file.\n\n+ ``config.top_path`` - path to the location of main ``setup.py`` file.\n\n``Configuration`` instance methods\n----------------------------------\n\n+ ``config.todict()`` --- returns configuration distionary suitable for\n passing to ``scipy.distutils.core.setup(..)`` function.\n\n+ ``config.paths(*paths) --- applies ``glob.glob(..)`` to items of\n ``paths`` if necessary. Fixes ``paths`` item that is relative to\n ``config.local_path``.\n\n+ ``config.get_subpackage(subpackage_name,subpackage_path=None)`` ---\n returns Scipy subpackage configuration. Subpackage is looked in the\n current directory under the name ``subpackage_name`` but the path\n can be specified also via optional ``subpackage_path`` argument.\n If ``subpackage_name`` is specified as ``None`` then the subpackage\n name will be taken the basename of ``subpackage_path``.\n\n+ ``config.add_subpackage(subpackage_name,subpackage_path=None)`` ---\n add Scipy subpackage configuration to the current one. The meaning\n and usage of arguments is explained above, see\n ``config.get_subpackage()`` method.\n\n+ ``config.add_data_files(*files)`` --- prepend ``files`` to ``data_files``\n list. If ``files`` item is a tuple then its first element defines\n the suffix of where data files are copied relative to package installation\n directory and the second element specifies the path to data\n files. By default data files are copied under package installation\n directory. For example,\n\n ::\n\n config.add_data_files('foo.dat',\n ('fun',['gun.dat','nun/pun.dat','/tmp/sun.dat']),\n 'bar/car.dat'.\n '/full/path/to/can.dat',\n )\n\n will install data files to the following locations::\n\n /\n foo.dat\n fun/\n gun.dat\n nun/\n pun.dat\n sun.dat\n bar/\n car.dat\n can.dat \n\n Path to data files can be a function taking no arguments and\n returning path(s) to data files -- this is a useful when data files\n are generated while building the package. (XXX: explain the step\n when this function are called exactly) \n\n+ ``config.add_data_dir(data_path)`` --- add directory ``data_path``\n recursively to ``data_files``. The whole directory tree starting at\n ``data_path`` will be copied under package installation directory.\n\n+ ``config.add_include_dirs(*paths)`` --- prepend ``paths`` to\n ``include_dirs`` list. This list will be visible to all extension\n modules of the current package.\n\n+ ``config.add_headers(*files)`` --- prepend ``files`` to ``headers``\n list. By default, headers will be installed under \n ``/include/pythonX.X//``\n directory. If ``files`` item is a tuple then it's first argument\n specifies the installation suffix relative to\n ``/include/pythonX.X/`` path.\n\n+ ``config.add_scripts(*files)`` --- prepend ``files`` to ``scripts``\n list. Scripts will be installed under ``/bin/`` directory.\n\n+ ``config.add_extension(name,sources,*kw)`` --- create and add an\n ``Extension`` instance to ``ext_modules`` list. The first argument \n ``name`` defines the name of the extension module that will be\n installed under ``config.name`` package. The second argument is\n a list of sources. ``add_extension`` method takes also keyword\n arguments that are passed on to the ``Extension`` constructor.\n The list of allowed keywords is the following: ``include_dirs``,\n ``define_macros``, ``undef_macros``, ``library_dirs``, ``libraries``,\n ``runtime_library_dirs``, ``extra_objects``, ``extra_compile_args``,\n ``extra_link_args``, ``export_symbols``, ``swig_opts``, ``depends``,\n ``language``, ``f2py_options``, ``module_dirs``, ``extra_info``.\n\n Note that ``config.paths`` method is applied to all lists that\n may contain paths. ``extra_info`` is a dictionary or a list\n of dictionaries that content will be appended to keyword arguments.\n The list ``depends`` contains paths to files or directories\n that the sources of the extension module depend on. If any path\n in the ``depends`` list is newer than the extension module, then\n the module will be rebuilt.\n\n The list of sources may contain functions ('source generators')\n with a pattern ``def (ext, build_dir): return\n ``. If ``funcname`` returns ``None``, no sources\n are generated. And if the ``Extension`` instance has no sources\n after processing all source generators, no extension module will\n be built. This is the recommended way to conditionally define\n extension modules. Source generator functions are called by the\n ``build_src`` command of ``scipy.distutils``.\n\n For example, here is a typical source generator function::\n\n def generate_source(ext,build_dir):\n import os\n from distutils.dep_util import newer\n target = os.path.join(build_dir,'somesource.c')\n if newer(target,__file__):\n # create target file\n return target\n\n The first argument contains the Extension instance that can be\n useful to access its attributes like ``depends``, ``sources``,\n etc. lists and modify them during the building process.\n The second argument gives a path to a build directory that must\n be used when creating files to a disk.\n\n+ ``config.add_library(name, sources, **build_info)`` --- add\n a library to ``libraries`` list. Allowed keywords arguments\n are ``depends``, ``macros``, ``include_dirs``,\n ``extra_compiler_args``, ``f2py_options``. See ``.add_extension()``\n method for more information on arguments.\n\n+ ``config.have_f77c()`` --- return True if Fortran 77 compiler is\n available (read: a simple Fortran 77 code compiled succesfully). \n\n+ ``config.have_f90c()`` --- return True if Fortran 90 compiler is\n available (read: a simple Fortran 90 code compiled succesfully). \n\n+ ``config.get_version()`` --- return version string of the current package,\n ``None`` if version information could not be detected. This methods\n scans files ``__version__.py``, ``_version.py``,\n ``version.py``, ``__svn_version__.py`` for string variables\n ``version``, ``__version__``, ``_version``.\n\n+ ``config.make_svn_version_py()`` --- appends a data function to\n ``data_files`` list that will generate ``__svn_version__.py`` file\n to the current package directory. The file will be removed from\n the source directory when Python exits.\n\n+ ``config.get_build_temp_dir()`` --- return a path to a temporary\n directory. This is the place where one should build temporary\n files.\n\n+ ``config.get_distribution()`` --- return distutils ``Distribution``\n instance.\n\n+ ``config.get_config_cmd()`` --- returns ``scipy.distutils`` config\n command instance.\n\nTemplate files\n--------------\n\nXXX: Describe how files with extensions ``.f.src``, ``.pyf.src``,\n``.c.src``, etc. are pre-processed by the ``build_src`` command.\n\nUseful functions in ``scipy.distutils.misc_util``\n-------------------------------------------------\n\n+ ``get_scipy_include_dirs()`` --- return a list of Scipy base\n include directories. Scipy base include directories contain\n header files such as ``scipy/arrayobject.h``, ``scipy/funcobject.h``\n etc. For installed Scipy core the returned list has length 1\n but when building Scipy core the list may contain more directories,\n for example, a path to ``config.h`` file that\n ``scipy/base/setup.py`` file generates and is used by ``scipy``\n header files.\n\n+ ``append_path(prefix,path)`` --- smart append ``path`` to ``prefix``.\n\n+ ``def get_cmd(cmdname,_cache={})`` --- returns ``scipy.distutils``\n command instance.\n\n+ ``all_strings(lst)``\n\n+ ``has_f_sources(sources)``\n\n+ ``has_cxx_sources(sources)``\n\n+ ``filter_sources(sources)`` --- return ``c_sources, cxx_sources,\n f_sources, fmodule_sources``\n\n+ ``get_dependencies(sources)``\n\n+ ``is_local_src_dir(directory)``\n\n+ ``get_ext_source_files(ext)``\n\n+ ``get_script_files(scripts)``\n\n+ ``get_lib_source_files(lib)``\n\n+ ``get_data_files(data)``\n\n+ ``dot_join(*args)``\n\n+ ``get_frame(level=0)``\n\n+ ``cyg2win32(path)``\n\n+ ``terminal_has_colors()``, ``red_text(s)``, ``green_text(s)``,\n ``yellow_text(s)``, ``blue_text(s)``, ``cyan_text(s)``\n\n+ ``get_path(mod_name,parent_path=None)``\n\n+ ``allpath(name)``\n\n+ ``cxx_ext_match``, ``fortran_ext_match``, ``f90_ext_match``,\n ``f90_module_name_match``\n\n``scipy.distutils.system_info`` module\n--------------------------------------\n\n+ ``get_info(name,notfound_action=0)``\n+ ``combine_paths(*args,**kws)``\n+ ``show_all()``\n\n``scipy.distutils.cpuinfo`` module\n----------------------------------\n\n+ ``cpuinfo``\n\n``scipy.distutils.log`` module\n------------------------------\n\n+ ``set_verbosity(v)``\n\n\n``scipy.distutils.exec_command`` module\n---------------------------------------\n\n+ ``get_pythonexe()``\n+ ``splitcmdline(line)``\n+ ``find_executable(exe, path=None)``\n+ ``exec_command( command, execute_in='', use_shell=None, use_tee=None, **env )``\n", "source_code_before": null, "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ ".. -*- rest -*-", "", "Scipy Distutils - Users Guide", "=============================", "", ":Author: Pearu Peterson ", ":Discussions to: scipy-dev@scipy.org", ":Created: October 2005", "", "Scipy structure", "---------------", "", "Currently Scipy project consists of two packages:", "", "- Scipy core --- it provides packages like:", "", " + scipy.distutils - extension to Python distutils", " + scipy.f2py - a tool to bind Fortran/C codes to Python", " + scipy.weave - a tool to bind C++ codes to Python", " + scipy.base - future replacement of Numeric and numarray packages", " + etc", "", "- Scipy --- a collection of Scientific tools for Python.", "", "The aim of this document is to describe how to add new tools to Scipy.", "", "", "Requirements for SciPy packages", "-------------------------------", "", "Scipy consists of Python packages, called Scipy packages, that are", "available to Python users via ``scipy`` name space. Each Scipy package", "may contain other Scipy packages. And so on. So, Scipy directory tree", "is a tree of packages with arbitrary depth and width. Any Scipy", "package may depend on Scipy core packages but the dependence on other", "Scipy packages should be kept minimal or zero.", "", "In order to add a Python package to Scipy, its building script (the", "``setup.py`` file) must meet certain requirements. The minimal and the", "most important one is that it must define a function", "``configuration(parent_package='',top_path=None)`` that returns a", "dictionary suitable for passing to ``scipy.distutils.core.setup(..)``", "function. In order to simplify the construction of such an distionary,", "``scipy.distutils.misc_util`` provides a class ``Configuration``, the", "usage of will be described below.", "", "Scipy pure Python package example", "---------------------------------", "", "Here follows a minimal example for a pure Python Scipy package", "``setup.py`` file that will be explained in detail below::", "", " #!/usr/bin/env python", " def configuration(parent_package='',top_path=None):", " from scipy.distutils.misc_util import Configuration", " config = Configuration('mypackage',parent_package,top_path)", " return config", "", " if __name__ == \"__main__\":", " from scipy.distutils.core import setup", " setup(**configuration(top_path='').todict())", "", "The first argument ``parent_package`` of the main configuration", "function will contain a name of the parent Scipy package and the", "second argument ``top_path`` contains the name of the directory where", "the main ``setup.py`` script is located. Both arguments should be", "passed to the ``Configuration`` constructor after the name of the", "current package.", "", "The ``Configuration`` constructor has also fourth optional argument,", "``package_path``, that can be used when package files are located in", "some other location than the directory of the ``setup.py`` file.", "", "Remaining ``Configuration`` arguments are all keyword arguments that will", "be used to initialize attributes of ``Configuration``", "instance. Usually, these keywords are the same as the ones that", "``setup(..)`` function would expect, for example, ``packages``,", "``ext_modules``, ``data_files``, ``include_dirs``, ``libraries``,", "``headers``, ``scripts``, ``package_dir``, etc. However, the direct", "specification of these keywords is not recommended as the content of", "these keyword arguments will not be processed or checked for the", "consistency of Scipy building system.", "", "Finally, ``Configuration`` has ``.todict()`` method that returns all", "the configuration data as a dictionary suitable for passing on to the", "``setup(..)`` function.", "", "``Configuration`` instance attributes", "-------------------------------------", "", "In addition to attributes that can be specified via keyword arguments", "to ``Configuration`` constructor, ``Configuration`` instance (let us", "denote as ``config``) has the following attributes that can be useful", "in writing setup scripts:", "", "+ ``config.name`` - full name of the current package. The names of parent", " packages can be extracted as ``config.name.split('.')``.", "", "+ ``config.local_path`` - path to the location of current ``setup.py`` file.", "", "+ ``config.top_path`` - path to the location of main ``setup.py`` file.", "", "``Configuration`` instance methods", "----------------------------------", "", "+ ``config.todict()`` --- returns configuration distionary suitable for", " passing to ``scipy.distutils.core.setup(..)`` function.", "", "+ ``config.paths(*paths) --- applies ``glob.glob(..)`` to items of", " ``paths`` if necessary. Fixes ``paths`` item that is relative to", " ``config.local_path``.", "", "+ ``config.get_subpackage(subpackage_name,subpackage_path=None)`` ---", " returns Scipy subpackage configuration. Subpackage is looked in the", " current directory under the name ``subpackage_name`` but the path", " can be specified also via optional ``subpackage_path`` argument.", " If ``subpackage_name`` is specified as ``None`` then the subpackage", " name will be taken the basename of ``subpackage_path``.", "", "+ ``config.add_subpackage(subpackage_name,subpackage_path=None)`` ---", " add Scipy subpackage configuration to the current one. The meaning", " and usage of arguments is explained above, see", " ``config.get_subpackage()`` method.", "", "+ ``config.add_data_files(*files)`` --- prepend ``files`` to ``data_files``", " list. If ``files`` item is a tuple then its first element defines", " the suffix of where data files are copied relative to package installation", " directory and the second element specifies the path to data", " files. By default data files are copied under package installation", " directory. For example,", "", " ::", "", " config.add_data_files('foo.dat',", " ('fun',['gun.dat','nun/pun.dat','/tmp/sun.dat']),", " 'bar/car.dat'.", " '/full/path/to/can.dat',", " )", "", " will install data files to the following locations::", "", " /", " foo.dat", " fun/", " gun.dat", " nun/", " pun.dat", " sun.dat", " bar/", " car.dat", " can.dat", "", " Path to data files can be a function taking no arguments and", " returning path(s) to data files -- this is a useful when data files", " are generated while building the package. (XXX: explain the step", " when this function are called exactly)", "", "+ ``config.add_data_dir(data_path)`` --- add directory ``data_path``", " recursively to ``data_files``. The whole directory tree starting at", " ``data_path`` will be copied under package installation directory.", "", "+ ``config.add_include_dirs(*paths)`` --- prepend ``paths`` to", " ``include_dirs`` list. This list will be visible to all extension", " modules of the current package.", "", "+ ``config.add_headers(*files)`` --- prepend ``files`` to ``headers``", " list. By default, headers will be installed under", " ``/include/pythonX.X//``", " directory. If ``files`` item is a tuple then it's first argument", " specifies the installation suffix relative to", " ``/include/pythonX.X/`` path.", "", "+ ``config.add_scripts(*files)`` --- prepend ``files`` to ``scripts``", " list. Scripts will be installed under ``/bin/`` directory.", "", "+ ``config.add_extension(name,sources,*kw)`` --- create and add an", " ``Extension`` instance to ``ext_modules`` list. The first argument", " ``name`` defines the name of the extension module that will be", " installed under ``config.name`` package. The second argument is", " a list of sources. ``add_extension`` method takes also keyword", " arguments that are passed on to the ``Extension`` constructor.", " The list of allowed keywords is the following: ``include_dirs``,", " ``define_macros``, ``undef_macros``, ``library_dirs``, ``libraries``,", " ``runtime_library_dirs``, ``extra_objects``, ``extra_compile_args``,", " ``extra_link_args``, ``export_symbols``, ``swig_opts``, ``depends``,", " ``language``, ``f2py_options``, ``module_dirs``, ``extra_info``.", "", " Note that ``config.paths`` method is applied to all lists that", " may contain paths. ``extra_info`` is a dictionary or a list", " of dictionaries that content will be appended to keyword arguments.", " The list ``depends`` contains paths to files or directories", " that the sources of the extension module depend on. If any path", " in the ``depends`` list is newer than the extension module, then", " the module will be rebuilt.", "", " The list of sources may contain functions ('source generators')", " with a pattern ``def (ext, build_dir): return", " ``. If ``funcname`` returns ``None``, no sources", " are generated. And if the ``Extension`` instance has no sources", " after processing all source generators, no extension module will", " be built. This is the recommended way to conditionally define", " extension modules. Source generator functions are called by the", " ``build_src`` command of ``scipy.distutils``.", "", " For example, here is a typical source generator function::", "", " def generate_source(ext,build_dir):", " import os", " from distutils.dep_util import newer", " target = os.path.join(build_dir,'somesource.c')", " if newer(target,__file__):", " # create target file", " return target", "", " The first argument contains the Extension instance that can be", " useful to access its attributes like ``depends``, ``sources``,", " etc. lists and modify them during the building process.", " The second argument gives a path to a build directory that must", " be used when creating files to a disk.", "", "+ ``config.add_library(name, sources, **build_info)`` --- add", " a library to ``libraries`` list. Allowed keywords arguments", " are ``depends``, ``macros``, ``include_dirs``,", " ``extra_compiler_args``, ``f2py_options``. See ``.add_extension()``", " method for more information on arguments.", "", "+ ``config.have_f77c()`` --- return True if Fortran 77 compiler is", " available (read: a simple Fortran 77 code compiled succesfully).", "", "+ ``config.have_f90c()`` --- return True if Fortran 90 compiler is", " available (read: a simple Fortran 90 code compiled succesfully).", "", "+ ``config.get_version()`` --- return version string of the current package,", " ``None`` if version information could not be detected. This methods", " scans files ``__version__.py``, ``_version.py``,", " ``version.py``, ``__svn_version__.py`` for string variables", " ``version``, ``__version__``, ``_version``.", "", "+ ``config.make_svn_version_py()`` --- appends a data function to", " ``data_files`` list that will generate ``__svn_version__.py`` file", " to the current package directory. The file will be removed from", " the source directory when Python exits.", "", "+ ``config.get_build_temp_dir()`` --- return a path to a temporary", " directory. This is the place where one should build temporary", " files.", "", "+ ``config.get_distribution()`` --- return distutils ``Distribution``", " instance.", "", "+ ``config.get_config_cmd()`` --- returns ``scipy.distutils`` config", " command instance.", "", "Template files", "--------------", "", "XXX: Describe how files with extensions ``.f.src``, ``.pyf.src``,", "``.c.src``, etc. are pre-processed by the ``build_src`` command.", "", "Useful functions in ``scipy.distutils.misc_util``", "-------------------------------------------------", "", "+ ``get_scipy_include_dirs()`` --- return a list of Scipy base", " include directories. Scipy base include directories contain", " header files such as ``scipy/arrayobject.h``, ``scipy/funcobject.h``", " etc. For installed Scipy core the returned list has length 1", " but when building Scipy core the list may contain more directories,", " for example, a path to ``config.h`` file that", " ``scipy/base/setup.py`` file generates and is used by ``scipy``", " header files.", "", "+ ``append_path(prefix,path)`` --- smart append ``path`` to ``prefix``.", "", "+ ``def get_cmd(cmdname,_cache={})`` --- returns ``scipy.distutils``", " command instance.", "", "+ ``all_strings(lst)``", "", "+ ``has_f_sources(sources)``", "", "+ ``has_cxx_sources(sources)``", "", "+ ``filter_sources(sources)`` --- return ``c_sources, cxx_sources,", " f_sources, fmodule_sources``", "", "+ ``get_dependencies(sources)``", "", "+ ``is_local_src_dir(directory)``", "", "+ ``get_ext_source_files(ext)``", "", "+ ``get_script_files(scripts)``", "", "+ ``get_lib_source_files(lib)``", "", "+ ``get_data_files(data)``", "", "+ ``dot_join(*args)``", "", "+ ``get_frame(level=0)``", "", "+ ``cyg2win32(path)``", "", "+ ``terminal_has_colors()``, ``red_text(s)``, ``green_text(s)``,", " ``yellow_text(s)``, ``blue_text(s)``, ``cyan_text(s)``", "", "+ ``get_path(mod_name,parent_path=None)``", "", "+ ``allpath(name)``", "", "+ ``cxx_ext_match``, ``fortran_ext_match``, ``f90_ext_match``,", " ``f90_module_name_match``", "", "``scipy.distutils.system_info`` module", "--------------------------------------", "", "+ ``get_info(name,notfound_action=0)``", "+ ``combine_paths(*args,**kws)``", "+ ``show_all()``", "", "``scipy.distutils.cpuinfo`` module", "----------------------------------", "", "+ ``cpuinfo``", "", "``scipy.distutils.log`` module", "------------------------------", "", "+ ``set_verbosity(v)``", "", "", "``scipy.distutils.exec_command`` module", "---------------------------------------", "", "+ ``get_pythonexe()``", "+ ``splitcmdline(line)``", "+ ``find_executable(exe, path=None)``", "+ ``exec_command( command, execute_in='', use_shell=None, use_tee=None, **env )``" ], "deleted": [] } } ] }, { "hash": "bb644a0eb115f75efe4f3960d3e8e386fcefb70e", "msg": "Minor changes", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-07T23:10:43+00:00", "author_timezone": 0, "committer_date": "2005-10-07T23:10:43+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "1effbf88f59949aa8e1fe857c9f74c83236557ea" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 0, "insertions": 3, "lines": 3, "files": 1, "dmm_unit_size": null, "dmm_unit_complexity": null, "dmm_unit_interfacing": null, "modified_files": [ { "old_path": "doc/CAPI.txt", "new_path": "doc/CAPI.txt", "filename": "CAPI.txt", "extension": "txt", "change_type": "MODIFY", "diff": "@@ -1,3 +1,6 @@\n+Author: Travis Oliphant\n+Discussions to: scipy-dev@scipy.org\n+Created: October 2005\n \n The CAPI of SciPy is (mostly) backward compatible with Numeric. \n \n", "added_lines": 3, "deleted_lines": 0, "source_code": "Author: Travis Oliphant\nDiscussions to: scipy-dev@scipy.org\nCreated: October 2005\n\nThe CAPI of SciPy is (mostly) backward compatible with Numeric. \n\nThere are a few non-standard API Numeric usages that will need to be changed:\n\n * If you used any of the function pointers in the PyArray_Descr\n structure you will have to modify your usage of those. The\n casting functions have eliminated the strides argument (use\n PyArray_CastTo if you need strided casting). All functions have\n one or two PyArrayObject * arguments at the end. This allows the\n flexible arrays and mis-behaved arrays to be handled.\n\n * The descr->zero and descr->one constants have been replaced with\n function calls, PyArray_Zero, and PyArray_One.\n\n * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to\n get the itemsize of an object (for flexible arrays descr->elsize\n is 0).\n\n\nThe header files arrayobject.h and ufuncobject.h contain many defines\nthat you may find useful. The files __ufunc_api.h and\n__multiarray_api.h contain the available C-API function calls with\ntheir function signatures.\n\nAll of these headers are installed to \n\n/site-packages/scipy/base/include\n\n\nGetting arrays in C-code\n=========================\n\nAll new arrays can be created using PyArray_New.\n\nThis is a very flexible function. \n\nPyObject * PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type, \n intp *strides, char *data, int itemsize, int flags, \n PyObject *obj);\n\n\nsubtype : The subtype that should be created (either pass in\n &PyArray_Type, &PyBigArray_Type, or obj->ob_type,\n where obj is a subtype (or subclass) of PyBigArray_Type).\n\nnd : The number of dimensions (base member of the returned array to the Python object.\n You are responsible for setting the base object. Failure\n to do so will create a memory leak.\n \n If you pass in a data buffer, the flags argument will be\n the flags of the new array. If you create a new array, a\n non-zero flags argument indicates that you want the array\n to be in FORTRAN order.\n\n\nitemsize : Indicates the itemsize for the new array. This can be 0\n if it is a fixed-size array type. It is only used for\n flexible array types and must be set in that case.\n\n\nflags : Either the flags showing how to interpret the data buffer\n passed in. Or if a new array is created, nonzero to\n indicate a FORTRAN order array.\n\n\nobj : If subtypes is &PyArray_Type or &PyBigArray_Type, this\n argument is ignored. Otherwise, the __array_finalize__\n method of the subtype is called (if present) and passed\n this object. This is usually an array of the type to be\n created (so the __array_finalize__ method must handle an\n array argument. But, it can be anything...)\n\nNote: The returned array object will be unitialized unless the type is\nPyArray_OBJECT.\n\n\nThe PyArray_FromDims and family of functions are still available and\nare loose wrappers around this function.\n\n\nGetting an arrayobject from an arbitrary Python object: PyArray_FromAny\n\nThis function replaces PyArray_ContiguousFromObject and friends (those\nfunction calls still remain but they are loose wrappers around the\nPyArray_FromAny call).\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n\n\nop : The Python object to \"convert\" to an array object\n\ntypecode : A typecode structure filled with the data type and\n itemsize of the desired data type. This can be NULL, if\n the type should be determined from the object. Unless\n FORCECAST is present in flags, this call will generate\n an error if the data type cannot be safely obtained from\n the object.\n\nmin_depth : The minimum depth of array needed or 0 if doesn't matter\n\nmax_depth : The maximum depth of array allowed or 0 if doesn't matter\n\nrequires : A flag indicating the \"requirements\" of the returned array. \n\n\nFrom the code comments, the requires flag is explained.\n\nrequires can be any of \n\n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, \n and WRITEABLE and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, if the object is an array and requires is 0, \n the array will just be INCREF'd and returned. \n \n typecode->fortran can be set to request a\n fortran-contiguous array (or just | FORTRAN to the requires flags).\n Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. This is useful, \n if you don't want to deal with a possibly mis-behaved array, but want\n to update it easily using a local contiguous copy. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n\n\nPyArray_Typecode structure\n{\n int type_num;\n int itemsize;\n int fortran --- used to indicate a fortran array is desired.\n}\n\n\nPassing Data Type information to C-code\n============================================\n\nTo get a Typecode structure from Python use the\nPyArray_TypecodeConverter function. This will return a typecode\nstructure filled appropriately based on a wide variety of user inputs.\n\nSee the arraymethods.c and multiarraymodule.c files for many examples of usage.\n\n\nGetting at the structure of the array.\n\nYou should use the #defines provided to access array structure portions:\n\nPyArray_DATA(obj)\nPyArray_ITEMSIZE(obj)\nPyArray_NDIM(obj)\nPyArray_DIMS(obj)\nPyArray_DIM(obj, n)\nPyArray_STRIDES(obj)\nPyArray_STRIDE(obj,n)\n\n\nsee more in arrayobject.h\n\n\nThere are more C-API enhancements which you can discover in the code, \n or buy the book (http://www.trelgol.com)\n\n\n", "source_code_before": "\nThe CAPI of SciPy is (mostly) backward compatible with Numeric. \n\nThere are a few non-standard API Numeric usages that will need to be changed:\n\n * If you used any of the function pointers in the PyArray_Descr\n structure you will have to modify your usage of those. The\n casting functions have eliminated the strides argument (use\n PyArray_CastTo if you need strided casting). All functions have\n one or two PyArrayObject * arguments at the end. This allows the\n flexible arrays and mis-behaved arrays to be handled.\n\n * The descr->zero and descr->one constants have been replaced with\n function calls, PyArray_Zero, and PyArray_One.\n\n * You should use PyArray_ITEMSIZE(obj) instead of descr->elsize to\n get the itemsize of an object (for flexible arrays descr->elsize\n is 0).\n\n\nThe header files arrayobject.h and ufuncobject.h contain many defines\nthat you may find useful. The files __ufunc_api.h and\n__multiarray_api.h contain the available C-API function calls with\ntheir function signatures.\n\nAll of these headers are installed to \n\n/site-packages/scipy/base/include\n\n\nGetting arrays in C-code\n=========================\n\nAll new arrays can be created using PyArray_New.\n\nThis is a very flexible function. \n\nPyObject * PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type, \n intp *strides, char *data, int itemsize, int flags, \n PyObject *obj);\n\n\nsubtype : The subtype that should be created (either pass in\n &PyArray_Type, &PyBigArray_Type, or obj->ob_type,\n where obj is a subtype (or subclass) of PyBigArray_Type).\n\nnd : The number of dimensions (base member of the returned array to the Python object.\n You are responsible for setting the base object. Failure\n to do so will create a memory leak.\n \n If you pass in a data buffer, the flags argument will be\n the flags of the new array. If you create a new array, a\n non-zero flags argument indicates that you want the array\n to be in FORTRAN order.\n\n\nitemsize : Indicates the itemsize for the new array. This can be 0\n if it is a fixed-size array type. It is only used for\n flexible array types and must be set in that case.\n\n\nflags : Either the flags showing how to interpret the data buffer\n passed in. Or if a new array is created, nonzero to\n indicate a FORTRAN order array.\n\n\nobj : If subtypes is &PyArray_Type or &PyBigArray_Type, this\n argument is ignored. Otherwise, the __array_finalize__\n method of the subtype is called (if present) and passed\n this object. This is usually an array of the type to be\n created (so the __array_finalize__ method must handle an\n array argument. But, it can be anything...)\n\nNote: The returned array object will be unitialized unless the type is\nPyArray_OBJECT.\n\n\nThe PyArray_FromDims and family of functions are still available and\nare loose wrappers around this function.\n\n\nGetting an arrayobject from an arbitrary Python object: PyArray_FromAny\n\nThis function replaces PyArray_ContiguousFromObject and friends (those\nfunction calls still remain but they are loose wrappers around the\nPyArray_FromAny call).\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n\n\nop : The Python object to \"convert\" to an array object\n\ntypecode : A typecode structure filled with the data type and\n itemsize of the desired data type. This can be NULL, if\n the type should be determined from the object. Unless\n FORCECAST is present in flags, this call will generate\n an error if the data type cannot be safely obtained from\n the object.\n\nmin_depth : The minimum depth of array needed or 0 if doesn't matter\n\nmax_depth : The maximum depth of array allowed or 0 if doesn't matter\n\nrequires : A flag indicating the \"requirements\" of the returned array. \n\n\nFrom the code comments, the requires flag is explained.\n\nrequires can be any of \n\n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, \n and WRITEABLE and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, if the object is an array and requires is 0, \n the array will just be INCREF'd and returned. \n \n typecode->fortran can be set to request a\n fortran-contiguous array (or just | FORTRAN to the requires flags).\n Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. This is useful, \n if you don't want to deal with a possibly mis-behaved array, but want\n to update it easily using a local contiguous copy. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n\n\nPyArray_Typecode structure\n{\n int type_num;\n int itemsize;\n int fortran --- used to indicate a fortran array is desired.\n}\n\n\nPassing Data Type information to C-code\n============================================\n\nTo get a Typecode structure from Python use the\nPyArray_TypecodeConverter function. This will return a typecode\nstructure filled appropriately based on a wide variety of user inputs.\n\nSee the arraymethods.c and multiarraymodule.c files for many examples of usage.\n\n\nGetting at the structure of the array.\n\nYou should use the #defines provided to access array structure portions:\n\nPyArray_DATA(obj)\nPyArray_ITEMSIZE(obj)\nPyArray_NDIM(obj)\nPyArray_DIMS(obj)\nPyArray_DIM(obj, n)\nPyArray_STRIDES(obj)\nPyArray_STRIDE(obj,n)\n\n\nsee more in arrayobject.h\n\n\nThere are more C-API enhancements which you can discover in the code, \n or buy the book (http://www.trelgol.com)\n\n\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ "Author: Travis Oliphant", "Discussions to: scipy-dev@scipy.org", "Created: October 2005" ], "deleted": [] } } ] }, { "hash": "21d16bd6429b919f33056ce88d05aa2404f1a65e", "msg": "Fixed some typecode initilization warnings. Made core libraries accessible directly under scipy name space.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-08T05:22:32+00:00", "author_timezone": 0, "committer_date": "2005-10-08T05:22:32+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "bb644a0eb115f75efe4f3960d3e8e386fcefb70e" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 29, "insertions": 57, "lines": 86, "files": 5, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.3888888888888889, "dmm_unit_interfacing": 0.3333333333333333, "modified_files": [ { "old_path": "scipy/__init__.py", "new_path": "scipy/__init__.py", "filename": "__init__.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -13,6 +13,9 @@\n import scipy.basic as basic\n from scipy.basic.fft import fft, ifft\n from scipy.basic.random import rand, randn\n+ import scipy.basic.fft as fftpack\n+ import scipy.basic.linalg as linalg\n+ import scipy.basic.random as random\n from core_version import version as __version__\n from scipy.test.testing import ScipyTest\n test = ScipyTest('scipy').test\n", "added_lines": 3, "deleted_lines": 0, "source_code": "\"\"\"SciPy Core\n\nYou can support the development of SciPy by purchasing documentation at\n\nhttp://www.trelgol.com\n\nIt is being distributed for a fee for a limited time to try and raise money for\ndevelopment.\n\"\"\"\n\ntry: # For installation purposes only \n from scipy.base import *\n import scipy.basic as basic\n from scipy.basic.fft import fft, ifft\n from scipy.basic.random import rand, randn\n import scipy.basic.fft as fftpack\n import scipy.basic.linalg as linalg\n import scipy.basic.random as random\n from core_version import version as __version__\n from scipy.test.testing import ScipyTest\n test = ScipyTest('scipy').test\n\nexcept AttributeError, inst:\n if inst.args[0] == \"'module' object has no attribute 'typeinfo'\":\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\nexcept ImportError, inst:\n if inst.args[0] == 'No module named multiarray':\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\n\n", "source_code_before": "\"\"\"SciPy Core\n\nYou can support the development of SciPy by purchasing documentation at\n\nhttp://www.trelgol.com\n\nIt is being distributed for a fee for a limited time to try and raise money for\ndevelopment.\n\"\"\"\n\ntry: # For installation purposes only \n from scipy.base import *\n import scipy.basic as basic\n from scipy.basic.fft import fft, ifft\n from scipy.basic.random import rand, randn\n from core_version import version as __version__\n from scipy.test.testing import ScipyTest\n test = ScipyTest('scipy').test\n\nexcept AttributeError, inst:\n if inst.args[0] == \"'module' object has no attribute 'typeinfo'\":\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\nexcept ImportError, inst:\n if inst.args[0] == 'No module named multiarray':\n print \"Not loaded: Are you running from the source directory?\"\n else:\n raise\n\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": 30, "complexity": 0, "token_count": 121, "diff_parsed": { "added": [ " import scipy.basic.fft as fftpack", " import scipy.basic.linalg as linalg", " import scipy.basic.random as random" ], "deleted": [] } }, { "old_path": "scipy/base/matrix.py", "new_path": "scipy/base/matrix.py", "filename": "matrix.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -189,7 +189,7 @@ def getH(self):\n return self.transpose()\n \n def getI(self):\n- from scipy.basic.linalg import inv\n+ from scipy.linalg import inv\n return matrix(inv(self))\n \n A = property(getA, None, doc=\"base array\")\n", "added_lines": 1, "deleted_lines": 1, "source_code": "\nimport numeric as N\nfrom numeric import ArrayType, concatenate, integer, multiply, power\nfrom type_check import isscalar\nfrom function_base import binary_repr\nimport types\nimport string as str_\nimport sys\n\n__all__ = ['matrix', 'bmat', 'mat']\n\n# make translation table\n_table = [None]*256\nfor k in range(256):\n _table[k] = chr(k)\n_table = ''.join(_table)\n\n_numchars = str_.digits + \".-+jeEL\"\ndel str_\n_todelete = []\nfor k in _table:\n if k not in _numchars:\n _todelete.append(k)\n_todelete = ''.join(_todelete)\n\ndef _eval(astr):\n return eval(astr.translate(_table,_todelete))\n\ndef _convert_from_string(data):\n rows = data.split(';')\n newdata = []\n count = 0\n for row in rows:\n trow = row.split(',')\n newrow = []\n for col in trow:\n temp = col.split()\n newrow.extend(map(_eval,temp))\n if count == 0:\n Ncols = len(newrow)\n elif len(newrow) != Ncols:\n raise ValueError, \"Rows not the same size.\"\n count += 1\n newdata.append(newrow)\n return newdata\n\n\nclass matrix(N.ndarray):\n __array_priority__ = 10.0\n def __new__(self, data, dtype=None, copy=0):\n if isinstance(data, matrix):\n dtype2 = data.dtype\n if (dtype is None):\n dtype = dtype2\n if (dtype2 is dtype) and (not copy):\n return data\n return data.astype(dtype)\n\n if dtype is None:\n if isinstance(data, N.ndarray):\n dtype = data.dtype\n intype = N.obj2dtype(dtype)\n \n if isinstance(data, types.StringType):\n data = _convert_from_string(data)\n\n # now convert data to an array\n arr = N.array(data, dtype=intype, copy=copy)\n ndim = arr.ndim\n shape = arr.shape\n if (ndim > 2):\n raise ValueError, \"matrix must be 2-dimensional\"\n elif ndim == 0:\n shape = (1,1)\n elif ndim == 1:\n shape = (1,shape[0])\n\n fortran = False;\n if (ndim == 2) and arr.flags['FORTRAN']:\n fortran = True\n\n if not (fortran or arr.flags['CONTIGUOUS']):\n arr = arr.copy()\n\n ret = N.ndarray.__new__(matrix, shape, arr.dtype, buffer=arr,\n fortran=fortran,\n swap=(not arr.flags['NOTSWAPPED']))\n return ret; \n\n\n def __array_finalize__(self, obj):\n ndim = self.ndim\n if ndim == 0:\n self.shape = (1,1)\n elif ndim == 1:\n self.shape = (1, self.shape[0])\n return\n\n def __getitem__(self, index):\n out = N.ndarray.__getitem__(self, index)\n # Need to swap if slice is on first inde\n retscal = False\n try:\n n = len(index)\n if (n==2):\n if isinstance(index[0], types.SliceType):\n if (isscalar(index[1])):\n sh = out.shape\n out.shape = (sh[1], sh[0])\n else:\n if (isscalar(index[0])) and (isscalar(index[1])):\n retscal = True\n except TypeError:\n pass\n if retscal and out.shape == (1,1): # convert scalars\n return out.A[0,0]\n return out\n\n def __mul__(self, other):\n if isinstance(other, N.ndarray) and other.ndim == 0:\n return N.multiply(self, other)\n else:\n return N.dot(self, other)\n\n def __rmul__(self, other):\n if isinstance(other, N.ndarray) and other.ndim == 0:\n return N.multiply(other, self)\n else:\n return N.dot(other, self)\n\n def __pow__(self, other):\n if len(shape)!=2 or shape[0]!=shape[1]:\n raise TypeError, \"matrix is not square\"\n if type(other) in (type(1), type(1L)):\n if other==0:\n return matrix(N.identity(shape[0]))\n if other<0:\n x = self.I\n other=-other\n else:\n x=self\n result = x\n if other <= 3:\n while(other>1):\n result=result*x\n other=other-1\n return result\n # binary decomposition to reduce the number of Matrix\n # Multiplies for other > 3.\n beta = binary_repr(other)\n t = len(beta)\n Z,q = x.copy(),0\n while beta[t-q-1] == '0':\n Z *= Z\n q += 1\n result = Z.copy()\n for k in range(q+1,t):\n Z *= Z\n if beta[t-k-1] == '1':\n result *= Z\n return result\n else:\n raise TypeError, \"exponent must be an integer\"\n\n def __rpow__(self, other):\n raise NotImplementedError\n\n def __repr__(self):\n return repr(self.__array__()).replace('array','matrix')\n\n def __str__(self):\n return str(self.__array__())\n\n # Needed becase tolist method expects a[i] \n # to have dimension a.ndim-1\n def tolist(self):\n return self.__array__().tolist()\n \n def getA(self):\n return self.__array__()\n \n def getT(self):\n return self.transpose()\n\n def getH(self):\n if issubclass(self.dtype, N.complexfloating):\n return self.transpose(self.conjugate())\n else:\n return self.transpose()\n\n def getI(self):\n from scipy.linalg import inv\n return matrix(inv(self))\n\n A = property(getA, None, doc=\"base array\")\n T = property(getT, None, doc=\"transpose\") \n H = property(getH, None, doc=\"hermitian (conjugate) transpose\")\n I = property(getI, None, doc=\"inverse\")\n\n\ndef _from_string(str,gdict,ldict):\n rows = str.split(';')\n rowtup = []\n for row in rows:\n trow = row.split(',')\n newrow = []\n for x in trow:\n newrow.extend(x.split())\n trow = newrow\n coltup = []\n for col in trow:\n col = col.strip()\n try:\n thismat = ldict[col]\n except KeyError:\n try:\n thismat = gdict[col]\n except KeyError:\n raise KeyError, \"%s not found\" % (col,)\n \n coltup.append(thismat)\n rowtup.append(concatenate(coltup,axis=-1))\n return concatenate(rowtup,axis=0)\n \n\ndef bmat(obj,ldict=None, gdict=None):\n \"\"\"Build a matrix object from string, nested sequence, or array.\n\n Ex: F = bmat('A, B; C, D') \n F = bmat([[A,B],[C,D]])\n F = bmat(r_[c_[A,B],c_[C,D]])\n\n all produce the same Matrix Object [ A B ]\n [ C D ]\n \n if A, B, C, and D are appropriately shaped 2-d arrays.\n \"\"\"\n if isinstance(obj, types.StringType):\n if gdict is None:\n # get previous frame\n frame = sys._getframe().f_back\n glob_dict = frame.f_globals\n loc_dict = frame.f_locals\n else:\n glob_dict = gdict\n loc_dict = ldict\n \n return matrix(_from_string(obj, glob_dict, loc_dict))\n \n if isinstance(obj, (types.TupleType, types.ListType)):\n # [[A,B],[C,D]]\n arr_rows = []\n for row in obj:\n if isinstance(row, ArrayType): # not 2-d\n return matrix(concatenate(obj,axis=-1))\n else:\n arr_rows.append(concatenate(row,axis=-1))\n return matrix(concatenate(arr_rows,axis=0))\n if isinstance(obj, ArrayType):\n return matrix(obj)\n\nmat = matrix\n\n \n", "source_code_before": "\nimport numeric as N\nfrom numeric import ArrayType, concatenate, integer, multiply, power\nfrom type_check import isscalar\nfrom function_base import binary_repr\nimport types\nimport string as str_\nimport sys\n\n__all__ = ['matrix', 'bmat', 'mat']\n\n# make translation table\n_table = [None]*256\nfor k in range(256):\n _table[k] = chr(k)\n_table = ''.join(_table)\n\n_numchars = str_.digits + \".-+jeEL\"\ndel str_\n_todelete = []\nfor k in _table:\n if k not in _numchars:\n _todelete.append(k)\n_todelete = ''.join(_todelete)\n\ndef _eval(astr):\n return eval(astr.translate(_table,_todelete))\n\ndef _convert_from_string(data):\n rows = data.split(';')\n newdata = []\n count = 0\n for row in rows:\n trow = row.split(',')\n newrow = []\n for col in trow:\n temp = col.split()\n newrow.extend(map(_eval,temp))\n if count == 0:\n Ncols = len(newrow)\n elif len(newrow) != Ncols:\n raise ValueError, \"Rows not the same size.\"\n count += 1\n newdata.append(newrow)\n return newdata\n\n\nclass matrix(N.ndarray):\n __array_priority__ = 10.0\n def __new__(self, data, dtype=None, copy=0):\n if isinstance(data, matrix):\n dtype2 = data.dtype\n if (dtype is None):\n dtype = dtype2\n if (dtype2 is dtype) and (not copy):\n return data\n return data.astype(dtype)\n\n if dtype is None:\n if isinstance(data, N.ndarray):\n dtype = data.dtype\n intype = N.obj2dtype(dtype)\n \n if isinstance(data, types.StringType):\n data = _convert_from_string(data)\n\n # now convert data to an array\n arr = N.array(data, dtype=intype, copy=copy)\n ndim = arr.ndim\n shape = arr.shape\n if (ndim > 2):\n raise ValueError, \"matrix must be 2-dimensional\"\n elif ndim == 0:\n shape = (1,1)\n elif ndim == 1:\n shape = (1,shape[0])\n\n fortran = False;\n if (ndim == 2) and arr.flags['FORTRAN']:\n fortran = True\n\n if not (fortran or arr.flags['CONTIGUOUS']):\n arr = arr.copy()\n\n ret = N.ndarray.__new__(matrix, shape, arr.dtype, buffer=arr,\n fortran=fortran,\n swap=(not arr.flags['NOTSWAPPED']))\n return ret; \n\n\n def __array_finalize__(self, obj):\n ndim = self.ndim\n if ndim == 0:\n self.shape = (1,1)\n elif ndim == 1:\n self.shape = (1, self.shape[0])\n return\n\n def __getitem__(self, index):\n out = N.ndarray.__getitem__(self, index)\n # Need to swap if slice is on first inde\n retscal = False\n try:\n n = len(index)\n if (n==2):\n if isinstance(index[0], types.SliceType):\n if (isscalar(index[1])):\n sh = out.shape\n out.shape = (sh[1], sh[0])\n else:\n if (isscalar(index[0])) and (isscalar(index[1])):\n retscal = True\n except TypeError:\n pass\n if retscal and out.shape == (1,1): # convert scalars\n return out.A[0,0]\n return out\n\n def __mul__(self, other):\n if isinstance(other, N.ndarray) and other.ndim == 0:\n return N.multiply(self, other)\n else:\n return N.dot(self, other)\n\n def __rmul__(self, other):\n if isinstance(other, N.ndarray) and other.ndim == 0:\n return N.multiply(other, self)\n else:\n return N.dot(other, self)\n\n def __pow__(self, other):\n if len(shape)!=2 or shape[0]!=shape[1]:\n raise TypeError, \"matrix is not square\"\n if type(other) in (type(1), type(1L)):\n if other==0:\n return matrix(N.identity(shape[0]))\n if other<0:\n x = self.I\n other=-other\n else:\n x=self\n result = x\n if other <= 3:\n while(other>1):\n result=result*x\n other=other-1\n return result\n # binary decomposition to reduce the number of Matrix\n # Multiplies for other > 3.\n beta = binary_repr(other)\n t = len(beta)\n Z,q = x.copy(),0\n while beta[t-q-1] == '0':\n Z *= Z\n q += 1\n result = Z.copy()\n for k in range(q+1,t):\n Z *= Z\n if beta[t-k-1] == '1':\n result *= Z\n return result\n else:\n raise TypeError, \"exponent must be an integer\"\n\n def __rpow__(self, other):\n raise NotImplementedError\n\n def __repr__(self):\n return repr(self.__array__()).replace('array','matrix')\n\n def __str__(self):\n return str(self.__array__())\n\n # Needed becase tolist method expects a[i] \n # to have dimension a.ndim-1\n def tolist(self):\n return self.__array__().tolist()\n \n def getA(self):\n return self.__array__()\n \n def getT(self):\n return self.transpose()\n\n def getH(self):\n if issubclass(self.dtype, N.complexfloating):\n return self.transpose(self.conjugate())\n else:\n return self.transpose()\n\n def getI(self):\n from scipy.basic.linalg import inv\n return matrix(inv(self))\n\n A = property(getA, None, doc=\"base array\")\n T = property(getT, None, doc=\"transpose\") \n H = property(getH, None, doc=\"hermitian (conjugate) transpose\")\n I = property(getI, None, doc=\"inverse\")\n\n\ndef _from_string(str,gdict,ldict):\n rows = str.split(';')\n rowtup = []\n for row in rows:\n trow = row.split(',')\n newrow = []\n for x in trow:\n newrow.extend(x.split())\n trow = newrow\n coltup = []\n for col in trow:\n col = col.strip()\n try:\n thismat = ldict[col]\n except KeyError:\n try:\n thismat = gdict[col]\n except KeyError:\n raise KeyError, \"%s not found\" % (col,)\n \n coltup.append(thismat)\n rowtup.append(concatenate(coltup,axis=-1))\n return concatenate(rowtup,axis=0)\n \n\ndef bmat(obj,ldict=None, gdict=None):\n \"\"\"Build a matrix object from string, nested sequence, or array.\n\n Ex: F = bmat('A, B; C, D') \n F = bmat([[A,B],[C,D]])\n F = bmat(r_[c_[A,B],c_[C,D]])\n\n all produce the same Matrix Object [ A B ]\n [ C D ]\n \n if A, B, C, and D are appropriately shaped 2-d arrays.\n \"\"\"\n if isinstance(obj, types.StringType):\n if gdict is None:\n # get previous frame\n frame = sys._getframe().f_back\n glob_dict = frame.f_globals\n loc_dict = frame.f_locals\n else:\n glob_dict = gdict\n loc_dict = ldict\n \n return matrix(_from_string(obj, glob_dict, loc_dict))\n \n if isinstance(obj, (types.TupleType, types.ListType)):\n # [[A,B],[C,D]]\n arr_rows = []\n for row in obj:\n if isinstance(row, ArrayType): # not 2-d\n return matrix(concatenate(obj,axis=-1))\n else:\n arr_rows.append(concatenate(row,axis=-1))\n return matrix(concatenate(arr_rows,axis=0))\n if isinstance(obj, ArrayType):\n return matrix(obj)\n\nmat = matrix\n\n \n", "methods": [ { "name": "_eval", "long_name": "_eval( astr )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 17, "parameters": [ "astr" ], "start_line": 26, "end_line": 27, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "_convert_from_string", "long_name": "_convert_from_string( data )", "filename": "matrix.py", "nloc": 17, "complexity": 5, "token_count": 94, "parameters": [ "data" ], "start_line": 29, "end_line": 45, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "__new__", "long_name": "__new__( self , data , dtype = None , copy = 0 )", "filename": "matrix.py", "nloc": 32, "complexity": 15, "token_count": 247, "parameters": [ "self", "data", "dtype", "copy" ], "start_line": 50, "end_line": 88, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 1 }, { "name": "__array_finalize__", "long_name": "__array_finalize__( self , obj )", "filename": "matrix.py", "nloc": 7, "complexity": 3, "token_count": 46, "parameters": [ "self", "obj" ], "start_line": 91, "end_line": 97, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 1 }, { "name": "__getitem__", "long_name": "__getitem__( self , index )", "filename": "matrix.py", "nloc": 18, "complexity": 9, "token_count": 135, "parameters": [ "self", "index" ], "start_line": 99, "end_line": 117, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 1 }, { "name": "__mul__", "long_name": "__mul__( self , other )", "filename": "matrix.py", "nloc": 5, "complexity": 3, "token_count": 43, "parameters": [ "self", "other" ], "start_line": 119, "end_line": 123, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "__rmul__", "long_name": "__rmul__( self , other )", "filename": "matrix.py", "nloc": 5, "complexity": 3, "token_count": 43, "parameters": [ "self", "other" ], "start_line": 125, "end_line": 129, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "__pow__", "long_name": "__pow__( self , other )", "filename": "matrix.py", "nloc": 31, "complexity": 11, "token_count": 200, "parameters": [ "self", "other" ], "start_line": 131, "end_line": 163, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 1 }, { "name": "__rpow__", "long_name": "__rpow__( self , other )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [ "self", "other" ], "start_line": 165, "end_line": 166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "__repr__", "long_name": "__repr__( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 168, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "__str__", "long_name": "__str__( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 14, "parameters": [ "self" ], "start_line": 171, "end_line": 172, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "tolist", "long_name": "tolist( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 15, "parameters": [ "self" ], "start_line": 176, "end_line": 177, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getA", "long_name": "getA( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "self" ], "start_line": 179, "end_line": 180, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getT", "long_name": "getT( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "self" ], "start_line": 182, "end_line": 183, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getH", "long_name": "getH( self )", "filename": "matrix.py", "nloc": 5, "complexity": 2, "token_count": 36, "parameters": [ "self" ], "start_line": 185, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "getI", "long_name": "getI( self )", "filename": "matrix.py", "nloc": 3, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 191, "end_line": 193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 1 }, { "name": "_from_string", "long_name": "_from_string( str , gdict , ldict )", "filename": "matrix.py", "nloc": 22, "complexity": 6, "token_count": 132, "parameters": [ "str", "gdict", "ldict" ], "start_line": 201, "end_line": 223, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "bmat", "long_name": "bmat( obj , ldict = None , gdict = None )", "filename": "matrix.py", "nloc": 20, "complexity": 7, "token_count": 155, "parameters": [ "obj", "ldict", "gdict" ], "start_line": 226, "end_line": 260, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 } ], "methods_before": [ { "name": "_eval", "long_name": "_eval( astr )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 17, "parameters": [ "astr" ], "start_line": 26, "end_line": 27, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 0 }, { "name": "_convert_from_string", "long_name": "_convert_from_string( data )", "filename": "matrix.py", "nloc": 17, "complexity": 5, "token_count": 94, "parameters": [ "data" ], "start_line": 29, "end_line": 45, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "__new__", "long_name": "__new__( self , data , dtype = None , copy = 0 )", "filename": "matrix.py", "nloc": 32, "complexity": 15, "token_count": 247, "parameters": [ "self", "data", "dtype", "copy" ], "start_line": 50, "end_line": 88, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 1 }, { "name": "__array_finalize__", "long_name": "__array_finalize__( self , obj )", "filename": "matrix.py", "nloc": 7, "complexity": 3, "token_count": 46, "parameters": [ "self", "obj" ], "start_line": 91, "end_line": 97, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 1 }, { "name": "__getitem__", "long_name": "__getitem__( self , index )", "filename": "matrix.py", "nloc": 18, "complexity": 9, "token_count": 135, "parameters": [ "self", "index" ], "start_line": 99, "end_line": 117, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 1 }, { "name": "__mul__", "long_name": "__mul__( self , other )", "filename": "matrix.py", "nloc": 5, "complexity": 3, "token_count": 43, "parameters": [ "self", "other" ], "start_line": 119, "end_line": 123, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "__rmul__", "long_name": "__rmul__( self , other )", "filename": "matrix.py", "nloc": 5, "complexity": 3, "token_count": 43, "parameters": [ "self", "other" ], "start_line": 125, "end_line": 129, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "__pow__", "long_name": "__pow__( self , other )", "filename": "matrix.py", "nloc": 31, "complexity": 11, "token_count": 200, "parameters": [ "self", "other" ], "start_line": 131, "end_line": 163, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 1 }, { "name": "__rpow__", "long_name": "__rpow__( self , other )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 9, "parameters": [ "self", "other" ], "start_line": 165, "end_line": 166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "__repr__", "long_name": "__repr__( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 168, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "__str__", "long_name": "__str__( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 14, "parameters": [ "self" ], "start_line": 171, "end_line": 172, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "tolist", "long_name": "tolist( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 15, "parameters": [ "self" ], "start_line": 176, "end_line": 177, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getA", "long_name": "getA( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "self" ], "start_line": 179, "end_line": 180, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getT", "long_name": "getT( self )", "filename": "matrix.py", "nloc": 2, "complexity": 1, "token_count": 11, "parameters": [ "self" ], "start_line": 182, "end_line": 183, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 2, "top_nesting_level": 1 }, { "name": "getH", "long_name": "getH( self )", "filename": "matrix.py", "nloc": 5, "complexity": 2, "token_count": 36, "parameters": [ "self" ], "start_line": 185, "end_line": 189, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "getI", "long_name": "getI( self )", "filename": "matrix.py", "nloc": 3, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 191, "end_line": 193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 1 }, { "name": "_from_string", "long_name": "_from_string( str , gdict , ldict )", "filename": "matrix.py", "nloc": 22, "complexity": 6, "token_count": 132, "parameters": [ "str", "gdict", "ldict" ], "start_line": 201, "end_line": 223, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "bmat", "long_name": "bmat( obj , ldict = None , gdict = None )", "filename": "matrix.py", "nloc": 20, "complexity": 7, "token_count": 155, "parameters": [ "obj", "ldict", "gdict" ], "start_line": 226, "end_line": 260, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "getI", "long_name": "getI( self )", "filename": "matrix.py", "nloc": 3, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 191, "end_line": 193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 1 } ], "nloc": 205, "complexity": 72, "token_count": 1441, "diff_parsed": { "added": [ " from scipy.linalg import inv" ], "deleted": [ " from scipy.basic.linalg import inv" ] } }, { "old_path": "scipy/base/src/arrayobject.c", "new_path": "scipy/base/src/arrayobject.c", "filename": "arrayobject.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -689,10 +689,13 @@ PyArray_CopyObject(PyArrayObject *dest, PyObject *src_object)\n {\n PyArrayObject *src;\n int ret;\n-\tPyArray_Typecode typecode = {dest->descr->type_num, \n-\t\t\t\t dest->itemsize, \n-\t\t\t\t PyArray_ISFORTRAN(dest)};\n-\t\n+\tPyArray_Typecode typecode;\n+\n+\n+\ttypecode.type_num = dest->descr->type_num;\n+\ttypecode.itemsize = dest->itemsize;\n+\ttypecode.fortran = PyArray_ISFORTRAN(dest);\n+\t\t\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n \t\t\t\t\t &typecode, 0,\n \t\t\t\t\t dest->nd, 0);\n@@ -4043,9 +4046,11 @@ array_imag_get(PyArrayObject *self)\n \tPyArrayObject *ret;\n \tint itemsize;\n \tint typenum;\n- PyArray_Typecode type = {self->descr->type_num, \n- self->itemsize,\t \n- PyArray_ISFORTRAN(self)};\n+ PyArray_Typecode type;\n+\t\n+\ttype.type_num = self->descr->type_num;\n+\ttype.itemsize = self->itemsize;\n+\ttype.fortran = PyArray_ISFORTRAN(self);\n \t\n \tif (PyArray_ISCOMPLEX(self)) {\n \t\titemsize = self->itemsize >> 1;\n@@ -4125,11 +4130,13 @@ array_flat_set(PyArrayObject *self, PyObject *val)\n \tPyObject *arr=NULL;\n \tint retval = -1;\n \tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n-\tPyArray_Typecode typecode = {self->descr->type_num,\n-\t\t\t\t self->itemsize,\n-\t\t\t\t PyArray_ISFORTRAN(self)};\n+\tPyArray_Typecode typecode;\n int swap;\n PyArray_CopySwapFunc *copyswap;\n+\n+\ttypecode.type_num = self->descr->type_num;\n+\ttypecode.itemsize = self->itemsize;\n+\ttypecode.fortran = PyArray_ISFORTRAN(self);\n \t\n \tarr = PyArray_FromAny(val, &typecode, \n \t\t\t 0, 0, FORCECAST);\n@@ -4539,7 +4546,10 @@ _array_find_type(PyObject *op, PyArray_Typecode *minitype,\n \tif (PyInstance_Check(op)) goto deflt;\n \t\n if (PySequence_Check(op)) {\n-\t\tPyArray_Typecode newtype = {mintype, minsize, 0};\n+\t\tPyArray_Typecode newtype;\n+\t\tnewtype.type_num = mintype;\n+\t\tnewtype.itemsize = minsize;\n+\t\tnewtype.fortran = 0;\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n \t\t\tPyErr_Clear(); \n@@ -4935,9 +4945,13 @@ array_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags)\n \tint itemsize = typecode->itemsize;\n \tint copy = 0;\n \tint arrflags;\n-\tPyArray_Typecode oldtype={PyArray_TYPE(arr),PyArray_ITEMSIZE(arr),0};\n+\tPyArray_Typecode oldtype;\n \tchar *msg = \"Cannot copy-back to a read-only array.\";\n-\t\n+\n+\toldtype.type_num = PyArray_TYPE(arr);\n+\toldtype.itemsize = PyArray_ITEMSIZE(arr);\n+\toldtype.fortran = 0;\n+\n \tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n \tif (itemsize == 0) itemsize = arr->itemsize;\n \ttypecode->type_num = type;\n@@ -5448,7 +5462,8 @@ PyArray_EnsureArray(PyObject *op)\n static PyObject *\n PyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n {\n-\tPyArray_Typecode typecode = {type, 0, 0};\n+\tPyArray_Typecode typecode = {0, 0, 0};\n+\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n \t\t\t max_depth, BEHAVED_FLAGS);\n }\n@@ -5457,7 +5472,8 @@ static PyObject *\n PyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n \t\t\t int max_depth) \n {\n-\tPyArray_Typecode typecode = {type, 0, 0};\n+\tPyArray_Typecode typecode = {0, 0, 0};\n+\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n \t\t\t max_depth, DEFAULT_FLAGS);\n }\n@@ -5466,7 +5482,8 @@ static PyObject *\n PyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n \t\t int max_depth) \n {\n-\tPyArray_Typecode typecode = {type, 0, 0};\n+\tPyArray_Typecode typecode = {0, 0, 0};\n+\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n \t\t\t ENSURECOPY);\n }\n", "added_lines": 33, "deleted_lines": 16, "source_code": " /*\n Provide multidimensional arrays as a basic object type in python. \n\nBased on Original Numeric implementation\nCopyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\nwith contributions from many Numeric Python developers 1995-2004 *\n\nHeavily modified in 2005 with inspiration from Numarray \n\nby\n\nTravis Oliphant\nAssistant Professor at\nBrigham Young University \n\nmaintainer email: oliphant.travis@ieee.org\n\nNumarray design (which provided guidance) by \nSpace Science Telescope Institute \n (J. Todd Miller, Perry Greenfield, Rick White)\n\n*/\n\n/* $Id: arrayobject.c,v 1.59 2005/09/14 00:14:00 teoliphant Exp $ */\n\n/*\n#include \"Python.h\"\n#include \"structmember.h\"\n\n#define _MULTIARRAYMODULE\n#include \"Numeric3/arrayobject.h\"\n*/\n\n/* Helper functions */\n\n#define error_converting(x) (((x) == -1) && PyErr_Occurred())\n\nstatic intp\nPyArray_PyIntAsIntp(PyObject *o)\n{\n\tlonglong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INTP, 0, 0};\n\tintp ret;\n\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((intp *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (longlong) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (longlong) PyLong_AsLongLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\t\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONGLONG != SIZEOF_PY_INTPTR_T)\n\tif ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C intp\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (intp) long_value;\n}\n\n\nstatic PyObject *array_int(PyArrayObject *v);\n\nstatic int\nPyArray_PyIntAsInt(PyObject *o)\n{\n\tlong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INT, 0, 0};\n\tint ret;\n\t\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((int *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (long) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (long) PyLong_AsLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONG != SIZEOF_INT)\n\tif ((long_value < INT_MIN) || (long_value > INT_MAX)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C int\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (int) long_value;\n}\n\n\nstatic double\nPyArray_GetPriority(PyObject *obj, double default_) \n{\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n\n\tif (PyArray_CheckExact(obj))\n\t\treturn priority;\n if (PyBigArray_CheckExact(obj)) \n return PyArray_BIG_PRIORITY;\n\n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n if (PyErr_Occurred()) {\n PyErr_Clear(); \n priority = default_;\n }\n Py_XDECREF(ret);\n return priority; \n}\n\n/* Backward compatibility only */\n/* In both Zero and One\n\n ***You must free the memory once you are done with it\n using PyDataMem_FREE(ptr) or you create a memory leak***\n\n If arr is an Object array you are getting a \n BORROWED reference to Zero or One.\n Do not DECREF.\n Please INCREF if you will be hanging on to it.\n\n The memory for the ptr still must be freed in any case;\n*/\n\nstatic char *\nPyArray_Zero(PyArrayObject *arr)\n{\n char *zeroval;\n char *buf;\n int buf_len;\n PyObject *obj, *ret;\n\n zeroval = PyDataMem_NEW(arr->itemsize);\n if (zeroval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n if (PyArray_ISOBJECT(arr)) {\n obj=PyInt_FromLong((long) 0);\n memcpy(zeroval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return zeroval;\n }\n ret = PyObject_GetAttrString((PyObject *)arr, \"_zero\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_zero not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n return NULL;\n }\n memcpy(zeroval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n memset(zeroval, 0, arr->itemsize);\n return zeroval;\n}\n\nstatic char *\nPyArray_One(PyArrayObject *arr)\n{\n char *oneval;\n char *buf;\n int buf_len, ret2;\n PyObject *obj, *ret;\n\n oneval = PyDataMem_NEW(arr->itemsize);\n if (oneval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n obj = PyInt_FromLong((long) 1);\n if (PyArray_ISOBJECT(arr)) {\n memcpy(oneval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return oneval;\n }\n \n ret = PyObject_GetAttrString((PyObject *)arr, \"_one\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_one not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n PyDataMem_FREE(oneval);\n return NULL;\n }\n memcpy(oneval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n\n ret2 = arr->descr->setitem(obj, oneval, arr);\n Py_DECREF(obj);\n if (ret < 0) {\n PyDataMem_FREE(oneval);\n return NULL;\n }\n return oneval;\n}\n\n/* End deprecated */\n\n\nstatic int \ndo_sliced_copy(char *dest, intp *dest_strides, intp *dest_dimensions,\n\t int dest_nd, char *src, intp *src_strides, \n\t intp *src_dimensions, int src_nd, int elsize, \n\t int copies) {\n intp i, j;\n\t\n if (src_nd == 0 && dest_nd == 0) {\n for(j=0; j src_nd) {\n for(i=0; i<*dest_dimensions; i++, dest += *dest_strides) {\n if (do_sliced_copy(dest, dest_strides+1, \n dest_dimensions+1, dest_nd-1,\n src, src_strides, \n src_dimensions, src_nd, \n elsize, copies) == -1) \n return -1;\n }\n return 0;\n }\n\t\n if (dest_nd == 1) {\n if (*dest_dimensions != *src_dimensions) {\n PyErr_SetString(PyExc_ValueError, \n \"matrices are not aligned for copy\");\n return -1;\n }\n for(i=0; i<*dest_dimensions; i++, src += *src_strides) {\n for(j=0; j 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize) && \n ((*src_strides)[*src_nd-1] == *elsize)) {\n if ((*dest_dimensions)[*dest_nd-1] != \n (*src_dimensions)[*src_nd-1]) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"matrices are not aligned\");\n return -1;\n }\n *elsize *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1; *src_nd-=1;\n } else {\n break;\n }\n }\n if (*src_nd == 0) {\n while (*dest_nd > 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize)) {\n *copies *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1;\n } else {\n break;\n }\n }\n }\n return 0;\n}\n\nstatic char *\ncontiguous_data(PyArrayObject *src) \n{\n intp dest_strides[MAX_DIMS], *dest_strides_ptr;\n intp *dest_dimensions=src->dimensions;\n int dest_nd=src->nd;\n intp *src_strides = src->strides;\n intp *src_dimensions=src->dimensions;\n int src_nd=src->nd;\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n intp stride=elsize;\n char *new_data;\n\t\n for(i=dest_nd-1; i>=0; i--) {\n dest_strides[i] = stride;\n stride *= dest_dimensions[i];\n }\n\t\n dest_strides_ptr = dest_strides;\n\t\n if (optimize_slices(&dest_strides_ptr, &dest_dimensions, &dest_nd,\n &src_strides, &src_dimensions, &src_nd,\n &elsize, &copies) == -1) \n return NULL;\n\t\n new_data = (char *)malloc(stride);\n\t\n ret = do_sliced_copy(new_data, dest_strides_ptr, dest_dimensions, \n dest_nd, src->data, src_strides, \n src_dimensions, src_nd, elsize, copies);\n\t\n if (ret != -1) { return new_data; }\n else { free(new_data); return NULL; }\n}\n\n/* end Helper functions */\n\n\nstatic PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n int, intp *, char *, int, int, PyObject *);\n\n/* C-API functions */\n\n/* Used for arrays of python objects to increment the reference count of */\n/* every python object in the array. */\nstatic int \nPyArray_INCREF(PyArrayObject *mp) \n{\n\tintp i, n;\n\n PyObject **data, **data2;\n\t\n if (mp->descr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data;\n for(i=0; idescr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data; \n for(i=0; i 0; n--, a += 1) {\n b = a + 1;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 4:\n for (a = (char*)p ; n > 0; n--, a += 2) {\n b = a + 3;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 8:\n for (a = (char*)p ; n > 0; n--, a += 4) {\n b = a + 7;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n default:\n m = size / 2;\n for (a = (char *)p ; n > 0; n--, a += m) {\n b = a + (size-1);\n for (j=0; j 1, then dst must be contiguous */\nstatic void\ncopy_and_swap(void *dst, void *src, int itemsize, intp numitems,\n intp srcstrides, int swap) \n{\n int i;\n char *s1 = (char *)src;\n char *d1 = (char *)dst;\n \n\n if ((numitems == 1) || (itemsize == srcstrides)) \n memcpy(d1, s1, itemsize*numitems);\n else { \n for (i = 0; i < numitems; i++) {\n memcpy(d1, s1, itemsize);\n d1 += itemsize;\n s1 += srcstrides;\n } \n }\n\n if (swap)\n byte_swap_vector(d1, numitems, itemsize);\n}\n\n\n/* Computer-generated arraytype and scalartype code */\n#include \"scalartypes.inc\"\n#include \"arraytypes.inc\"\n\nstatic char *\nindex2ptr(PyArrayObject *mp, int i) \n{\n\tif (i==0 && (mp->nd == 0 || mp->dimensions[0] > 0)) \n\t\treturn mp->data;\n\t\n if (mp->nd>0 && i>0 && i < mp->dimensions[0]) {\n return mp->data+i*mp->strides[0];\n }\n PyErr_SetString(PyExc_IndexError,\"index out of bounds\");\n return NULL;\n}\n\nstatic intp \nPyArray_Size(PyObject *op) \n{\n if (PyArray_Check(op)) {\n return PyArray_SIZE((PyArrayObject *)op);\n } \n\telse {\n return 0;\n }\n}\n\n/* If destination is not the right type, then src \n will be cast to destination. \n*/\n\n/* Does a flat iterator-based copy. \n\n The arrays are assumed to have the same number of elements\n They can be different sizes and have different types however. \n*/\n\nstatic int\nPyArray_CopyInto(PyArrayObject *dest, PyArrayObject *src)\n{\n intp dsize, ssize, sbytes;\n\tint ncopies, elsize, index;\n PyArrayIterObject *dit=NULL;\n PyArrayIterObject *sit=NULL;\n\tchar *dptr;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n PyArray_CopySwapNFunc *copyswapn;\n \n if (!PyArray_ISWRITEABLE(dest)) {\n PyErr_SetString(PyExc_RuntimeError, \n \"Cannot write to array.\");\n return -1;\n }\n\n if (!PyArray_EquivArrTypes(dest, src)) {\n return PyArray_CastTo(dest, src);\n }\n\n dsize = PyArray_SIZE(dest);\n ssize = PyArray_SIZE(src);\n\tif (ssize == 0) return 0;\n if (dsize % ssize != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Destination number of elements must be\"\\\n \"an integer multiple of the source number of\"\\\n \"elements.\");\n return -1;\n }\n ncopies = dsize / ssize;\n\n\tswap = PyArray_ISNOTSWAPPED(dest) != PyArray_ISNOTSWAPPED(src);\n\tcopyswap = dest->descr->copyswap;\n\tcopyswapn = dest->descr->copyswapn;\n\n elsize = dest->itemsize;\n\n if ((PyArray_ISCONTIGUOUS(dest) && PyArray_ISCONTIGUOUS(src)) \\\n\t || (PyArray_ISFORTRAN(dest) && PyArray_ISFORTRAN(src))) {\n \n PyArray_XDECREF(dest);\n dptr = dest->data;\n sbytes = ssize * src->itemsize;\n while(ncopies--) {\n memmove(dptr, src->data, sbytes);\n dptr += sbytes;\n }\n\t\tif (swap)\n\t\t\tcopyswapn(dest->data, NULL, dsize, 1, elsize);\n PyArray_INCREF(dest);\n return 0;\n }\n\n dit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)dest);\n sit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)src);\n\n if ((dit == NULL) || (sit == NULL)) {\n Py_XDECREF(dit);\n Py_XDECREF(sit);\n return -1;\n }\n\n PyArray_XDECREF(dest);\n while(ncopies--) {\n index = ssize;\n while(index--) {\n memmove(dit->dataptr, sit->dataptr, elsize);\n\t\t\tif (swap)\n\t\t\t\tcopyswap(dit->dataptr, NULL, 1, elsize);\n PyArray_ITER_NEXT(dit);\n PyArray_ITER_NEXT(sit);\n }\n PyArray_ITER_RESET(sit);\n } \n PyArray_INCREF(dest);\n Py_DECREF(dit);\n Py_DECREF(sit);\n\treturn 0;\n}\n\n\nstatic int \nPyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) \n{\n PyArrayObject *src;\n int ret;\n\tPyArray_Typecode typecode;\n\n\n\ttypecode.type_num = dest->descr->type_num;\n\ttypecode.itemsize = dest->itemsize;\n\ttypecode.fortran = PyArray_ISFORTRAN(dest);\n\t\t\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n\t\t\t\t\t &typecode, 0,\n\t\t\t\t\t dest->nd, 0);\n if (src == NULL) return -1;\n\n ret = PyArray_CopyInto(dest, src);\n Py_DECREF(src);\n return ret;\n}\n\n\n/* These are also old calls (should use PyArray_New) */\n\n/* They all zero-out the memory as previously done */\n\nstatic PyObject *\nPyArray_FromDimsAndDataAndDescr(int nd, int *d, \n PyArray_Descr *descr,\n char *data) {\n\tPyObject *ret;\n\n#if SIZEOF_INTP != SIZEOF_INT\n\tint i;\n\tintp newd[MAX_DIMS];\n\t\n\tfor (i=0; itype_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#else\n\tret = PyArray_New(&PyArray_Type, nd, (intp *)d, \n descr->type_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#endif\n\tif (descr->type_num != PyArray_OBJECT)\n\t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_FromDimsAndData(int nd, int *d, int type, char *data) \n{\n\tPyObject *ret;\n#if SIZEOF_INTP != SIZEOF_INT\n\tintp newd[MAX_DIMS];\n\tint i;\t\n\tfor (i=0; iob_type, m1->nd, \n\t\t\t\t\t m1->dimensions,\n\t\t\t\t\t m1->descr->type_num,\n\t\t\t\t\t NULL, NULL, m1->itemsize,\n\t\t\t\t\t 0, (PyObject *)m1);\n\t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n\t\n return (PyObject *)ret;\n}\n\n\nstatic PyObject *array_item(PyArrayObject *, int);\n\nstatic PyObject *\nPyArray_Scalar(char *data, int type_num, int itemsize, int swap)\n{\n PyArray_Descr *descr;\n\tPyTypeObject *type;\n\tPyObject *obj;\t\n\tchar *destptr;\n PyArray_CopySwapFunc *copyswap;\n\n descr = PyArray_DescrFromType(type_num);\n if (descr == NULL) return NULL;\n type = descr->typeobj;\n copyswap = descr->copyswap;\n\tif (type_num == PyArray_STRING) \n\t\tobj = type->tp_alloc(type, itemsize);\n\telse\n\t\tobj = type->tp_alloc(type, 0);\n\tif (obj == NULL) return NULL;\n\tif PyTypeNum_ISFLEXIBLE(type_num) { \n\t\tif (type_num == PyArray_STRING) {\n\t\t\tdestptr = PyString_AS_STRING(obj);\n\t\t\t((PyStringObject *)obj)->ob_shash = -1;\n\t\t\t((PyStringObject *)obj)->ob_sstate =\t\\\n\t\t\t\tSSTATE_NOT_INTERNED; \n\t\t}\n\t\telse {\n\t\t\tdestptr = PyDataMem_NEW(itemsize);\n\t\t\tif (destptr == NULL) {\n\t\t\t\tPyObject_Del(obj);\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tif (type_num == PyArray_UNICODE) {\n\t\t\t\tPyUnicode_AS_UNICODE(obj) = \\\n\t\t\t\t\t(Py_UNICODE *)destptr;\n\t\t\t\t((PyUnicodeObject*)obj)->length = itemsize / \\\n\t\t\t\t\tsizeof(Py_UNICODE);\n\t\t\t\t((PyUnicodeObject*)obj)->hash = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t((PyVoidScalarObject *)obj)->obval = destptr;\n\t\t\t\t((PyVoidScalarObject *)obj)->ob_size = itemsize;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tdestptr = &(((PyScalarObject*)obj)->obval);\n\t}\n\t/* copyswap for OBJECT increments the reference count */\n copyswap(destptr, data, swap, itemsize);\n\treturn obj;\n}\n\n/* returns an Array-Scalar Object of the type of arr\n from the given pointer to memory -- main Scalar creation function\n default new method calls this. \n*/\nstatic PyObject *\nPyArray_ToScalar(char *data, PyArrayObject *arr)\n{\n\tint type_num = arr->descr->type_num;\n\tint itemsize = arr->itemsize;\n int swap = !(PyArray_ISNOTSWAPPED(arr));\n\n\treturn PyArray_Scalar(data, type_num, itemsize, swap);\n}\n\n\n/* Return Python scalar if 0-d array object is encountered */\n\nstatic PyObject *\nPyArray_Return(PyArrayObject *mp) \n{\n \n\tif (mp == NULL) return NULL;\n\n if (PyErr_Occurred()) {\n Py_XDECREF(mp);\n return NULL;\n }\n\n\tif (PyArray_Check((PyObject *)mp) && mp->nd == 0) {\n\t\tPyObject *ret;\n\t\tret = PyArray_ToScalar(mp->data, mp);\n\t\tPy_DECREF(mp);\n\t\treturn ret;\n\t}\n\telse {\n\t\treturn (PyObject *)mp;\n\t}\n}\n\n/*\n returns typenum to associate with this type >=PyArray_USERDEF.\n Also creates a copy of the VOID_DESCR table inserting it's typeobject in\n and it's typenum in the appropriate place.\n \n needs the userdecrs table and PyArray_NUMUSER variables\n defined in arratypes.inc\n*/\nstatic int \nPyArray_RegisterDataType(PyTypeObject *type)\n{\n\tPyArray_Descr *descr;\n\tint typenum;\n\tint i;\n\t\n\tif ((type == &PyVoidArrType_Type) ||\t\t\t\\\n\t !PyType_IsSubtype(type, &PyVoidArrType_Type)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can only register void subtypes.\");\n\t\treturn -1;\n\t}\n\t/* See if this type is already registered */\n\tfor (i=0; itypeobj == type)\n\t\t\treturn descr->type_num;\n\t}\n\tdescr = malloc(sizeof(PyArray_Descr));\n\tmemcpy(descr, PyArray_DescrFromType(PyArray_VOID), \n\t sizeof(PyArray_Descr));\n\ttypenum = PyArray_USERDEF + PyArray_NUMUSERTYPES;\n\tdescr->type_num = typenum;\n\tdescr->typeobj = type;\n\tuserdescrs = realloc(userdescrs, \n\t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n if (userdescrs == NULL) {\n PyErr_SetString(PyExc_MemoryError, \"RegisterDataType\");\n return -1;\n }\n\tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n\treturn typenum;\n}\n\n\n/* \n copyies over from the old descr table for anything\n NULL or zero in what is given. \n frees the copy of the Descr_table already there.\n places a pointer to the new one into the slot.\n*/\nstatic int\nPyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n{\n\tPyArray_Descr *old;\n\tint i;\n\n\tif (!PyArray_ISUSERDEF(typenum)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Data type not registered.\");\n\t\treturn -1;\n\t}\n\told = userdescrs[typenum-PyArray_USERDEF];\n\tdescr->typeobj = old->typeobj;\n\tdescr->type_num = typenum;\n\n#define _NULL_CHECK(member) \\\n\tif (descr->member == NULL) descr->member = old->member\n\n\tfor (i=0; imember == 0) descr->member = old->member\n\n\t_ZERO_CHECK(kind);\n\t_ZERO_CHECK(type);\n\t_ZERO_CHECK(elsize);\n\t_ZERO_CHECK(alignment);\n#undef _ZERO_CHECK\n\n\tfree(old);\n\tuserdescrs[typenum-PyArray_USERDEF] = descr;\n\treturn 0;\n}\n\n\nstatic int\nPyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) \n{\n intp size;\n intp n, n2;\n int n3, n4;\n PyArrayIterObject *it;\n PyObject *obj, *strobj, *tupobj;\n\n n3 = strlen((const char *)sep);\n if (n3 == 0) { /* binary data */\n if (PyArray_ISOBJECT(self)) {\n PyErr_SetString(PyExc_ValueError, \"Cannot write \"\\\n\t\t\t\t\t\"object arrays to a file in \"\\\n\t\t\t\t\t\"binary mode.\");\n return -1;\n }\n\n if (PyArray_ISCONTIGUOUS(self)) {\n size = PyArray_SIZE(self);\n if ((n=fwrite((const void *)self->data, \n (size_t) self->itemsize,\n (size_t) size, fp)) < size) {\n PyErr_Format(PyExc_ValueError, \n \"%ld requested and %ld written\",\n (long) size, (long) n);\n return -1;\n }\n }\n else {\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n while(it->index < it->size) {\n if (fwrite((const void *)it->dataptr, \n (size_t) self->itemsize,\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n \" %d to file\", it->index);\n Py_DECREF(it);\n return -1;\n }\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n } \n }\n else { /* text data */\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n\t\tn4 = strlen((const char *)format);\n while(it->index < it->size) {\n obj = self->descr->getitem(it->dataptr, self);\n if (obj == NULL) {Py_DECREF(it); return -1;}\n\t\t\tif (n4 == 0) { /* standard writing */\n\t\t\t\tstrobj = PyObject_Str(obj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n\t\t\telse { /* use format string */\n\t\t\t\ttupobj = PyTuple_New(1);\n\t\t\t\tif (tupobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t\tPyTuple_SET_ITEM(tupobj,0,obj);\n\t\t\t\tobj = PyString_FromString((const char *)format);\n\t\t\t\tif (obj == NULL) {Py_DECREF(tupobj); \n\t\t\t\t\tPy_DECREF(it); return -1;}\n\t\t\t\tstrobj = PyString_Format(obj, tupobj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tPy_DECREF(tupobj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n if ((n=fwrite(PyString_AS_STRING(strobj), \n 1, n2=PyString_GET_SIZE(strobj),\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n \" to file\", it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n }\n /* write separator for all but last one */\n if (it->index != it->size-1) \n fwrite(sep, 1, n3, fp);\n Py_DECREF(strobj);\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n return 0;\n}\n\nstatic PyObject *\nPyArray_ToList(PyArrayObject *self) \n{\n PyObject *lp;\n PyArrayObject *v;\n intp sz, i;\n\t\n if (!PyArray_Check(self)) return (PyObject *)self;\n\n if (self->nd == 0) \n\t\treturn self->descr->getitem(self->data,self);\n\t\n sz = self->dimensions[0];\n lp = PyList_New(sz);\n\t\n for (i=0; ind >= self->nd) {\n\t\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\t\"array_item not returning smaller\" \\\n\t\t\t\t\t\" dimensional array\");\n\t\t\tPy_DECREF(lp);\n\t\t\treturn NULL;\n\t\t}\n PyList_SetItem(lp, i, PyArray_ToList(v));\n\t\tPy_DECREF(v);\n }\n\t\n return lp;\n}\n\nstatic PyObject *\nPyArray_ToString(PyArrayObject *self)\n{\n intp numbytes;\n intp index;\n char *dptr;\n int elsize;\n PyObject *ret;\n PyArrayIterObject *it;\n \n if (PyArray_TYPE(self) == PyArray_OBJECT) {\n PyErr_SetString(PyExc_ValueError, \"a string for the data\"\\\n\t\t\t\t\"in an object array is not appropriate.\");\n return NULL;\n }\n\n numbytes = PyArray_NBYTES(self);\n if (PyArray_ISONESEGMENT(self)) {\n ret = PyString_FromStringAndSize(self->data, (int) numbytes);\n }\n else {\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it==NULL) return NULL;\n ret = PyString_FromStringAndSize(NULL, (int) numbytes);\n if (ret == NULL) {Py_DECREF(it); return NULL;}\n dptr = PyString_AS_STRING(ret);\n index = it->size;\n elsize = self->itemsize;\n while(index--) {\n memcpy(dptr, it->dataptr, elsize);\n dptr += elsize;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n\treturn ret;\n}\n\n\n/*********************** end C-API functions **********************/\n\n\n/* array object functions */\n\nstatic void \narray_dealloc(PyArrayObject *self) {\n\n if (self->weakreflist != NULL)\n PyObject_ClearWeakRefs((PyObject *)self);\n\n if(self->base) {\n\t\t/* UPDATEIFCOPY means that base points to an \n\t\t array that should be updated with the contents\n\t\t of this array upon destruction.\n self->base->flags must have been WRITEABLE \n (checked previously) and it was locked here\n thus, unlock it.\n\t\t*/\n\t\tif (self->flags & UPDATEIFCOPY) {\n ((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tPy_INCREF(self); /* hold on to self in next call */\n PyArray_CopyInto((PyArrayObject *)self->base, self);\n\t\t\t/* Don't need to DECREF -- because we are deleting\n\t\t\t self already... */\n\t\t}\n\t\t/* In any case base is pointing to something that we need\n\t\t to DECREF -- either a view or a buffer object */\n Py_DECREF(self->base);\n }\n \n if ((self->flags & OWN_DATA) && (self->data != NULL)) {\n\t\t/* Free internal references if an Object array */\n\t\tPyArray_XDECREF(self);\n\n PyDataMem_FREE(self->data);\n }\n\t\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t}\n\t\n self->ob_type->tp_free((PyObject *)self);\n}\n\n/*************************************************************************\n **************** Implement Mapping Protocol ***************************\n *************************************************************************/\n\nstatic int \narray_length(PyArrayObject *self) \n{\n if (self->nd != 0) {\n return self->dimensions[0];\n } else {\n\t\tPyErr_SetString(PyExc_TypeError, \"len() of unsized object.\");\n\t\treturn -1;\n }\n}\n\n\nstatic PyObject *\narray_item(PyArrayObject *self, int i) \n{\n char *item;\n PyArrayObject *r;\n\n\n\tif(self->nd == 0) {\n\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\"0-d arrays can't be indexed.\");\n\t\treturn NULL;\n\t}\n if ((item = index2ptr(self, i)) == NULL) return NULL;\n\n\tr = (PyArrayObject *)PyArray_New(self->ob_type, \n\t\t\t\t\t self->nd-1, self->dimensions+1, \n\t\t\t\t\t self->descr->type_num, \n\t\t\t\t\t self->strides+1, item, \n\t\t\t\t\t self->itemsize, self->flags,\n\t\t\t\t\t (PyObject *)self);\n\tif (r == NULL) return NULL;\n\tPy_INCREF(self);\n\tr->base = (PyObject *)self;\n PyArray_UpdateFlags(r, CONTIGUOUS | FORTRAN);\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_item_nice(PyArrayObject *self, int i) \n{\n\treturn PyArray_Return((PyArrayObject *)array_item(self, i));\n}\n\n\nstatic int \narray_ass_item(PyArrayObject *self, int i, PyObject *v) \n{\n PyArrayObject *tmp;\n char *item;\n int ret;\n\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n if (i < 0) i = i+self->dimensions[0];\n\n if (self->nd > 1) {\n if((tmp = (PyArrayObject *)array_item(self, i)) == NULL)\n return -1;\n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n return ret; \n }\n\t\n if ((item = index2ptr(self, i)) == NULL) return -1;\n if (self->descr->setitem(v, item, self) == -1) return -1;\n return 0;\n}\n\n/* -------------------------------------------------------------- */\nstatic int\nslice_coerce_index(PyObject *o, int *v)\n{\n\t*v = PyArray_PyIntAsInt(o);\n\tif (error_converting(*v)) {\n\t\tPyErr_Clear();\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\n/* This is basically PySlice_GetIndicesEx, but with our coercion\n * of indices to integers (plus, that function is new in Python 2.3) */\nstatic int\nslice_GetIndices(PySliceObject *r, int length,\n int *start, int *stop, int *step,\n intp *slicelength)\n{\n\tint defstart, defstop;\n\t\n\tif (r->step == Py_None) {\n\t\t*step = 1;\n\t} else {\n\t\tif (!slice_coerce_index(r->step, step)) return -1;\n\t\tif (*step == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"slice step can not be zero\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tdefstart = *step < 0 ? length - 1 : 0;\n\tdefstop = *step < 0 ? -1 : length;\n\t\n\tif (r->start == Py_None) {\n\t\t*start = *step < 0 ? length-1 : 0;\n\t} else {\n\t\tif (!slice_coerce_index(r->start, start)) return -1;\n\t\tif (*start < 0) *start += length;\n\t\tif (*start < 0) *start = (*step < 0) ? -1 : 0;\n\t\tif (*start >= length) {\n\t\t\t*start = (*step < 0) ? length - 1 : length;\n\t\t}\n\t}\n\t\n\tif (r->stop == Py_None) {\n\t\t*stop = defstop;\n\t} else {\n\t\tif (!slice_coerce_index(r->stop, stop)) return -1;\n\t\tif (*stop < 0) *stop += length;\n if (*stop < 0) *stop = -1;\n if (*stop > length) *stop = length;\n\t}\n\t\n\tif ((*step < 0 && *stop >= *start) || \\\n\t (*step > 0 && *start >= *stop)) {\n\t\t*slicelength = 0;\n\t} else if (*step < 0) {\n\t\t*slicelength = (*stop - *start + 1) / (*step) + 1;\n\t} else {\n\t\t*slicelength = (*stop - *start - 1) / (*step) + 1;\n\t}\n\t\n\treturn 0;\n}\n\n#define PseudoIndex -1\n#define RubberIndex -2\n#define SingleIndex -3\n\nstatic int\nparse_subindex(PyObject *op, int *step_size, intp *n_steps, int max)\n{\n\tint index;\n\t\n\tif (op == Py_None) {\n\t\t*n_steps = PseudoIndex;\n\t\tindex = 0;\n\t} else if (op == Py_Ellipsis) {\n\t\t*n_steps = RubberIndex;\n\t\tindex = 0;\n\t} else if (PySlice_Check(op)) {\n\t\tint stop;\n\t\tif (slice_GetIndices((PySliceObject *)op, max,\n\t\t\t\t &index, &stop, step_size, n_steps) < 0) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"invalid slice\");\n\t\t\t}\n\t\t\tgoto fail;\n\t\t}\n\t\tif (*n_steps <= 0) {\n\t\t\t*n_steps = 0;\n\t\t\t*step_size = 1;\n\t\t\tindex = 0;\n\t\t}\n\t} else {\n\t\tindex = PyArray_PyIntAsInt(op);\n\t\tif (error_converting(index)) {\n\t\t\tPyErr_SetString(PyExc_IndexError,\n\t\t\t\t\t\"each subindex must be either a \"\\\n\t\t\t\t\t\"slice, an integer, Ellipsis, or \"\\\n\t\t\t\t\t\"newaxis\");\n\t\t\tgoto fail;\n\t\t}\n\t\t*n_steps = SingleIndex;\n\t\t*step_size = 0;\n\t\tif (index < 0) index += max;\n\t\tif (index >= max || index < 0) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \"invalid index\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn index;\n fail:\n\treturn -1;\n}\n\n\nstatic int \nparse_index(PyArrayObject *self, PyObject *op, \n intp *dimensions, intp *strides, intp *offset_ptr)\n{\n int i, j, n;\n int nd_old, nd_new, start, offset, n_add, n_pseudo;\n int step_size;\n\tintp n_steps;\n PyObject *op1=NULL;\n int is_slice;\n\n\n if (PySlice_Check(op) || op == Py_Ellipsis || op == Py_None) {\n n = 1;\n op1 = op;\n Py_INCREF(op);\t\n /* this relies on the fact that n==1 for loop below */\n is_slice = 1;\n }\n else {\n if (!PySequence_Check(op)) {\n PyErr_SetString(PyExc_IndexError, \n \"index must be either an int \"\\\n \"or a sequence\");\n return -1;\n }\n n = PySequence_Length(op);\n is_slice = 0;\n }\n\t\n nd_old = nd_new = 0;\n\t\n offset = 0;\n for(i=0; ind ? \\\n self->dimensions[nd_old] : 0);\n Py_DECREF(op1);\n if (start == -1) break;\n\t\t\n if (n_steps == PseudoIndex) {\n dimensions[nd_new] = 1; strides[nd_new] = 0; nd_new++;\n } else {\n if (n_steps == RubberIndex) {\n for(j=i+1, n_pseudo=0; jnd-(n-i-n_pseudo-1+nd_old);\n if (n_add < 0) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = \\\n self->strides[nd_old];\n nd_new++; nd_old++;\n }\n } else {\n if (nd_old >= self->nd) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n offset += self->strides[nd_old]*start;\n nd_old++;\n if (n_steps != SingleIndex) {\n dimensions[nd_new] = n_steps;\n strides[nd_new] = step_size * \\\n self->strides[nd_old-1];\n nd_new++;\n }\n }\n }\n }\n if (i < n) return -1;\n n_add = self->nd-nd_old;\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = self->strides[nd_old];\n nd_new++; nd_old++;\n }\t \n *offset_ptr = offset;\n return nd_new;\n}\n\nstatic void\n_swap_axes(PyArrayMapIterObject *mit, PyArrayObject **ret)\n{\n\tPyObject *new, *tup;\n\tint n1, n2, n3, val;\n\tint i;\n\n\ttup = PyTuple_New(mit->nd);\n\t/* tuple for transpose is \n\t (n1,..,n1+n2-1,0,..,n1-1,n1+n2,...,n3-1)\n\t n1 is the number of dimensions of \n\t the broadcasted index array \n\t n2 is the number of dimensions skipped at the\n\t start\n\t n3 is the number of dimensions of the \n\t result \n\t*/\n\tn1 = mit->iters[0]->nd_m1 + 1;\n\tn2 = mit->iteraxes[0];\n\tn3 = mit->nd;\n\tval = n1;\n\ti = 0;\n\twhile(val < n1+n2) \n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = 0;\n\twhile(val < n1)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = n1+n2;\n\twhile(val < n3)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\n\tnew = PyArray_Transpose(*ret, tup);\n\tPy_DECREF(tup);\n\tPy_DECREF(*ret);\n\t*ret = (PyArrayObject *)new;\n}\n\n\n\nstatic PyObject *\nPyArray_GetMap(PyArrayMapIterObject *mit)\n{\n\n\tPyArrayObject *ret, *temp;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\t/* Unbound map iterator --- Bind should have been called */\n\tif (mit->ait == NULL) return NULL;\n\n\t/* This relies on the map iterator object telling us the shape\n\t of the new array in nd and dimensions.\n\t*/\n\ttemp = mit->ait->ao;\n\tret = (PyArrayObject *)\\\n\t\tPyArray_New(temp->ob_type, mit->nd, mit->dimensions, \n\t\t\t temp->descr->type_num, NULL, NULL, \n\t\t\t temp->itemsize, \n\t\t\t PyArray_ISFORTRAN(temp),\n\t\t\t (PyObject *)temp);\n\tif (ret == NULL) return NULL;\n\n\t/* Now just iterate through the new array filling it in\n\t with the next object from the original array as\n\t defined by the mapping iterator */\n\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ret)) \n\t == NULL) \n\t\treturn NULL;\n\tindex = it->size;\n\tswap = ((temp->flags & NOTSWAPPED) != (ret->flags & NOTSWAPPED));\n copyswap = ret->descr->copyswap;\n\tPyArray_MapIterReset(mit);\n\twhile (index--) {\n copyswap(it->dataptr, mit->dataptr, swap, ret->itemsize);\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\t\n\t/* check for consecutive axes */\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, &ret);\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\nstatic int\nPyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)\n{\n\tPyObject *arr=NULL;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n\tPyArray_Typecode typecode = {0, 0, 0};\n PyArray_CopySwapFunc *copyswap;\n\n\t/* Unbound Map Iterator */\n\tif (mit->ait == NULL) return -1;\n\n\ttypecode.type_num = mit->ait->ao->descr->type_num;\n\ttypecode.itemsize = mit->ait->ao->itemsize;\n\n\tarr = PyArray_FromAny(op, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, (PyArrayObject **)&arr);\n\t\t}\n\t}\n\t\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) \n\t\treturn -1;\n\n\tindex = mit->size;\n\tswap = ((mit->ait->ao->flags & NOTSWAPPED) != \\\n\t\t(PyArray_FLAGS(arr) & NOTSWAPPED));\n\n copyswap = PyArray_DESCR(arr)->copyswap;\n\tPyArray_MapIterReset(mit);\n /* Need to decref OBJECT arrays */\n if (PyTypeNum_ISOBJECT(typecode.type_num)) {\n while (index--) {\n Py_XDECREF(*((PyObject **)mit->dataptr));\n Py_INCREF(*((PyObject **)it->dataptr));\n memmove(mit->dataptr, it->dataptr, sizeof(PyObject *));\n copyswap(mit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_MapIterNext(mit);\n PyArray_ITER_NEXT(it);\n if (it->index == it->size)\n PyArray_ITER_RESET(it);\n }\n return 0;\n }\n\n\twhile(index--) {\n\t\tmemmove(mit->dataptr, it->dataptr, PyArray_ITEMSIZE(arr));\n copyswap(mit->dataptr, NULL, swap, PyArray_ITEMSIZE(arr));\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t\tif (it->index == it->size)\n\t\t\tPyArray_ITER_RESET(it);\n\t}\t\t\n\treturn 0;\n}\n\n/* Called when treating array object like a mapping -- called first from \n Python when using a[object] unless object is a standard slice object\n (not an extended one). \n\n*/\n\n/* There are two situations: \n\n 1 - the subscript is a standard view and a reference to the \n array can be returned\n\n 2 - the subscript uses Boolean masks or integer indexing and\n therefore a new array is created and returned. \n\n*/\n\n/* Always returns 0-dimensional arrays */\n\nstatic PyObject *\narray_subscript(PyArrayObject *self, PyObject *op) \n{\n intp dimensions[MAX_DIMS], strides[MAX_DIMS];\n\tintp offset;\n int nd, i;\n PyArrayObject *other;\n\tPyArrayMapIterObject *mit;\n\n if (PyArray_IsScalar(op, Integer) || PyInt_Check(op) || \\\n PyLong_Check(op)) {\n intp value;\n value = PyArray_PyIntAsIntp(op);\n if (PyErr_Occurred())\n PyErr_Clear();\n else if (value >= 0) {\n if (value <= MAX_INT)\n return array_item(self, (int) value);\n }\n else if (value < 0) {\n if (value >= -MAX_INT) {\n if (self->nd > 0) value += self->dimensions[0];\n return array_item(self, (int) value);\n }\n }\n }\n\n\tif (PyArrayMapIter_Check(op)) {\n\t\tmit = (PyArrayMapIterObject *)op;\n\t\t/* bind to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\n\t\t/* If the mapiterator was created with standard indexing\n\t\t behavior, fall through to view-based code */\n\t\tif (!mit->view) return PyArray_GetMap(mit);\n\t\top = mit->indexobj;\n\t}\n\telse { /* wrap arguments into a mapiter object */\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(op);\n\t\tif (mit == NULL) return NULL;\n\t\tif (!mit->view) { /* fancy indexing */\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tother = (PyArrayObject *)PyArray_GetMap(mit);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn (PyObject *)other;\n\t\t}\n\t\tPy_DECREF(mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(op);\n\tif (!error_converting(i)) {\n\t\tif (i < 0 && self->nd > 0) i = i+self->dimensions[0];\n\t\treturn array_item(self, i);\n\t}\n\tPyErr_Clear();\n\n\t/* Standard (view-based) Indexing */\n if ((nd = parse_index(self, op, dimensions, strides, &offset)) \n == -1) \n return NULL;\n\n\t/* This will only work if new array will be a view */\n\tif ((other = (PyArrayObject *)\t\t\t\t\t\\\n\t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n\t\t\t strides, self->data+offset, \n\t\t\t self->itemsize, self->flags,\n\t\t\t (PyObject *)self)) == NULL) \n\t\treturn NULL;\n\n\n\tother->base = (PyObject *)self;\n\tPy_INCREF(self);\n\t\n\tPyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);\n\t\n\treturn (PyObject *)other;\n}\n\n\n/* Another assignment hacked by using CopyObject. */\n\n/* This only works if subscript returns a standard view. */\n\n/* Again there are two cases. In the first case, PyArray_CopyObject\n can be used. In the second case, a new indexing function has to be \n used.\n*/\n\nstatic int \narray_ass_sub(PyArrayObject *self, PyObject *index, PyObject *op) \n{\n int ret, i;\n PyArrayObject *tmp;\n\tPyArrayMapIterObject *mit;\n\t\n if (op == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n\tif (PyArrayMapIter_Check(index)) {\n\t\tmit = (PyArrayMapIterObject *)index;\n\t\t/* bind behavior to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\t\n\t\t/* fall through if standard view-based map iterator */\n\t\tif (!mit->view) return PyArray_SetMap(mit, op);\n\t\tindex = mit->indexobj;\n\t}\n\telse {\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(index);\n\t\tif (mit == NULL) return -1;\n\t\tif (!mit->view) {\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tret = PyArray_SetMap(mit, op);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn ret;\n\t\t}\n\t\tPy_DECREF((PyObject*)mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(index);\n\tif (!error_converting(i)) {\n\t\treturn array_ass_item(self, i, op);\n\t}\n\tPyErr_Clear();\n\t\n\t/* Rest of standard (view-based) indexing */\n\n if ((tmp = (PyArrayObject *)array_subscript(self, index)) == NULL)\n return -1; \n ret = PyArray_CopyObject(tmp, op);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\n/* There are places that require that array_subscript return a PyArrayObject\n and not possibly a scalar. Thus, this is the function exposed to \n Python so that 0-dim arrays are passed as scalars\n*/\n\nstatic PyObject *\narray_subscript_nice(PyArrayObject *self, PyObject *op) \n{\n\treturn PyArray_Return((PyArrayObject *)array_subscript(self, op));\n}\n\n\nstatic PyMappingMethods array_as_mapping = {\n (inquiry)array_length,\t\t /*mp_length*/\n (binaryfunc)array_subscript_nice,\t/*mp_subscript*/\n (objobjargproc)array_ass_sub,\t /*mp_ass_subscript*/\n};\n\n/****************** End of Mapping Protocol ******************************/\n\n\n/*************************************************************************\n **************** Implement Buffer Protocol ****************************\n *************************************************************************/\n\n/* removed multiple segment interface */\n\nstatic int \narray_getsegcount(PyArrayObject *self, int *lenp) \n{\n if (lenp)\n *lenp = PyArray_NBYTES(self);\n\n if (PyArray_ISONESEGMENT(self)) {\n return 1;\n }\n\n if (lenp)\n *lenp = 0;\n return 0;\n}\n\nstatic int \narray_getreadbuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (segment != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Accessing non-existing array segment\");\n return -1;\n }\n \n if (PyArray_ISONESEGMENT(self)) {\n *ptrptr = self->data;\n return PyArray_NBYTES(self);\n }\n PyErr_SetString(PyExc_ValueError, \"Array is not a single segment\");\n *ptrptr = NULL;\n return -1;\n}\n\n\nstatic int \narray_getwritebuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (PyArray_CHKFLAGS(self, WRITEABLE)) \n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_ValueError, \"Array cannot be \"\\\n \"accessed as a writeable buffer.\");\n return -1;\n }\n}\n\nstatic int \narray_getcharbuf(PyArrayObject *self, int segment, const char **ptrptr) \n{\n if (self->descr->type_num == PyArray_STRING || \\\n\t self->descr->type_num == PyArray_UNICODE)\n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_TypeError, \n \"Non-character array cannot be interpreted \"\\\n \"as character buffer.\");\n return -1;\n }\n}\n\nstatic PyBufferProcs array_as_buffer = {\n (getreadbufferproc)array_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)array_getwritebuf, /*bf_getwritebuffer*/\n (getsegcountproc)array_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)array_getcharbuf, /*bf_getcharbuffer*/\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Number Protocol ****************************\n *************************************************************************/\n\n\ntypedef struct {\n PyObject *add,\n *subtract,\n *multiply,\n *divide,\n *remainder,\n *power,\n\t\t*sqrt,\n *negative,\n *absolute,\n *invert,\n *left_shift,\n *right_shift,\n *bitwise_and,\n *bitwise_xor,\n *bitwise_or,\n *less,\n *less_equal,\n *equal,\n *not_equal,\n *greater,\n *greater_equal,\n *floor_divide,\n *TRUE_divide,\n\t\t*logical_or,\n\t\t*logical_and,\n\t\t*floor,\n\t\t*ceil,\n\t\t*maximum,\n\t\t*minimum;\t\n\t\n} NumericOps;\n\nstatic NumericOps n_ops = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL};\n\n/* Dictionary can contain any of the numeric operations, by name. \n Those not present will not be changed\n */\n\n#define SET(op) temp=PyDict_GetItemString(dict, #op);\t\\\n\tif (temp != NULL) {\t\t\t\t\\\n\t\tif (!(PyCallable_Check(temp))) return -1; \\\n Py_XDECREF(n_ops.op); \\\n\t\tn_ops.op = temp; \\\n\t}\n\n \nint \nPyArray_SetNumericOps(PyObject *dict) \n{\n PyObject *temp = NULL;\n SET(add);\n SET(subtract);\n SET(multiply);\n SET(divide);\n SET(remainder);\n SET(power);\n\tSET(sqrt);\n SET(negative);\n SET(absolute);\n SET(invert);\n SET(left_shift);\n SET(right_shift);\n SET(bitwise_and);\n SET(bitwise_or);\n SET(bitwise_xor);\n SET(less);\t \n SET(less_equal);\n SET(equal);\n SET(not_equal);\n SET(greater);\n SET(greater_equal);\n SET(floor_divide);\t\n SET(TRUE_divide);\t\n\tSET(logical_or);\n\tSET(logical_and);\n\tSET(floor);\n\tSET(ceil);\n\tSET(maximum);\n\tSET(minimum);\n return 0;\n}\n\n#define GET(op) if (PyDict_SetItemString(dict, #op, n_ops.op)==-1) \\\n\t\tgoto fail;\n\nstatic PyObject *\nPyArray_GetNumericOps(void) \n{\n\tPyObject *dict;\n\tif ((dict = PyDict_New())==NULL) \n\t\treturn NULL;\t\n\tGET(add);\n GET(subtract);\n GET(multiply);\n GET(divide);\n GET(remainder);\n GET(power);\n\tGET(sqrt);\n GET(negative);\n GET(absolute);\n GET(invert);\n GET(left_shift);\n GET(right_shift);\n GET(bitwise_and);\n GET(bitwise_or);\n GET(bitwise_xor);\n GET(less);\t \n GET(less_equal);\n GET(equal);\n GET(not_equal);\n GET(greater);\n GET(greater_equal);\n GET(floor_divide); \n GET(TRUE_divide); \n\tGET(logical_or);\n\tGET(logical_and);\n\tGET(floor);\n\tGET(ceil);\n\tGET(maximum);\n\tGET(minimum);\n\treturn dict;\t\n\n fail:\n\tPy_DECREF(dict);\n\treturn NULL;\t\t\n}\n\nstatic PyObject *\nPyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"reduce\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"accumulate\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OO)\", m1, m2);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(O)\", m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericInplaceBinaryFunction(PyArrayObject *m1, \n\t\t\t\t PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OOO)\", m1, m2, m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\narray_add(PyArrayObject *m1, PyObject *m2) \n{ \n return PyArray_GenericBinaryFunction(m1, m2, n_ops.add); \n}\n\nstatic PyObject *\narray_subtract(PyArrayObject *m1, PyObject *m2) \n{\n\treturn PyArray_GenericBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_negative(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.negative);\n}\n\nstatic PyObject *\narray_absolute(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.absolute);\n}\n\nstatic PyObject *\narray_invert(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.invert);\n}\n\nstatic PyObject *\narray_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_inplace_add(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.add);\n}\n\nstatic PyObject *\narray_inplace_subtract(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_inplace_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_inplace_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_inplace_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_inplace_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_inplace_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_inplace_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_inplace_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_inplace_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_inplace_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.TRUE_divide);\n}\n\nstatic PyObject *\narray_inplace_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_inplace_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.TRUE_divide);\n}\n\n/* Array evaluates as \"TRUE\" if any of the elements are non-zero */\nstatic int \narray_all_nonzero(PyArrayObject *mp) \n{\n\tintp index;\n\tPyArrayIterObject *it;\n\tBool anyTRUE = 0;\n\t\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)mp);\n\tif (it==NULL) return anyTRUE;\n\tindex = it->size;\n\twhile(index--) {\n\t\tif (mp->descr->nonzero(it->dataptr, mp)) {\n\t\t\tanyTRUE = 1;\n\t\t\tbreak;\n\t\t}\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\treturn anyTRUE;\n}\n\nstatic PyObject *\narray_divmod(PyArrayObject *op1, PyObject *op2) \n{\n PyObject *divp, *modp, *result;\n\n divp = array_divide(op1, op2);\n if (divp == NULL) return NULL;\n modp = array_remainder(op1, op2);\n if (modp == NULL) {\n Py_DECREF(divp);\n return NULL;\n }\n result = Py_BuildValue(\"OO\", divp, modp);\n Py_DECREF(divp);\n Py_DECREF(modp);\n return result;\n}\n\n\nstatic PyObject *\narray_int(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can be\"\\\n\t\t\t\t\" converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_int == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to int\");\n Py_DECREF(pv);\n return NULL;\n }\n\n pv2 = pv->ob_type->tp_as_number->nb_int(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_float(PyArrayObject *v) \n{\n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an \"\\\n\t\t\t\t\"int, scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_float == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to float\");\n Py_DECREF(pv);\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_float(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_long(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_long == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to long\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_long(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_oct(PyArrayObject *v) \n{\t \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_oct == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to oct\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_oct(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_hex(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_hex == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to hex\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_hex(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\n_array_copy_nice(PyArrayObject *self)\n{\n\treturn PyArray_Return((PyArrayObject *)\t\t\\\n\t\t\t PyArray_Copy(self));\n}\n\nstatic PyNumberMethods array_as_number = {\n (binaryfunc)array_add,\t\t /*nb_add*/\n (binaryfunc)array_subtract,\t\t /*nb_subtract*/\n (binaryfunc)array_multiply,\t\t /*nb_multiply*/\n (binaryfunc)array_divide,\t\t /*nb_divide*/\n (binaryfunc)array_remainder,\t /*nb_remainder*/\n (binaryfunc)array_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)array_power,\t\t /*nb_power*/\n (unaryfunc)array_negative, /*nb_neg*/\t\n (unaryfunc)_array_copy_nice,\t\t /*nb_pos*/ \n (unaryfunc)array_absolute,\t\t /*(unaryfunc)array_abs,*/\n (inquiry)array_all_nonzero,\t\t /*nb_nonzero*/\n (unaryfunc)array_invert,\t\t /*nb_invert*/\n (binaryfunc)array_left_shift,\t /*nb_lshift*/\n (binaryfunc)array_right_shift,\t /*nb_rshift*/\n (binaryfunc)array_bitwise_and,\t /*nb_and*/\n (binaryfunc)array_bitwise_xor,\t /*nb_xor*/\n (binaryfunc)array_bitwise_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)array_int,\t\t /*nb_int*/\n (unaryfunc)array_long,\t\t /*nb_long*/\n (unaryfunc)array_float,\t\t /*nb_float*/\n (unaryfunc)array_oct,\t\t /*nb_oct*/\n (unaryfunc)array_hex,\t\t /*nb_hex*/\n\n /*This code adds augmented assignment functionality*/\n /*that was made available in Python 2.0*/\n (binaryfunc)array_inplace_add,\t /*inplace_add*/\n (binaryfunc)array_inplace_subtract,\t /*inplace_subtract*/\n (binaryfunc)array_inplace_multiply,\t /*inplace_multiply*/\n (binaryfunc)array_inplace_divide,\t /*inplace_divide*/\n (binaryfunc)array_inplace_remainder, /*inplace_remainder*/\n (ternaryfunc)array_inplace_power,\t /*inplace_power*/\n (binaryfunc)array_inplace_left_shift, /*inplace_lshift*/\n (binaryfunc)array_inplace_right_shift, /*inplace_rshift*/\n (binaryfunc)array_inplace_bitwise_and, /*inplace_and*/\n (binaryfunc)array_inplace_bitwise_xor, /*inplace_xor*/\n (binaryfunc)array_inplace_bitwise_or, /*inplace_or*/\n\n (binaryfunc)array_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)array_TRUE_divide,\t /*nb_TRUE_divide*/\n (binaryfunc)array_inplace_floor_divide, /*nb_inplace_floor_divide*/\n (binaryfunc)array_inplace_TRUE_divide, /*nb_inplace_TRUE_divide*/\n\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Sequence Protocol **************************\n *************************************************************************/\n\n/* Some of this is repeated in the array_as_mapping protocol. But\n we fill it in here so that PySequence_XXXX calls work as expected \n*/\n\n\nstatic PyObject * \narray_slice(PyArrayObject *self, int ilow, int ihigh) \n{\n PyArrayObject *r;\n int l;\n char *data;\n\n if (self->nd == 0) {\n PyErr_SetString(PyExc_ValueError, \"can't slice a scalar\");\n return NULL;\n }\n \t\n l=self->dimensions[0];\n if (ihigh < 0) ihigh += l;\n if (ilow < 0) ilow += l;\n if (ilow < 0) ilow = 0;\n else if (ilow > l) ilow = l;\n if (ihigh < 0) ihigh = 0;\n else if (ihigh > l) ihigh = l;\n if (ihigh < ilow) ihigh = ilow;\n\n if (ihigh != ilow) {\n data = index2ptr(self, ilow);\n if (data == NULL) return NULL;\n } else {\n data = self->data;\n }\n\n self->dimensions[0] = ihigh-ilow;\n r = (PyArrayObject *)\\\n\t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n\t\t\t self->descr->type_num, self->strides, data,\n\t\t\t self->itemsize, self->flags, (PyObject *)self);\n\n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n Py_INCREF(self);\n\tPyArray_UpdateFlags(r, UPDATE_ALL_FLAGS); \n return (PyObject *)r;\n}\n\n\nstatic int \narray_ass_slice(PyArrayObject *self, int ilow, int ihigh, PyObject *v) {\n int ret;\n PyArrayObject *tmp;\n\t\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n if ((tmp = (PyArrayObject *)array_slice(self, ilow, ihigh)) \\\n == NULL) \n return -1; \n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\nstatic int\narray_contains(PyArrayObject *self, PyObject *el)\n{\n /* equivalent to any(self == el) */\n\n return PyObject_RichCompareBool((PyObject *)self, el, Py_EQ);\n}\n\n\nstatic PySequenceMethods array_as_sequence = {\n (inquiry)array_length,\t\t/*sq_length*/\n (binaryfunc)NULL, /* sq_concat is handled by nb_add*/\n (intargfunc)NULL, /* sq_repeat is handled nb_multiply*/\n (intargfunc)array_item_nice,\t\t/*sq_item*/\n (intintargfunc)array_slice,\t\t/*sq_slice*/\n (intobjargproc)array_ass_item,\t/*sq_ass_item*/\n (intintobjargproc)array_ass_slice,\t/*sq_ass_slice*/\n\t(objobjproc) array_contains, /* sq_contains */\n\t(binaryfunc) NULL, /* sg_inplace_concat */\n\t(intargfunc) NULL /* sg_inplace_repeat */\n};\n\n\n/****************** End of Sequence Protocol ****************************/\n\n\nstatic int \ndump_data(char **string, int *n, int *max_n, char *data, int nd, \n intp *dimensions, intp *strides, PyArrayObject* self) \n{\n PyArray_Descr *descr=self->descr;\n PyObject *op, *sp;\n char *ostring;\n int i, N;\n\t\n#define CHECK_MEMORY if (*n >= *max_n-16) { *max_n *= 2; \\\n\t\t*string = (char *)realloc(*string, *max_n); }\n\t\n if (nd == 0) {\n\t\t\n if ((op = descr->getitem(data, self)) == NULL) return -1;\n sp = PyObject_Repr(op);\n if (sp == NULL) {Py_DECREF(op); return -1;}\n ostring = PyString_AsString(sp);\n N = PyString_Size(sp)*sizeof(char);\n *n += N;\n CHECK_MEMORY\n memmove(*string+(*n-N), ostring, N);\n Py_DECREF(sp);\n Py_DECREF(op);\n return 0;\n } else {\n CHECK_MEMORY\n (*string)[*n] = '[';\n *n += 1;\n for(i=0; idata, \n\t\t self->nd, self->dimensions, \n self->strides, self) < 0) { \n\t\tfree(string); return NULL; \n\t}\n\t\n\tif (PyArray_ISFLEXIBLE(self)) {\n\t\tchar buf[100];\n\t\tsnprintf(buf, sizeof(buf), \"%d\", self->itemsize);\n\t\tsprintf(string+n, \", '%c%s')\", self->descr->type, buf);\n\t\tret = PyString_FromStringAndSize(string, n+6+strlen(buf));\n\t}\n\telse {\n\t\tsprintf(string+n, \", '%c')\", self->descr->type);\n\t\tret = PyString_FromStringAndSize(string, n+6);\n\t}\n\t\n\n free(string);\n return ret;\n}\n\nstatic PyObject *PyArray_StrFunction=NULL;\nstatic PyObject *PyArray_ReprFunction=NULL;\n\nstatic void \nPyArray_SetStringFunction(PyObject *op, int repr) \n{\n if (repr) {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_ReprFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_ReprFunction = op; \n } else {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_StrFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_StrFunction = op; \n }\n}\n\nstatic PyObject *\narray_repr(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_ReprFunction == NULL) {\n s = array_repr_builtin(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_ReprFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\nstatic PyObject *\narray_str(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_StrFunction == NULL) {\n s = array_repr(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_StrFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\n\nstatic PyObject *\narray_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) \n{\n PyObject *array_other, *result;\n\n switch (cmp_op) \n {\n case Py_LT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less);\n case Py_LE:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less_equal);\n case Py_EQ:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then return the integer\n\t\t\t object 0. This fixes code that used to\n\t\t\t allow equality comparisons between arrays\n\t\t\t and other objects which would give a result\n\t\t\t of 0\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.equal);\n /* If the comparison results in NULL, then the \n\t\t\t two array objects can not be compared together so \n\t\t\t return zero \n */\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n return result;\n case Py_NE:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then objects cannot be \n\t\t\t compared and cannot be equal, therefore, \n\t\t\t return True;\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.not_equal);\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n return result;\n case Py_GT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.greater);\n case Py_GE:\n return PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t other, \n\t\t\t\t\t \t n_ops.greater_equal);\n }\n return NULL;\n}\n\nstatic PyObject *\n_check_axis(PyArrayObject *arr, int *axis, int flags)\n{\n\tPyObject *temp;\n\tint n = arr->nd;\n\n\tif ((*axis >= MAX_DIMS) || (n==0)) {\n\t\ttemp = PyArray_Ravel(arr,0);\n\t\t*axis = 0;\n\t\treturn temp;\n\t}\n\telse {\n\t\tif (flags) {\n\t\t\ttemp = PyArray_FromAny((PyObject *)arr, NULL, \n\t\t\t\t\t 0, 0, flags);\n\t\t\tif (temp == NULL) return NULL;\n\t\t}\n\t\telse {\n\t\t\tPy_INCREF(arr);\n\t\t\ttemp = (PyObject *)arr;\n\t\t}\n\t}\n\tif (*axis < 0) *axis += n;\n\tif ((*axis < 0) || (*axis >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"axis(=%d) out of bounds\", *axis);\n\t\tPy_DECREF(temp);\n\t\treturn NULL;\n\t}\n\treturn temp;\n}\n\n#include \"arraymethods.c\"\n\n/* Lifted from numarray */\nstatic PyObject *\nPyArray_IntTupleFromIntp(int len, intp *vals)\n{\n\tint i;\n PyObject *intTuple = PyTuple_New(len);\n if (!intTuple) goto fail;\n for(i=0; ind == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i = ap->nd-1; i >= 0; --i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int \n_IsFortranContiguous(PyArrayObject *ap) \n{\n\tint sd;\n\tint i;\n\t\n\tif (ap->nd == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i=0; i< ap->nd; ++i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int\n_IsAligned(PyArrayObject *ap) \n{\n\tint i, alignment, aligned=1;\n\tintp ptr;\n\tint type = ap->descr->type_num;\n\n\tif ((type == PyArray_STRING) || (type == PyArray_VOID))\n\t\treturn 1;\n\n\talignment = ap->descr->alignment;\n\n\tptr = (intp) ap->data;\n aligned = (ptr % alignment) == 0;\n for (i=0; i nd; i++)\n aligned &= ((ap->strides[i] % alignment) == 0);\n return aligned != 0;\n}\n\nstatic Bool\n_IsWriteable(PyArrayObject *ap)\n{\n\tPyObject *base=ap->base;\n\tPyBufferProcs *pb;\n\n\t/* If we own our own data, then no-problem */\n\tif ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;\n\n\t/* Get to the final base object \n\t If it is a writeable array, then return TRUE\n\t If we can find an array object \n\t or a writeable buffer object as the final base object\n\t or a string object (for pickling support memory savings).\n\t - this last could be removed if a proper pickleable \n\t buffer was added to Python.\n\t*/\n\n\twhile(PyArray_Check(base)) {\n\t\tif (PyArray_CHKFLAGS(base, OWN_DATA)) \n\t\t\treturn (Bool) (PyArray_ISWRITEABLE(base));\n\t\tbase = PyArray_BASE(base);\n\t}\n\n\t/* here so pickle support works seamlessly \n\t and unpickled array can be set and reset writeable \n\t -- could be abused -- */\n\tif PyString_Check(base) return TRUE;\n\n\tpb = base->ob_type->tp_as_buffer;\n\tif (pb == NULL || pb->bf_getwritebuffer == NULL)\n\t\treturn FALSE;\n\t\n\treturn TRUE;\n}\n\n\nstatic void\nPyArray_UpdateFlags(PyArrayObject *ret, int flagmask)\n{\n\n\tif (flagmask & FORTRAN) {\n\t\tif (_IsFortranContiguous(ret)) {\n\t\t\tret->flags |= FORTRAN;\n\t\t\tif (ret->nd > 1) ret->flags &= ~CONTIGUOUS;\n\t\t}\n\t\telse ret->flags &= ~FORTRAN;\n\t}\n\tif (flagmask & CONTIGUOUS) {\n\t\tif (_IsContiguous(ret)) {\n\t\t\tret->flags |= CONTIGUOUS;\n\t\t\tif (ret->nd > 1) ret->flags &= ~FORTRAN;\n\t\t}\n\t\telse ret->flags &= ~CONTIGUOUS;\n\t}\n\tif (flagmask & ALIGNED) {\n\t\tif (_IsAligned(ret)) ret->flags |= ALIGNED;\n\t\telse ret->flags &= ~ALIGNED;\n\t}\n\treturn;\n}\n\n/* This routine checks to see if newstrides (of length nd) will not \n walk outside of the memory implied by either numbytes or\n a single segment array of the provided dimensions and element size if\n numbytes is 0 */\nstatic Bool\nPyArray_CheckStrides(int elsize, int nd, intp numbytes, \n\t\t intp *dims, intp *newstrides)\n{\n\tint i;\n\t\n\tif (numbytes == 0) \n\t\tnumbytes = PyArray_MultiplyList(dims, nd) * elsize;\n\t\n\tfor (i=0; i numbytes) {\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\treturn TRUE;\n\t\n}\n\n\n/* This is the main array creation routine. */\n\n/* Flags argument has multiple related meanings \n depending on data and strides: \n\n If data is given, then flags is flags associated with data. \n If strides is not given, then a contiguous strides array will be created\n and the CONTIGUOUS bit will be set. If the flags argument \n has the FORTRAN bit set, then a FORTRAN-style strides array will be\n created (and of course the FORTRAN flag bit will be set). \n\n If data is not given but created here, then flags will be DEFAULT_FLAGS\n and a non-zero flags argument can be used to indicate a FORTRAN style\n array is desired. \n*/\n\nstatic intp\n_array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize, \n\t\t int inflag, int *objflags) \n{\n\tint i;\n\t/* Only make Fortran strides if not contiguous as well */\n\tif ((inflag & FORTRAN) && !(inflag & CONTIGUOUS)) {\n\t\tfor (i=0; i 1) *objflags &= ~CONTIGUOUS;\n\t\telse *objflags |= CONTIGUOUS;\n\t}\n\telse {\n\t\tfor (i=nd-1;i>=0;i--) {\n\t\t\tstrides[i] = itemsize;\n\t\t\titemsize *= dims[i] ? dims[i] : 1;\n\t\t}\n\t\t*objflags |= CONTIGUOUS;\n\t\tif (nd > 1) *objflags &= ~FORTRAN;\n\t\telse *objflags |= FORTRAN;\n\t}\n\treturn itemsize;\n}\n\n\t\nstatic PyObject *\nPyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n\t PyObject *obj)\n{\n\tPyArrayObject *self;\n\tPyArray_Descr *descr;\n\tregister int i;\n\tintp sd, temp;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\tif (descr == NULL) return NULL;\n\n\tif (nd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"number of dimensions must be >=0\");\n\t\treturn NULL;\n\t}\n if (nd > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError,\n \"maximum number of dimensions is %d\", MAX_DIMS);\n return NULL;\n\t}\n\n\t/* Check dimensions */\n\tfor (i=nd-1;i>=0;i--) {\n\t\tif (dims[i] < 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"negative dimensions\"\t\\\n\t\t\t\t\t\" are not allowed.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tself = (PyArrayObject *) subtype->tp_alloc(subtype, 0);\n\tif (self == NULL) return NULL;\t\n\tself->descr = descr;\n\tself->dimensions = NULL;\n\tif (data == NULL) { /* strides is NULL too */\n\t\tself->flags = DEFAULT_FLAGS;\n\t\tif (flags) {\n\t\t\tself->flags |= FORTRAN; \n\t\t\tif (nd > 1) self->flags &= ~CONTIGUOUS;\n\t\t\tflags = FORTRAN;\n\t\t}\n\t}\n\telse self->flags = (flags & ~UPDATEIFCOPY);\n\t\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tif (itemsize < 1) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"Type must provide an itemsize.\");\n\t\t\tPyObject_Del(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tself->itemsize = itemsize;\n\t\t/* Guarantee that these kind of arrays are never byteswapped\n\t\t unknowingly. \n\t\t*/\n\t\tif (type_num != PyArray_UNICODE)\n\t\t\tself->flags |= NOTSWAPPED;\n\t}\n\telse self->itemsize = descr->elsize; \n\t\t\n\tsd = self->itemsize;\n\t\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dims, sizeof(intp)*nd);\n\t\tif (strides == NULL) { /* fill it in */\n\t\t\tsd = _array_fill_strides(self->strides, dims, nd, sd,\n\t\t\t\t\t\t flags, &(self->flags));\n\t\t}\n\t\telse {\n\t\t\tif (data == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"If strides is given in \" \\\n\t\t\t\t\t\t\"array creation, data must \" \\\n\t\t\t\t\t\t\"be given too.\");\n\t\t\t\tPyObject_Del(self);\n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\t\treturn NULL;\n\t\t\t}\t\t\t\t\t\n\t\t\tmemcpy(self->strides, strides, sizeof(intp)*nd);\n\t\t}\n\t}\n \t\n\t\t\n\tif (data == NULL) {\n\n\t\t/* Make sure we are aligned on void ptrs (without wasting\n\t\t space if we already are). But, also, allocate something \n\t\t even for zero-space arrays e.g. shape=(0,) -- otherwise\n buffer exposure (a.data) doesn't work as it should. */\n\n\t\tif (sd==0) sd = sizeof(intp);\n\t\telse if ((temp=sd%sizeof(intp))) sd += sizeof(intp) - temp;\n\n\t\tif ((data = PyDataMem_NEW(sd))==NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\tif (self->dimensions != NULL) \n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\n\t\t/* It is bad to have unitialized OBJECT pointers */\n\t\t/* We shouldn't need to check for the OBJECT Letter\n\t\t but perhaps it's best. */\n\t\tif (type_num == PyArray_OBJECT || \\\n\t\t type_num == PyArray_OBJECTLTR) {\n\t\t\tmemset(data, 0, sd);\n\t\t}\n\t}\n\telse {\n self->flags &= ~OWN_DATA; /* If data is passed in, \n\t\t\t\t\t this object won't own it \n\t\t\t\t\t by default.\n\t\t\t\t\t Caller must arrange for \n\t\t\t\t\t this to be reset if truly\n\t\t\t\t\t desired */\n }\n self->data = data;\n\tself->nd = nd;\n\tself->base = (PyObject *)NULL;\n self->weakreflist = (PyObject *)NULL;\n\n /* call the __array_finalize__\n\t method if a subtype and some object passed in */\n\tif ((obj != NULL) && (subtype != &PyArray_Type) && \n\t (subtype != &PyBigArray_Type)) {\n\t\tPyObject *res;\n\t\tres = PyObject_CallMethod((PyObject *)self, \n\t\t\t\t\t \"__array_finalize__\",\n\t\t\t\t\t \"O\", obj);\n\t\tif (res == NULL) PyErr_Clear();\n\t\telse Py_DECREF(res);\n\t}\n\n\treturn (PyObject *)self;\n}\n\n\n\nstatic PyObject * \nPyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape)\n{\n intp oldsize, newsize;\n int new_nd=newshape->len, k, n, elsize;\n int refcnt;\n intp* new_dimensions=newshape->ptr;\n intp new_strides[MAX_DIMS];\n intp sd;\n intp *dimptr;\n char *new_data;\n\t\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n \"resize only works on contiguous arrays\");\n return NULL;\n }\n\n\n newsize = PyArray_MultiplyList(new_dimensions, new_nd);\n\n if (newsize == 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Newsize is zero. Cannot delete an array \"\\\n \"in this way.\");\n return NULL;\n }\n oldsize = PyArray_SIZE(self);\n \n\tif (oldsize != newsize) {\n\t\tif (!(self->flags & OWN_DATA)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize this array: \"\t\\\n\t\t\t\t\t\"it does not own its data.\");\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\trefcnt = (((PyObject *)self)->ob_refcnt);\n\t\tif ((refcnt > 2) || (self->base != NULL) || \\\n\t\t (self->weakreflist != NULL)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize an array that has \"\\\n\t\t\t\t\t\"been referenced or is referencing\\n\"\\\n\t\t\t\t\t\"another array in this way. Use the \"\\\n\t\t\t\t\t\"resize function.\");\n\t\t\treturn NULL;\n\t\t} \n\t\t\n\t\t/* Reallocate space if needed */\n\t\tnew_data = PyDataMem_RENEW(self->data, \n\t\t\t\t\t newsize*(self->itemsize));\n\t\tif (new_data == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n\t\t\t\t\t\"can't allocate memory for array.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tself->data = new_data;\n\t}\n \n if ((newsize > oldsize) && PyArray_ISWRITEABLE(self)) { \n\t\t/* Fill new memory with zeros */\n elsize = self->itemsize;\n\t\tif ((PyArray_TYPE(self) == PyArray_OBJECT)) {\n\t\t\tPyObject *zero = PyInt_FromLong(0);\n PyObject **optr;\n\t\t\toptr = ((PyObject **)self->data) + oldsize;\n\t\t\tn = newsize - oldsize;\n\t\t\tfor (k=0; kdata+oldsize*elsize, 0, \n\t\t\t (newsize-oldsize)*elsize);\n\t\t}\n\t}\n \n if (self->nd != new_nd) { /* Different number of dimensions. */\n self->nd = new_nd;\n \n /* Need new dimensions and strides arrays */\n dimptr = PyDimMem_RENEW(self->dimensions, 2*new_nd);\n if (dimptr == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n \"can't allocate memory for array \" \\\n \"(array may be corrupted).\");\n return NULL;\n }\n self->dimensions = dimptr;\n\t\tself->strides = dimptr + new_nd;\n }\n\n /* make new_strides variable */\n sd = (intp) self->itemsize;\n sd = _array_fill_strides(new_strides, new_dimensions, new_nd, sd,\n 0, &(self->flags));\n\n \n memmove(self->dimensions, new_dimensions, new_nd*sizeof(intp));\n memmove(self->strides, new_strides, new_nd*sizeof(intp));\n\n Py_INCREF(Py_None);\t\n return Py_None;\n \n}\n\n\nstatic void\nPyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj)\n{\n PyObject **optr;\n intp i,n;\n optr = (PyObject **)(arr->data);\n n = PyArray_SIZE(arr);\n if (obj == NULL) {\n for (i=0; ibase = buffer.base;\n Py_INCREF(buffer.base); \n }\n\n PyDimMem_FREE(dims.ptr);\n if (strides.ptr) PyDimMem_FREE(strides.ptr);\n return PyArray_Return(ret);\n \n fail:\n if (dims.ptr) free(dims.ptr);\n if (strides.ptr) free(strides.ptr);\n return NULL;\n}\n\n\n\n/******************* array attribute get and set routines ******************/\n\nstatic PyObject *\narray_ndim_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong(self->nd);\n}\n\nstatic PyObject *\narray_flags_get(PyArrayObject *self)\n{\n static PyObject *module=NULL;\n\n if (module==NULL) {\n module = PyImport_ImportModule(\"scipy.base._internal\");\n if (module == NULL) return NULL;\n }\n return PyObject_CallMethod(module, \"flagsobj\", \"Oi\", \n self, self->flags);\n}\n\n/*\nstatic int\narray_flags_set(PyArrayObject *self, PyObject *obj) \n{\n\tint flagback = self->flags;\n\n if (PyDict_Check(obj)) {\n PyObject *new;\n\t\tnew = PyDict_GetItemString(obj, \"ALIGNED\");\n\t\tif (new) {\n\t\t\tif (PyObject_Not(new)) self->flags &= ~ALIGNED;\n\t\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\t\telse {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"cannot set aligned flag of \" \\\n\t\t\t\t\t\t\"mis-aligned array to True\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n new = PyDict_GetItemString(obj, \"UPDATEIFCOPY\");\n if (new) {\n if (PyObject_Not(new)) {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n else {\n\t\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return -1;\n }\n }\n new = PyDict_GetItemString(obj, \"WRITEABLE\");\n if (new) {\n\t\t\tif (PyObject_IsTrue(new)) {\n\t\t\t\tif (_IsWriteable(self)) {\n\t\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself->flags = flagback;\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\t\"cannot set \"\t\\\n\t\t\t\t\t\t\t\"WRITEABLE \"\t\\\n\t\t\t\t\t\t\t\"flag to True of \"\\\n\t\t\t\t\t\t\t\"this array \");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n new = PyDict_GetItemString(obj, \"NOTSWAPPED\");\n if (new) {\n if (PyObject_IsTrue(new))\n self->flags |= NOTSWAPPED;\n else {\n self->flags &= ~NOTSWAPPED;\n\t\t\t}\n\t\t}\n return 0;\n }\n PyErr_SetString(PyExc_ValueError, \n \"Object must be a dictionary\");\n return -1;\n}\n*/\n\n\nstatic PyObject *\narray_shape_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->dimensions);\n}\n\n\nstatic int\narray_shape_set(PyArrayObject *self, PyObject *val)\n{\n \tint nd;\n\tPyObject *ret;\n\n\tif (!PyTuple_Check(val)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"shape must be a tuple\");\n\t\treturn -1;\n\t}\n\tret = PyArray_Reshape(self, val);\n\tif (ret == NULL) return -1;\n\t\n\tif (self->nd > 0) { /* Free old dimensions and strides */\n\t\tPyDimMem_FREE(self->dimensions);\n\t}\n\tnd = PyArray_NDIM(ret);\n\tself->nd = nd;\n\tif (nd > 0) { /* create new dimensions and strides */\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\tPyErr_SetString(PyExc_MemoryError,\"\");\n\t\t\treturn -1;\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, PyArray_DIMS(ret), \n\t\t nd*sizeof(intp));\n\t\tmemcpy(self->strides, PyArray_STRIDES(ret), \n\t\t nd*sizeof(intp));\n\t}\n\telse self->dimensions=NULL;\n\tPy_DECREF(ret);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_strides_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic int\narray_strides_set(PyArrayObject *self, PyObject *obj)\n{\n\tPyArray_Dims newstrides = {NULL, 0};\n\tPyArrayObject *new;\n\tintp numbytes;\n\n\tif (!PyArray_IntpConverter(obj, &newstrides) || \\\n\t newstrides.ptr == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"invalid strides.\");\n\t\treturn -1;\n\t}\n\tif (newstrides.len != self->nd) {\n\t\tPyErr_Format(PyExc_ValueError, \"strides must be \"\t\\\n\t\t\t \" same length as shape (%d)\", self->nd);\n\t\treturn -1;\n\t}\n\tnew = self;\n\twhile(new->base != NULL) {\n\t\tif (PyArray_Check(new->base)) \n\t\t\tnew = (PyArrayObject *)new->base;\n\t}\n\tnumbytes = PyArray_MultiplyList(new->dimensions, \n\t\t\t\t\tnew->nd)*new->itemsize;\n\t\n\tif (!PyArray_CheckStrides(self->itemsize, self->nd, numbytes, \n\t\t\t\t self->dimensions, newstrides.ptr)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"strides is not \"\\\n\t\t\t\t\"compatible with available memory\");\n\t\treturn -1;\n\t}\n\tmemcpy(self->strides, newstrides.ptr, sizeof(intp)*newstrides.len);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_protocol_strides_get(PyArrayObject *self)\n{\n\tif PyArray_ISCONTIGUOUS(self) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic PyObject *\narray_priority_get(PyArrayObject *self)\n{\n\tif (PyArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_PRIORITY);\n\telse if (PyBigArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_BIG_PRIORITY);\n\telse\n\t\treturn PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY);\n}\n\n\nstatic PyObject *\narray_data_get(PyArrayObject *self)\n{\n\tintp nbytes;\n\tif (!(PyArray_ISONESEGMENT(self))) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot get single-\"\\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn NULL;\n\t}\t\t\n\tnbytes = PyArray_NBYTES(self);\n\tif PyArray_ISWRITEABLE(self) \n\t\treturn PyBuffer_FromReadWriteObject((PyObject *)self, 0, \n\t\t\t\t\t\t (int) nbytes);\n\telse\n\t\treturn PyBuffer_FromObject((PyObject *)self, 0, (int) nbytes);\n}\n\nstatic int\narray_data_set(PyArrayObject *self, PyObject *op)\n{\n\tvoid *buf;\n\tint buf_len;\n\tint writeable=1;\n\n\tif (PyObject_AsWriteBuffer(op, &buf, &buf_len) < 0) {\n\t\twriteable = 0;\n\t\tif (PyObject_AsReadBuffer(op, (const void **)&buf, \n\t\t\t\t\t &buf_len) < 0) {\n\t\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\t\"Object does not have single-segment\" \\\n\t\t\t\t\t\"buffer interface\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif (!PyArray_ISONESEGMENT(self)) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot set single-\" \\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn -1;\n\t}\n\tif (PyArray_NBYTES(self) > buf_len) {\n\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\"Not enough data for array.\");\n\t\treturn -1;\n\t}\n\tif (self->flags & OWN_DATA) {\n\t\tPyArray_XDECREF(self);\n\t\tPyDataMem_FREE(self->data);\n\t}\n\tif (self->base) {\n\t\tif (self->flags & UPDATEIFCOPY) {\n\t\t\t((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tself->flags &= ~UPDATEIFCOPY;\n\t\t}\n\t\tPy_DECREF(self->base);\n\t}\n\tPy_INCREF(op);\n\tself->base = op;\n\tself->data = buf;\n\tself->flags = CARRAY_FLAGS;\n\tif (!writeable)\n\t\tself->flags &= ~WRITEABLE;\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_itemsize_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->itemsize);\n}\n\nstatic PyObject *\narray_size_get(PyArrayObject *self)\n{\n\tlonglong size=PyArray_SIZE(self);\n\tif (size > MAX_INT || size < MIN_INT)\n\t\treturn PyLong_FromLongLong((longlong) size);\n\telse \n\t\treturn PyInt_FromLong((long) size);\n}\n\n\nstatic PyObject *\narray_typechar_get(PyArrayObject *self)\n{\n\tif PyArray_ISFLEXIBLE(self) \n\t\treturn PyString_FromFormat(\"%c%d\", (self->descr->type),\n\t\t\t\t\t self->itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(self->descr->type), 1);\n}\n\nstatic PyObject *\narray_typestr_get(PyArrayObject *self)\n{\n\tstatic char endians[] = \"<>\";\n\tchar endian;\n\tint which;\n\tunsigned long val = 1;\n\tchar *s;\n\tchar basic_=self->descr->kind;\n\n\ts = (char *)&val; /* s[0] == 0 implies big-endian */\n\twhich = (PyArray_ISNOTSWAPPED(self) ? 0 : 1);\n\tif (s[0] == 0) which = 1 - which;\n\tendian = endians[which]; \n\t\n\tif ((basic_==PyArray_VOIDLTR) || (basic_==PyArray_STRINGLTR) || \\\n\t (basic_==PyArray_OBJECTLTR) || (self->itemsize == 1))\n\t\treturn PyString_FromFormat(\"|%c%d\", basic_, self->itemsize);\n\telse\n\t\treturn PyString_FromFormat(\"%c%c%d\", endian, basic_,\n\t\t\t\t\t self->itemsize);\n}\n\nstatic PyObject *\narray_descr_get(PyArrayObject *self)\n{\n\tPyObject *res;\n\tPyObject *dobj;\n\n\t/* hand this off to the typeobject */\n\t/* or give default */\n\tif (PyArray_ISUSERDEF(self)) {\n\t\tres = PyObject_GetAttrString((PyObject *)self->descr->typeobj, \n\t\t\t\t\t \"__array_descr__\");\n\t\tif (res) return res;\n\t\tPyErr_Clear();\n\t}\n\t/* get default */\n\tdobj = PyTuple_New(2);\n\tif (dobj == NULL) return NULL;\n\tPyTuple_SET_ITEM(dobj, 0, PyString_FromString(\"\"));\n\tPyTuple_SET_ITEM(dobj, 1, array_typestr_get(self));\n\tres = PyList_New(1);\n\tif (res == NULL) {Py_DECREF(dobj); return NULL;}\n\tPyList_SET_ITEM(res, 0, dobj);\n\treturn res;\n}\n\nstatic PyObject *\narray_typenum_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->descr->type_num);\n}\n\n\nstatic PyObject *\narray_type_get(PyArrayObject *self)\n{\n\treturn PyArray_TypeObjectFromType(self->descr->type_num);\n}\n\n/* If the type is changed. \n Also needing change: strides, itemsize\n\n Either itemsize is exactly the same\n or the array is single-segment (contiguous or fortran) with\n compatibile dimensions\n\n*/\n\nstatic int\narray_type_set(PyArrayObject *self, PyObject *arg)\n{\n PyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n intp newdim;\n int index;\n char *msg = \"new type not compatible with array.\";\n\n if ((PyArray_TypecodeConverter(arg, &newtype) < 0) ||\n newtype.type_num == PyArray_NOTYPE) {\n PyErr_SetString(PyExc_TypeError, \"Invalid type for array\");\n return -1;\n }\n if (!(PyArray_ISONESEGMENT(self) ||\t\t\\\n\t (newtype.itemsize != self->itemsize))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1; \n }\n\n\tif (PyArray_ISCONTIGUOUS(self)) index = self->nd - 1;\n\telse index = 0;\n\n if (newtype.itemsize < self->itemsize) {\n /* if it is compatible increase the size of the dimension\n at end (or at the front for FORTRAN)\n */\n if (self->itemsize % newtype.itemsize != 0) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n newdim = self->itemsize / newtype.itemsize;\n\t\tself->dimensions[index] *= newdim;\n self->strides[index] = newtype.itemsize;\n\t}\n \n else if (newtype.itemsize > self->itemsize) {\n \n /* Determine if last (or first if FORTRAN) dimension\n is compatible */\n\n\t\tnewdim = self->dimensions[index] * self->itemsize;\n if ((newdim % newtype.itemsize) != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n\t\t\n self->dimensions[index] = newdim / newtype.itemsize;\n self->strides[index] = newtype.itemsize;\n\t\t\n }\n\t\n \n /* fall through -- adjust type*/\n\n self->descr = PyArray_DescrFromType(newtype.type_num);\n self->itemsize = newtype.itemsize;\n PyArray_UpdateFlags(self, ALIGNED);\n return 0;\n\n}\n\n\n\nstatic PyObject *\narray_base_get(PyArrayObject *self)\n{\n\tif (self->base == NULL) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\telse {\n\t\tPy_INCREF(self->base);\n\t\treturn self->base;\n\t}\n}\n\n\nstatic PyObject *\narray_real_get(PyArrayObject *self)\n{\n\tPyArrayObject *ret;\n\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *)ret;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n}\n\n\nstatic int\narray_real_set(PyArrayObject *self, PyObject *val)\n{\n\tPyArrayObject *ret;\n\tPyArrayObject *new;\n\tint rint;\n\n\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0);\n\tif (new == NULL) return -1;\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return -1;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\tret = self;\n\t}\t\n\trint = PyArray_CopyInto(ret, new);\n\tPy_DECREF(ret);\n\treturn rint;\n}\n\nstatic PyObject *\narray_imag_get(PyArrayObject *self)\n{\t\n\tPyArrayObject *ret;\n\tint itemsize;\n\tint typenum;\n PyArray_Typecode type;\n\t\n\ttype.type_num = self->descr->type_num;\n\ttype.itemsize = self->itemsize;\n\ttype.fortran = PyArray_ISFORTRAN(self);\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\titemsize = self->itemsize >> 1;\n\t\ttypenum = self->descr->type_num - PyArray_NUM_FLOATTYPE;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t typenum,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data + itemsize,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *) ret;\n\t}\n\telse {\n\t\tret = (PyArrayObject *)PyArray_Zeros(self->nd, \n\t\t\t\t\t\t self->dimensions, &type);\n\t\tret->flags &= ~WRITEABLE;\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic int\narray_imag_set(PyArrayObject *self, PyObject *val)\n{\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyArrayObject *ret;\n\t\tPyArrayObject *new;\n\t\tint rint;\n\n\t\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0); \n\t\tif (new == NULL) return -1;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides+ \\\n\t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) {\n\t\t\tPy_DECREF(new); \n\t\t\treturn -1;\n\t\t}\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\trint = PyArray_CopyInto(ret, new);\n\t\tPy_DECREF(ret);\t\t\n\t\tPy_DECREF(new);\n\t\treturn rint;\n\t}\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError, \"Does not have imaginary \" \\\n\t\t\t\t\"part to set.\");\n\t\treturn -1;\n\t}\n}\n\nstatic PyObject *\narray_flat_get(PyArrayObject *self)\n{\n return PyArray_IterNew((PyObject *)self);\n}\n\nstatic int \narray_flat_set(PyArrayObject *self, PyObject *val)\n{\n\tPyObject *arr=NULL;\n\tint retval = -1;\n\tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n\tPyArray_Typecode typecode;\n int swap;\n PyArray_CopySwapFunc *copyswap;\n\n\ttypecode.type_num = self->descr->type_num;\n\ttypecode.itemsize = self->itemsize;\n\ttypecode.fortran = PyArray_ISFORTRAN(self);\n\t\n\tarr = PyArray_FromAny(val, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\tarrit = (PyArrayIterObject *)PyArray_IterNew(arr);\n\tif (arrit == NULL) goto exit;\n\tselfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (selfit == NULL) goto exit;\n\n swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);\n copyswap = self->descr->copyswap;\n if (PyArray_ISOBJECT(self)) {\n while(selfit->index < selfit->size) {\n Py_XDECREF(*((PyObject **)selfit->dataptr));\n Py_INCREF(*((PyObject **)arrit->dataptr)); \n memmove(selfit->dataptr, arrit->dataptr, \n sizeof(PyObject *));\n copyswap(selfit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_ITER_NEXT(selfit);\n PyArray_ITER_NEXT(arrit);\n if (arrit->index == arrit->size) \n PyArray_ITER_RESET(arrit);\n }\n retval = 0; \n goto exit;\n }\n\n\twhile(selfit->index < selfit->size) {\n\t\tmemmove(selfit->dataptr, arrit->dataptr, self->itemsize);\n copyswap(selfit->dataptr, NULL, swap, self->itemsize);\n\t\tPyArray_ITER_NEXT(selfit);\n\t\tPyArray_ITER_NEXT(arrit);\n\t\tif (arrit->index == arrit->size) \n\t\t\tPyArray_ITER_RESET(arrit);\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(selfit);\n\tPy_XDECREF(arrit);\n\tPy_XDECREF(arr);\n\treturn retval;\n}\n\nstatic PyGetSetDef array_getsetlist[] = {\n {\"ndim\", \n\t (getter)array_ndim_get, \n\t NULL, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)array_flags_get, \n NULL,\n\t \"special dictionary of flags\"},\n {\"shape\", \n\t (getter)array_shape_get, \n\t (setter)array_shape_set, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)array_strides_get, \n\t (setter)array_strides_set,\n\t \"tuple of bytes steps in each dimension\"},\n {\"data\", \n\t (getter)array_data_get, \n\t (setter)array_data_set, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)array_itemsize_get, \n\t NULL,\n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)array_size_get,\n\t NULL,\n \"number of elements in the array\"},\n\t{\"base\",\n\t (getter)array_base_get,\n\t NULL,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)array_type_get, \n\t (setter)array_type_set,\n\t \"get array type class\"},\n\t{\"dtypechar\",\n\t (getter)array_typechar_get,\n\t NULL,\n\t \"get array type character code\"},\n\t{\"dtypenum\",\n\t (getter)array_typenum_get,\n\t NULL,\n\t \"get array type number code\"},\n\t{\"dtypestr\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)array_real_get, \n\t (setter)array_real_set, \n\t \"real part of array\"},\n {\"imag\", \n\t (getter)array_imag_get, \n\t (setter)array_imag_set, \n\t \"imaginary part of array\"},\n\t{\"flat\", \n\t (getter)array_flat_get, \n\t (setter)array_flat_set, \n\t \"a 1-d view of a contiguous array\"}, \n\t{\"__array_data__\", \n\t (getter)array_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)array_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)array_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)array_protocol_strides_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t{\"__array_priority__\",\n\t (getter)array_priority_get,\n\t NULL,\n\t \"Array priority\"},\n \t{NULL, NULL, NULL, NULL}, /* Sentinel */\n};\n\n/****************** end of attribute get and set routines *******************/\n\n\n\nstatic char Arraytype__doc__[] = \n \"A array object represents a multidimensional, homogeneous array of basic values. It has the folowing data members, m.shape (the size of each dimension in the array), m.itemsize (the size (in bytes) of each element of the array), and m.typecode (a character representing the type of the array elements). Arrays are sequence, mapping and numeric objects. Sequence indexing is similar to lists, with single indices returning a reference that points to the old array data, and slices returning by copy. A array is also allowed to be indexed by a sequence of items.\t Each member of the sequence indexes the corresponding dimension of the array.\";\n\nstatic PyTypeObject PyBigArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.bigndarray\",\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n /* methods */\n (destructor)array_dealloc,\t\t /*tp_dealloc */\n (printfunc)NULL,\t\t\t /*tp_print*/\n 0,\t\t\t\t\t /*tp_getattr*/\n 0,\t\t\t\t\t /*tp_setattr*/\n (cmpfunc)0, \t\t /*tp_compare*/\n (reprfunc)array_repr,\t\t /*tp_repr*/\n &array_as_number,\t\t\t /*tp_as_number*/\n NULL, \t\t\t /*tp_as_sequence*/\n &array_as_mapping,\t\t\t /*tp_as_mapping*/\n (hashfunc)0,\t\t\t /*tp_hash*/\n (ternaryfunc)0,\t\t\t /*tp_call*/\n (reprfunc)array_str, \t /*tp_str*/\n\t\t\n (getattrofunc)0,\t\t\t /*tp_getattro*/\n (setattrofunc)0,\t\t\t /*tp_setattro*/\n NULL, \t /*tp_as_buffer*/\n (Py_TPFLAGS_DEFAULT \n | Py_TPFLAGS_BASETYPE\n | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/\n /*Documentation string */\n Arraytype__doc__,\t\t\t /*tp_doc*/\n\n (traverseproc)0,\t\t\t /*tp_traverse */\n (inquiry)0,\t\t\t /*tp_clear */\n (richcmpfunc)array_richcompare,\t \n offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */\n\n /* Iterator support (use standard) */\n\n (getiterfunc)0, \t\t /* tp_iter */\n (iternextfunc)0,\t\t\t /* tp_iternext */\n\n /* Sub-classing (new-style object) support */\n\n array_methods,\t\t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n array_getsetlist,\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0,\t /* tp_alloc */ \n (newfunc)array_new,\t\t /* tp_new */\n 0,\t \t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n};\n\n/* A standard array will subclass from the Big Array and \n add the array_as_sequence table\n and the array_as_buffer table\n */\n\nstatic PyTypeObject PyArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.ndarray\",\t\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n};\n\n\n/* The rest of this code is to build the right kind of array from a python */\n/* object. */\n\nstatic int \ndiscover_depth(PyObject *s, int max, int stop_at_string) \n{\n int d=0;\n PyObject *e;\n\t\n if(max < 1) return -1;\n\n if(! PySequence_Check(s) || PyInstance_Check(s) || \\\n\t PySequence_Length(s) < 0) {\n PyErr_Clear(); return 0;\n }\n if (PyArray_Check(s))\n\t\treturn PyArray_NDIM(s);\n if(PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))\n\t\treturn stop_at_string ? 0:1;\n if (PySequence_Length(s) == 0) \n\t\treturn 1;\n\t\n if ((e=PySequence_GetItem(s,0)) == NULL) return -1;\n if(e!=s) {\n\t\td=discover_depth(e,max-1, stop_at_string);\n\t\tif(d >= 0) d++;\n\t}\n Py_DECREF(e);\n return d;\n}\n\nstatic int\ndiscover_itemsize(PyObject *s, int nd, int *itemsize) \n{\n\tint n, r, i;\n\tPyObject *e;\n\t\n\tn = PyObject_Length(s);\n\n\tif ((nd == 0) || PyString_Check(s) ||\t\t\\\n\t PyUnicode_Check(s) || PyBuffer_Check(s)) {\n\t\tif PyUnicode_Check(s) \n\t\t\t*itemsize = MAX(*itemsize, sizeof(Py_UNICODE)*n);\n\t\telse\n\t\t\t*itemsize = MAX(*itemsize, n);\n\t\treturn 0;\n\t}\n\tfor (i=0; i n_lower) n_lower = d[1];\n }\n d[1] = n_lower;\n\t\n return 0;\n}\n\nstatic void\n_array_small_type(int chktype, int mintype, int chksize, int minsize, \n\t\t PyArray_Typecode *outtype)\n{\n\touttype->type_num = MAX(chktype, mintype);\n\tif (PyTypeNum_ISFLEXIBLE(outtype->type_num) &&\t\\\n\t PyTypeNum_ISFLEXIBLE(mintype)) {\n\t\t/* Handle string->unicode case separately \n\t\t because string itemsize is twice as large */\n\t\tif (outtype->type_num == PyArray_UNICODE && \n\t\t mintype == PyArray_STRING) {\n\t\t\touttype->itemsize = MAX(chksize, 2*minsize);\n\t\t}\n\t\telse {\n\t\t\touttype->itemsize = MAX(chksize, minsize);\n\t\t}\n\t}\n\telse {\n\t\touttype->itemsize = chksize;\n\t}\n\treturn;\t\n}\n\nstatic void\n_array_find_type(PyObject *op, PyArray_Typecode *minitype, \n\t\t PyArray_Typecode *outtype, int max)\n{\n int l;\n PyObject *ip;\n\tint chktype=0;\n\tint chksize=0;\n\tint mintype, minsize;\n\n\tif (minitype == NULL) {\n\t\tmintype = PyArray_BOOL;\n\t\tminsize = sizeof(Bool);\n\t}\n\telse {\n\t\tmintype = minitype->type_num;\n\t\tminsize = minitype->itemsize;\n\t}\n\n \n if (max < 0 || mintype == -1) goto deflt;\n\t\n if (PyArray_Check(op)) {\n\t\tchktype = PyArray_TYPE(op);\n\t\tchksize = PyArray_ITEMSIZE(op);\n\t\tgoto finish;\n\t}\n\t\n\tif (PyArray_IsScalar(op, Generic)) {\n\t\tPyArray_TypecodeFromScalar(op, outtype);\n\t\tchktype = outtype->type_num;\n\t\tchksize = outtype->itemsize;\n\t\tgoto finish;\n\t}\n\t\n\n if (PyObject_HasAttrString(op, \"__array__\")) {\n ip = PyObject_CallMethod(op, \"__array__\", NULL);\n if(ip && PyArray_Check(ip)) {\n\t\t\tchktype = PyArray_TYPE(ip);\n\t\t\tchksize = PyArray_ITEMSIZE(ip);\n\t\t\tgoto finish;\n\t\t}\n } \n\t\n\tif (PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tint swap=0, res;\n\t\tip = PyObject_GetAttrString(op, \"__array_typestr__\");\n\t\tif (ip && PyString_Check(ip)) {\n\t\t\tres = _array_typecode_fromstr(PyString_AS_STRING(ip), \n\t\t\t\t\t\t &swap, outtype); \n\t\t\tif (res >= 0) {\n\t\t\t\tPy_DECREF(ip);\n\t\t\t\tchktype = outtype->type_num;\n\t\t\t\tchksize = outtype->itemsize;\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t}\n\t\tPy_XDECREF(ip);\n\t}\n\n if (PyString_Check(op)) {\n\t\tchktype = PyArray_STRING;\n\t\tchksize = PyString_GET_SIZE(op);\n\t\tgoto finish;\n }\n\n\tif (PyUnicode_Check(op)) {\n\t\tchktype = PyArray_UNICODE;\n\t\tchksize = PyUnicode_GET_DATA_SIZE(op);\n\t\tgoto finish;\n\t}\n\n\tif (PyBuffer_Check(op)) {\n\t\tchktype = PyArray_VOID;\n\t\tchksize = op->ob_type->tp_as_sequence->sq_length(op);\n\t\tPyErr_Clear();\n\t\tgoto finish;\n\t}\n\n\tif (PyInstance_Check(op)) goto deflt;\n\t\n if (PySequence_Check(op)) {\n\t\tPyArray_Typecode newtype;\n\t\tnewtype.type_num = mintype;\n\t\tnewtype.itemsize = minsize;\n\t\tnewtype.fortran = 0;\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n\t\t\tPyErr_Clear(); \n\t\t\tgoto deflt;\n\t\t}\n if (l == 0 && mintype == 0) {\n\t\t\tnewtype.type_num = PyArray_INTP;\n\t\t\tnewtype.itemsize = sizeof(intp);\n\t\t}\n while (--l >= 0) {\n ip = PySequence_GetItem(op, l);\n if (ip==NULL) {\n\t\t\t\tPyErr_Clear(); \n\t\t\t\tgoto deflt;\n\t\t\t}\n\t\t\t_array_find_type(ip, &newtype, outtype, max-1);\n\t\t\t_array_small_type(outtype->type_num,\n\t\t\t\t\t newtype.type_num, \n\t\t\t\t\t outtype->itemsize,\n\t\t\t\t\t newtype.itemsize,\n\t\t\t\t\t &newtype);\n Py_DECREF(ip);\n }\n\t\tchktype = newtype.type_num;\n\t\tchksize = newtype.itemsize;\n\t\tgoto finish;\n }\n\t\n\tif (PyBool_Check(op)) {\n\t\tchktype = PyArray_BOOL;\n\t\tchksize = sizeof(Bool);\n\t\tgoto finish;\t\t\n\t}\n else if (PyInt_Check(op)) {\n\t\tchktype = PyArray_LONG;\n\t\tchksize = sizeof(long);\n\t\tgoto finish;\n } else if (PyFloat_Check(op)) {\n\t\tchktype = PyArray_DOUBLE;\n\t\tchksize = sizeof(double);\n\t\tgoto finish;\n\t} else if (PyComplex_Check(op)) {\n\t\tchktype = PyArray_CDOUBLE;\n\t\tchksize = sizeof(cdouble);\n\t\tgoto finish;\n\t}\n\n deflt:\n\tchktype = PyArray_OBJECT;\n\tchksize = sizeof(void *);\n\n finish:\n\t_array_small_type(chktype, mintype, chksize, minsize, \n\t\t\t outtype);\n\treturn;\n}\n\nstatic int \nAssign_Array(PyArrayObject *self, PyObject *v) \n{\n PyObject *e;\n int l, r;\n\t\n if (!PySequence_Check(v)) {\n PyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"assignment from non-sequence\");\n return -1;\n }\n\t\n l=PyObject_Length(v);\n if(l < 0) return -1; \n\t\n while(--l >= 0)\n {\n e=PySequence_GetItem(v,l);\n if (e == NULL) return -1; \n\t\t\tr = PySequence_SetItem((PyObject*)self,l,e);\n Py_DECREF(e);\n if(r == -1) return -1;\n }\n return 0;\n}\n\n/* \"Array Scalars don't call this code\" */ \nstatic PyObject *\nArray_FromScalar(PyObject *op, PyArray_Typecode *typecode) \n{\n PyArrayObject *ret;\n\tint itemsize = 0;\n\tint type = typecode->type_num;\n\n\tif PyTypeNum_ISFLEXIBLE(type) {\n\t\titemsize = PyObject_Length(op);\n\t}\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,\n\t\t\t\t\t NULL, NULL, itemsize, 0, NULL);\n\n\tif (ret == NULL) return NULL;\n\n ret->descr->setitem(op, ret->data, ret);\n\t\n if (PyErr_Occurred()) {\n array_dealloc(ret);\n return NULL;\n } else {\n return (PyObject *)ret;\n }\n}\n\n\nstatic PyObject *\nArray_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth)\n{\n PyArrayObject *r;\n int nd;\n\tintp *d;\n\tint stop_at_string;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\t\n\t\n\tstop_at_string = ((type == PyArray_OBJECT) ||\t\\\n\t\t\t (type == PyArray_STRING) ||\t\\\n\t\t\t (type == PyArray_UNICODE) || \\\n\t\t\t (type == PyArray_VOID));\n\n if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string)) > 0)) {\n\t\tif (nd==0)\n\t\t\treturn Array_FromScalar(s, typecode);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid input sequence\");\n return NULL;\n }\n\t\n if ((max_depth && nd > max_depth) ||\t\\\n\t (min_depth && nd < min_depth)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of dimensions\");\n return NULL;\n }\n\t\n\tif ((d=PyDimMem_NEW(nd)) == NULL) {\n\t\treturn PyErr_NoMemory();\n }\n\tif(discover_dimensions(s,nd,d, !stop_at_string) == -1) {\n\t\tPyDimMem_FREE(d);\n\t\treturn NULL;\n\t}\n\tif (itemsize == 0 && PyTypeNum_ISFLEXIBLE(type)) {\n\t\tif (discover_itemsize(s, nd, &itemsize) == -1) {\n\t\t\tPyDimMem_FREE(d);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n r=(PyArrayObject*)PyArray_New(&PyArray_Type, nd, d, \n\t\t\t\t type, NULL, NULL,\n\t\t\t\t itemsize, \n\t\t\t\t typecode->fortran, NULL);\n\n PyDimMem_FREE(d);\n if(!r) return NULL;\n if(Assign_Array(r,s) == -1) {\n\t\tPy_DECREF(r);\n\t\treturn NULL;\n\t}\n return (PyObject*)r;\n}\n\n\nstatic int \nPyArray_ValidType(int type) \n{\n\tPyArray_Descr *descr;\n\t\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr==NULL) return 0;\n\treturn 1;\n}\n\n\n/* If the output is not a CARRAY, then it is buffered also */\n\nstatic int\n_bufferedcast(PyArrayObject *out, PyArrayObject *in)\n{\n\tchar *inbuffer, *bptr, *optr;\n\tchar *outbuffer=NULL;\n\tPyArrayIterObject *it_in=NULL, *it_out=NULL;\n\tregister intp i, index;\n\tintp ncopies = PyArray_SIZE(out) / PyArray_SIZE(in);\n\tint elsize=in->itemsize;\n\tint nels = PyArray_BUFSIZE;\n\tint el;\n\tint inswap, outswap=0;\n\tint obuf=!PyArray_ISCARRAY(out);\n\tint oelsize = out->itemsize;\n\tPyArray_VectorUnaryFunc *castfunc;\n PyArray_CopySwapFunc *in_csn;\n PyArray_CopySwapFunc *out_csn;\n\tint retval = -1;\n\n\tcastfunc = in->descr->cast[out->descr->type_num];\n in_csn = in->descr->copyswap;\n out_csn = out->descr->copyswap;\n\n\t/* If the input or output is STRING, UNICODE, or VOID */\n\t/* then getitem and setitem are used for the cast */\n\t/* and byteswapping is handled by those methods */\n\n\tinswap = !(PyArray_ISFLEXIBLE(in) || PyArray_ISNOTSWAPPED(in));\n\t\n\tinbuffer = PyDataMem_NEW(PyArray_BUFSIZE*elsize);\n\tif (inbuffer == NULL) return -1;\n\tit_in = (PyArrayIterObject *)PyArray_IterNew((PyObject *)in);\n\tif (it_in == NULL) goto exit;\n\n\tif (obuf) {\n\t\toutswap = !(PyArray_ISFLEXIBLE(out) || \\\n\t\t\t PyArray_ISNOTSWAPPED(out));\n\t\toutbuffer = PyDataMem_NEW(PyArray_BUFSIZE*oelsize);\n\t\tif (outbuffer == NULL) goto exit;\n\n\t\tit_out = (PyArrayIterObject *)PyArray_IterNew((PyObject *)out);\n\t\tif (it_out == NULL) goto exit;\n\n\t\tnels = MIN(nels, PyArray_BUFSIZE);\n\t}\n\t\n\toptr = (obuf) ? outbuffer: out->data;\n\tbptr = inbuffer;\n\tel = 0;\t\n\twhile(ncopies--) {\n\t\tindex = it_in->size;\n\t\tPyArray_ITER_RESET(it_in);\n\t\twhile(index--) {\n in_csn(bptr, it_in->dataptr, inswap, elsize);\n\t\t\tbptr += elsize;\n\t\t\tPyArray_ITER_NEXT(it_in);\n\t\t\tel += 1;\n\t\t\tif ((el == nels) || (index == 0)) {\n\t\t\t\t/* buffer filled, do cast */\n\t\t\t\t\n\t\t\t\tcastfunc(inbuffer, optr, el, in, out);\n\t\t\t\t\n\t\t\t\tif (obuf) {\n\t\t\t\t\t/* Copy from outbuffer to array */\n\t\t\t\t\tfor(i=0; idataptr,\n optr, outswap,\n oelsize);\n\t\t\t\t\t\toptr += oelsize;\n\t\t\t\t\t\tPyArray_ITER_NEXT(it_out);\n\t\t\t\t\t}\n\t\t\t\t\toptr = outbuffer;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toptr += out->itemsize * nels;\n\t\t\t\t}\n\t\t\t\tel = 0;\n\t\t\t\tbptr = inbuffer;\n\t\t\t}\n\t\t}\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(it_in);\n\tPyDataMem_FREE(inbuffer);\n\tPyDataMem_FREE(outbuffer);\t\n\tif (obuf) {\n\t\tPy_XDECREF(it_out);\n\t}\n\treturn retval;\n\n}\n\n\n/* For backward compatibility */\n\nstatic PyObject *\nPyArray_Cast(PyArrayObject *mp, int type_num) \n{\n\tPyArray_Typecode type;\n\tPyArray_Descr *descr;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\ttype.itemsize = descr->elsize;\n\ttype.type_num = descr->type_num;\n\ttype.fortran = 0;\n\t\n\treturn PyArray_CastToType(mp, &type);\n}\n\nstatic PyObject * \nPyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at) \n{\n\tPyObject *out;\n\tint ret;\n\n\tif ((mp->descr->type_num == at->type_num) && \\\n\t (at->itemsize==0 || mp->itemsize == at->itemsize) &&\n\t PyArray_ISBEHAVED_RO(mp)) {\n\t\tPy_INCREF(mp);\n\t\treturn (PyObject *)mp;\n\t}\n\t\t\n\tif (at->itemsize == 0) {\n\t\tif (mp->descr->type_num == PyArray_STRING &&\t\\\n\t\t at->type_num == PyArray_UNICODE)\n\t\t\tat->itemsize = mp->itemsize*sizeof(Py_UNICODE);\n\t\tif (mp->descr->type_num == PyArray_UNICODE &&\n\t\t at->type_num == PyArray_STRING) \n\t\t\tat->itemsize = mp->itemsize/sizeof(Py_UNICODE);\n\t\tif (at->type_num == PyArray_VOID)\n\t\t\tat->itemsize = mp->itemsize;\n\t}\n\n\tout = PyArray_New(mp->ob_type, mp->nd, \n\t\t\t mp->dimensions, \n\t\t\t at->type_num,\n\t\t\t NULL, NULL, at->itemsize, \n\t\t\t at->fortran, (PyObject *)mp);\n\tif (out == NULL) return NULL;\n\tret = PyArray_CastTo((PyArrayObject *)out, mp);\n\tif (ret != -1) return out;\n\n\tPy_DECREF(out);\n\treturn NULL;\n\t\n}\n\t \n/* The number of elements in out must be an integer multiple\n of the number of elements in mp. \n*/\n\nstatic int\nPyArray_CastTo(PyArrayObject *out, PyArrayObject *mp)\n{\n\n\tint simple;\n\tintp mpsize = PyArray_SIZE(mp);\n\tintp outsize = PyArray_SIZE(out);\n\n\tif (mpsize == 0) return 0;\n\tif (!PyArray_ISWRITEABLE(out)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array is not writeable.\");\n\t\treturn -1;\n\t}\n\tif (outsize % mpsize != 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array must have an integer-multiple\"\\\n\t\t\t\t\" of the number of elements in the input \"\\\n\t\t\t\t\"array\");\n\t\treturn -1; \n\t}\n\n\tsimple = ((PyArray_ISCARRAY(mp) && PyArray_ISCARRAY(out)) || \\\n (PyArray_ISFARRAY(mp) && PyArray_ISFARRAY(out)));\n\t\n\tif (simple) {\n\t\tchar *inptr;\n\t\tchar *optr = out->data;\n\t\tintp obytes = out->itemsize * outsize;\n\t\tintp ncopies = outsize / mpsize;\n\n\t\twhile(ncopies--) {\n\t\t\tinptr = mp->data;\n\t\t\tmp->descr->cast[out->descr->type_num](inptr, \n\t\t\t\t\t\t\t optr,\n\t\t\t\t\t\t\t mpsize,\n\t\t\t\t\t\t\t mp, out);\n\t\t\toptr += obytes;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t/* If not a well-behaved cast, then use buffers */\n\tif (_bufferedcast(out, mp) == -1) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nstatic PyObject *\narray_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags) \n{\n\t\n\tPyArrayObject *ret=NULL;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\tint copy = 0;\n\tint arrflags;\n\tPyArray_Typecode oldtype;\n\tchar *msg = \"Cannot copy-back to a read-only array.\";\n\n\toldtype.type_num = PyArray_TYPE(arr);\n\toldtype.itemsize = PyArray_ITEMSIZE(arr);\n\toldtype.fortran = 0;\n\n\tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n\tif (itemsize == 0) itemsize = arr->itemsize;\n\ttypecode->type_num = type;\n\ttypecode->itemsize = itemsize;\n\n\t/* Don't copy if sizes are compatible */\n\tif (PyArray_EquivalentTypes(&oldtype, typecode)) {\n\t\tarrflags = arr->flags;\n\n\t\tcopy = (flags & ENSURECOPY) || \\\n\t\t\t((flags & CONTIGUOUS) && (!(arrflags & CONTIGUOUS))) \\\n\t\t\t|| (PyArray_ITEMSIZE(arr) != itemsize) || \\\n\t\t\t((flags & ALIGNED) && (!(arrflags & ALIGNED))) || \\\n\t\t\t((flags & NOTSWAPPED) && (!(arrflags & NOTSWAPPED))) \\\n\t\t\t|| (arr->nd > 1 &&\t\t\t\t\\\n\t\t\t ((flags & FORTRAN) != (arrflags & FORTRAN))) || \\\n\t\t\t((flags & WRITEABLE) && (!(arrflags & WRITEABLE)));\n\t\t\n\t\tif (copy) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_New(arr->ob_type, \n\t\t\t\t\t arr->nd, \n\t\t\t\t\t arr->dimensions,\n\t\t\t\t\t arr->descr->type_num,\n\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t itemsize,\n\t\t\t\t\t flags & FORTRAN,\n\t\t\t\t\t (PyObject *)arr);\n\t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t} \n\t\t/* If no copy then just increase the reference\n\t\t count and return the input */\n\t\telse { \n\t\t\tPy_INCREF(arr);\n\t\t\tret = arr;\n\t\t}\n\t}\n\t\n\t/* The desired output type is different than the input\n\t array type */\n\telse {\n\t\t/* Cast to the desired type if we can do it safely\n\t\t Also cast if source is a ndim-0 array to mimic\n\t\t behavior with Python scalars */\n\t\tif (flags & FORCECAST || PyArray_NDIM(arr)==0 ||\n\t\t PyArray_CanCastSafely(PyArray_TYPE(arr), type)) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_CastToType(arr, typecode);\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Array can not be safely cast \"\\\n\t\t\t\t\t\"to required type\");\n\t\t\tret = NULL;\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic int\n_array_typecode_fromstr(char *str, int *swap, PyArray_Typecode *type)\n{\n int type_num;\n char typechar;\n int size;\n unsigned long number = 1;\n char *s;\n char msg[] = \"unsupported typestring\";\n \n s = (char *)&number; /* s[0] == 0 implies big-endian */\n\n *swap = 0;\n\n if (str[0] == '<' || str[0] == '>') {\n\tif ((str[0] == '<') && (s[0] == 0)) *swap = 1;\n\telse if ((str[0] == '>') && (s[0] != 0)) *swap = 1;\n }\n str += 1;\n \n#define _MY_FAIL {\t\t\t\t \\\n\t PyErr_SetString(PyExc_ValueError, msg); \\\n\t return -1;\t\t\t \\\n }\t\t\n\n typechar = str[0];\n size = atoi(str + 1);\n switch (typechar) {\n case 'b':\n\t if (size == sizeof(Bool))\n\t\t type_num = PyArray_BOOL;\t \n\t else _MY_FAIL \n\t break;\t\t \n case 'u':\n if (size == sizeof(uintp))\n type_num = PyArray_UINTP;\n\t else if (size == sizeof(char))\n\t\t type_num = PyArray_UBYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_USHORT;\n\t else if (size == sizeof(int)) \n\t\t type_num = PyArray_UINT;\n\t else if (size == sizeof(ulong)) \n\t\t type_num = PyArray_ULONG;\n\t else if (size == sizeof(ulonglong))\n\t\t type_num = PyArray_ULONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'i':\n if (size == sizeof(intp))\n type_num = PyArray_INTP;\n\t else if (size == sizeof(char)) \n\t\t type_num = PyArray_BYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_SHORT;\n\t else if (size == sizeof(int))\n\t\t type_num = PyArray_INT;\n\t else if (size == sizeof(long)) \n\t\t type_num = PyArray_LONG;\n\t else if (size == sizeof(longlong))\n\t\t type_num = PyArray_LONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'f':\n\t if (size == sizeof(float))\n\t\t type_num = PyArray_FLOAT;\n\t else if (size == sizeof(double))\n\t\t type_num = PyArray_DOUBLE;\n\t else if (size == sizeof(longdouble))\n\t\t type_num = PyArray_LONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'c':\n\t if (size == sizeof(float)*2)\n\t\t type_num = PyArray_CFLOAT;\n\t else if (size == sizeof(double)*2)\n\t\t type_num = PyArray_CDOUBLE;\n\t else if (size == sizeof(longdouble)*2)\n\t\t type_num = PyArray_CLONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'O':\n\t if (size == sizeof(PyObject *))\n\t\t type_num = PyArray_OBJECT;\n\t else _MY_FAIL\n\t break;\n case 'S':\n\t type_num = PyArray_STRING;\n\t break;\n case 'U':\n\t type_num = PyArray_UNICODE;\n\t size *= sizeof(Py_UNICODE);\n\t break;\t \n case 'V':\n\t type_num = PyArray_VOID;\n\t break;\n default:\n\t _MY_FAIL\n }\n\n#undef _MY_FAIL\n\n type->type_num = type_num;\n type->itemsize = size;\n type->fortran = 0;\n return 0;\n}\n\nstatic PyObject *\narray_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n{\n\tPyObject *attr=NULL, *item=NULL, *r;\n\tPyArrayObject *ret=NULL;\n\tPyArray_Typecode type;\n\tchar *data;\n\tint buffer_len;\n\tint res, i, n;\n\tintp dims[MAX_DIMS], strides[MAX_DIMS];\n\tint swap;\n\n\t/* Get the memory from __array_data__ and __array_offset__ */\n\t/* Get the shape */\n\t/* Get the typestring -- ignore array_descr */\n\t/* Get the strides */\n\t\n\tattr = PyObject_GetAttrString(input, \"__array_data__\");\n\tif (attr == NULL) {\n\t\tPy_INCREF(input);\n\t\tattr = input;\n\t}\n\t\n\tres = PyObject_AsWriteBuffer(attr, (void **)&data, &buffer_len);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n\n\tattr = PyObject_GetAttrString(input, \"__array_typestr__\");\n\tif (!PyString_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_typestr__ must be a string.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\t\n\t}\n\tres = _array_typecode_fromstr(PyString_AS_STRING(attr), &swap, &type);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n \n\tattr = PyObject_GetAttrString(input, \"__array_shape__\");\n\tif (!PyTuple_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_shape__ must be a tuple.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\n\t}\n\tn = PyTuple_GET_SIZE(attr);\n\tfor (i=0; ibase = input;\n \n\tattr = PyObject_GetAttrString(input, \"__array_strides__\");\n\tif (attr != NULL && attr != Py_None) {\n\t\tif (!PyTuple_Check(attr)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"__array_strides__ must be a tuple.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tif (n != PyTuple_GET_SIZE(attr)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"mismatch in length of \"\\\n\t\t\t\t\t\"__array_strides__ and \"\\\n\t\t\t\t\t\"__array_shape__.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tfor (i=0; istrides, strides, n*sizeof(intp));\n\t}\n\n\tif (swap) {\n\t\tPyObject *tmp;\n\t\ttmp = PyObject_CallMethod((PyObject *)ret, \"byteswap\", \"\");\n\t\tPy_DECREF(tmp);\n\t}\n\n\tPyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);\n\tr = array_fromarray(ret, intype, flags);\n\tPy_DECREF(ret);\n\treturn r;\n}\n\nstatic PyObject *\narray_fromattr(PyObject *op, PyArray_Typecode *typecode, int flags) \n{\n PyObject *new, *r;\n\t \n if (typecode->type_num == PyArray_NOTYPE) {\n new = PyObject_CallMethod(op, \"__array__\", NULL);\n } else {\n new = PyObject_CallMethod(op, \"__array__\", \"i\", \n typecode->type_num);\n }\n if (new == NULL) return NULL;\n if (!PyArray_Check(new)) {\n PyErr_SetString(PyExc_ValueError, \n \"object __array__ method not \" \\\n \"producing an array.\");\n Py_DECREF(new);\n return NULL;\n }\n r = array_fromarray((PyArrayObject *)new, typecode, flags);\n Py_DECREF(new);\n return r;\n} \n\n\nstatic PyObject *\narray_fromobject(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth, int flags) \n{\n /* This is the main code to make a NumPy array from a Python\n Object. It is called from lot's of different places which\n is why there are so many checks. The comments try to\n explain some of the checks. */\n\n\tint type = typecode->type_num;\n PyObject *r=NULL;\n\n\t/* Is input object already an array? */\n\t/* This is where the flags are used */\n if (PyArray_Check(op)) \n\t\tr = array_fromarray((PyArrayObject *)op, typecode, flags);\n\telse if (PyObject_HasAttrString(op, \"__array__\")) {\n\t\t/* Code that returns the object to convert for a non\n\t\t multiarray input object from the __array__ attribute of the\n\t\t object. */\n r = array_fromattr(op, typecode, flags);\n\t}\n\telse if (PyObject_HasAttrString(op, \"__array_shape__\") &&\n\t\t PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tr = array_frominterface(op, typecode, flags);\n\t}\n\telse {\n\t\tif (type == PyArray_NOTYPE) {\n\t\t\t_array_find_type(op, NULL, typecode, MAX_DIMS);\n\t\t}\n\t\tif (PySequence_Check(op))\n\t\t\tr = Array_FromSequence(op, typecode, \n\t\t\t\t\t min_depth, max_depth);\n\t\telse\n\t\t\tr = Array_FromScalar(op, typecode);\n\t}\n\n /* If we didn't succed return NULL */\n if (r == NULL) return NULL;\n\t\n\t/* Be sure we succeed here */\n\t\n if(!PyArray_Check(r)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Internal error array_fromobject \"\\\n\t\t\t\t\"not producing an array\");\n\t\tPy_DECREF(r);\n return NULL;\n }\n\n if (min_depth != 0 && ((PyArrayObject *)r)->nd < min_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object of too small depth for desired array\");\n return NULL;\n }\n if (max_depth != 0 && ((PyArrayObject *)r)->nd > max_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object too deep for desired array\");\n return NULL;\n }\n return r;\n}\n\nstatic void\nPyArray_ArrayType(PyObject *op, PyArray_Typecode *intype, \n\t\t PyArray_Typecode *outtype) \n{\n\t_array_find_type(op, intype, outtype, MAX_DIMS);\n\treturn;\n}\n\nstatic int \nPyArray_ObjectType(PyObject *op, int minimum_type) \n{\n\tPyArray_Typecode intype, outtype;\n\tintype.type_num = minimum_type;\n\t_array_find_type(op, &intype, &outtype, MAX_DIMS);\n\treturn outtype.type_num;\n}\n\n\n\n/* flags is any of \n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough\n to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, and WRITEABLE\n and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, the returned array will be a copy of the object, \n (C) contiguous in memory, aligned, notswapped, and writeable.\n \n So CONTIGUOUS | ENSURECOPY passed in means that the returned\n array does not have to be CONTIGUOUS or a COPY but should be\n ALIGNED, NOTSWAPPED and WRITEABLE. \n\n typecode->fortran can be set to request a\n fortran-contiguous array. Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n*/\n\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n{\n \tPyArray_Typecode mine = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode *type;\n\t\n\tif (typecode == NULL) type = &mine;\n\telse type = typecode;\n\t\t\n\tif (requires & ENSURECOPY) {\n\t\trequires |= DEFAULT_FLAGS;\n\t}\n\t/* Ensure that type->fortran and flags & FORTRAN are the\n\t same */\n\tif (requires & FORTRAN) typecode->fortran = 1;\n\tif (type->fortran == 1) {\n\t\trequires |= FARRAY_FLAGS;\n\t\tif (min_depth > 2) requires &= ~CONTIGUOUS;\n\t}\n\n\t/* make sure itemsize is not 0 unless warranted. */\n\tif ((type->itemsize == 0) && (type->type_num != PyArray_NOTYPE)) {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type->type_num);\n\t\tif (descr != NULL) type->itemsize = descr->elsize;\n\t\telse return NULL;\n\t}\n\t\n\treturn array_fromobject(op, type, min_depth, max_depth, \n\t\t\t\trequires);\t\n}\n\n/* This is a quick wrapper around PyArray_FromAny(op, NULL, 0, 0, 0) */\n/* that special cases Arrays and PyArray_Scalars up front */\n/* It steals a reference to the object */\n\n/* Because it decrefs op if any conversion needs to take place \n -- so it can be used like PyArray_EnsureArray(some_function(...)) */\n\nstatic PyObject *\nPyArray_EnsureArray(PyObject *op)\n{\n PyObject *new;\n\n if (op == NULL) return NULL;\n\n if (PyArray_Check(op)) return op;\n\n if (PyArray_IsScalar(op, Generic)) {\n new = PyArray_FromScalar(op, NULL);\n Py_DECREF(op);\n return new;\n }\n new = PyArray_FromAny(op, NULL, 0, 0, 0);\n Py_DECREF(op);\n return new;\n}\n\n/* These are all compressed into a single API */\n/* Deprecated calls -- Use PyArray_FromAny */\n\nstatic PyObject *\nPyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, BEHAVED_FLAGS);\n}\n\nstatic PyObject *\nPyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n\t\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, DEFAULT_FLAGS);\n}\n\nstatic PyObject *\nPyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n\t\t\t ENSURECOPY);\n}\n\n/* End of deprecated */\n\n\nstatic int \nPyArray_CanCastSafely(int fromtype, int totype) \n{\n\tPyArray_Descr *from, *to;\n\n if (fromtype == totype) return 1;\n if (fromtype == PyArray_BOOL) return 1;\n\tif (totype == PyArray_BOOL) return 0;\n if (totype == PyArray_OBJECT || totype == PyArray_VOID) return 1;\n\tif (fromtype == PyArray_OBJECT || fromtype == PyArray_VOID) return 0;\n\n\tfrom = PyArray_DescrFromType(fromtype);\n\tto = PyArray_DescrFromType(totype);\n \n switch(fromtype) {\n case PyArray_BYTE:\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISUNSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_UBYTE:\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_FLOAT:\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\tif (PyTypeNum_ISCOMPLEX(totype)) \n\t\t\treturn ((to->elsize >> 1) >= from->elsize);\n\t\telse\n\t\t\treturn (totype > fromtype);\n case PyArray_CFLOAT:\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn (totype > fromtype);\n\tcase PyArray_STRING:\n\tcase PyArray_UNICODE:\n\t\treturn (totype > fromtype);\n default:\n return 0;\n }\n}\n\nstatic Bool\nPyArray_CanCastTo(PyArray_Typecode *from, PyArray_Typecode *to)\n{\n\tint fromtype=from->type_num;\n\tint totype=to->type_num;\n\tBool ret;\n\n\tret = (Bool) PyArray_CanCastSafely(fromtype, totype);\n\tif (ret) { /* Check String and Unicode more closely */\n\t\tif (fromtype == PyArray_STRING) {\n\t\t\tif (totype == PyArray_STRING) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t\telse if (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize * sizeof(Py_UNICODE)\\\n\t\t\t\t <= to->itemsize);\n\t\t\t}\n\t\t}\n\t\telse if (fromtype == PyArray_UNICODE) {\n\t\t\tif (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}\n\n\n\n/*********************** Element-wise Array Iterator ***********************/\n/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/\n/* and Python's array iterator ***/\n \n\nstatic PyObject *\nPyArray_IterNew(PyObject *obj)\n{\n PyArrayIterObject *it;\n\tint i, nd; \n\tPyArrayObject *ao = (PyArrayObject *)obj;\n\n if (!PyArray_Check(ao)) {\n PyErr_BadInternalCall();\n return NULL;\n }\n\n it = PyObject_GC_New(PyArrayIterObject, &PyArrayIter_Type);\n if (it == NULL)\n return NULL;\n\n\tnd = ao->nd;\n\tPyArray_UpdateFlags(ao, CONTIGUOUS);\n\tit->contiguous = 0;\n\tif PyArray_ISCONTIGUOUS(ao) it->contiguous = 1;\n Py_INCREF(ao);\n it->ao = ao;\n\tit->size = PyArray_SIZE(ao);\n\tit->nd_m1 = nd - 1;\n\tit->factors[nd-1] = 1;\n\tfor (i=0; i < nd; i++) {\n\t\tit->dims_m1[i] = it->ao->dimensions[i] - 1;\n\t\tit->strides[i] = it->ao->strides[i];\n\t\tit->backstrides[i] = it->strides[i] *\t\\\n\t\t\tit->dims_m1[i];\n\t\tif (i > 0)\n\t\t\tit->factors[nd-i-1] = it->factors[nd-i] *\t\\\n\t\t\t\tit->ao->dimensions[nd-i];\n\t}\n\tPyArray_ITER_RESET(it);\n\t\n PyObject_GC_Track(it);\n return (PyObject *)it;\n}\n\n/* Returns an array scalar holding the element desired */\n\nstatic PyObject *\narrayiter_next(PyArrayIterObject *it)\n{\n\tPyObject *ret;\n\n\tif (it->index < it->size) {\n\t\tret = PyArray_ToScalar(it->dataptr, it->ao);\n\t\tPyArray_ITER_NEXT(it);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narrayiter_dealloc(PyArrayIterObject *it)\n{\n PyObject_GC_UnTrack(it);\n Py_XDECREF(it->ao);\n PyObject_GC_Del(it);\n }\n\nstatic int\narrayiter_traverse(PyArrayIterObject *it, visitproc visit, void *arg)\n{\n if (it->ao != NULL)\n return visit((PyObject *)(it->ao), arg);\n return 0;\n}\n\n\nstatic int\niter_length(PyArrayIterObject *self) \n{\n return (int) self->size;\n}\n\n\nstatic PyObject *\niter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tint index, strides, itemsize;\n\tintp count=0;\n\tchar *dptr, *optr;\n\tPyObject *r;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn NULL;\n\t}\n\tindex = (ind->dimensions[0]);\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\t/* Get size of return array */\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0)\n\t\t\tcount++;\n\t\tdptr += strides;\n\t}\n\titemsize = self->ao->itemsize;\n\tr = PyArray_New(self->ao->ob_type, 1, &count, \n\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\titemsize, 0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\t/* Set up loop */\n\toptr = PyArray_DATA(r);\n\tindex = ind->dimensions[0];\n\tdptr = ind->data;\n\n copyswap = self->ao->descr->copyswap;\n\t/* Loop over Boolean array */\n\tswap = !(PyArray_ISNOTSWAPPED(self->ao));\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\t\toptr += itemsize;\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\nstatic PyObject *\niter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tintp num;\n\tPyObject *r;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint swap;\n\tchar *optr;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = self->ao->itemsize;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t}\n\t\n\tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n\t\t\tself->ao->descr->type_num, NULL, \n\t\t\tNULL, self->ao->itemsize, \n\t\t\t0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\toptr = PyArray_DATA(r);\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) {Py_DECREF(r); return NULL;}\n\tindex = ind_it->size;\n copyswap = PyArray_DESCR(r)->copyswap;\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif (num < 0 || num >= self->size) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\tPy_DECREF(r);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\toptr += itemsize;\n\t\tPyArray_ITER_NEXT(ind_it);\n\t}\n\tPy_DECREF(ind_it);\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\n\nstatic PyObject *\niter_subscript(PyArrayIterObject *self, PyObject *ind)\n{\n\tint i;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *r;\n\tchar *dptr;\n\tint size;\n\tPyObject *obj = NULL;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\t\t\n\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\tobj = iter_subscript(self, ind);\n\t\tPy_DECREF(ind);\n\t\treturn obj;\n\t}\n\n\t/* Tuples not accepted --- i.e. no NewAxis */\n\t/* Could implement this with adjusted strides\n\t and dimensions in iterator */\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\tPyArray_ITER_RESET(self);\n\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n\t\t\treturn PyArray_ToScalar(self->dataptr, self->ao);\n\t\t}\n\t\telse { /* empty array */\n\t\t\tintp ii = 0;\n\t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n\t\t\t\t\tself->ao->descr->type_num, NULL, \n\t\t\t\t\tNULL, self->ao->itemsize, 0,\n\t\t\t\t\t(PyObject *)self->ao);\n\t\t\treturn r;\t\t\t\n\t\t}\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) \n\t\t\tgoto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start)\n\t\tif (n_steps == SingleIndex) { /* Integer */\n\t\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn r;\n\t\t}\n\t\tsize = self->ao->itemsize;\n\t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n\t\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\t\tsize, 0, (PyObject *)self->ao);\n\t\tif (r==NULL) goto fail; \n\t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n copyswap = PyArray_DESCR(r)->copyswap;\n\t\twhile(n_steps--) {\n copyswap(dptr, self->dataptr, swap, size);\n\t\t\tfor(i=0; i< step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tdptr += size;\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer) || PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tr = iter_subscript_Bool(self, (PyArrayObject *)obj);\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tobj = new;\n\t\t\tr = iter_subscript_int(self, (PyArrayObject *)obj);\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"unsupported iterator index\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPy_DECREF(obj);\n\t\treturn r;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\n fail:\n\tPy_XDECREF(obj);\n\treturn NULL;\n\n}\n\n\nstatic int\niter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tint index, strides, itemsize;\n\tchar *dptr;\n PyArray_CopySwapFunc *copyswap;\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn -1;\n\t}\n\titemsize = self->ao->itemsize;\n\tindex = ind->dimensions[0];\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\tPyArray_ITER_RESET(self);\n\t/* Loop over Boolean array */\n copyswap = self->ao->descr->copyswap;\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(self->dataptr, val->dataptr, swap,\n itemsize);\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index==val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn 0;\n}\n\nstatic int\niter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tPyArray_Typecode typecode;\n\tintp num;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = typecode.itemsize = self->ao->itemsize;\n\ttypecode.type_num = self->ao->descr->type_num;\n copyswap = self->ao->descr->copyswap;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\treturn 0;\n\t}\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) return -1;\n\tindex = ind_it->size;\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif ((num < 0) || (num >= self->size)) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\treturn -1;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\tPyArray_ITER_NEXT(ind_it);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index == val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPy_DECREF(ind_it);\n\treturn 0;\n}\n\n\nstatic int\niter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) \n{\n\tint i;\n\tPyObject *arrval=NULL;\n\tPyArrayIterObject *val_it=NULL;\n\tPyArray_Typecode type;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint swap;\n\tint itemsize;\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *obj;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\ti = iter_ass_subscript(self, ind, val);\n\t\tPy_DECREF(ind);\n\t\treturn i;\n\t}\n\t\n\ttype.type_num = self->ao->descr->type_num;\n\titemsize = type.itemsize = self->ao->itemsize;\n\t\n\tarrval = PyArray_FromAny(val, &type, 0, 0, 0);\n\tif (arrval==NULL) return -1;\n\tval_it = (PyArrayIterObject *)PyArray_IterNew(arrval);\n\tif (val_it==NULL) goto fail;\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\n copyswap = PyArray_DESCR(arrval)->copyswap;\n\tswap = (PyArray_ISNOTSWAPPED(self->ao)!=PyArray_ISNOTSWAPPED(arrval));\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n copyswap(self->dataptr, PyArray_DATA(arrval), \n swap, itemsize);\n\t\t}\n\t\tgoto succeed;\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) goto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start);\n\t\tif (n_steps == SingleIndex) { /* Integer */\n copyswap(self->dataptr, PyArray_DATA(arrval),\n swap, itemsize);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\tgoto succeed;\n\t\t}\n\t\twhile(n_steps--) {\n copyswap(self->dataptr, val_it->dataptr,\n swap, itemsize);\n\t\t\tfor(i=0; i < step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tPyArray_ITER_NEXT(val_it);\n\t\t\tif (val_it->index == val_it->size) \n\t\t\t\tPyArray_ITER_RESET(val_it);\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\tgoto succeed;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer))\n\t\tobj = PyArray_FromScalar(ind, &indtype);\n\telse if (PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tif (iter_ass_sub_Bool(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tPy_DECREF(obj);\n\t\t\tobj = new;\n\t\t\tif (iter_ass_sub_int(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t}\n\t\telse goto fail;\n\t\tPy_DECREF(obj);\n\t\tgoto succeed;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\tgoto fail;\n\n succeed:\n\tPy_DECREF(val_it);\n\tPy_DECREF(arrval);\n\treturn 0;\n\n fail:\n\tPy_XDECREF(val_it);\n\tPy_XDECREF(arrval);\n\treturn -1;\n\t\n}\n\n\nstatic PyMappingMethods iter_as_mapping = {\n (inquiry)iter_length,\t\t /*mp_length*/\n (binaryfunc)iter_subscript,\t /*mp_subscript*/\n (objobjargproc)iter_ass_subscript,\t/*mp_ass_subscript*/\n};\n\nstatic char doc_iter_array[] = \"__array__(type=None)\\n Get array \"\\\n \"from iterator\";\n\nstatic PyObject *\niter_array(PyArrayIterObject *it, PyObject *op) \n{\n \n PyObject *r;\n intp size;\n\n /* Any argument ignored */\n\n /* Two options: \n 1) underlying array is contiguous\n -- return 1-d wrapper around it \n 2) underlying array is not contiguous\n -- make new 1-d contiguous array with updateifcopy flag set\n to copy back to the old array\n */\n\n size = PyArray_SIZE(it->ao);\n if (PyArray_ISCONTIGUOUS(it->ao)) {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n\t\t\t\tit->ao->flags,\n (PyObject *)it->ao); \n\t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, NULL, it->ao->itemsize, 0, \n (PyObject *)it->ao);\n\t\tif (r==NULL) return NULL;\n\t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n\t\t\tPy_DECREF(r); \n\t\t\treturn NULL;\n\t\t}\n PyArray_FLAGS(r) |= UPDATEIFCOPY;\n it->ao->flags &= ~WRITEABLE;\n }\n Py_INCREF(it->ao);\n PyArray_BASE(r) = (PyObject *)it->ao;\n return r;\n \n}\n\nstatic char doc_iter_copy[] = \"copy()\\n Get a copy of 1-d array\";\n\nstatic PyObject *\niter_copy(PyArrayIterObject *it, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\t\n\treturn PyArray_Flatten(it->ao, 0);\n}\n\nstatic PyMethodDef iter_methods[] = {\n /* to get array */\n {\"__array__\", (PyCFunction)iter_array, 1, doc_iter_array},\n\t{\"copy\", (PyCFunction)iter_copy, 1, doc_iter_copy},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\nstatic PyTypeObject PyArrayIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.flatiter\",\t\t /* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arrayiter_dealloc,\t\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0, \t\t\t /* tp_as_sequence */\n &iter_as_mapping, \t /* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0,\t \t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arrayiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arrayiter_next,\t\t/* tp_iternext */\n iter_methods,\t\t\t\t/* tp_methods */\n};\n\n/** END of Array Iterator **/\n\n\n\n/*********************** Subscript Array Iterator *************************\n * *\n * This object handles subscript behavior for array objects. *\n * It is an iterator object with a next method *\n * It abstracts the n-dimensional mapping behavior to make the looping *\n * code more understandable (maybe) *\n * and so that indexing can be set up ahead of time *\n */ \n\n/* This checks the args for any fancy indexing objects */\n\n#define SOBJ_NOTFANCY 0 \n#define SOBJ_ISFANCY 1\n#define SOBJ_BADARRAY 2\n#define SOBJ_TOOMANY 3\n#define SOBJ_LISTTUP 4\n\nstatic int\nfancy_indexing_check(PyObject *args)\n{\n\tint i, n;\n\tPyObject *obj;\n\tint retval = SOBJ_NOTFANCY;\n\n\tif (PyTuple_Check(args)) {\n\t\tn = PyTuple_GET_SIZE(args);\n\t\tif (n >= MAX_DIMS) return SOBJ_TOOMANY;\n\t\tfor (i=0; i=MAX_DIMS) return SOBJ_ISFANCY;\n\t\tfor (i=0; i SOBJ_ISFANCY) return retval;\n\t\t}\n\t}\n\n\treturn retval;\n}\n\n/* convert an indexing object to an INTP indexing array iterator\n if possible -- otherwise, it is a Slice or Ellipsis object\n and has to be interpreted on bind to a particular \n array so leave it NULL for now.\n */\nstatic int\n_convert_obj(PyObject *obj, PyArrayIterObject **iter)\n{\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tPyObject *arr;\n\n\tif (PySlice_Check(obj) || (obj == Py_Ellipsis))\n\t\t*iter = NULL;\n\telse {\n\t\tarr = PyArray_FromAny(obj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) return -1;\n\t\t*iter = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (*iter == NULL) return -1;\n\t}\n\treturn 0;\n}\n\n/* Adjust dimensionality and strides for index object iterators \n --- i.e. broadcast\n */\nstatic int\nPyArray_Broadcast(PyArrayMultiIterObject *mit)\n{\n\tint i, nd, k, j;\n\tintp tmp;\n\tPyArrayIterObject *it;\n\t\n\t/* Discover the broadcast number of dimensions */\n\tfor (i=0, nd=0; inumiter; i++) \n\t\tnd = MAX(nd, mit->iters[i]->ao->nd);\n\tmit->nd = nd;\n\n\t/* Discover the broadcast shape in each dimension */\n\tfor (i=0; idimensions[i] = 1;\n\t\tfor (j=0; jnumiter; j++) {\n\t\t\tit = mit->iters[j];\n\t\t\t/* This prepends 1 to shapes not already \n\t\t\t equal to nd */\n\t\t\tk = i + it->ao->nd - nd;\n\t\t\tif (k>=0) {\n\t\t\t\ttmp = it->ao->dimensions[k];\n\t\t\t\tif (tmp == 1) continue;\n\t\t\t\tif (mit->dimensions[i] == 1) \n\t\t\t\t\tmit->dimensions[i] = tmp;\n\t\t\t\telse if (mit->dimensions[i] != tmp) {\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\t\"index objects are \" \\\n\t\t\t\t\t\t\t\"not broadcastable \" \\\n\t\t\t\t\t\t\t\"to a single shape.\");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Reset the iterator dimensions and strides of each iterator\n\t object -- using 0 valued strides for broadcasting */\n\n\ttmp = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tmit->size = tmp;\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tit->nd_m1 = mit->nd - 1;\n\t\tit->size = tmp;\n\t\tnd = it->ao->nd;\n\t\tit->factors[mit->nd-1] = 1;\n\t\tfor (j=0; j < mit->nd; j++) {\n\t\t\tit->dims_m1[j] = mit->dimensions[j] - 1;\n\t\t\tk = j + nd - mit->nd;\n\t\t\t/* If this dimension was added or shape\n\t\t\t of underlying array was 1 */\n\t\t\tif ((k < 0) || \\\n\t\t\t it->ao->dimensions[k] != mit->dimensions[j]) {\n\t\t\t\tit->contiguous = 0;\n\t\t\t\tit->strides[j] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tit->strides[j] = it->ao->strides[k];\n\t\t\t}\n\t\t\tit->backstrides[j] = it->strides[j] *\t\\\n\t\t\t\tit->dims_m1[j];\n\t\t\tif (j > 0)\n\t\t\t\tit->factors[mit->nd-j-1] =\t\t\\\n\t\t\t\t\tit->factors[mit->nd-j] *\t\\\n\t\t\t\t\tmit->dimensions[mit->nd-j];\n\t\t}\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn 0;\n}\n\n/* Reset the map iterator to the beginning */\nstatic void\nPyArray_MapIterReset(PyArrayMapIterObject *mit)\n{\n\tint i,j; intp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index = 0;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\n\tif (mit->subspace != NULL) {\n\t\tmemcpy(coord, mit->bscoord, sizeof(intp)*mit->ait->ao->nd);\n\t\tPyArray_ITER_RESET(mit->subspace);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tj = mit->iteraxes[i];\n\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* This function needs to update the state of the map iterator\n and point mit->dataptr to the memory-location of the next object\n*/\nstatic void\nPyArray_MapIterNext(PyArrayMapIterObject *mit)\n{\n\tint i, j;\n\tintp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index += 1;\n\tif (mit->index >= mit->size) return;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\t/* Sub-space iteration */\n\tif (mit->subspace != NULL) {\n\t\tPyArray_ITER_NEXT(mit->subspace);\n\t\tif (mit->subspace->index == mit->subspace->size) {\n\t\t\t/* reset coord to coordinates of \n\t\t\t beginning of the subspace */\n\t\t\tmemcpy(coord, mit->bscoord, \n\t\t\t sizeof(intp)*mit->ait->ao->nd);\n\t\t\tPyArray_ITER_RESET(mit->subspace);\n\t\t\tfor (i=0; inumiter; i++) {\n\t\t\t\tit = mit->iters[i];\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t\tj = mit->iteraxes[i];\n\t\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t\t sizeof(intp));\n\t\t\t}\n\t\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\t}\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* Bind a mapiteration to a particular array */\n\n/* Determine if subspace iteration is necessary. If so, \n 1) Fill in mit->iteraxes\n\t 2) Create subspace iterator\n\t 3) Update nd, dimensions, and size. \n\n Subspace iteration is necessary if: arr->nd > mit->numiter\n*/\n\n/* Need to check for index-errors somewhere. \n\n Let's do it at bind time and also convert all <0 values to >0 here\n as well. \n*/\nstatic void\nPyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n{\n\tint subnd;\n\tPyObject *sub=NULL, *obj=NULL;\n\tint i, j, n, curraxis, ellipexp, noellip;\n\tPyArrayIterObject *it;\n\tintp dimsize;\n\tintp *indptr;\n\n\t/* Remove old binding if any */\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\n\tPy_XDECREF(mit->subspace);\n\tmit->subspace = NULL;\n\t\n\tsubnd = arr->nd - mit->numiter;\n\tif (subnd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Too many indices for array.\");\n\t\treturn;\n\t}\n\n\tmit->ait = (PyArrayIterObject *)PyArray_IterNew((PyObject *)arr);\n\tif (mit->ait == NULL) return;\n\n\t/* If this is just a view, then do nothing more */\n\t/* views are handled by just adjusting the strides\n\t and dimensions of the object.\n\t*/\n\t \n\tif (mit->view) return;\n\n\t/* no subspace iteration needed. Return */\n\tif (subnd == 0) {\n\t\tn = arr->nd;\n\t\tfor (i=0; iiteraxes[i] = i;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\t/* all indexing arrays have been converted to 0 \n\t therefore we can extract the subspace with a simple\n\t getitem call which will use view semantics\n\t*/\n\t\n\tsub = PyObject_GetItem((PyObject *)arr, mit->indexobj);\n\tif (sub == NULL) goto fail;\n\tmit->subspace = (PyArrayIterObject *)PyArray_IterNew(sub);\n\tif (mit->subspace == NULL) goto fail;\n\tPy_DECREF(sub);\n\n\t/* Expand dimensions of result */\n\tn = mit->subspace->ao->nd;\n\tfor (i=0; idimensions[mit->nd+i] = mit->subspace->ao->dimensions[i];\n\tmit->nd += n;\n\n\t/* Now, we still need to interpret the ellipsis and slice objects \n\t to determine which axes the indexing arrays are referring to\n\t*/\n\tn = PyTuple_GET_SIZE(mit->indexobj);\n\n\t/* The number of dimensions an ellipsis takes up */\n\tellipexp = arr->nd - n + 1;\n\t/* Now fill in iteraxes -- remember indexing arrays have been \n converted to 0's in mit->indexobj */\n\tcurraxis = 0;\n\tj = 0;\n\tnoellip = 1; /* Only expand the first ellipsis */\n\tmemset(mit->bscoord, '\\0', sizeof(intp)*arr->nd);\n\tfor (i=0; iindexobj, i);\n\t\tif (PyInt_Check(obj) || PyLong_Check(obj)) \n\t\t\tmit->iteraxes[j++] = curraxis++;\n\t\telse if (noellip && obj == Py_Ellipsis) {\n\t\t\tcurraxis += ellipexp;\n\t\t\tnoellip = 0;\n\t\t}\n\t\telse {\n\t\t\tint start=0;\n\t\t\tint stop, step;\n\t\t\t/* Should be slice object or\n\t\t\t another Ellipsis */\n\t\t\tif (obj == Py_Ellipsis) {\n\t\t\t\tmit->bscoord[curraxis] = 0;\n\t\t\t}\n\t\t\telse if (!PySlice_Check(obj) || \\\n\t\t\t\t (slice_GetIndices((PySliceObject *)obj, \n\t\t\t\t\t\t arr->dimensions[curraxis],\n\t\t\t\t\t\t &start, &stop, &step,\n\t\t\t\t\t\t &dimsize) < 0)) {\n\t\t\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t\t\t \"unexpected object \"\t\\\n\t\t\t\t\t \"(%s) in selection position %d\",\n\t\t\t\t\t obj->ob_type->tp_name, i);\n\t\t\t goto fail;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmit->bscoord[curraxis] = start;\n\t\t\t}\n\t\t\tcurraxis += 1; \n\t\t}\n\t}\n finish:\n\t/* Here check the indexes (now that we have iteraxes) */\n\tmit->size = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tPyArray_ITER_RESET(it);\n\t\tdimsize = arr->dimensions[mit->iteraxes[i]];\n\t\twhile(it->index < it->size) {\n\t\t\tindptr = ((intp *)it->dataptr);\n\t\t\tif (*indptr < 0) *indptr += dimsize;\n\t\t\tif (*indptr < 0 || *indptr >= dimsize) {\n\t\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t\t \"index (%d) out of range \"\\\n\t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n\t\t\t\t\t *indptr, dimsize-1, \n\t\t\t\t\t mit->iteraxes[i]);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn;\n\n fail:\n\tPy_XDECREF(sub);\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\treturn;\n}\n\n/* This function takes a Boolean array and constructs index objects and\n iterators as if nonzero(Bool) had been called\n*/\nstatic int\n_nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)\n{\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\tPyArrayObject *ba =NULL, *new=NULL;\n\tint nd, j;\n\tintp size, i, count;\n\tBool *ptr;\n\tintp coords[MAX_DIMS], dims_m1[MAX_DIMS];\n\tintp *dptr[MAX_DIMS];\n\n\tba = (PyArrayObject *)PyArray_FromAny(myBool, &typecode, 0, 0, \n\t\t\t\t\t CARRAY_FLAGS);\n\tif (ba == NULL) return -1;\n\tnd = ba->nd;\n\tfor (j=0; jdata;\n\tcount = 0;\n\n\t/* pre-determine how many nonzero entries there are */\n\tfor (i=0; iao->data;\n\t\tcoords[j] = 0;\n\t\tdims_m1[j] = ba->dimensions[j]-1;\n\t}\n\n\tptr = (Bool *)ba->data;\n\n\tif (count == 0) return nd;\n\n\t/* Loop through the Boolean array and copy coordinates\n\t for non-zero entries */\n\tfor (i=0; i=0; j--) {\n\t\t\tif (coords[j] < dims_m1[j]) {\n\t\t\t\tcoords[j]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcoords[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn nd;\n\n fail:\n\tfor (j=0; jiters[i] = NULL;\n \tmit->view = 0;\n \tmit->index = 0;\n \tmit->ait = NULL;\n \tmit->subspace = NULL;\n\tmit->numiter = 0;\n\tmit->consec = 1;\n\tfancy = fancy_indexing_check(indexobj);\n\tPy_INCREF(indexobj);\n\tmit->indexobj = indexobj;\n\tif (fancy == SOBJ_NOTFANCY) { /* bail out */\n\t\tmit->view = 1;\n\t\tgoto ret;\n\t}\n\n\tif (fancy == SOBJ_BADARRAY) {\n\t\tPyErr_SetString(PyExc_TypeError,\t\t\t\\\n\t\t\t\t\"Arrays used as indexes must be of \" \\\n\t\t\t\t\"integer type\");\n\t\tgoto fail;\n\t}\n\tif (fancy == SOBJ_TOOMANY) {\n\t\tPyErr_SetString(PyExc_TypeError,\"Too many indicies\");\n\t\tgoto fail;\n\t}\n\n\tif (fancy == SOBJ_LISTTUP) {\n\t\tPyObject *newobj;\n\t\tnewobj = PySequence_Tuple(indexobj);\n\t\tif (newobj == NULL) goto fail;\n\t\tPy_DECREF(indexobj);\n\t\tindexobj = newobj;\n\t\tmit->indexobj = indexobj;\n\t}\n\n#undef SOBJ_NOTFANCY \n#undef SOBJ_ISFANCY \n#undef SOBJ_BADARRAY \n#undef SOBJ_TOOMANY \n#undef SOBJ_LISTTUP \n\n\n\t/* Must have some kind of fancy indexing if we are here */\n\t/* indexobj is either a list, an arrayobject, or a tuple \n\t (with at least 1 list or arrayobject or Bool object), */\n\t\n\t/* convert all inputs to iterators */\n\tif (PyArray_Check(indexobj) &&\t\t\t\\\n\t (PyArray_TYPE(indexobj) == PyArray_BOOL)) {\n\t\tmit->numiter = _nonzero_indices(indexobj, mit->iters);\n\t\tif (mit->numiter < 0) goto fail;\n\t\tmit->nd = 1;\n\t\tmit->dimensions[0] = mit->iters[0]->dims_m1[0]+1;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = PyTuple_New(mit->numiter);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tPyTuple_SET_ITEM(mit->indexobj, i, \n\t\t\t\t\t PyInt_FromLong(0));\n\t\t}\n\t}\n\n\telse if (PyList_Check(indexobj) || PyArray_Check(indexobj)) {\n\t\tmit->numiter = 1;\n\t\tarr = PyArray_FromAny(indexobj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) goto fail;\n\t\tmit->iters[0] = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (mit->iters[0] == NULL) goto fail;\n\t\tmit->nd = PyArray_NDIM(arr);\n\t\tmemcpy(mit->dimensions,PyArray_DIMS(arr),mit->nd*sizeof(intp));\n\t\tmit->size = PyArray_SIZE(arr);\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = Py_BuildValue(\"(N)\", PyInt_FromLong(0));\n\t}\n\telse { /* must be a tuple */\n\t\tPyObject *obj;\n\t\tPyArrayIterObject *iter;\n\t\tPyObject *new;\n\t\t/* Make a copy of the tuple -- we will be replacing \n\t\t index objects with 0's */\n\t\tn = PyTuple_GET_SIZE(indexobj);\n\t\tnew = PyTuple_New(n);\n\t\tif (new == NULL) goto fail;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = new;\n\t\tstarted = 0;\n\t\tnonindex = 0;\n\t\tfor (i=0; iconsec = 0;\n\t\t\t\tmit->iters[(mit->numiter)++] = iter;\n\t\t\t\tPyTuple_SET_ITEM(new,i,\n\t\t\t\t\t\t PyInt_FromLong(0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (started) nonindex = 1;\n\t\t\t\tPy_INCREF(obj);\n\t\t\t\tPyTuple_SET_ITEM(new,i,obj);\n\t\t\t}\n\t\t}\n\t\t/* Store the number of iterators actually converted */\n\t\t/* These will be mapped to actual axes at bind time */\n\t\tif (PyArray_Broadcast((PyArrayMultiIterObject *)mit) < 0)\n\t\t\tgoto fail;\n\t}\n\n ret:\n PyObject_GC_Track(mit);\n return (PyObject *)mit;\n \n fail:\n\tPy_XDECREF(arr);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n\treturn NULL;\n}\n\n\n/* return unbound mapiter object */\n\nstatic PyObject *\narraymapiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) \n{\n\tPyObject *newtup, *res;\n\tint n;\n\n\tif (!PyTuple_Check(args)) {\n\t\tPyErr_BadInternalCall();\n\t\treturn NULL;\n\t}\n\n\tn = PyTuple_GET_SIZE(args);\n\t\n\tif (n < 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"must be initialized with >= 1 argument\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n > 1) {\n\t\tnewtup = PyTuple_GetSlice(args, 0, n);\n\t\tif (newtup == NULL) return NULL;\n\t\tres = PyArray_MapIterNew(newtup);\n\t\tPy_DECREF(newtup);\n\t}\n\telse { /* n == 1 */\n\t\tnewtup = PyTuple_GET_ITEM(args, 0);\n\t\tres = PyArray_MapIterNew(newtup);\n\t}\n\n\treturn res; \t\n}\n\n\n/* Returns a 0-dim array holding the element desired */\n\nstatic PyObject *\narraymapiter_next(PyArrayMapIterObject *mit)\n{\n\tPyObject *ret;\n\tif (mit->ait == NULL) return NULL;\n\tif (mit->view) return NULL;\n\tif (mit->index < mit->size) {\n\t\tret = PyArray_ToScalar(mit->dataptr, mit->ait->ao);\n\t\tPyArray_MapIterNext(mit);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narraymapiter_dealloc(PyArrayMapIterObject *mit)\n{\n\tint i;\n PyObject_GC_UnTrack(mit);\n Py_XDECREF(mit->ait);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n}\n\nstatic int\narraymapiter_traverse(PyArrayMapIterObject *mit, visitproc visit, void *arg)\n{\n\tint ret, i;\n if (mit->ait != NULL)\n if ((ret = visit((PyObject *)(mit->ait), arg)) != 0) \n\t\t\treturn ret;\t\n\n\tif (mit->iters != NULL) \n\t\tfor (i=0; inumiter; i++) \n\t\t\tif (mit->iters[i] != NULL) \n\t\t\t\tif ((ret=visit((PyObject *)mit->iters[i], \n\t\t\t\t\t arg)) != 0)\n\t\t\t\t\treturn ret;\n\n\tif (mit->indexobj != NULL)\n\t\tif ((ret = visit(mit->indexobj, arg)) != 0) return ret;\n\t\n return 0;\n}\n\n/* \nstatic char doc_mapiter_bind[] = \"obj.bind(a)\\n Bind an array to the \"\\\n\t\"mapiter object\";\n\nstatic PyObject *\nmapiter_bind(PyArrayMapIterObject *mit, PyObject *args)\n{\n\tPyObject *r;\n intp size, strides;\n int nd;\n\tPyArrayObject *arr;\n\n if (!PyArg_ParseTuple(args, \"O!\", &PyArray_Type, &arr)) return NULL;\n\n\tPyArray_MapIterBind(mit, arr);\n\n\tif (mit->ait == NULL) return NULL;\n\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyMethodDef mapiter_methods[] = {\n\t{\"bind\", (PyCFunction)mapiter_bind, 1, doc_mapiter_bind},\n {NULL,\t\tNULL}\t\t\n};\n*/\n\n\nstatic PyTypeObject PyArrayMapIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.mapiter\",\t\t \t/* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arraymapiter_dealloc,\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0,\t\t\t\t\t/* tp_as_sequence */\n 0,\t\t\t\t\t/* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0, \t\t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arraymapiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arraymapiter_next,\t/* tp_iternext */\n 0,\t \t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n 0,\t\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0, \t /* tp_alloc */\n (newfunc)arraymapiter_new,\t /* tp_new */\n 0,\t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n\n};\n\n/** END of Subscript Iterator **/\n\n\n\n", "source_code_before": " /*\n Provide multidimensional arrays as a basic object type in python. \n\nBased on Original Numeric implementation\nCopyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\nwith contributions from many Numeric Python developers 1995-2004 *\n\nHeavily modified in 2005 with inspiration from Numarray \n\nby\n\nTravis Oliphant\nAssistant Professor at\nBrigham Young University \n\nmaintainer email: oliphant.travis@ieee.org\n\nNumarray design (which provided guidance) by \nSpace Science Telescope Institute \n (J. Todd Miller, Perry Greenfield, Rick White)\n\n*/\n\n/* $Id: arrayobject.c,v 1.59 2005/09/14 00:14:00 teoliphant Exp $ */\n\n/*\n#include \"Python.h\"\n#include \"structmember.h\"\n\n#define _MULTIARRAYMODULE\n#include \"Numeric3/arrayobject.h\"\n*/\n\n/* Helper functions */\n\n#define error_converting(x) (((x) == -1) && PyErr_Occurred())\n\nstatic intp\nPyArray_PyIntAsIntp(PyObject *o)\n{\n\tlonglong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INTP, 0, 0};\n\tintp ret;\n\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((intp *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (longlong) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (longlong) PyLong_AsLongLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\t\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONGLONG != SIZEOF_PY_INTPTR_T)\n\tif ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C intp\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (intp) long_value;\n}\n\n\nstatic PyObject *array_int(PyArrayObject *v);\n\nstatic int\nPyArray_PyIntAsInt(PyObject *o)\n{\n\tlong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INT, 0, 0};\n\tint ret;\n\t\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((int *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (long) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (long) PyLong_AsLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONG != SIZEOF_INT)\n\tif ((long_value < INT_MIN) || (long_value > INT_MAX)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C int\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (int) long_value;\n}\n\n\nstatic double\nPyArray_GetPriority(PyObject *obj, double default_) \n{\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n\n\tif (PyArray_CheckExact(obj))\n\t\treturn priority;\n if (PyBigArray_CheckExact(obj)) \n return PyArray_BIG_PRIORITY;\n\n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n if (PyErr_Occurred()) {\n PyErr_Clear(); \n priority = default_;\n }\n Py_XDECREF(ret);\n return priority; \n}\n\n/* Backward compatibility only */\n/* In both Zero and One\n\n ***You must free the memory once you are done with it\n using PyDataMem_FREE(ptr) or you create a memory leak***\n\n If arr is an Object array you are getting a \n BORROWED reference to Zero or One.\n Do not DECREF.\n Please INCREF if you will be hanging on to it.\n\n The memory for the ptr still must be freed in any case;\n*/\n\nstatic char *\nPyArray_Zero(PyArrayObject *arr)\n{\n char *zeroval;\n char *buf;\n int buf_len;\n PyObject *obj, *ret;\n\n zeroval = PyDataMem_NEW(arr->itemsize);\n if (zeroval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n if (PyArray_ISOBJECT(arr)) {\n obj=PyInt_FromLong((long) 0);\n memcpy(zeroval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return zeroval;\n }\n ret = PyObject_GetAttrString((PyObject *)arr, \"_zero\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_zero not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n return NULL;\n }\n memcpy(zeroval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n memset(zeroval, 0, arr->itemsize);\n return zeroval;\n}\n\nstatic char *\nPyArray_One(PyArrayObject *arr)\n{\n char *oneval;\n char *buf;\n int buf_len, ret2;\n PyObject *obj, *ret;\n\n oneval = PyDataMem_NEW(arr->itemsize);\n if (oneval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n obj = PyInt_FromLong((long) 1);\n if (PyArray_ISOBJECT(arr)) {\n memcpy(oneval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return oneval;\n }\n \n ret = PyObject_GetAttrString((PyObject *)arr, \"_one\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_one not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n PyDataMem_FREE(oneval);\n return NULL;\n }\n memcpy(oneval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n\n ret2 = arr->descr->setitem(obj, oneval, arr);\n Py_DECREF(obj);\n if (ret < 0) {\n PyDataMem_FREE(oneval);\n return NULL;\n }\n return oneval;\n}\n\n/* End deprecated */\n\n\nstatic int \ndo_sliced_copy(char *dest, intp *dest_strides, intp *dest_dimensions,\n\t int dest_nd, char *src, intp *src_strides, \n\t intp *src_dimensions, int src_nd, int elsize, \n\t int copies) {\n intp i, j;\n\t\n if (src_nd == 0 && dest_nd == 0) {\n for(j=0; j src_nd) {\n for(i=0; i<*dest_dimensions; i++, dest += *dest_strides) {\n if (do_sliced_copy(dest, dest_strides+1, \n dest_dimensions+1, dest_nd-1,\n src, src_strides, \n src_dimensions, src_nd, \n elsize, copies) == -1) \n return -1;\n }\n return 0;\n }\n\t\n if (dest_nd == 1) {\n if (*dest_dimensions != *src_dimensions) {\n PyErr_SetString(PyExc_ValueError, \n \"matrices are not aligned for copy\");\n return -1;\n }\n for(i=0; i<*dest_dimensions; i++, src += *src_strides) {\n for(j=0; j 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize) && \n ((*src_strides)[*src_nd-1] == *elsize)) {\n if ((*dest_dimensions)[*dest_nd-1] != \n (*src_dimensions)[*src_nd-1]) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"matrices are not aligned\");\n return -1;\n }\n *elsize *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1; *src_nd-=1;\n } else {\n break;\n }\n }\n if (*src_nd == 0) {\n while (*dest_nd > 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize)) {\n *copies *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1;\n } else {\n break;\n }\n }\n }\n return 0;\n}\n\nstatic char *\ncontiguous_data(PyArrayObject *src) \n{\n intp dest_strides[MAX_DIMS], *dest_strides_ptr;\n intp *dest_dimensions=src->dimensions;\n int dest_nd=src->nd;\n intp *src_strides = src->strides;\n intp *src_dimensions=src->dimensions;\n int src_nd=src->nd;\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n intp stride=elsize;\n char *new_data;\n\t\n for(i=dest_nd-1; i>=0; i--) {\n dest_strides[i] = stride;\n stride *= dest_dimensions[i];\n }\n\t\n dest_strides_ptr = dest_strides;\n\t\n if (optimize_slices(&dest_strides_ptr, &dest_dimensions, &dest_nd,\n &src_strides, &src_dimensions, &src_nd,\n &elsize, &copies) == -1) \n return NULL;\n\t\n new_data = (char *)malloc(stride);\n\t\n ret = do_sliced_copy(new_data, dest_strides_ptr, dest_dimensions, \n dest_nd, src->data, src_strides, \n src_dimensions, src_nd, elsize, copies);\n\t\n if (ret != -1) { return new_data; }\n else { free(new_data); return NULL; }\n}\n\n/* end Helper functions */\n\n\nstatic PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n int, intp *, char *, int, int, PyObject *);\n\n/* C-API functions */\n\n/* Used for arrays of python objects to increment the reference count of */\n/* every python object in the array. */\nstatic int \nPyArray_INCREF(PyArrayObject *mp) \n{\n\tintp i, n;\n\n PyObject **data, **data2;\n\t\n if (mp->descr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data;\n for(i=0; idescr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data; \n for(i=0; i 0; n--, a += 1) {\n b = a + 1;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 4:\n for (a = (char*)p ; n > 0; n--, a += 2) {\n b = a + 3;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 8:\n for (a = (char*)p ; n > 0; n--, a += 4) {\n b = a + 7;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n default:\n m = size / 2;\n for (a = (char *)p ; n > 0; n--, a += m) {\n b = a + (size-1);\n for (j=0; j 1, then dst must be contiguous */\nstatic void\ncopy_and_swap(void *dst, void *src, int itemsize, intp numitems,\n intp srcstrides, int swap) \n{\n int i;\n char *s1 = (char *)src;\n char *d1 = (char *)dst;\n \n\n if ((numitems == 1) || (itemsize == srcstrides)) \n memcpy(d1, s1, itemsize*numitems);\n else { \n for (i = 0; i < numitems; i++) {\n memcpy(d1, s1, itemsize);\n d1 += itemsize;\n s1 += srcstrides;\n } \n }\n\n if (swap)\n byte_swap_vector(d1, numitems, itemsize);\n}\n\n\n/* Computer-generated arraytype and scalartype code */\n#include \"scalartypes.inc\"\n#include \"arraytypes.inc\"\n\nstatic char *\nindex2ptr(PyArrayObject *mp, int i) \n{\n\tif (i==0 && (mp->nd == 0 || mp->dimensions[0] > 0)) \n\t\treturn mp->data;\n\t\n if (mp->nd>0 && i>0 && i < mp->dimensions[0]) {\n return mp->data+i*mp->strides[0];\n }\n PyErr_SetString(PyExc_IndexError,\"index out of bounds\");\n return NULL;\n}\n\nstatic intp \nPyArray_Size(PyObject *op) \n{\n if (PyArray_Check(op)) {\n return PyArray_SIZE((PyArrayObject *)op);\n } \n\telse {\n return 0;\n }\n}\n\n/* If destination is not the right type, then src \n will be cast to destination. \n*/\n\n/* Does a flat iterator-based copy. \n\n The arrays are assumed to have the same number of elements\n They can be different sizes and have different types however. \n*/\n\nstatic int\nPyArray_CopyInto(PyArrayObject *dest, PyArrayObject *src)\n{\n intp dsize, ssize, sbytes;\n\tint ncopies, elsize, index;\n PyArrayIterObject *dit=NULL;\n PyArrayIterObject *sit=NULL;\n\tchar *dptr;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n PyArray_CopySwapNFunc *copyswapn;\n \n if (!PyArray_ISWRITEABLE(dest)) {\n PyErr_SetString(PyExc_RuntimeError, \n \"Cannot write to array.\");\n return -1;\n }\n\n if (!PyArray_EquivArrTypes(dest, src)) {\n return PyArray_CastTo(dest, src);\n }\n\n dsize = PyArray_SIZE(dest);\n ssize = PyArray_SIZE(src);\n\tif (ssize == 0) return 0;\n if (dsize % ssize != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Destination number of elements must be\"\\\n \"an integer multiple of the source number of\"\\\n \"elements.\");\n return -1;\n }\n ncopies = dsize / ssize;\n\n\tswap = PyArray_ISNOTSWAPPED(dest) != PyArray_ISNOTSWAPPED(src);\n\tcopyswap = dest->descr->copyswap;\n\tcopyswapn = dest->descr->copyswapn;\n\n elsize = dest->itemsize;\n\n if ((PyArray_ISCONTIGUOUS(dest) && PyArray_ISCONTIGUOUS(src)) \\\n\t || (PyArray_ISFORTRAN(dest) && PyArray_ISFORTRAN(src))) {\n \n PyArray_XDECREF(dest);\n dptr = dest->data;\n sbytes = ssize * src->itemsize;\n while(ncopies--) {\n memmove(dptr, src->data, sbytes);\n dptr += sbytes;\n }\n\t\tif (swap)\n\t\t\tcopyswapn(dest->data, NULL, dsize, 1, elsize);\n PyArray_INCREF(dest);\n return 0;\n }\n\n dit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)dest);\n sit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)src);\n\n if ((dit == NULL) || (sit == NULL)) {\n Py_XDECREF(dit);\n Py_XDECREF(sit);\n return -1;\n }\n\n PyArray_XDECREF(dest);\n while(ncopies--) {\n index = ssize;\n while(index--) {\n memmove(dit->dataptr, sit->dataptr, elsize);\n\t\t\tif (swap)\n\t\t\t\tcopyswap(dit->dataptr, NULL, 1, elsize);\n PyArray_ITER_NEXT(dit);\n PyArray_ITER_NEXT(sit);\n }\n PyArray_ITER_RESET(sit);\n } \n PyArray_INCREF(dest);\n Py_DECREF(dit);\n Py_DECREF(sit);\n\treturn 0;\n}\n\n\nstatic int \nPyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) \n{\n PyArrayObject *src;\n int ret;\n\tPyArray_Typecode typecode = {dest->descr->type_num, \n\t\t\t\t dest->itemsize, \n\t\t\t\t PyArray_ISFORTRAN(dest)};\n\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n\t\t\t\t\t &typecode, 0,\n\t\t\t\t\t dest->nd, 0);\n if (src == NULL) return -1;\n\n ret = PyArray_CopyInto(dest, src);\n Py_DECREF(src);\n return ret;\n}\n\n\n/* These are also old calls (should use PyArray_New) */\n\n/* They all zero-out the memory as previously done */\n\nstatic PyObject *\nPyArray_FromDimsAndDataAndDescr(int nd, int *d, \n PyArray_Descr *descr,\n char *data) {\n\tPyObject *ret;\n\n#if SIZEOF_INTP != SIZEOF_INT\n\tint i;\n\tintp newd[MAX_DIMS];\n\t\n\tfor (i=0; itype_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#else\n\tret = PyArray_New(&PyArray_Type, nd, (intp *)d, \n descr->type_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#endif\n\tif (descr->type_num != PyArray_OBJECT)\n\t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_FromDimsAndData(int nd, int *d, int type, char *data) \n{\n\tPyObject *ret;\n#if SIZEOF_INTP != SIZEOF_INT\n\tintp newd[MAX_DIMS];\n\tint i;\t\n\tfor (i=0; iob_type, m1->nd, \n\t\t\t\t\t m1->dimensions,\n\t\t\t\t\t m1->descr->type_num,\n\t\t\t\t\t NULL, NULL, m1->itemsize,\n\t\t\t\t\t 0, (PyObject *)m1);\n\t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n\t\n return (PyObject *)ret;\n}\n\n\nstatic PyObject *array_item(PyArrayObject *, int);\n\nstatic PyObject *\nPyArray_Scalar(char *data, int type_num, int itemsize, int swap)\n{\n PyArray_Descr *descr;\n\tPyTypeObject *type;\n\tPyObject *obj;\t\n\tchar *destptr;\n PyArray_CopySwapFunc *copyswap;\n\n descr = PyArray_DescrFromType(type_num);\n if (descr == NULL) return NULL;\n type = descr->typeobj;\n copyswap = descr->copyswap;\n\tif (type_num == PyArray_STRING) \n\t\tobj = type->tp_alloc(type, itemsize);\n\telse\n\t\tobj = type->tp_alloc(type, 0);\n\tif (obj == NULL) return NULL;\n\tif PyTypeNum_ISFLEXIBLE(type_num) { \n\t\tif (type_num == PyArray_STRING) {\n\t\t\tdestptr = PyString_AS_STRING(obj);\n\t\t\t((PyStringObject *)obj)->ob_shash = -1;\n\t\t\t((PyStringObject *)obj)->ob_sstate =\t\\\n\t\t\t\tSSTATE_NOT_INTERNED; \n\t\t}\n\t\telse {\n\t\t\tdestptr = PyDataMem_NEW(itemsize);\n\t\t\tif (destptr == NULL) {\n\t\t\t\tPyObject_Del(obj);\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tif (type_num == PyArray_UNICODE) {\n\t\t\t\tPyUnicode_AS_UNICODE(obj) = \\\n\t\t\t\t\t(Py_UNICODE *)destptr;\n\t\t\t\t((PyUnicodeObject*)obj)->length = itemsize / \\\n\t\t\t\t\tsizeof(Py_UNICODE);\n\t\t\t\t((PyUnicodeObject*)obj)->hash = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t((PyVoidScalarObject *)obj)->obval = destptr;\n\t\t\t\t((PyVoidScalarObject *)obj)->ob_size = itemsize;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tdestptr = &(((PyScalarObject*)obj)->obval);\n\t}\n\t/* copyswap for OBJECT increments the reference count */\n copyswap(destptr, data, swap, itemsize);\n\treturn obj;\n}\n\n/* returns an Array-Scalar Object of the type of arr\n from the given pointer to memory -- main Scalar creation function\n default new method calls this. \n*/\nstatic PyObject *\nPyArray_ToScalar(char *data, PyArrayObject *arr)\n{\n\tint type_num = arr->descr->type_num;\n\tint itemsize = arr->itemsize;\n int swap = !(PyArray_ISNOTSWAPPED(arr));\n\n\treturn PyArray_Scalar(data, type_num, itemsize, swap);\n}\n\n\n/* Return Python scalar if 0-d array object is encountered */\n\nstatic PyObject *\nPyArray_Return(PyArrayObject *mp) \n{\n \n\tif (mp == NULL) return NULL;\n\n if (PyErr_Occurred()) {\n Py_XDECREF(mp);\n return NULL;\n }\n\n\tif (PyArray_Check((PyObject *)mp) && mp->nd == 0) {\n\t\tPyObject *ret;\n\t\tret = PyArray_ToScalar(mp->data, mp);\n\t\tPy_DECREF(mp);\n\t\treturn ret;\n\t}\n\telse {\n\t\treturn (PyObject *)mp;\n\t}\n}\n\n/*\n returns typenum to associate with this type >=PyArray_USERDEF.\n Also creates a copy of the VOID_DESCR table inserting it's typeobject in\n and it's typenum in the appropriate place.\n \n needs the userdecrs table and PyArray_NUMUSER variables\n defined in arratypes.inc\n*/\nstatic int \nPyArray_RegisterDataType(PyTypeObject *type)\n{\n\tPyArray_Descr *descr;\n\tint typenum;\n\tint i;\n\t\n\tif ((type == &PyVoidArrType_Type) ||\t\t\t\\\n\t !PyType_IsSubtype(type, &PyVoidArrType_Type)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can only register void subtypes.\");\n\t\treturn -1;\n\t}\n\t/* See if this type is already registered */\n\tfor (i=0; itypeobj == type)\n\t\t\treturn descr->type_num;\n\t}\n\tdescr = malloc(sizeof(PyArray_Descr));\n\tmemcpy(descr, PyArray_DescrFromType(PyArray_VOID), \n\t sizeof(PyArray_Descr));\n\ttypenum = PyArray_USERDEF + PyArray_NUMUSERTYPES;\n\tdescr->type_num = typenum;\n\tdescr->typeobj = type;\n\tuserdescrs = realloc(userdescrs, \n\t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n if (userdescrs == NULL) {\n PyErr_SetString(PyExc_MemoryError, \"RegisterDataType\");\n return -1;\n }\n\tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n\treturn typenum;\n}\n\n\n/* \n copyies over from the old descr table for anything\n NULL or zero in what is given. \n frees the copy of the Descr_table already there.\n places a pointer to the new one into the slot.\n*/\nstatic int\nPyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n{\n\tPyArray_Descr *old;\n\tint i;\n\n\tif (!PyArray_ISUSERDEF(typenum)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Data type not registered.\");\n\t\treturn -1;\n\t}\n\told = userdescrs[typenum-PyArray_USERDEF];\n\tdescr->typeobj = old->typeobj;\n\tdescr->type_num = typenum;\n\n#define _NULL_CHECK(member) \\\n\tif (descr->member == NULL) descr->member = old->member\n\n\tfor (i=0; imember == 0) descr->member = old->member\n\n\t_ZERO_CHECK(kind);\n\t_ZERO_CHECK(type);\n\t_ZERO_CHECK(elsize);\n\t_ZERO_CHECK(alignment);\n#undef _ZERO_CHECK\n\n\tfree(old);\n\tuserdescrs[typenum-PyArray_USERDEF] = descr;\n\treturn 0;\n}\n\n\nstatic int\nPyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) \n{\n intp size;\n intp n, n2;\n int n3, n4;\n PyArrayIterObject *it;\n PyObject *obj, *strobj, *tupobj;\n\n n3 = strlen((const char *)sep);\n if (n3 == 0) { /* binary data */\n if (PyArray_ISOBJECT(self)) {\n PyErr_SetString(PyExc_ValueError, \"Cannot write \"\\\n\t\t\t\t\t\"object arrays to a file in \"\\\n\t\t\t\t\t\"binary mode.\");\n return -1;\n }\n\n if (PyArray_ISCONTIGUOUS(self)) {\n size = PyArray_SIZE(self);\n if ((n=fwrite((const void *)self->data, \n (size_t) self->itemsize,\n (size_t) size, fp)) < size) {\n PyErr_Format(PyExc_ValueError, \n \"%ld requested and %ld written\",\n (long) size, (long) n);\n return -1;\n }\n }\n else {\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n while(it->index < it->size) {\n if (fwrite((const void *)it->dataptr, \n (size_t) self->itemsize,\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n \" %d to file\", it->index);\n Py_DECREF(it);\n return -1;\n }\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n } \n }\n else { /* text data */\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n\t\tn4 = strlen((const char *)format);\n while(it->index < it->size) {\n obj = self->descr->getitem(it->dataptr, self);\n if (obj == NULL) {Py_DECREF(it); return -1;}\n\t\t\tif (n4 == 0) { /* standard writing */\n\t\t\t\tstrobj = PyObject_Str(obj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n\t\t\telse { /* use format string */\n\t\t\t\ttupobj = PyTuple_New(1);\n\t\t\t\tif (tupobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t\tPyTuple_SET_ITEM(tupobj,0,obj);\n\t\t\t\tobj = PyString_FromString((const char *)format);\n\t\t\t\tif (obj == NULL) {Py_DECREF(tupobj); \n\t\t\t\t\tPy_DECREF(it); return -1;}\n\t\t\t\tstrobj = PyString_Format(obj, tupobj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tPy_DECREF(tupobj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n if ((n=fwrite(PyString_AS_STRING(strobj), \n 1, n2=PyString_GET_SIZE(strobj),\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n \" to file\", it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n }\n /* write separator for all but last one */\n if (it->index != it->size-1) \n fwrite(sep, 1, n3, fp);\n Py_DECREF(strobj);\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n return 0;\n}\n\nstatic PyObject *\nPyArray_ToList(PyArrayObject *self) \n{\n PyObject *lp;\n PyArrayObject *v;\n intp sz, i;\n\t\n if (!PyArray_Check(self)) return (PyObject *)self;\n\n if (self->nd == 0) \n\t\treturn self->descr->getitem(self->data,self);\n\t\n sz = self->dimensions[0];\n lp = PyList_New(sz);\n\t\n for (i=0; ind >= self->nd) {\n\t\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\t\"array_item not returning smaller\" \\\n\t\t\t\t\t\" dimensional array\");\n\t\t\tPy_DECREF(lp);\n\t\t\treturn NULL;\n\t\t}\n PyList_SetItem(lp, i, PyArray_ToList(v));\n\t\tPy_DECREF(v);\n }\n\t\n return lp;\n}\n\nstatic PyObject *\nPyArray_ToString(PyArrayObject *self)\n{\n intp numbytes;\n intp index;\n char *dptr;\n int elsize;\n PyObject *ret;\n PyArrayIterObject *it;\n \n if (PyArray_TYPE(self) == PyArray_OBJECT) {\n PyErr_SetString(PyExc_ValueError, \"a string for the data\"\\\n\t\t\t\t\"in an object array is not appropriate.\");\n return NULL;\n }\n\n numbytes = PyArray_NBYTES(self);\n if (PyArray_ISONESEGMENT(self)) {\n ret = PyString_FromStringAndSize(self->data, (int) numbytes);\n }\n else {\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it==NULL) return NULL;\n ret = PyString_FromStringAndSize(NULL, (int) numbytes);\n if (ret == NULL) {Py_DECREF(it); return NULL;}\n dptr = PyString_AS_STRING(ret);\n index = it->size;\n elsize = self->itemsize;\n while(index--) {\n memcpy(dptr, it->dataptr, elsize);\n dptr += elsize;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n\treturn ret;\n}\n\n\n/*********************** end C-API functions **********************/\n\n\n/* array object functions */\n\nstatic void \narray_dealloc(PyArrayObject *self) {\n\n if (self->weakreflist != NULL)\n PyObject_ClearWeakRefs((PyObject *)self);\n\n if(self->base) {\n\t\t/* UPDATEIFCOPY means that base points to an \n\t\t array that should be updated with the contents\n\t\t of this array upon destruction.\n self->base->flags must have been WRITEABLE \n (checked previously) and it was locked here\n thus, unlock it.\n\t\t*/\n\t\tif (self->flags & UPDATEIFCOPY) {\n ((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tPy_INCREF(self); /* hold on to self in next call */\n PyArray_CopyInto((PyArrayObject *)self->base, self);\n\t\t\t/* Don't need to DECREF -- because we are deleting\n\t\t\t self already... */\n\t\t}\n\t\t/* In any case base is pointing to something that we need\n\t\t to DECREF -- either a view or a buffer object */\n Py_DECREF(self->base);\n }\n \n if ((self->flags & OWN_DATA) && (self->data != NULL)) {\n\t\t/* Free internal references if an Object array */\n\t\tPyArray_XDECREF(self);\n\n PyDataMem_FREE(self->data);\n }\n\t\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t}\n\t\n self->ob_type->tp_free((PyObject *)self);\n}\n\n/*************************************************************************\n **************** Implement Mapping Protocol ***************************\n *************************************************************************/\n\nstatic int \narray_length(PyArrayObject *self) \n{\n if (self->nd != 0) {\n return self->dimensions[0];\n } else {\n\t\tPyErr_SetString(PyExc_TypeError, \"len() of unsized object.\");\n\t\treturn -1;\n }\n}\n\n\nstatic PyObject *\narray_item(PyArrayObject *self, int i) \n{\n char *item;\n PyArrayObject *r;\n\n\n\tif(self->nd == 0) {\n\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\"0-d arrays can't be indexed.\");\n\t\treturn NULL;\n\t}\n if ((item = index2ptr(self, i)) == NULL) return NULL;\n\n\tr = (PyArrayObject *)PyArray_New(self->ob_type, \n\t\t\t\t\t self->nd-1, self->dimensions+1, \n\t\t\t\t\t self->descr->type_num, \n\t\t\t\t\t self->strides+1, item, \n\t\t\t\t\t self->itemsize, self->flags,\n\t\t\t\t\t (PyObject *)self);\n\tif (r == NULL) return NULL;\n\tPy_INCREF(self);\n\tr->base = (PyObject *)self;\n PyArray_UpdateFlags(r, CONTIGUOUS | FORTRAN);\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_item_nice(PyArrayObject *self, int i) \n{\n\treturn PyArray_Return((PyArrayObject *)array_item(self, i));\n}\n\n\nstatic int \narray_ass_item(PyArrayObject *self, int i, PyObject *v) \n{\n PyArrayObject *tmp;\n char *item;\n int ret;\n\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n if (i < 0) i = i+self->dimensions[0];\n\n if (self->nd > 1) {\n if((tmp = (PyArrayObject *)array_item(self, i)) == NULL)\n return -1;\n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n return ret; \n }\n\t\n if ((item = index2ptr(self, i)) == NULL) return -1;\n if (self->descr->setitem(v, item, self) == -1) return -1;\n return 0;\n}\n\n/* -------------------------------------------------------------- */\nstatic int\nslice_coerce_index(PyObject *o, int *v)\n{\n\t*v = PyArray_PyIntAsInt(o);\n\tif (error_converting(*v)) {\n\t\tPyErr_Clear();\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\n/* This is basically PySlice_GetIndicesEx, but with our coercion\n * of indices to integers (plus, that function is new in Python 2.3) */\nstatic int\nslice_GetIndices(PySliceObject *r, int length,\n int *start, int *stop, int *step,\n intp *slicelength)\n{\n\tint defstart, defstop;\n\t\n\tif (r->step == Py_None) {\n\t\t*step = 1;\n\t} else {\n\t\tif (!slice_coerce_index(r->step, step)) return -1;\n\t\tif (*step == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"slice step can not be zero\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tdefstart = *step < 0 ? length - 1 : 0;\n\tdefstop = *step < 0 ? -1 : length;\n\t\n\tif (r->start == Py_None) {\n\t\t*start = *step < 0 ? length-1 : 0;\n\t} else {\n\t\tif (!slice_coerce_index(r->start, start)) return -1;\n\t\tif (*start < 0) *start += length;\n\t\tif (*start < 0) *start = (*step < 0) ? -1 : 0;\n\t\tif (*start >= length) {\n\t\t\t*start = (*step < 0) ? length - 1 : length;\n\t\t}\n\t}\n\t\n\tif (r->stop == Py_None) {\n\t\t*stop = defstop;\n\t} else {\n\t\tif (!slice_coerce_index(r->stop, stop)) return -1;\n\t\tif (*stop < 0) *stop += length;\n if (*stop < 0) *stop = -1;\n if (*stop > length) *stop = length;\n\t}\n\t\n\tif ((*step < 0 && *stop >= *start) || \\\n\t (*step > 0 && *start >= *stop)) {\n\t\t*slicelength = 0;\n\t} else if (*step < 0) {\n\t\t*slicelength = (*stop - *start + 1) / (*step) + 1;\n\t} else {\n\t\t*slicelength = (*stop - *start - 1) / (*step) + 1;\n\t}\n\t\n\treturn 0;\n}\n\n#define PseudoIndex -1\n#define RubberIndex -2\n#define SingleIndex -3\n\nstatic int\nparse_subindex(PyObject *op, int *step_size, intp *n_steps, int max)\n{\n\tint index;\n\t\n\tif (op == Py_None) {\n\t\t*n_steps = PseudoIndex;\n\t\tindex = 0;\n\t} else if (op == Py_Ellipsis) {\n\t\t*n_steps = RubberIndex;\n\t\tindex = 0;\n\t} else if (PySlice_Check(op)) {\n\t\tint stop;\n\t\tif (slice_GetIndices((PySliceObject *)op, max,\n\t\t\t\t &index, &stop, step_size, n_steps) < 0) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"invalid slice\");\n\t\t\t}\n\t\t\tgoto fail;\n\t\t}\n\t\tif (*n_steps <= 0) {\n\t\t\t*n_steps = 0;\n\t\t\t*step_size = 1;\n\t\t\tindex = 0;\n\t\t}\n\t} else {\n\t\tindex = PyArray_PyIntAsInt(op);\n\t\tif (error_converting(index)) {\n\t\t\tPyErr_SetString(PyExc_IndexError,\n\t\t\t\t\t\"each subindex must be either a \"\\\n\t\t\t\t\t\"slice, an integer, Ellipsis, or \"\\\n\t\t\t\t\t\"newaxis\");\n\t\t\tgoto fail;\n\t\t}\n\t\t*n_steps = SingleIndex;\n\t\t*step_size = 0;\n\t\tif (index < 0) index += max;\n\t\tif (index >= max || index < 0) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \"invalid index\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn index;\n fail:\n\treturn -1;\n}\n\n\nstatic int \nparse_index(PyArrayObject *self, PyObject *op, \n intp *dimensions, intp *strides, intp *offset_ptr)\n{\n int i, j, n;\n int nd_old, nd_new, start, offset, n_add, n_pseudo;\n int step_size;\n\tintp n_steps;\n PyObject *op1=NULL;\n int is_slice;\n\n\n if (PySlice_Check(op) || op == Py_Ellipsis || op == Py_None) {\n n = 1;\n op1 = op;\n Py_INCREF(op);\t\n /* this relies on the fact that n==1 for loop below */\n is_slice = 1;\n }\n else {\n if (!PySequence_Check(op)) {\n PyErr_SetString(PyExc_IndexError, \n \"index must be either an int \"\\\n \"or a sequence\");\n return -1;\n }\n n = PySequence_Length(op);\n is_slice = 0;\n }\n\t\n nd_old = nd_new = 0;\n\t\n offset = 0;\n for(i=0; ind ? \\\n self->dimensions[nd_old] : 0);\n Py_DECREF(op1);\n if (start == -1) break;\n\t\t\n if (n_steps == PseudoIndex) {\n dimensions[nd_new] = 1; strides[nd_new] = 0; nd_new++;\n } else {\n if (n_steps == RubberIndex) {\n for(j=i+1, n_pseudo=0; jnd-(n-i-n_pseudo-1+nd_old);\n if (n_add < 0) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = \\\n self->strides[nd_old];\n nd_new++; nd_old++;\n }\n } else {\n if (nd_old >= self->nd) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n offset += self->strides[nd_old]*start;\n nd_old++;\n if (n_steps != SingleIndex) {\n dimensions[nd_new] = n_steps;\n strides[nd_new] = step_size * \\\n self->strides[nd_old-1];\n nd_new++;\n }\n }\n }\n }\n if (i < n) return -1;\n n_add = self->nd-nd_old;\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = self->strides[nd_old];\n nd_new++; nd_old++;\n }\t \n *offset_ptr = offset;\n return nd_new;\n}\n\nstatic void\n_swap_axes(PyArrayMapIterObject *mit, PyArrayObject **ret)\n{\n\tPyObject *new, *tup;\n\tint n1, n2, n3, val;\n\tint i;\n\n\ttup = PyTuple_New(mit->nd);\n\t/* tuple for transpose is \n\t (n1,..,n1+n2-1,0,..,n1-1,n1+n2,...,n3-1)\n\t n1 is the number of dimensions of \n\t the broadcasted index array \n\t n2 is the number of dimensions skipped at the\n\t start\n\t n3 is the number of dimensions of the \n\t result \n\t*/\n\tn1 = mit->iters[0]->nd_m1 + 1;\n\tn2 = mit->iteraxes[0];\n\tn3 = mit->nd;\n\tval = n1;\n\ti = 0;\n\twhile(val < n1+n2) \n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = 0;\n\twhile(val < n1)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = n1+n2;\n\twhile(val < n3)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\n\tnew = PyArray_Transpose(*ret, tup);\n\tPy_DECREF(tup);\n\tPy_DECREF(*ret);\n\t*ret = (PyArrayObject *)new;\n}\n\n\n\nstatic PyObject *\nPyArray_GetMap(PyArrayMapIterObject *mit)\n{\n\n\tPyArrayObject *ret, *temp;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\t/* Unbound map iterator --- Bind should have been called */\n\tif (mit->ait == NULL) return NULL;\n\n\t/* This relies on the map iterator object telling us the shape\n\t of the new array in nd and dimensions.\n\t*/\n\ttemp = mit->ait->ao;\n\tret = (PyArrayObject *)\\\n\t\tPyArray_New(temp->ob_type, mit->nd, mit->dimensions, \n\t\t\t temp->descr->type_num, NULL, NULL, \n\t\t\t temp->itemsize, \n\t\t\t PyArray_ISFORTRAN(temp),\n\t\t\t (PyObject *)temp);\n\tif (ret == NULL) return NULL;\n\n\t/* Now just iterate through the new array filling it in\n\t with the next object from the original array as\n\t defined by the mapping iterator */\n\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ret)) \n\t == NULL) \n\t\treturn NULL;\n\tindex = it->size;\n\tswap = ((temp->flags & NOTSWAPPED) != (ret->flags & NOTSWAPPED));\n copyswap = ret->descr->copyswap;\n\tPyArray_MapIterReset(mit);\n\twhile (index--) {\n copyswap(it->dataptr, mit->dataptr, swap, ret->itemsize);\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\t\n\t/* check for consecutive axes */\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, &ret);\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\nstatic int\nPyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)\n{\n\tPyObject *arr=NULL;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n\tPyArray_Typecode typecode = {0, 0, 0};\n PyArray_CopySwapFunc *copyswap;\n\n\t/* Unbound Map Iterator */\n\tif (mit->ait == NULL) return -1;\n\n\ttypecode.type_num = mit->ait->ao->descr->type_num;\n\ttypecode.itemsize = mit->ait->ao->itemsize;\n\n\tarr = PyArray_FromAny(op, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, (PyArrayObject **)&arr);\n\t\t}\n\t}\n\t\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) \n\t\treturn -1;\n\n\tindex = mit->size;\n\tswap = ((mit->ait->ao->flags & NOTSWAPPED) != \\\n\t\t(PyArray_FLAGS(arr) & NOTSWAPPED));\n\n copyswap = PyArray_DESCR(arr)->copyswap;\n\tPyArray_MapIterReset(mit);\n /* Need to decref OBJECT arrays */\n if (PyTypeNum_ISOBJECT(typecode.type_num)) {\n while (index--) {\n Py_XDECREF(*((PyObject **)mit->dataptr));\n Py_INCREF(*((PyObject **)it->dataptr));\n memmove(mit->dataptr, it->dataptr, sizeof(PyObject *));\n copyswap(mit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_MapIterNext(mit);\n PyArray_ITER_NEXT(it);\n if (it->index == it->size)\n PyArray_ITER_RESET(it);\n }\n return 0;\n }\n\n\twhile(index--) {\n\t\tmemmove(mit->dataptr, it->dataptr, PyArray_ITEMSIZE(arr));\n copyswap(mit->dataptr, NULL, swap, PyArray_ITEMSIZE(arr));\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t\tif (it->index == it->size)\n\t\t\tPyArray_ITER_RESET(it);\n\t}\t\t\n\treturn 0;\n}\n\n/* Called when treating array object like a mapping -- called first from \n Python when using a[object] unless object is a standard slice object\n (not an extended one). \n\n*/\n\n/* There are two situations: \n\n 1 - the subscript is a standard view and a reference to the \n array can be returned\n\n 2 - the subscript uses Boolean masks or integer indexing and\n therefore a new array is created and returned. \n\n*/\n\n/* Always returns 0-dimensional arrays */\n\nstatic PyObject *\narray_subscript(PyArrayObject *self, PyObject *op) \n{\n intp dimensions[MAX_DIMS], strides[MAX_DIMS];\n\tintp offset;\n int nd, i;\n PyArrayObject *other;\n\tPyArrayMapIterObject *mit;\n\n if (PyArray_IsScalar(op, Integer) || PyInt_Check(op) || \\\n PyLong_Check(op)) {\n intp value;\n value = PyArray_PyIntAsIntp(op);\n if (PyErr_Occurred())\n PyErr_Clear();\n else if (value >= 0) {\n if (value <= MAX_INT)\n return array_item(self, (int) value);\n }\n else if (value < 0) {\n if (value >= -MAX_INT) {\n if (self->nd > 0) value += self->dimensions[0];\n return array_item(self, (int) value);\n }\n }\n }\n\n\tif (PyArrayMapIter_Check(op)) {\n\t\tmit = (PyArrayMapIterObject *)op;\n\t\t/* bind to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\n\t\t/* If the mapiterator was created with standard indexing\n\t\t behavior, fall through to view-based code */\n\t\tif (!mit->view) return PyArray_GetMap(mit);\n\t\top = mit->indexobj;\n\t}\n\telse { /* wrap arguments into a mapiter object */\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(op);\n\t\tif (mit == NULL) return NULL;\n\t\tif (!mit->view) { /* fancy indexing */\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tother = (PyArrayObject *)PyArray_GetMap(mit);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn (PyObject *)other;\n\t\t}\n\t\tPy_DECREF(mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(op);\n\tif (!error_converting(i)) {\n\t\tif (i < 0 && self->nd > 0) i = i+self->dimensions[0];\n\t\treturn array_item(self, i);\n\t}\n\tPyErr_Clear();\n\n\t/* Standard (view-based) Indexing */\n if ((nd = parse_index(self, op, dimensions, strides, &offset)) \n == -1) \n return NULL;\n\n\t/* This will only work if new array will be a view */\n\tif ((other = (PyArrayObject *)\t\t\t\t\t\\\n\t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n\t\t\t strides, self->data+offset, \n\t\t\t self->itemsize, self->flags,\n\t\t\t (PyObject *)self)) == NULL) \n\t\treturn NULL;\n\n\n\tother->base = (PyObject *)self;\n\tPy_INCREF(self);\n\t\n\tPyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);\n\t\n\treturn (PyObject *)other;\n}\n\n\n/* Another assignment hacked by using CopyObject. */\n\n/* This only works if subscript returns a standard view. */\n\n/* Again there are two cases. In the first case, PyArray_CopyObject\n can be used. In the second case, a new indexing function has to be \n used.\n*/\n\nstatic int \narray_ass_sub(PyArrayObject *self, PyObject *index, PyObject *op) \n{\n int ret, i;\n PyArrayObject *tmp;\n\tPyArrayMapIterObject *mit;\n\t\n if (op == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n\tif (PyArrayMapIter_Check(index)) {\n\t\tmit = (PyArrayMapIterObject *)index;\n\t\t/* bind behavior to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\t\n\t\t/* fall through if standard view-based map iterator */\n\t\tif (!mit->view) return PyArray_SetMap(mit, op);\n\t\tindex = mit->indexobj;\n\t}\n\telse {\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(index);\n\t\tif (mit == NULL) return -1;\n\t\tif (!mit->view) {\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tret = PyArray_SetMap(mit, op);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn ret;\n\t\t}\n\t\tPy_DECREF((PyObject*)mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(index);\n\tif (!error_converting(i)) {\n\t\treturn array_ass_item(self, i, op);\n\t}\n\tPyErr_Clear();\n\t\n\t/* Rest of standard (view-based) indexing */\n\n if ((tmp = (PyArrayObject *)array_subscript(self, index)) == NULL)\n return -1; \n ret = PyArray_CopyObject(tmp, op);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\n/* There are places that require that array_subscript return a PyArrayObject\n and not possibly a scalar. Thus, this is the function exposed to \n Python so that 0-dim arrays are passed as scalars\n*/\n\nstatic PyObject *\narray_subscript_nice(PyArrayObject *self, PyObject *op) \n{\n\treturn PyArray_Return((PyArrayObject *)array_subscript(self, op));\n}\n\n\nstatic PyMappingMethods array_as_mapping = {\n (inquiry)array_length,\t\t /*mp_length*/\n (binaryfunc)array_subscript_nice,\t/*mp_subscript*/\n (objobjargproc)array_ass_sub,\t /*mp_ass_subscript*/\n};\n\n/****************** End of Mapping Protocol ******************************/\n\n\n/*************************************************************************\n **************** Implement Buffer Protocol ****************************\n *************************************************************************/\n\n/* removed multiple segment interface */\n\nstatic int \narray_getsegcount(PyArrayObject *self, int *lenp) \n{\n if (lenp)\n *lenp = PyArray_NBYTES(self);\n\n if (PyArray_ISONESEGMENT(self)) {\n return 1;\n }\n\n if (lenp)\n *lenp = 0;\n return 0;\n}\n\nstatic int \narray_getreadbuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (segment != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Accessing non-existing array segment\");\n return -1;\n }\n \n if (PyArray_ISONESEGMENT(self)) {\n *ptrptr = self->data;\n return PyArray_NBYTES(self);\n }\n PyErr_SetString(PyExc_ValueError, \"Array is not a single segment\");\n *ptrptr = NULL;\n return -1;\n}\n\n\nstatic int \narray_getwritebuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (PyArray_CHKFLAGS(self, WRITEABLE)) \n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_ValueError, \"Array cannot be \"\\\n \"accessed as a writeable buffer.\");\n return -1;\n }\n}\n\nstatic int \narray_getcharbuf(PyArrayObject *self, int segment, const char **ptrptr) \n{\n if (self->descr->type_num == PyArray_STRING || \\\n\t self->descr->type_num == PyArray_UNICODE)\n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_TypeError, \n \"Non-character array cannot be interpreted \"\\\n \"as character buffer.\");\n return -1;\n }\n}\n\nstatic PyBufferProcs array_as_buffer = {\n (getreadbufferproc)array_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)array_getwritebuf, /*bf_getwritebuffer*/\n (getsegcountproc)array_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)array_getcharbuf, /*bf_getcharbuffer*/\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Number Protocol ****************************\n *************************************************************************/\n\n\ntypedef struct {\n PyObject *add,\n *subtract,\n *multiply,\n *divide,\n *remainder,\n *power,\n\t\t*sqrt,\n *negative,\n *absolute,\n *invert,\n *left_shift,\n *right_shift,\n *bitwise_and,\n *bitwise_xor,\n *bitwise_or,\n *less,\n *less_equal,\n *equal,\n *not_equal,\n *greater,\n *greater_equal,\n *floor_divide,\n *TRUE_divide,\n\t\t*logical_or,\n\t\t*logical_and,\n\t\t*floor,\n\t\t*ceil,\n\t\t*maximum,\n\t\t*minimum;\t\n\t\n} NumericOps;\n\nstatic NumericOps n_ops = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL};\n\n/* Dictionary can contain any of the numeric operations, by name. \n Those not present will not be changed\n */\n\n#define SET(op) temp=PyDict_GetItemString(dict, #op);\t\\\n\tif (temp != NULL) {\t\t\t\t\\\n\t\tif (!(PyCallable_Check(temp))) return -1; \\\n Py_XDECREF(n_ops.op); \\\n\t\tn_ops.op = temp; \\\n\t}\n\n \nint \nPyArray_SetNumericOps(PyObject *dict) \n{\n PyObject *temp = NULL;\n SET(add);\n SET(subtract);\n SET(multiply);\n SET(divide);\n SET(remainder);\n SET(power);\n\tSET(sqrt);\n SET(negative);\n SET(absolute);\n SET(invert);\n SET(left_shift);\n SET(right_shift);\n SET(bitwise_and);\n SET(bitwise_or);\n SET(bitwise_xor);\n SET(less);\t \n SET(less_equal);\n SET(equal);\n SET(not_equal);\n SET(greater);\n SET(greater_equal);\n SET(floor_divide);\t\n SET(TRUE_divide);\t\n\tSET(logical_or);\n\tSET(logical_and);\n\tSET(floor);\n\tSET(ceil);\n\tSET(maximum);\n\tSET(minimum);\n return 0;\n}\n\n#define GET(op) if (PyDict_SetItemString(dict, #op, n_ops.op)==-1) \\\n\t\tgoto fail;\n\nstatic PyObject *\nPyArray_GetNumericOps(void) \n{\n\tPyObject *dict;\n\tif ((dict = PyDict_New())==NULL) \n\t\treturn NULL;\t\n\tGET(add);\n GET(subtract);\n GET(multiply);\n GET(divide);\n GET(remainder);\n GET(power);\n\tGET(sqrt);\n GET(negative);\n GET(absolute);\n GET(invert);\n GET(left_shift);\n GET(right_shift);\n GET(bitwise_and);\n GET(bitwise_or);\n GET(bitwise_xor);\n GET(less);\t \n GET(less_equal);\n GET(equal);\n GET(not_equal);\n GET(greater);\n GET(greater_equal);\n GET(floor_divide); \n GET(TRUE_divide); \n\tGET(logical_or);\n\tGET(logical_and);\n\tGET(floor);\n\tGET(ceil);\n\tGET(maximum);\n\tGET(minimum);\n\treturn dict;\t\n\n fail:\n\tPy_DECREF(dict);\n\treturn NULL;\t\t\n}\n\nstatic PyObject *\nPyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"reduce\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"accumulate\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OO)\", m1, m2);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(O)\", m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericInplaceBinaryFunction(PyArrayObject *m1, \n\t\t\t\t PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OOO)\", m1, m2, m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\narray_add(PyArrayObject *m1, PyObject *m2) \n{ \n return PyArray_GenericBinaryFunction(m1, m2, n_ops.add); \n}\n\nstatic PyObject *\narray_subtract(PyArrayObject *m1, PyObject *m2) \n{\n\treturn PyArray_GenericBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_negative(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.negative);\n}\n\nstatic PyObject *\narray_absolute(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.absolute);\n}\n\nstatic PyObject *\narray_invert(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.invert);\n}\n\nstatic PyObject *\narray_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_inplace_add(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.add);\n}\n\nstatic PyObject *\narray_inplace_subtract(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_inplace_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_inplace_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_inplace_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_inplace_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_inplace_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_inplace_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_inplace_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_inplace_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_inplace_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.TRUE_divide);\n}\n\nstatic PyObject *\narray_inplace_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_inplace_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.TRUE_divide);\n}\n\n/* Array evaluates as \"TRUE\" if any of the elements are non-zero */\nstatic int \narray_all_nonzero(PyArrayObject *mp) \n{\n\tintp index;\n\tPyArrayIterObject *it;\n\tBool anyTRUE = 0;\n\t\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)mp);\n\tif (it==NULL) return anyTRUE;\n\tindex = it->size;\n\twhile(index--) {\n\t\tif (mp->descr->nonzero(it->dataptr, mp)) {\n\t\t\tanyTRUE = 1;\n\t\t\tbreak;\n\t\t}\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\treturn anyTRUE;\n}\n\nstatic PyObject *\narray_divmod(PyArrayObject *op1, PyObject *op2) \n{\n PyObject *divp, *modp, *result;\n\n divp = array_divide(op1, op2);\n if (divp == NULL) return NULL;\n modp = array_remainder(op1, op2);\n if (modp == NULL) {\n Py_DECREF(divp);\n return NULL;\n }\n result = Py_BuildValue(\"OO\", divp, modp);\n Py_DECREF(divp);\n Py_DECREF(modp);\n return result;\n}\n\n\nstatic PyObject *\narray_int(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can be\"\\\n\t\t\t\t\" converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_int == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to int\");\n Py_DECREF(pv);\n return NULL;\n }\n\n pv2 = pv->ob_type->tp_as_number->nb_int(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_float(PyArrayObject *v) \n{\n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an \"\\\n\t\t\t\t\"int, scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_float == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to float\");\n Py_DECREF(pv);\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_float(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_long(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_long == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to long\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_long(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_oct(PyArrayObject *v) \n{\t \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_oct == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to oct\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_oct(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_hex(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_hex == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to hex\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_hex(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\n_array_copy_nice(PyArrayObject *self)\n{\n\treturn PyArray_Return((PyArrayObject *)\t\t\\\n\t\t\t PyArray_Copy(self));\n}\n\nstatic PyNumberMethods array_as_number = {\n (binaryfunc)array_add,\t\t /*nb_add*/\n (binaryfunc)array_subtract,\t\t /*nb_subtract*/\n (binaryfunc)array_multiply,\t\t /*nb_multiply*/\n (binaryfunc)array_divide,\t\t /*nb_divide*/\n (binaryfunc)array_remainder,\t /*nb_remainder*/\n (binaryfunc)array_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)array_power,\t\t /*nb_power*/\n (unaryfunc)array_negative, /*nb_neg*/\t\n (unaryfunc)_array_copy_nice,\t\t /*nb_pos*/ \n (unaryfunc)array_absolute,\t\t /*(unaryfunc)array_abs,*/\n (inquiry)array_all_nonzero,\t\t /*nb_nonzero*/\n (unaryfunc)array_invert,\t\t /*nb_invert*/\n (binaryfunc)array_left_shift,\t /*nb_lshift*/\n (binaryfunc)array_right_shift,\t /*nb_rshift*/\n (binaryfunc)array_bitwise_and,\t /*nb_and*/\n (binaryfunc)array_bitwise_xor,\t /*nb_xor*/\n (binaryfunc)array_bitwise_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)array_int,\t\t /*nb_int*/\n (unaryfunc)array_long,\t\t /*nb_long*/\n (unaryfunc)array_float,\t\t /*nb_float*/\n (unaryfunc)array_oct,\t\t /*nb_oct*/\n (unaryfunc)array_hex,\t\t /*nb_hex*/\n\n /*This code adds augmented assignment functionality*/\n /*that was made available in Python 2.0*/\n (binaryfunc)array_inplace_add,\t /*inplace_add*/\n (binaryfunc)array_inplace_subtract,\t /*inplace_subtract*/\n (binaryfunc)array_inplace_multiply,\t /*inplace_multiply*/\n (binaryfunc)array_inplace_divide,\t /*inplace_divide*/\n (binaryfunc)array_inplace_remainder, /*inplace_remainder*/\n (ternaryfunc)array_inplace_power,\t /*inplace_power*/\n (binaryfunc)array_inplace_left_shift, /*inplace_lshift*/\n (binaryfunc)array_inplace_right_shift, /*inplace_rshift*/\n (binaryfunc)array_inplace_bitwise_and, /*inplace_and*/\n (binaryfunc)array_inplace_bitwise_xor, /*inplace_xor*/\n (binaryfunc)array_inplace_bitwise_or, /*inplace_or*/\n\n (binaryfunc)array_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)array_TRUE_divide,\t /*nb_TRUE_divide*/\n (binaryfunc)array_inplace_floor_divide, /*nb_inplace_floor_divide*/\n (binaryfunc)array_inplace_TRUE_divide, /*nb_inplace_TRUE_divide*/\n\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Sequence Protocol **************************\n *************************************************************************/\n\n/* Some of this is repeated in the array_as_mapping protocol. But\n we fill it in here so that PySequence_XXXX calls work as expected \n*/\n\n\nstatic PyObject * \narray_slice(PyArrayObject *self, int ilow, int ihigh) \n{\n PyArrayObject *r;\n int l;\n char *data;\n\n if (self->nd == 0) {\n PyErr_SetString(PyExc_ValueError, \"can't slice a scalar\");\n return NULL;\n }\n \t\n l=self->dimensions[0];\n if (ihigh < 0) ihigh += l;\n if (ilow < 0) ilow += l;\n if (ilow < 0) ilow = 0;\n else if (ilow > l) ilow = l;\n if (ihigh < 0) ihigh = 0;\n else if (ihigh > l) ihigh = l;\n if (ihigh < ilow) ihigh = ilow;\n\n if (ihigh != ilow) {\n data = index2ptr(self, ilow);\n if (data == NULL) return NULL;\n } else {\n data = self->data;\n }\n\n self->dimensions[0] = ihigh-ilow;\n r = (PyArrayObject *)\\\n\t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n\t\t\t self->descr->type_num, self->strides, data,\n\t\t\t self->itemsize, self->flags, (PyObject *)self);\n\n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n Py_INCREF(self);\n\tPyArray_UpdateFlags(r, UPDATE_ALL_FLAGS); \n return (PyObject *)r;\n}\n\n\nstatic int \narray_ass_slice(PyArrayObject *self, int ilow, int ihigh, PyObject *v) {\n int ret;\n PyArrayObject *tmp;\n\t\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n if ((tmp = (PyArrayObject *)array_slice(self, ilow, ihigh)) \\\n == NULL) \n return -1; \n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\nstatic int\narray_contains(PyArrayObject *self, PyObject *el)\n{\n /* equivalent to any(self == el) */\n\n return PyObject_RichCompareBool((PyObject *)self, el, Py_EQ);\n}\n\n\nstatic PySequenceMethods array_as_sequence = {\n (inquiry)array_length,\t\t/*sq_length*/\n (binaryfunc)NULL, /* sq_concat is handled by nb_add*/\n (intargfunc)NULL, /* sq_repeat is handled nb_multiply*/\n (intargfunc)array_item_nice,\t\t/*sq_item*/\n (intintargfunc)array_slice,\t\t/*sq_slice*/\n (intobjargproc)array_ass_item,\t/*sq_ass_item*/\n (intintobjargproc)array_ass_slice,\t/*sq_ass_slice*/\n\t(objobjproc) array_contains, /* sq_contains */\n\t(binaryfunc) NULL, /* sg_inplace_concat */\n\t(intargfunc) NULL /* sg_inplace_repeat */\n};\n\n\n/****************** End of Sequence Protocol ****************************/\n\n\nstatic int \ndump_data(char **string, int *n, int *max_n, char *data, int nd, \n intp *dimensions, intp *strides, PyArrayObject* self) \n{\n PyArray_Descr *descr=self->descr;\n PyObject *op, *sp;\n char *ostring;\n int i, N;\n\t\n#define CHECK_MEMORY if (*n >= *max_n-16) { *max_n *= 2; \\\n\t\t*string = (char *)realloc(*string, *max_n); }\n\t\n if (nd == 0) {\n\t\t\n if ((op = descr->getitem(data, self)) == NULL) return -1;\n sp = PyObject_Repr(op);\n if (sp == NULL) {Py_DECREF(op); return -1;}\n ostring = PyString_AsString(sp);\n N = PyString_Size(sp)*sizeof(char);\n *n += N;\n CHECK_MEMORY\n memmove(*string+(*n-N), ostring, N);\n Py_DECREF(sp);\n Py_DECREF(op);\n return 0;\n } else {\n CHECK_MEMORY\n (*string)[*n] = '[';\n *n += 1;\n for(i=0; idata, \n\t\t self->nd, self->dimensions, \n self->strides, self) < 0) { \n\t\tfree(string); return NULL; \n\t}\n\t\n\tif (PyArray_ISFLEXIBLE(self)) {\n\t\tchar buf[100];\n\t\tsnprintf(buf, sizeof(buf), \"%d\", self->itemsize);\n\t\tsprintf(string+n, \", '%c%s')\", self->descr->type, buf);\n\t\tret = PyString_FromStringAndSize(string, n+6+strlen(buf));\n\t}\n\telse {\n\t\tsprintf(string+n, \", '%c')\", self->descr->type);\n\t\tret = PyString_FromStringAndSize(string, n+6);\n\t}\n\t\n\n free(string);\n return ret;\n}\n\nstatic PyObject *PyArray_StrFunction=NULL;\nstatic PyObject *PyArray_ReprFunction=NULL;\n\nstatic void \nPyArray_SetStringFunction(PyObject *op, int repr) \n{\n if (repr) {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_ReprFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_ReprFunction = op; \n } else {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_StrFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_StrFunction = op; \n }\n}\n\nstatic PyObject *\narray_repr(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_ReprFunction == NULL) {\n s = array_repr_builtin(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_ReprFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\nstatic PyObject *\narray_str(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_StrFunction == NULL) {\n s = array_repr(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_StrFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\n\nstatic PyObject *\narray_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) \n{\n PyObject *array_other, *result;\n\n switch (cmp_op) \n {\n case Py_LT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less);\n case Py_LE:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less_equal);\n case Py_EQ:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then return the integer\n\t\t\t object 0. This fixes code that used to\n\t\t\t allow equality comparisons between arrays\n\t\t\t and other objects which would give a result\n\t\t\t of 0\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.equal);\n /* If the comparison results in NULL, then the \n\t\t\t two array objects can not be compared together so \n\t\t\t return zero \n */\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n return result;\n case Py_NE:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then objects cannot be \n\t\t\t compared and cannot be equal, therefore, \n\t\t\t return True;\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.not_equal);\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n return result;\n case Py_GT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.greater);\n case Py_GE:\n return PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t other, \n\t\t\t\t\t \t n_ops.greater_equal);\n }\n return NULL;\n}\n\nstatic PyObject *\n_check_axis(PyArrayObject *arr, int *axis, int flags)\n{\n\tPyObject *temp;\n\tint n = arr->nd;\n\n\tif ((*axis >= MAX_DIMS) || (n==0)) {\n\t\ttemp = PyArray_Ravel(arr,0);\n\t\t*axis = 0;\n\t\treturn temp;\n\t}\n\telse {\n\t\tif (flags) {\n\t\t\ttemp = PyArray_FromAny((PyObject *)arr, NULL, \n\t\t\t\t\t 0, 0, flags);\n\t\t\tif (temp == NULL) return NULL;\n\t\t}\n\t\telse {\n\t\t\tPy_INCREF(arr);\n\t\t\ttemp = (PyObject *)arr;\n\t\t}\n\t}\n\tif (*axis < 0) *axis += n;\n\tif ((*axis < 0) || (*axis >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"axis(=%d) out of bounds\", *axis);\n\t\tPy_DECREF(temp);\n\t\treturn NULL;\n\t}\n\treturn temp;\n}\n\n#include \"arraymethods.c\"\n\n/* Lifted from numarray */\nstatic PyObject *\nPyArray_IntTupleFromIntp(int len, intp *vals)\n{\n\tint i;\n PyObject *intTuple = PyTuple_New(len);\n if (!intTuple) goto fail;\n for(i=0; ind == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i = ap->nd-1; i >= 0; --i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int \n_IsFortranContiguous(PyArrayObject *ap) \n{\n\tint sd;\n\tint i;\n\t\n\tif (ap->nd == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i=0; i< ap->nd; ++i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int\n_IsAligned(PyArrayObject *ap) \n{\n\tint i, alignment, aligned=1;\n\tintp ptr;\n\tint type = ap->descr->type_num;\n\n\tif ((type == PyArray_STRING) || (type == PyArray_VOID))\n\t\treturn 1;\n\n\talignment = ap->descr->alignment;\n\n\tptr = (intp) ap->data;\n aligned = (ptr % alignment) == 0;\n for (i=0; i nd; i++)\n aligned &= ((ap->strides[i] % alignment) == 0);\n return aligned != 0;\n}\n\nstatic Bool\n_IsWriteable(PyArrayObject *ap)\n{\n\tPyObject *base=ap->base;\n\tPyBufferProcs *pb;\n\n\t/* If we own our own data, then no-problem */\n\tif ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;\n\n\t/* Get to the final base object \n\t If it is a writeable array, then return TRUE\n\t If we can find an array object \n\t or a writeable buffer object as the final base object\n\t or a string object (for pickling support memory savings).\n\t - this last could be removed if a proper pickleable \n\t buffer was added to Python.\n\t*/\n\n\twhile(PyArray_Check(base)) {\n\t\tif (PyArray_CHKFLAGS(base, OWN_DATA)) \n\t\t\treturn (Bool) (PyArray_ISWRITEABLE(base));\n\t\tbase = PyArray_BASE(base);\n\t}\n\n\t/* here so pickle support works seamlessly \n\t and unpickled array can be set and reset writeable \n\t -- could be abused -- */\n\tif PyString_Check(base) return TRUE;\n\n\tpb = base->ob_type->tp_as_buffer;\n\tif (pb == NULL || pb->bf_getwritebuffer == NULL)\n\t\treturn FALSE;\n\t\n\treturn TRUE;\n}\n\n\nstatic void\nPyArray_UpdateFlags(PyArrayObject *ret, int flagmask)\n{\n\n\tif (flagmask & FORTRAN) {\n\t\tif (_IsFortranContiguous(ret)) {\n\t\t\tret->flags |= FORTRAN;\n\t\t\tif (ret->nd > 1) ret->flags &= ~CONTIGUOUS;\n\t\t}\n\t\telse ret->flags &= ~FORTRAN;\n\t}\n\tif (flagmask & CONTIGUOUS) {\n\t\tif (_IsContiguous(ret)) {\n\t\t\tret->flags |= CONTIGUOUS;\n\t\t\tif (ret->nd > 1) ret->flags &= ~FORTRAN;\n\t\t}\n\t\telse ret->flags &= ~CONTIGUOUS;\n\t}\n\tif (flagmask & ALIGNED) {\n\t\tif (_IsAligned(ret)) ret->flags |= ALIGNED;\n\t\telse ret->flags &= ~ALIGNED;\n\t}\n\treturn;\n}\n\n/* This routine checks to see if newstrides (of length nd) will not \n walk outside of the memory implied by either numbytes or\n a single segment array of the provided dimensions and element size if\n numbytes is 0 */\nstatic Bool\nPyArray_CheckStrides(int elsize, int nd, intp numbytes, \n\t\t intp *dims, intp *newstrides)\n{\n\tint i;\n\t\n\tif (numbytes == 0) \n\t\tnumbytes = PyArray_MultiplyList(dims, nd) * elsize;\n\t\n\tfor (i=0; i numbytes) {\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\treturn TRUE;\n\t\n}\n\n\n/* This is the main array creation routine. */\n\n/* Flags argument has multiple related meanings \n depending on data and strides: \n\n If data is given, then flags is flags associated with data. \n If strides is not given, then a contiguous strides array will be created\n and the CONTIGUOUS bit will be set. If the flags argument \n has the FORTRAN bit set, then a FORTRAN-style strides array will be\n created (and of course the FORTRAN flag bit will be set). \n\n If data is not given but created here, then flags will be DEFAULT_FLAGS\n and a non-zero flags argument can be used to indicate a FORTRAN style\n array is desired. \n*/\n\nstatic intp\n_array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize, \n\t\t int inflag, int *objflags) \n{\n\tint i;\n\t/* Only make Fortran strides if not contiguous as well */\n\tif ((inflag & FORTRAN) && !(inflag & CONTIGUOUS)) {\n\t\tfor (i=0; i 1) *objflags &= ~CONTIGUOUS;\n\t\telse *objflags |= CONTIGUOUS;\n\t}\n\telse {\n\t\tfor (i=nd-1;i>=0;i--) {\n\t\t\tstrides[i] = itemsize;\n\t\t\titemsize *= dims[i] ? dims[i] : 1;\n\t\t}\n\t\t*objflags |= CONTIGUOUS;\n\t\tif (nd > 1) *objflags &= ~FORTRAN;\n\t\telse *objflags |= FORTRAN;\n\t}\n\treturn itemsize;\n}\n\n\t\nstatic PyObject *\nPyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n\t PyObject *obj)\n{\n\tPyArrayObject *self;\n\tPyArray_Descr *descr;\n\tregister int i;\n\tintp sd, temp;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\tif (descr == NULL) return NULL;\n\n\tif (nd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"number of dimensions must be >=0\");\n\t\treturn NULL;\n\t}\n if (nd > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError,\n \"maximum number of dimensions is %d\", MAX_DIMS);\n return NULL;\n\t}\n\n\t/* Check dimensions */\n\tfor (i=nd-1;i>=0;i--) {\n\t\tif (dims[i] < 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"negative dimensions\"\t\\\n\t\t\t\t\t\" are not allowed.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tself = (PyArrayObject *) subtype->tp_alloc(subtype, 0);\n\tif (self == NULL) return NULL;\t\n\tself->descr = descr;\n\tself->dimensions = NULL;\n\tif (data == NULL) { /* strides is NULL too */\n\t\tself->flags = DEFAULT_FLAGS;\n\t\tif (flags) {\n\t\t\tself->flags |= FORTRAN; \n\t\t\tif (nd > 1) self->flags &= ~CONTIGUOUS;\n\t\t\tflags = FORTRAN;\n\t\t}\n\t}\n\telse self->flags = (flags & ~UPDATEIFCOPY);\n\t\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tif (itemsize < 1) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"Type must provide an itemsize.\");\n\t\t\tPyObject_Del(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tself->itemsize = itemsize;\n\t\t/* Guarantee that these kind of arrays are never byteswapped\n\t\t unknowingly. \n\t\t*/\n\t\tif (type_num != PyArray_UNICODE)\n\t\t\tself->flags |= NOTSWAPPED;\n\t}\n\telse self->itemsize = descr->elsize; \n\t\t\n\tsd = self->itemsize;\n\t\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dims, sizeof(intp)*nd);\n\t\tif (strides == NULL) { /* fill it in */\n\t\t\tsd = _array_fill_strides(self->strides, dims, nd, sd,\n\t\t\t\t\t\t flags, &(self->flags));\n\t\t}\n\t\telse {\n\t\t\tif (data == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"If strides is given in \" \\\n\t\t\t\t\t\t\"array creation, data must \" \\\n\t\t\t\t\t\t\"be given too.\");\n\t\t\t\tPyObject_Del(self);\n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\t\treturn NULL;\n\t\t\t}\t\t\t\t\t\n\t\t\tmemcpy(self->strides, strides, sizeof(intp)*nd);\n\t\t}\n\t}\n \t\n\t\t\n\tif (data == NULL) {\n\n\t\t/* Make sure we are aligned on void ptrs (without wasting\n\t\t space if we already are). But, also, allocate something \n\t\t even for zero-space arrays e.g. shape=(0,) -- otherwise\n buffer exposure (a.data) doesn't work as it should. */\n\n\t\tif (sd==0) sd = sizeof(intp);\n\t\telse if ((temp=sd%sizeof(intp))) sd += sizeof(intp) - temp;\n\n\t\tif ((data = PyDataMem_NEW(sd))==NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\tif (self->dimensions != NULL) \n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\n\t\t/* It is bad to have unitialized OBJECT pointers */\n\t\t/* We shouldn't need to check for the OBJECT Letter\n\t\t but perhaps it's best. */\n\t\tif (type_num == PyArray_OBJECT || \\\n\t\t type_num == PyArray_OBJECTLTR) {\n\t\t\tmemset(data, 0, sd);\n\t\t}\n\t}\n\telse {\n self->flags &= ~OWN_DATA; /* If data is passed in, \n\t\t\t\t\t this object won't own it \n\t\t\t\t\t by default.\n\t\t\t\t\t Caller must arrange for \n\t\t\t\t\t this to be reset if truly\n\t\t\t\t\t desired */\n }\n self->data = data;\n\tself->nd = nd;\n\tself->base = (PyObject *)NULL;\n self->weakreflist = (PyObject *)NULL;\n\n /* call the __array_finalize__\n\t method if a subtype and some object passed in */\n\tif ((obj != NULL) && (subtype != &PyArray_Type) && \n\t (subtype != &PyBigArray_Type)) {\n\t\tPyObject *res;\n\t\tres = PyObject_CallMethod((PyObject *)self, \n\t\t\t\t\t \"__array_finalize__\",\n\t\t\t\t\t \"O\", obj);\n\t\tif (res == NULL) PyErr_Clear();\n\t\telse Py_DECREF(res);\n\t}\n\n\treturn (PyObject *)self;\n}\n\n\n\nstatic PyObject * \nPyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape)\n{\n intp oldsize, newsize;\n int new_nd=newshape->len, k, n, elsize;\n int refcnt;\n intp* new_dimensions=newshape->ptr;\n intp new_strides[MAX_DIMS];\n intp sd;\n intp *dimptr;\n char *new_data;\n\t\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n \"resize only works on contiguous arrays\");\n return NULL;\n }\n\n\n newsize = PyArray_MultiplyList(new_dimensions, new_nd);\n\n if (newsize == 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Newsize is zero. Cannot delete an array \"\\\n \"in this way.\");\n return NULL;\n }\n oldsize = PyArray_SIZE(self);\n \n\tif (oldsize != newsize) {\n\t\tif (!(self->flags & OWN_DATA)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize this array: \"\t\\\n\t\t\t\t\t\"it does not own its data.\");\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\trefcnt = (((PyObject *)self)->ob_refcnt);\n\t\tif ((refcnt > 2) || (self->base != NULL) || \\\n\t\t (self->weakreflist != NULL)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize an array that has \"\\\n\t\t\t\t\t\"been referenced or is referencing\\n\"\\\n\t\t\t\t\t\"another array in this way. Use the \"\\\n\t\t\t\t\t\"resize function.\");\n\t\t\treturn NULL;\n\t\t} \n\t\t\n\t\t/* Reallocate space if needed */\n\t\tnew_data = PyDataMem_RENEW(self->data, \n\t\t\t\t\t newsize*(self->itemsize));\n\t\tif (new_data == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n\t\t\t\t\t\"can't allocate memory for array.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tself->data = new_data;\n\t}\n \n if ((newsize > oldsize) && PyArray_ISWRITEABLE(self)) { \n\t\t/* Fill new memory with zeros */\n elsize = self->itemsize;\n\t\tif ((PyArray_TYPE(self) == PyArray_OBJECT)) {\n\t\t\tPyObject *zero = PyInt_FromLong(0);\n PyObject **optr;\n\t\t\toptr = ((PyObject **)self->data) + oldsize;\n\t\t\tn = newsize - oldsize;\n\t\t\tfor (k=0; kdata+oldsize*elsize, 0, \n\t\t\t (newsize-oldsize)*elsize);\n\t\t}\n\t}\n \n if (self->nd != new_nd) { /* Different number of dimensions. */\n self->nd = new_nd;\n \n /* Need new dimensions and strides arrays */\n dimptr = PyDimMem_RENEW(self->dimensions, 2*new_nd);\n if (dimptr == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n \"can't allocate memory for array \" \\\n \"(array may be corrupted).\");\n return NULL;\n }\n self->dimensions = dimptr;\n\t\tself->strides = dimptr + new_nd;\n }\n\n /* make new_strides variable */\n sd = (intp) self->itemsize;\n sd = _array_fill_strides(new_strides, new_dimensions, new_nd, sd,\n 0, &(self->flags));\n\n \n memmove(self->dimensions, new_dimensions, new_nd*sizeof(intp));\n memmove(self->strides, new_strides, new_nd*sizeof(intp));\n\n Py_INCREF(Py_None);\t\n return Py_None;\n \n}\n\n\nstatic void\nPyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj)\n{\n PyObject **optr;\n intp i,n;\n optr = (PyObject **)(arr->data);\n n = PyArray_SIZE(arr);\n if (obj == NULL) {\n for (i=0; ibase = buffer.base;\n Py_INCREF(buffer.base); \n }\n\n PyDimMem_FREE(dims.ptr);\n if (strides.ptr) PyDimMem_FREE(strides.ptr);\n return PyArray_Return(ret);\n \n fail:\n if (dims.ptr) free(dims.ptr);\n if (strides.ptr) free(strides.ptr);\n return NULL;\n}\n\n\n\n/******************* array attribute get and set routines ******************/\n\nstatic PyObject *\narray_ndim_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong(self->nd);\n}\n\nstatic PyObject *\narray_flags_get(PyArrayObject *self)\n{\n static PyObject *module=NULL;\n\n if (module==NULL) {\n module = PyImport_ImportModule(\"scipy.base._internal\");\n if (module == NULL) return NULL;\n }\n return PyObject_CallMethod(module, \"flagsobj\", \"Oi\", \n self, self->flags);\n}\n\n/*\nstatic int\narray_flags_set(PyArrayObject *self, PyObject *obj) \n{\n\tint flagback = self->flags;\n\n if (PyDict_Check(obj)) {\n PyObject *new;\n\t\tnew = PyDict_GetItemString(obj, \"ALIGNED\");\n\t\tif (new) {\n\t\t\tif (PyObject_Not(new)) self->flags &= ~ALIGNED;\n\t\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\t\telse {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"cannot set aligned flag of \" \\\n\t\t\t\t\t\t\"mis-aligned array to True\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n new = PyDict_GetItemString(obj, \"UPDATEIFCOPY\");\n if (new) {\n if (PyObject_Not(new)) {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n else {\n\t\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return -1;\n }\n }\n new = PyDict_GetItemString(obj, \"WRITEABLE\");\n if (new) {\n\t\t\tif (PyObject_IsTrue(new)) {\n\t\t\t\tif (_IsWriteable(self)) {\n\t\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself->flags = flagback;\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\t\"cannot set \"\t\\\n\t\t\t\t\t\t\t\"WRITEABLE \"\t\\\n\t\t\t\t\t\t\t\"flag to True of \"\\\n\t\t\t\t\t\t\t\"this array \");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n new = PyDict_GetItemString(obj, \"NOTSWAPPED\");\n if (new) {\n if (PyObject_IsTrue(new))\n self->flags |= NOTSWAPPED;\n else {\n self->flags &= ~NOTSWAPPED;\n\t\t\t}\n\t\t}\n return 0;\n }\n PyErr_SetString(PyExc_ValueError, \n \"Object must be a dictionary\");\n return -1;\n}\n*/\n\n\nstatic PyObject *\narray_shape_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->dimensions);\n}\n\n\nstatic int\narray_shape_set(PyArrayObject *self, PyObject *val)\n{\n \tint nd;\n\tPyObject *ret;\n\n\tif (!PyTuple_Check(val)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"shape must be a tuple\");\n\t\treturn -1;\n\t}\n\tret = PyArray_Reshape(self, val);\n\tif (ret == NULL) return -1;\n\t\n\tif (self->nd > 0) { /* Free old dimensions and strides */\n\t\tPyDimMem_FREE(self->dimensions);\n\t}\n\tnd = PyArray_NDIM(ret);\n\tself->nd = nd;\n\tif (nd > 0) { /* create new dimensions and strides */\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\tPyErr_SetString(PyExc_MemoryError,\"\");\n\t\t\treturn -1;\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, PyArray_DIMS(ret), \n\t\t nd*sizeof(intp));\n\t\tmemcpy(self->strides, PyArray_STRIDES(ret), \n\t\t nd*sizeof(intp));\n\t}\n\telse self->dimensions=NULL;\n\tPy_DECREF(ret);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_strides_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic int\narray_strides_set(PyArrayObject *self, PyObject *obj)\n{\n\tPyArray_Dims newstrides = {NULL, 0};\n\tPyArrayObject *new;\n\tintp numbytes;\n\n\tif (!PyArray_IntpConverter(obj, &newstrides) || \\\n\t newstrides.ptr == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"invalid strides.\");\n\t\treturn -1;\n\t}\n\tif (newstrides.len != self->nd) {\n\t\tPyErr_Format(PyExc_ValueError, \"strides must be \"\t\\\n\t\t\t \" same length as shape (%d)\", self->nd);\n\t\treturn -1;\n\t}\n\tnew = self;\n\twhile(new->base != NULL) {\n\t\tif (PyArray_Check(new->base)) \n\t\t\tnew = (PyArrayObject *)new->base;\n\t}\n\tnumbytes = PyArray_MultiplyList(new->dimensions, \n\t\t\t\t\tnew->nd)*new->itemsize;\n\t\n\tif (!PyArray_CheckStrides(self->itemsize, self->nd, numbytes, \n\t\t\t\t self->dimensions, newstrides.ptr)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"strides is not \"\\\n\t\t\t\t\"compatible with available memory\");\n\t\treturn -1;\n\t}\n\tmemcpy(self->strides, newstrides.ptr, sizeof(intp)*newstrides.len);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_protocol_strides_get(PyArrayObject *self)\n{\n\tif PyArray_ISCONTIGUOUS(self) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic PyObject *\narray_priority_get(PyArrayObject *self)\n{\n\tif (PyArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_PRIORITY);\n\telse if (PyBigArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_BIG_PRIORITY);\n\telse\n\t\treturn PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY);\n}\n\n\nstatic PyObject *\narray_data_get(PyArrayObject *self)\n{\n\tintp nbytes;\n\tif (!(PyArray_ISONESEGMENT(self))) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot get single-\"\\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn NULL;\n\t}\t\t\n\tnbytes = PyArray_NBYTES(self);\n\tif PyArray_ISWRITEABLE(self) \n\t\treturn PyBuffer_FromReadWriteObject((PyObject *)self, 0, \n\t\t\t\t\t\t (int) nbytes);\n\telse\n\t\treturn PyBuffer_FromObject((PyObject *)self, 0, (int) nbytes);\n}\n\nstatic int\narray_data_set(PyArrayObject *self, PyObject *op)\n{\n\tvoid *buf;\n\tint buf_len;\n\tint writeable=1;\n\n\tif (PyObject_AsWriteBuffer(op, &buf, &buf_len) < 0) {\n\t\twriteable = 0;\n\t\tif (PyObject_AsReadBuffer(op, (const void **)&buf, \n\t\t\t\t\t &buf_len) < 0) {\n\t\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\t\"Object does not have single-segment\" \\\n\t\t\t\t\t\"buffer interface\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif (!PyArray_ISONESEGMENT(self)) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot set single-\" \\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn -1;\n\t}\n\tif (PyArray_NBYTES(self) > buf_len) {\n\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\"Not enough data for array.\");\n\t\treturn -1;\n\t}\n\tif (self->flags & OWN_DATA) {\n\t\tPyArray_XDECREF(self);\n\t\tPyDataMem_FREE(self->data);\n\t}\n\tif (self->base) {\n\t\tif (self->flags & UPDATEIFCOPY) {\n\t\t\t((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tself->flags &= ~UPDATEIFCOPY;\n\t\t}\n\t\tPy_DECREF(self->base);\n\t}\n\tPy_INCREF(op);\n\tself->base = op;\n\tself->data = buf;\n\tself->flags = CARRAY_FLAGS;\n\tif (!writeable)\n\t\tself->flags &= ~WRITEABLE;\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_itemsize_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->itemsize);\n}\n\nstatic PyObject *\narray_size_get(PyArrayObject *self)\n{\n\tlonglong size=PyArray_SIZE(self);\n\tif (size > MAX_INT || size < MIN_INT)\n\t\treturn PyLong_FromLongLong((longlong) size);\n\telse \n\t\treturn PyInt_FromLong((long) size);\n}\n\n\nstatic PyObject *\narray_typechar_get(PyArrayObject *self)\n{\n\tif PyArray_ISFLEXIBLE(self) \n\t\treturn PyString_FromFormat(\"%c%d\", (self->descr->type),\n\t\t\t\t\t self->itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(self->descr->type), 1);\n}\n\nstatic PyObject *\narray_typestr_get(PyArrayObject *self)\n{\n\tstatic char endians[] = \"<>\";\n\tchar endian;\n\tint which;\n\tunsigned long val = 1;\n\tchar *s;\n\tchar basic_=self->descr->kind;\n\n\ts = (char *)&val; /* s[0] == 0 implies big-endian */\n\twhich = (PyArray_ISNOTSWAPPED(self) ? 0 : 1);\n\tif (s[0] == 0) which = 1 - which;\n\tendian = endians[which]; \n\t\n\tif ((basic_==PyArray_VOIDLTR) || (basic_==PyArray_STRINGLTR) || \\\n\t (basic_==PyArray_OBJECTLTR) || (self->itemsize == 1))\n\t\treturn PyString_FromFormat(\"|%c%d\", basic_, self->itemsize);\n\telse\n\t\treturn PyString_FromFormat(\"%c%c%d\", endian, basic_,\n\t\t\t\t\t self->itemsize);\n}\n\nstatic PyObject *\narray_descr_get(PyArrayObject *self)\n{\n\tPyObject *res;\n\tPyObject *dobj;\n\n\t/* hand this off to the typeobject */\n\t/* or give default */\n\tif (PyArray_ISUSERDEF(self)) {\n\t\tres = PyObject_GetAttrString((PyObject *)self->descr->typeobj, \n\t\t\t\t\t \"__array_descr__\");\n\t\tif (res) return res;\n\t\tPyErr_Clear();\n\t}\n\t/* get default */\n\tdobj = PyTuple_New(2);\n\tif (dobj == NULL) return NULL;\n\tPyTuple_SET_ITEM(dobj, 0, PyString_FromString(\"\"));\n\tPyTuple_SET_ITEM(dobj, 1, array_typestr_get(self));\n\tres = PyList_New(1);\n\tif (res == NULL) {Py_DECREF(dobj); return NULL;}\n\tPyList_SET_ITEM(res, 0, dobj);\n\treturn res;\n}\n\nstatic PyObject *\narray_typenum_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->descr->type_num);\n}\n\n\nstatic PyObject *\narray_type_get(PyArrayObject *self)\n{\n\treturn PyArray_TypeObjectFromType(self->descr->type_num);\n}\n\n/* If the type is changed. \n Also needing change: strides, itemsize\n\n Either itemsize is exactly the same\n or the array is single-segment (contiguous or fortran) with\n compatibile dimensions\n\n*/\n\nstatic int\narray_type_set(PyArrayObject *self, PyObject *arg)\n{\n PyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n intp newdim;\n int index;\n char *msg = \"new type not compatible with array.\";\n\n if ((PyArray_TypecodeConverter(arg, &newtype) < 0) ||\n newtype.type_num == PyArray_NOTYPE) {\n PyErr_SetString(PyExc_TypeError, \"Invalid type for array\");\n return -1;\n }\n if (!(PyArray_ISONESEGMENT(self) ||\t\t\\\n\t (newtype.itemsize != self->itemsize))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1; \n }\n\n\tif (PyArray_ISCONTIGUOUS(self)) index = self->nd - 1;\n\telse index = 0;\n\n if (newtype.itemsize < self->itemsize) {\n /* if it is compatible increase the size of the dimension\n at end (or at the front for FORTRAN)\n */\n if (self->itemsize % newtype.itemsize != 0) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n newdim = self->itemsize / newtype.itemsize;\n\t\tself->dimensions[index] *= newdim;\n self->strides[index] = newtype.itemsize;\n\t}\n \n else if (newtype.itemsize > self->itemsize) {\n \n /* Determine if last (or first if FORTRAN) dimension\n is compatible */\n\n\t\tnewdim = self->dimensions[index] * self->itemsize;\n if ((newdim % newtype.itemsize) != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n\t\t\n self->dimensions[index] = newdim / newtype.itemsize;\n self->strides[index] = newtype.itemsize;\n\t\t\n }\n\t\n \n /* fall through -- adjust type*/\n\n self->descr = PyArray_DescrFromType(newtype.type_num);\n self->itemsize = newtype.itemsize;\n PyArray_UpdateFlags(self, ALIGNED);\n return 0;\n\n}\n\n\n\nstatic PyObject *\narray_base_get(PyArrayObject *self)\n{\n\tif (self->base == NULL) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\telse {\n\t\tPy_INCREF(self->base);\n\t\treturn self->base;\n\t}\n}\n\n\nstatic PyObject *\narray_real_get(PyArrayObject *self)\n{\n\tPyArrayObject *ret;\n\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *)ret;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n}\n\n\nstatic int\narray_real_set(PyArrayObject *self, PyObject *val)\n{\n\tPyArrayObject *ret;\n\tPyArrayObject *new;\n\tint rint;\n\n\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0);\n\tif (new == NULL) return -1;\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return -1;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\tret = self;\n\t}\t\n\trint = PyArray_CopyInto(ret, new);\n\tPy_DECREF(ret);\n\treturn rint;\n}\n\nstatic PyObject *\narray_imag_get(PyArrayObject *self)\n{\t\n\tPyArrayObject *ret;\n\tint itemsize;\n\tint typenum;\n PyArray_Typecode type = {self->descr->type_num, \n self->itemsize,\t \n PyArray_ISFORTRAN(self)};\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\titemsize = self->itemsize >> 1;\n\t\ttypenum = self->descr->type_num - PyArray_NUM_FLOATTYPE;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t typenum,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data + itemsize,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *) ret;\n\t}\n\telse {\n\t\tret = (PyArrayObject *)PyArray_Zeros(self->nd, \n\t\t\t\t\t\t self->dimensions, &type);\n\t\tret->flags &= ~WRITEABLE;\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic int\narray_imag_set(PyArrayObject *self, PyObject *val)\n{\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyArrayObject *ret;\n\t\tPyArrayObject *new;\n\t\tint rint;\n\n\t\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0); \n\t\tif (new == NULL) return -1;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides+ \\\n\t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) {\n\t\t\tPy_DECREF(new); \n\t\t\treturn -1;\n\t\t}\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\trint = PyArray_CopyInto(ret, new);\n\t\tPy_DECREF(ret);\t\t\n\t\tPy_DECREF(new);\n\t\treturn rint;\n\t}\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError, \"Does not have imaginary \" \\\n\t\t\t\t\"part to set.\");\n\t\treturn -1;\n\t}\n}\n\nstatic PyObject *\narray_flat_get(PyArrayObject *self)\n{\n return PyArray_IterNew((PyObject *)self);\n}\n\nstatic int \narray_flat_set(PyArrayObject *self, PyObject *val)\n{\n\tPyObject *arr=NULL;\n\tint retval = -1;\n\tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n\tPyArray_Typecode typecode = {self->descr->type_num,\n\t\t\t\t self->itemsize,\n\t\t\t\t PyArray_ISFORTRAN(self)};\n int swap;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tarr = PyArray_FromAny(val, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\tarrit = (PyArrayIterObject *)PyArray_IterNew(arr);\n\tif (arrit == NULL) goto exit;\n\tselfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (selfit == NULL) goto exit;\n\n swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);\n copyswap = self->descr->copyswap;\n if (PyArray_ISOBJECT(self)) {\n while(selfit->index < selfit->size) {\n Py_XDECREF(*((PyObject **)selfit->dataptr));\n Py_INCREF(*((PyObject **)arrit->dataptr)); \n memmove(selfit->dataptr, arrit->dataptr, \n sizeof(PyObject *));\n copyswap(selfit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_ITER_NEXT(selfit);\n PyArray_ITER_NEXT(arrit);\n if (arrit->index == arrit->size) \n PyArray_ITER_RESET(arrit);\n }\n retval = 0; \n goto exit;\n }\n\n\twhile(selfit->index < selfit->size) {\n\t\tmemmove(selfit->dataptr, arrit->dataptr, self->itemsize);\n copyswap(selfit->dataptr, NULL, swap, self->itemsize);\n\t\tPyArray_ITER_NEXT(selfit);\n\t\tPyArray_ITER_NEXT(arrit);\n\t\tif (arrit->index == arrit->size) \n\t\t\tPyArray_ITER_RESET(arrit);\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(selfit);\n\tPy_XDECREF(arrit);\n\tPy_XDECREF(arr);\n\treturn retval;\n}\n\nstatic PyGetSetDef array_getsetlist[] = {\n {\"ndim\", \n\t (getter)array_ndim_get, \n\t NULL, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)array_flags_get, \n NULL,\n\t \"special dictionary of flags\"},\n {\"shape\", \n\t (getter)array_shape_get, \n\t (setter)array_shape_set, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)array_strides_get, \n\t (setter)array_strides_set,\n\t \"tuple of bytes steps in each dimension\"},\n {\"data\", \n\t (getter)array_data_get, \n\t (setter)array_data_set, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)array_itemsize_get, \n\t NULL,\n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)array_size_get,\n\t NULL,\n \"number of elements in the array\"},\n\t{\"base\",\n\t (getter)array_base_get,\n\t NULL,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)array_type_get, \n\t (setter)array_type_set,\n\t \"get array type class\"},\n\t{\"dtypechar\",\n\t (getter)array_typechar_get,\n\t NULL,\n\t \"get array type character code\"},\n\t{\"dtypenum\",\n\t (getter)array_typenum_get,\n\t NULL,\n\t \"get array type number code\"},\n\t{\"dtypestr\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)array_real_get, \n\t (setter)array_real_set, \n\t \"real part of array\"},\n {\"imag\", \n\t (getter)array_imag_get, \n\t (setter)array_imag_set, \n\t \"imaginary part of array\"},\n\t{\"flat\", \n\t (getter)array_flat_get, \n\t (setter)array_flat_set, \n\t \"a 1-d view of a contiguous array\"}, \n\t{\"__array_data__\", \n\t (getter)array_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)array_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)array_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)array_protocol_strides_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t{\"__array_priority__\",\n\t (getter)array_priority_get,\n\t NULL,\n\t \"Array priority\"},\n \t{NULL, NULL, NULL, NULL}, /* Sentinel */\n};\n\n/****************** end of attribute get and set routines *******************/\n\n\n\nstatic char Arraytype__doc__[] = \n \"A array object represents a multidimensional, homogeneous array of basic values. It has the folowing data members, m.shape (the size of each dimension in the array), m.itemsize (the size (in bytes) of each element of the array), and m.typecode (a character representing the type of the array elements). Arrays are sequence, mapping and numeric objects. Sequence indexing is similar to lists, with single indices returning a reference that points to the old array data, and slices returning by copy. A array is also allowed to be indexed by a sequence of items.\t Each member of the sequence indexes the corresponding dimension of the array.\";\n\nstatic PyTypeObject PyBigArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.bigndarray\",\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n /* methods */\n (destructor)array_dealloc,\t\t /*tp_dealloc */\n (printfunc)NULL,\t\t\t /*tp_print*/\n 0,\t\t\t\t\t /*tp_getattr*/\n 0,\t\t\t\t\t /*tp_setattr*/\n (cmpfunc)0, \t\t /*tp_compare*/\n (reprfunc)array_repr,\t\t /*tp_repr*/\n &array_as_number,\t\t\t /*tp_as_number*/\n NULL, \t\t\t /*tp_as_sequence*/\n &array_as_mapping,\t\t\t /*tp_as_mapping*/\n (hashfunc)0,\t\t\t /*tp_hash*/\n (ternaryfunc)0,\t\t\t /*tp_call*/\n (reprfunc)array_str, \t /*tp_str*/\n\t\t\n (getattrofunc)0,\t\t\t /*tp_getattro*/\n (setattrofunc)0,\t\t\t /*tp_setattro*/\n NULL, \t /*tp_as_buffer*/\n (Py_TPFLAGS_DEFAULT \n | Py_TPFLAGS_BASETYPE\n | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/\n /*Documentation string */\n Arraytype__doc__,\t\t\t /*tp_doc*/\n\n (traverseproc)0,\t\t\t /*tp_traverse */\n (inquiry)0,\t\t\t /*tp_clear */\n (richcmpfunc)array_richcompare,\t \n offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */\n\n /* Iterator support (use standard) */\n\n (getiterfunc)0, \t\t /* tp_iter */\n (iternextfunc)0,\t\t\t /* tp_iternext */\n\n /* Sub-classing (new-style object) support */\n\n array_methods,\t\t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n array_getsetlist,\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0,\t /* tp_alloc */ \n (newfunc)array_new,\t\t /* tp_new */\n 0,\t \t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n};\n\n/* A standard array will subclass from the Big Array and \n add the array_as_sequence table\n and the array_as_buffer table\n */\n\nstatic PyTypeObject PyArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.ndarray\",\t\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n};\n\n\n/* The rest of this code is to build the right kind of array from a python */\n/* object. */\n\nstatic int \ndiscover_depth(PyObject *s, int max, int stop_at_string) \n{\n int d=0;\n PyObject *e;\n\t\n if(max < 1) return -1;\n\n if(! PySequence_Check(s) || PyInstance_Check(s) || \\\n\t PySequence_Length(s) < 0) {\n PyErr_Clear(); return 0;\n }\n if (PyArray_Check(s))\n\t\treturn PyArray_NDIM(s);\n if(PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))\n\t\treturn stop_at_string ? 0:1;\n if (PySequence_Length(s) == 0) \n\t\treturn 1;\n\t\n if ((e=PySequence_GetItem(s,0)) == NULL) return -1;\n if(e!=s) {\n\t\td=discover_depth(e,max-1, stop_at_string);\n\t\tif(d >= 0) d++;\n\t}\n Py_DECREF(e);\n return d;\n}\n\nstatic int\ndiscover_itemsize(PyObject *s, int nd, int *itemsize) \n{\n\tint n, r, i;\n\tPyObject *e;\n\t\n\tn = PyObject_Length(s);\n\n\tif ((nd == 0) || PyString_Check(s) ||\t\t\\\n\t PyUnicode_Check(s) || PyBuffer_Check(s)) {\n\t\tif PyUnicode_Check(s) \n\t\t\t*itemsize = MAX(*itemsize, sizeof(Py_UNICODE)*n);\n\t\telse\n\t\t\t*itemsize = MAX(*itemsize, n);\n\t\treturn 0;\n\t}\n\tfor (i=0; i n_lower) n_lower = d[1];\n }\n d[1] = n_lower;\n\t\n return 0;\n}\n\nstatic void\n_array_small_type(int chktype, int mintype, int chksize, int minsize, \n\t\t PyArray_Typecode *outtype)\n{\n\touttype->type_num = MAX(chktype, mintype);\n\tif (PyTypeNum_ISFLEXIBLE(outtype->type_num) &&\t\\\n\t PyTypeNum_ISFLEXIBLE(mintype)) {\n\t\t/* Handle string->unicode case separately \n\t\t because string itemsize is twice as large */\n\t\tif (outtype->type_num == PyArray_UNICODE && \n\t\t mintype == PyArray_STRING) {\n\t\t\touttype->itemsize = MAX(chksize, 2*minsize);\n\t\t}\n\t\telse {\n\t\t\touttype->itemsize = MAX(chksize, minsize);\n\t\t}\n\t}\n\telse {\n\t\touttype->itemsize = chksize;\n\t}\n\treturn;\t\n}\n\nstatic void\n_array_find_type(PyObject *op, PyArray_Typecode *minitype, \n\t\t PyArray_Typecode *outtype, int max)\n{\n int l;\n PyObject *ip;\n\tint chktype=0;\n\tint chksize=0;\n\tint mintype, minsize;\n\n\tif (minitype == NULL) {\n\t\tmintype = PyArray_BOOL;\n\t\tminsize = sizeof(Bool);\n\t}\n\telse {\n\t\tmintype = minitype->type_num;\n\t\tminsize = minitype->itemsize;\n\t}\n\n \n if (max < 0 || mintype == -1) goto deflt;\n\t\n if (PyArray_Check(op)) {\n\t\tchktype = PyArray_TYPE(op);\n\t\tchksize = PyArray_ITEMSIZE(op);\n\t\tgoto finish;\n\t}\n\t\n\tif (PyArray_IsScalar(op, Generic)) {\n\t\tPyArray_TypecodeFromScalar(op, outtype);\n\t\tchktype = outtype->type_num;\n\t\tchksize = outtype->itemsize;\n\t\tgoto finish;\n\t}\n\t\n\n if (PyObject_HasAttrString(op, \"__array__\")) {\n ip = PyObject_CallMethod(op, \"__array__\", NULL);\n if(ip && PyArray_Check(ip)) {\n\t\t\tchktype = PyArray_TYPE(ip);\n\t\t\tchksize = PyArray_ITEMSIZE(ip);\n\t\t\tgoto finish;\n\t\t}\n } \n\t\n\tif (PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tint swap=0, res;\n\t\tip = PyObject_GetAttrString(op, \"__array_typestr__\");\n\t\tif (ip && PyString_Check(ip)) {\n\t\t\tres = _array_typecode_fromstr(PyString_AS_STRING(ip), \n\t\t\t\t\t\t &swap, outtype); \n\t\t\tif (res >= 0) {\n\t\t\t\tPy_DECREF(ip);\n\t\t\t\tchktype = outtype->type_num;\n\t\t\t\tchksize = outtype->itemsize;\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t}\n\t\tPy_XDECREF(ip);\n\t}\n\n if (PyString_Check(op)) {\n\t\tchktype = PyArray_STRING;\n\t\tchksize = PyString_GET_SIZE(op);\n\t\tgoto finish;\n }\n\n\tif (PyUnicode_Check(op)) {\n\t\tchktype = PyArray_UNICODE;\n\t\tchksize = PyUnicode_GET_DATA_SIZE(op);\n\t\tgoto finish;\n\t}\n\n\tif (PyBuffer_Check(op)) {\n\t\tchktype = PyArray_VOID;\n\t\tchksize = op->ob_type->tp_as_sequence->sq_length(op);\n\t\tPyErr_Clear();\n\t\tgoto finish;\n\t}\n\n\tif (PyInstance_Check(op)) goto deflt;\n\t\n if (PySequence_Check(op)) {\n\t\tPyArray_Typecode newtype = {mintype, minsize, 0};\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n\t\t\tPyErr_Clear(); \n\t\t\tgoto deflt;\n\t\t}\n if (l == 0 && mintype == 0) {\n\t\t\tnewtype.type_num = PyArray_INTP;\n\t\t\tnewtype.itemsize = sizeof(intp);\n\t\t}\n while (--l >= 0) {\n ip = PySequence_GetItem(op, l);\n if (ip==NULL) {\n\t\t\t\tPyErr_Clear(); \n\t\t\t\tgoto deflt;\n\t\t\t}\n\t\t\t_array_find_type(ip, &newtype, outtype, max-1);\n\t\t\t_array_small_type(outtype->type_num,\n\t\t\t\t\t newtype.type_num, \n\t\t\t\t\t outtype->itemsize,\n\t\t\t\t\t newtype.itemsize,\n\t\t\t\t\t &newtype);\n Py_DECREF(ip);\n }\n\t\tchktype = newtype.type_num;\n\t\tchksize = newtype.itemsize;\n\t\tgoto finish;\n }\n\t\n\tif (PyBool_Check(op)) {\n\t\tchktype = PyArray_BOOL;\n\t\tchksize = sizeof(Bool);\n\t\tgoto finish;\t\t\n\t}\n else if (PyInt_Check(op)) {\n\t\tchktype = PyArray_LONG;\n\t\tchksize = sizeof(long);\n\t\tgoto finish;\n } else if (PyFloat_Check(op)) {\n\t\tchktype = PyArray_DOUBLE;\n\t\tchksize = sizeof(double);\n\t\tgoto finish;\n\t} else if (PyComplex_Check(op)) {\n\t\tchktype = PyArray_CDOUBLE;\n\t\tchksize = sizeof(cdouble);\n\t\tgoto finish;\n\t}\n\n deflt:\n\tchktype = PyArray_OBJECT;\n\tchksize = sizeof(void *);\n\n finish:\n\t_array_small_type(chktype, mintype, chksize, minsize, \n\t\t\t outtype);\n\treturn;\n}\n\nstatic int \nAssign_Array(PyArrayObject *self, PyObject *v) \n{\n PyObject *e;\n int l, r;\n\t\n if (!PySequence_Check(v)) {\n PyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"assignment from non-sequence\");\n return -1;\n }\n\t\n l=PyObject_Length(v);\n if(l < 0) return -1; \n\t\n while(--l >= 0)\n {\n e=PySequence_GetItem(v,l);\n if (e == NULL) return -1; \n\t\t\tr = PySequence_SetItem((PyObject*)self,l,e);\n Py_DECREF(e);\n if(r == -1) return -1;\n }\n return 0;\n}\n\n/* \"Array Scalars don't call this code\" */ \nstatic PyObject *\nArray_FromScalar(PyObject *op, PyArray_Typecode *typecode) \n{\n PyArrayObject *ret;\n\tint itemsize = 0;\n\tint type = typecode->type_num;\n\n\tif PyTypeNum_ISFLEXIBLE(type) {\n\t\titemsize = PyObject_Length(op);\n\t}\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,\n\t\t\t\t\t NULL, NULL, itemsize, 0, NULL);\n\n\tif (ret == NULL) return NULL;\n\n ret->descr->setitem(op, ret->data, ret);\n\t\n if (PyErr_Occurred()) {\n array_dealloc(ret);\n return NULL;\n } else {\n return (PyObject *)ret;\n }\n}\n\n\nstatic PyObject *\nArray_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth)\n{\n PyArrayObject *r;\n int nd;\n\tintp *d;\n\tint stop_at_string;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\t\n\t\n\tstop_at_string = ((type == PyArray_OBJECT) ||\t\\\n\t\t\t (type == PyArray_STRING) ||\t\\\n\t\t\t (type == PyArray_UNICODE) || \\\n\t\t\t (type == PyArray_VOID));\n\n if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string)) > 0)) {\n\t\tif (nd==0)\n\t\t\treturn Array_FromScalar(s, typecode);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid input sequence\");\n return NULL;\n }\n\t\n if ((max_depth && nd > max_depth) ||\t\\\n\t (min_depth && nd < min_depth)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of dimensions\");\n return NULL;\n }\n\t\n\tif ((d=PyDimMem_NEW(nd)) == NULL) {\n\t\treturn PyErr_NoMemory();\n }\n\tif(discover_dimensions(s,nd,d, !stop_at_string) == -1) {\n\t\tPyDimMem_FREE(d);\n\t\treturn NULL;\n\t}\n\tif (itemsize == 0 && PyTypeNum_ISFLEXIBLE(type)) {\n\t\tif (discover_itemsize(s, nd, &itemsize) == -1) {\n\t\t\tPyDimMem_FREE(d);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n r=(PyArrayObject*)PyArray_New(&PyArray_Type, nd, d, \n\t\t\t\t type, NULL, NULL,\n\t\t\t\t itemsize, \n\t\t\t\t typecode->fortran, NULL);\n\n PyDimMem_FREE(d);\n if(!r) return NULL;\n if(Assign_Array(r,s) == -1) {\n\t\tPy_DECREF(r);\n\t\treturn NULL;\n\t}\n return (PyObject*)r;\n}\n\n\nstatic int \nPyArray_ValidType(int type) \n{\n\tPyArray_Descr *descr;\n\t\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr==NULL) return 0;\n\treturn 1;\n}\n\n\n/* If the output is not a CARRAY, then it is buffered also */\n\nstatic int\n_bufferedcast(PyArrayObject *out, PyArrayObject *in)\n{\n\tchar *inbuffer, *bptr, *optr;\n\tchar *outbuffer=NULL;\n\tPyArrayIterObject *it_in=NULL, *it_out=NULL;\n\tregister intp i, index;\n\tintp ncopies = PyArray_SIZE(out) / PyArray_SIZE(in);\n\tint elsize=in->itemsize;\n\tint nels = PyArray_BUFSIZE;\n\tint el;\n\tint inswap, outswap=0;\n\tint obuf=!PyArray_ISCARRAY(out);\n\tint oelsize = out->itemsize;\n\tPyArray_VectorUnaryFunc *castfunc;\n PyArray_CopySwapFunc *in_csn;\n PyArray_CopySwapFunc *out_csn;\n\tint retval = -1;\n\n\tcastfunc = in->descr->cast[out->descr->type_num];\n in_csn = in->descr->copyswap;\n out_csn = out->descr->copyswap;\n\n\t/* If the input or output is STRING, UNICODE, or VOID */\n\t/* then getitem and setitem are used for the cast */\n\t/* and byteswapping is handled by those methods */\n\n\tinswap = !(PyArray_ISFLEXIBLE(in) || PyArray_ISNOTSWAPPED(in));\n\t\n\tinbuffer = PyDataMem_NEW(PyArray_BUFSIZE*elsize);\n\tif (inbuffer == NULL) return -1;\n\tit_in = (PyArrayIterObject *)PyArray_IterNew((PyObject *)in);\n\tif (it_in == NULL) goto exit;\n\n\tif (obuf) {\n\t\toutswap = !(PyArray_ISFLEXIBLE(out) || \\\n\t\t\t PyArray_ISNOTSWAPPED(out));\n\t\toutbuffer = PyDataMem_NEW(PyArray_BUFSIZE*oelsize);\n\t\tif (outbuffer == NULL) goto exit;\n\n\t\tit_out = (PyArrayIterObject *)PyArray_IterNew((PyObject *)out);\n\t\tif (it_out == NULL) goto exit;\n\n\t\tnels = MIN(nels, PyArray_BUFSIZE);\n\t}\n\t\n\toptr = (obuf) ? outbuffer: out->data;\n\tbptr = inbuffer;\n\tel = 0;\t\n\twhile(ncopies--) {\n\t\tindex = it_in->size;\n\t\tPyArray_ITER_RESET(it_in);\n\t\twhile(index--) {\n in_csn(bptr, it_in->dataptr, inswap, elsize);\n\t\t\tbptr += elsize;\n\t\t\tPyArray_ITER_NEXT(it_in);\n\t\t\tel += 1;\n\t\t\tif ((el == nels) || (index == 0)) {\n\t\t\t\t/* buffer filled, do cast */\n\t\t\t\t\n\t\t\t\tcastfunc(inbuffer, optr, el, in, out);\n\t\t\t\t\n\t\t\t\tif (obuf) {\n\t\t\t\t\t/* Copy from outbuffer to array */\n\t\t\t\t\tfor(i=0; idataptr,\n optr, outswap,\n oelsize);\n\t\t\t\t\t\toptr += oelsize;\n\t\t\t\t\t\tPyArray_ITER_NEXT(it_out);\n\t\t\t\t\t}\n\t\t\t\t\toptr = outbuffer;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toptr += out->itemsize * nels;\n\t\t\t\t}\n\t\t\t\tel = 0;\n\t\t\t\tbptr = inbuffer;\n\t\t\t}\n\t\t}\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(it_in);\n\tPyDataMem_FREE(inbuffer);\n\tPyDataMem_FREE(outbuffer);\t\n\tif (obuf) {\n\t\tPy_XDECREF(it_out);\n\t}\n\treturn retval;\n\n}\n\n\n/* For backward compatibility */\n\nstatic PyObject *\nPyArray_Cast(PyArrayObject *mp, int type_num) \n{\n\tPyArray_Typecode type;\n\tPyArray_Descr *descr;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\ttype.itemsize = descr->elsize;\n\ttype.type_num = descr->type_num;\n\ttype.fortran = 0;\n\t\n\treturn PyArray_CastToType(mp, &type);\n}\n\nstatic PyObject * \nPyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at) \n{\n\tPyObject *out;\n\tint ret;\n\n\tif ((mp->descr->type_num == at->type_num) && \\\n\t (at->itemsize==0 || mp->itemsize == at->itemsize) &&\n\t PyArray_ISBEHAVED_RO(mp)) {\n\t\tPy_INCREF(mp);\n\t\treturn (PyObject *)mp;\n\t}\n\t\t\n\tif (at->itemsize == 0) {\n\t\tif (mp->descr->type_num == PyArray_STRING &&\t\\\n\t\t at->type_num == PyArray_UNICODE)\n\t\t\tat->itemsize = mp->itemsize*sizeof(Py_UNICODE);\n\t\tif (mp->descr->type_num == PyArray_UNICODE &&\n\t\t at->type_num == PyArray_STRING) \n\t\t\tat->itemsize = mp->itemsize/sizeof(Py_UNICODE);\n\t\tif (at->type_num == PyArray_VOID)\n\t\t\tat->itemsize = mp->itemsize;\n\t}\n\n\tout = PyArray_New(mp->ob_type, mp->nd, \n\t\t\t mp->dimensions, \n\t\t\t at->type_num,\n\t\t\t NULL, NULL, at->itemsize, \n\t\t\t at->fortran, (PyObject *)mp);\n\tif (out == NULL) return NULL;\n\tret = PyArray_CastTo((PyArrayObject *)out, mp);\n\tif (ret != -1) return out;\n\n\tPy_DECREF(out);\n\treturn NULL;\n\t\n}\n\t \n/* The number of elements in out must be an integer multiple\n of the number of elements in mp. \n*/\n\nstatic int\nPyArray_CastTo(PyArrayObject *out, PyArrayObject *mp)\n{\n\n\tint simple;\n\tintp mpsize = PyArray_SIZE(mp);\n\tintp outsize = PyArray_SIZE(out);\n\n\tif (mpsize == 0) return 0;\n\tif (!PyArray_ISWRITEABLE(out)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array is not writeable.\");\n\t\treturn -1;\n\t}\n\tif (outsize % mpsize != 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array must have an integer-multiple\"\\\n\t\t\t\t\" of the number of elements in the input \"\\\n\t\t\t\t\"array\");\n\t\treturn -1; \n\t}\n\n\tsimple = ((PyArray_ISCARRAY(mp) && PyArray_ISCARRAY(out)) || \\\n (PyArray_ISFARRAY(mp) && PyArray_ISFARRAY(out)));\n\t\n\tif (simple) {\n\t\tchar *inptr;\n\t\tchar *optr = out->data;\n\t\tintp obytes = out->itemsize * outsize;\n\t\tintp ncopies = outsize / mpsize;\n\n\t\twhile(ncopies--) {\n\t\t\tinptr = mp->data;\n\t\t\tmp->descr->cast[out->descr->type_num](inptr, \n\t\t\t\t\t\t\t optr,\n\t\t\t\t\t\t\t mpsize,\n\t\t\t\t\t\t\t mp, out);\n\t\t\toptr += obytes;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t/* If not a well-behaved cast, then use buffers */\n\tif (_bufferedcast(out, mp) == -1) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nstatic PyObject *\narray_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags) \n{\n\t\n\tPyArrayObject *ret=NULL;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\tint copy = 0;\n\tint arrflags;\n\tPyArray_Typecode oldtype={PyArray_TYPE(arr),PyArray_ITEMSIZE(arr),0};\n\tchar *msg = \"Cannot copy-back to a read-only array.\";\n\t\n\tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n\tif (itemsize == 0) itemsize = arr->itemsize;\n\ttypecode->type_num = type;\n\ttypecode->itemsize = itemsize;\n\n\t/* Don't copy if sizes are compatible */\n\tif (PyArray_EquivalentTypes(&oldtype, typecode)) {\n\t\tarrflags = arr->flags;\n\n\t\tcopy = (flags & ENSURECOPY) || \\\n\t\t\t((flags & CONTIGUOUS) && (!(arrflags & CONTIGUOUS))) \\\n\t\t\t|| (PyArray_ITEMSIZE(arr) != itemsize) || \\\n\t\t\t((flags & ALIGNED) && (!(arrflags & ALIGNED))) || \\\n\t\t\t((flags & NOTSWAPPED) && (!(arrflags & NOTSWAPPED))) \\\n\t\t\t|| (arr->nd > 1 &&\t\t\t\t\\\n\t\t\t ((flags & FORTRAN) != (arrflags & FORTRAN))) || \\\n\t\t\t((flags & WRITEABLE) && (!(arrflags & WRITEABLE)));\n\t\t\n\t\tif (copy) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_New(arr->ob_type, \n\t\t\t\t\t arr->nd, \n\t\t\t\t\t arr->dimensions,\n\t\t\t\t\t arr->descr->type_num,\n\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t itemsize,\n\t\t\t\t\t flags & FORTRAN,\n\t\t\t\t\t (PyObject *)arr);\n\t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t} \n\t\t/* If no copy then just increase the reference\n\t\t count and return the input */\n\t\telse { \n\t\t\tPy_INCREF(arr);\n\t\t\tret = arr;\n\t\t}\n\t}\n\t\n\t/* The desired output type is different than the input\n\t array type */\n\telse {\n\t\t/* Cast to the desired type if we can do it safely\n\t\t Also cast if source is a ndim-0 array to mimic\n\t\t behavior with Python scalars */\n\t\tif (flags & FORCECAST || PyArray_NDIM(arr)==0 ||\n\t\t PyArray_CanCastSafely(PyArray_TYPE(arr), type)) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_CastToType(arr, typecode);\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Array can not be safely cast \"\\\n\t\t\t\t\t\"to required type\");\n\t\t\tret = NULL;\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic int\n_array_typecode_fromstr(char *str, int *swap, PyArray_Typecode *type)\n{\n int type_num;\n char typechar;\n int size;\n unsigned long number = 1;\n char *s;\n char msg[] = \"unsupported typestring\";\n \n s = (char *)&number; /* s[0] == 0 implies big-endian */\n\n *swap = 0;\n\n if (str[0] == '<' || str[0] == '>') {\n\tif ((str[0] == '<') && (s[0] == 0)) *swap = 1;\n\telse if ((str[0] == '>') && (s[0] != 0)) *swap = 1;\n }\n str += 1;\n \n#define _MY_FAIL {\t\t\t\t \\\n\t PyErr_SetString(PyExc_ValueError, msg); \\\n\t return -1;\t\t\t \\\n }\t\t\n\n typechar = str[0];\n size = atoi(str + 1);\n switch (typechar) {\n case 'b':\n\t if (size == sizeof(Bool))\n\t\t type_num = PyArray_BOOL;\t \n\t else _MY_FAIL \n\t break;\t\t \n case 'u':\n if (size == sizeof(uintp))\n type_num = PyArray_UINTP;\n\t else if (size == sizeof(char))\n\t\t type_num = PyArray_UBYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_USHORT;\n\t else if (size == sizeof(int)) \n\t\t type_num = PyArray_UINT;\n\t else if (size == sizeof(ulong)) \n\t\t type_num = PyArray_ULONG;\n\t else if (size == sizeof(ulonglong))\n\t\t type_num = PyArray_ULONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'i':\n if (size == sizeof(intp))\n type_num = PyArray_INTP;\n\t else if (size == sizeof(char)) \n\t\t type_num = PyArray_BYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_SHORT;\n\t else if (size == sizeof(int))\n\t\t type_num = PyArray_INT;\n\t else if (size == sizeof(long)) \n\t\t type_num = PyArray_LONG;\n\t else if (size == sizeof(longlong))\n\t\t type_num = PyArray_LONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'f':\n\t if (size == sizeof(float))\n\t\t type_num = PyArray_FLOAT;\n\t else if (size == sizeof(double))\n\t\t type_num = PyArray_DOUBLE;\n\t else if (size == sizeof(longdouble))\n\t\t type_num = PyArray_LONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'c':\n\t if (size == sizeof(float)*2)\n\t\t type_num = PyArray_CFLOAT;\n\t else if (size == sizeof(double)*2)\n\t\t type_num = PyArray_CDOUBLE;\n\t else if (size == sizeof(longdouble)*2)\n\t\t type_num = PyArray_CLONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'O':\n\t if (size == sizeof(PyObject *))\n\t\t type_num = PyArray_OBJECT;\n\t else _MY_FAIL\n\t break;\n case 'S':\n\t type_num = PyArray_STRING;\n\t break;\n case 'U':\n\t type_num = PyArray_UNICODE;\n\t size *= sizeof(Py_UNICODE);\n\t break;\t \n case 'V':\n\t type_num = PyArray_VOID;\n\t break;\n default:\n\t _MY_FAIL\n }\n\n#undef _MY_FAIL\n\n type->type_num = type_num;\n type->itemsize = size;\n type->fortran = 0;\n return 0;\n}\n\nstatic PyObject *\narray_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n{\n\tPyObject *attr=NULL, *item=NULL, *r;\n\tPyArrayObject *ret=NULL;\n\tPyArray_Typecode type;\n\tchar *data;\n\tint buffer_len;\n\tint res, i, n;\n\tintp dims[MAX_DIMS], strides[MAX_DIMS];\n\tint swap;\n\n\t/* Get the memory from __array_data__ and __array_offset__ */\n\t/* Get the shape */\n\t/* Get the typestring -- ignore array_descr */\n\t/* Get the strides */\n\t\n\tattr = PyObject_GetAttrString(input, \"__array_data__\");\n\tif (attr == NULL) {\n\t\tPy_INCREF(input);\n\t\tattr = input;\n\t}\n\t\n\tres = PyObject_AsWriteBuffer(attr, (void **)&data, &buffer_len);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n\n\tattr = PyObject_GetAttrString(input, \"__array_typestr__\");\n\tif (!PyString_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_typestr__ must be a string.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\t\n\t}\n\tres = _array_typecode_fromstr(PyString_AS_STRING(attr), &swap, &type);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n \n\tattr = PyObject_GetAttrString(input, \"__array_shape__\");\n\tif (!PyTuple_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_shape__ must be a tuple.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\n\t}\n\tn = PyTuple_GET_SIZE(attr);\n\tfor (i=0; ibase = input;\n \n\tattr = PyObject_GetAttrString(input, \"__array_strides__\");\n\tif (attr != NULL && attr != Py_None) {\n\t\tif (!PyTuple_Check(attr)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"__array_strides__ must be a tuple.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tif (n != PyTuple_GET_SIZE(attr)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"mismatch in length of \"\\\n\t\t\t\t\t\"__array_strides__ and \"\\\n\t\t\t\t\t\"__array_shape__.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tfor (i=0; istrides, strides, n*sizeof(intp));\n\t}\n\n\tif (swap) {\n\t\tPyObject *tmp;\n\t\ttmp = PyObject_CallMethod((PyObject *)ret, \"byteswap\", \"\");\n\t\tPy_DECREF(tmp);\n\t}\n\n\tPyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);\n\tr = array_fromarray(ret, intype, flags);\n\tPy_DECREF(ret);\n\treturn r;\n}\n\nstatic PyObject *\narray_fromattr(PyObject *op, PyArray_Typecode *typecode, int flags) \n{\n PyObject *new, *r;\n\t \n if (typecode->type_num == PyArray_NOTYPE) {\n new = PyObject_CallMethod(op, \"__array__\", NULL);\n } else {\n new = PyObject_CallMethod(op, \"__array__\", \"i\", \n typecode->type_num);\n }\n if (new == NULL) return NULL;\n if (!PyArray_Check(new)) {\n PyErr_SetString(PyExc_ValueError, \n \"object __array__ method not \" \\\n \"producing an array.\");\n Py_DECREF(new);\n return NULL;\n }\n r = array_fromarray((PyArrayObject *)new, typecode, flags);\n Py_DECREF(new);\n return r;\n} \n\n\nstatic PyObject *\narray_fromobject(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth, int flags) \n{\n /* This is the main code to make a NumPy array from a Python\n Object. It is called from lot's of different places which\n is why there are so many checks. The comments try to\n explain some of the checks. */\n\n\tint type = typecode->type_num;\n PyObject *r=NULL;\n\n\t/* Is input object already an array? */\n\t/* This is where the flags are used */\n if (PyArray_Check(op)) \n\t\tr = array_fromarray((PyArrayObject *)op, typecode, flags);\n\telse if (PyObject_HasAttrString(op, \"__array__\")) {\n\t\t/* Code that returns the object to convert for a non\n\t\t multiarray input object from the __array__ attribute of the\n\t\t object. */\n r = array_fromattr(op, typecode, flags);\n\t}\n\telse if (PyObject_HasAttrString(op, \"__array_shape__\") &&\n\t\t PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tr = array_frominterface(op, typecode, flags);\n\t}\n\telse {\n\t\tif (type == PyArray_NOTYPE) {\n\t\t\t_array_find_type(op, NULL, typecode, MAX_DIMS);\n\t\t}\n\t\tif (PySequence_Check(op))\n\t\t\tr = Array_FromSequence(op, typecode, \n\t\t\t\t\t min_depth, max_depth);\n\t\telse\n\t\t\tr = Array_FromScalar(op, typecode);\n\t}\n\n /* If we didn't succed return NULL */\n if (r == NULL) return NULL;\n\t\n\t/* Be sure we succeed here */\n\t\n if(!PyArray_Check(r)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Internal error array_fromobject \"\\\n\t\t\t\t\"not producing an array\");\n\t\tPy_DECREF(r);\n return NULL;\n }\n\n if (min_depth != 0 && ((PyArrayObject *)r)->nd < min_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object of too small depth for desired array\");\n return NULL;\n }\n if (max_depth != 0 && ((PyArrayObject *)r)->nd > max_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object too deep for desired array\");\n return NULL;\n }\n return r;\n}\n\nstatic void\nPyArray_ArrayType(PyObject *op, PyArray_Typecode *intype, \n\t\t PyArray_Typecode *outtype) \n{\n\t_array_find_type(op, intype, outtype, MAX_DIMS);\n\treturn;\n}\n\nstatic int \nPyArray_ObjectType(PyObject *op, int minimum_type) \n{\n\tPyArray_Typecode intype, outtype;\n\tintype.type_num = minimum_type;\n\t_array_find_type(op, &intype, &outtype, MAX_DIMS);\n\treturn outtype.type_num;\n}\n\n\n\n/* flags is any of \n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough\n to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, and WRITEABLE\n and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, the returned array will be a copy of the object, \n (C) contiguous in memory, aligned, notswapped, and writeable.\n \n So CONTIGUOUS | ENSURECOPY passed in means that the returned\n array does not have to be CONTIGUOUS or a COPY but should be\n ALIGNED, NOTSWAPPED and WRITEABLE. \n\n typecode->fortran can be set to request a\n fortran-contiguous array. Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n*/\n\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n{\n \tPyArray_Typecode mine = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode *type;\n\t\n\tif (typecode == NULL) type = &mine;\n\telse type = typecode;\n\t\t\n\tif (requires & ENSURECOPY) {\n\t\trequires |= DEFAULT_FLAGS;\n\t}\n\t/* Ensure that type->fortran and flags & FORTRAN are the\n\t same */\n\tif (requires & FORTRAN) typecode->fortran = 1;\n\tif (type->fortran == 1) {\n\t\trequires |= FARRAY_FLAGS;\n\t\tif (min_depth > 2) requires &= ~CONTIGUOUS;\n\t}\n\n\t/* make sure itemsize is not 0 unless warranted. */\n\tif ((type->itemsize == 0) && (type->type_num != PyArray_NOTYPE)) {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type->type_num);\n\t\tif (descr != NULL) type->itemsize = descr->elsize;\n\t\telse return NULL;\n\t}\n\t\n\treturn array_fromobject(op, type, min_depth, max_depth, \n\t\t\t\trequires);\t\n}\n\n/* This is a quick wrapper around PyArray_FromAny(op, NULL, 0, 0, 0) */\n/* that special cases Arrays and PyArray_Scalars up front */\n/* It steals a reference to the object */\n\n/* Because it decrefs op if any conversion needs to take place \n -- so it can be used like PyArray_EnsureArray(some_function(...)) */\n\nstatic PyObject *\nPyArray_EnsureArray(PyObject *op)\n{\n PyObject *new;\n\n if (op == NULL) return NULL;\n\n if (PyArray_Check(op)) return op;\n\n if (PyArray_IsScalar(op, Generic)) {\n new = PyArray_FromScalar(op, NULL);\n Py_DECREF(op);\n return new;\n }\n new = PyArray_FromAny(op, NULL, 0, 0, 0);\n Py_DECREF(op);\n return new;\n}\n\n/* These are all compressed into a single API */\n/* Deprecated calls -- Use PyArray_FromAny */\n\nstatic PyObject *\nPyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, BEHAVED_FLAGS);\n}\n\nstatic PyObject *\nPyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n\t\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, DEFAULT_FLAGS);\n}\n\nstatic PyObject *\nPyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {type, 0, 0};\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n\t\t\t ENSURECOPY);\n}\n\n/* End of deprecated */\n\n\nstatic int \nPyArray_CanCastSafely(int fromtype, int totype) \n{\n\tPyArray_Descr *from, *to;\n\n if (fromtype == totype) return 1;\n if (fromtype == PyArray_BOOL) return 1;\n\tif (totype == PyArray_BOOL) return 0;\n if (totype == PyArray_OBJECT || totype == PyArray_VOID) return 1;\n\tif (fromtype == PyArray_OBJECT || fromtype == PyArray_VOID) return 0;\n\n\tfrom = PyArray_DescrFromType(fromtype);\n\tto = PyArray_DescrFromType(totype);\n \n switch(fromtype) {\n case PyArray_BYTE:\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISUNSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_UBYTE:\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_FLOAT:\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\tif (PyTypeNum_ISCOMPLEX(totype)) \n\t\t\treturn ((to->elsize >> 1) >= from->elsize);\n\t\telse\n\t\t\treturn (totype > fromtype);\n case PyArray_CFLOAT:\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn (totype > fromtype);\n\tcase PyArray_STRING:\n\tcase PyArray_UNICODE:\n\t\treturn (totype > fromtype);\n default:\n return 0;\n }\n}\n\nstatic Bool\nPyArray_CanCastTo(PyArray_Typecode *from, PyArray_Typecode *to)\n{\n\tint fromtype=from->type_num;\n\tint totype=to->type_num;\n\tBool ret;\n\n\tret = (Bool) PyArray_CanCastSafely(fromtype, totype);\n\tif (ret) { /* Check String and Unicode more closely */\n\t\tif (fromtype == PyArray_STRING) {\n\t\t\tif (totype == PyArray_STRING) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t\telse if (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize * sizeof(Py_UNICODE)\\\n\t\t\t\t <= to->itemsize);\n\t\t\t}\n\t\t}\n\t\telse if (fromtype == PyArray_UNICODE) {\n\t\t\tif (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}\n\n\n\n/*********************** Element-wise Array Iterator ***********************/\n/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/\n/* and Python's array iterator ***/\n \n\nstatic PyObject *\nPyArray_IterNew(PyObject *obj)\n{\n PyArrayIterObject *it;\n\tint i, nd; \n\tPyArrayObject *ao = (PyArrayObject *)obj;\n\n if (!PyArray_Check(ao)) {\n PyErr_BadInternalCall();\n return NULL;\n }\n\n it = PyObject_GC_New(PyArrayIterObject, &PyArrayIter_Type);\n if (it == NULL)\n return NULL;\n\n\tnd = ao->nd;\n\tPyArray_UpdateFlags(ao, CONTIGUOUS);\n\tit->contiguous = 0;\n\tif PyArray_ISCONTIGUOUS(ao) it->contiguous = 1;\n Py_INCREF(ao);\n it->ao = ao;\n\tit->size = PyArray_SIZE(ao);\n\tit->nd_m1 = nd - 1;\n\tit->factors[nd-1] = 1;\n\tfor (i=0; i < nd; i++) {\n\t\tit->dims_m1[i] = it->ao->dimensions[i] - 1;\n\t\tit->strides[i] = it->ao->strides[i];\n\t\tit->backstrides[i] = it->strides[i] *\t\\\n\t\t\tit->dims_m1[i];\n\t\tif (i > 0)\n\t\t\tit->factors[nd-i-1] = it->factors[nd-i] *\t\\\n\t\t\t\tit->ao->dimensions[nd-i];\n\t}\n\tPyArray_ITER_RESET(it);\n\t\n PyObject_GC_Track(it);\n return (PyObject *)it;\n}\n\n/* Returns an array scalar holding the element desired */\n\nstatic PyObject *\narrayiter_next(PyArrayIterObject *it)\n{\n\tPyObject *ret;\n\n\tif (it->index < it->size) {\n\t\tret = PyArray_ToScalar(it->dataptr, it->ao);\n\t\tPyArray_ITER_NEXT(it);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narrayiter_dealloc(PyArrayIterObject *it)\n{\n PyObject_GC_UnTrack(it);\n Py_XDECREF(it->ao);\n PyObject_GC_Del(it);\n }\n\nstatic int\narrayiter_traverse(PyArrayIterObject *it, visitproc visit, void *arg)\n{\n if (it->ao != NULL)\n return visit((PyObject *)(it->ao), arg);\n return 0;\n}\n\n\nstatic int\niter_length(PyArrayIterObject *self) \n{\n return (int) self->size;\n}\n\n\nstatic PyObject *\niter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tint index, strides, itemsize;\n\tintp count=0;\n\tchar *dptr, *optr;\n\tPyObject *r;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn NULL;\n\t}\n\tindex = (ind->dimensions[0]);\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\t/* Get size of return array */\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0)\n\t\t\tcount++;\n\t\tdptr += strides;\n\t}\n\titemsize = self->ao->itemsize;\n\tr = PyArray_New(self->ao->ob_type, 1, &count, \n\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\titemsize, 0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\t/* Set up loop */\n\toptr = PyArray_DATA(r);\n\tindex = ind->dimensions[0];\n\tdptr = ind->data;\n\n copyswap = self->ao->descr->copyswap;\n\t/* Loop over Boolean array */\n\tswap = !(PyArray_ISNOTSWAPPED(self->ao));\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\t\toptr += itemsize;\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\nstatic PyObject *\niter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tintp num;\n\tPyObject *r;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint swap;\n\tchar *optr;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = self->ao->itemsize;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t}\n\t\n\tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n\t\t\tself->ao->descr->type_num, NULL, \n\t\t\tNULL, self->ao->itemsize, \n\t\t\t0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\toptr = PyArray_DATA(r);\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) {Py_DECREF(r); return NULL;}\n\tindex = ind_it->size;\n copyswap = PyArray_DESCR(r)->copyswap;\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif (num < 0 || num >= self->size) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\tPy_DECREF(r);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\toptr += itemsize;\n\t\tPyArray_ITER_NEXT(ind_it);\n\t}\n\tPy_DECREF(ind_it);\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\n\nstatic PyObject *\niter_subscript(PyArrayIterObject *self, PyObject *ind)\n{\n\tint i;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *r;\n\tchar *dptr;\n\tint size;\n\tPyObject *obj = NULL;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\t\t\n\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\tobj = iter_subscript(self, ind);\n\t\tPy_DECREF(ind);\n\t\treturn obj;\n\t}\n\n\t/* Tuples not accepted --- i.e. no NewAxis */\n\t/* Could implement this with adjusted strides\n\t and dimensions in iterator */\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\tPyArray_ITER_RESET(self);\n\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n\t\t\treturn PyArray_ToScalar(self->dataptr, self->ao);\n\t\t}\n\t\telse { /* empty array */\n\t\t\tintp ii = 0;\n\t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n\t\t\t\t\tself->ao->descr->type_num, NULL, \n\t\t\t\t\tNULL, self->ao->itemsize, 0,\n\t\t\t\t\t(PyObject *)self->ao);\n\t\t\treturn r;\t\t\t\n\t\t}\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) \n\t\t\tgoto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start)\n\t\tif (n_steps == SingleIndex) { /* Integer */\n\t\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn r;\n\t\t}\n\t\tsize = self->ao->itemsize;\n\t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n\t\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\t\tsize, 0, (PyObject *)self->ao);\n\t\tif (r==NULL) goto fail; \n\t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n copyswap = PyArray_DESCR(r)->copyswap;\n\t\twhile(n_steps--) {\n copyswap(dptr, self->dataptr, swap, size);\n\t\t\tfor(i=0; i< step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tdptr += size;\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer) || PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tr = iter_subscript_Bool(self, (PyArrayObject *)obj);\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tobj = new;\n\t\t\tr = iter_subscript_int(self, (PyArrayObject *)obj);\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"unsupported iterator index\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPy_DECREF(obj);\n\t\treturn r;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\n fail:\n\tPy_XDECREF(obj);\n\treturn NULL;\n\n}\n\n\nstatic int\niter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tint index, strides, itemsize;\n\tchar *dptr;\n PyArray_CopySwapFunc *copyswap;\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn -1;\n\t}\n\titemsize = self->ao->itemsize;\n\tindex = ind->dimensions[0];\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\tPyArray_ITER_RESET(self);\n\t/* Loop over Boolean array */\n copyswap = self->ao->descr->copyswap;\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(self->dataptr, val->dataptr, swap,\n itemsize);\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index==val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn 0;\n}\n\nstatic int\niter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tPyArray_Typecode typecode;\n\tintp num;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = typecode.itemsize = self->ao->itemsize;\n\ttypecode.type_num = self->ao->descr->type_num;\n copyswap = self->ao->descr->copyswap;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\treturn 0;\n\t}\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) return -1;\n\tindex = ind_it->size;\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif ((num < 0) || (num >= self->size)) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\treturn -1;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\tPyArray_ITER_NEXT(ind_it);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index == val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPy_DECREF(ind_it);\n\treturn 0;\n}\n\n\nstatic int\niter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) \n{\n\tint i;\n\tPyObject *arrval=NULL;\n\tPyArrayIterObject *val_it=NULL;\n\tPyArray_Typecode type;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint swap;\n\tint itemsize;\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *obj;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\ti = iter_ass_subscript(self, ind, val);\n\t\tPy_DECREF(ind);\n\t\treturn i;\n\t}\n\t\n\ttype.type_num = self->ao->descr->type_num;\n\titemsize = type.itemsize = self->ao->itemsize;\n\t\n\tarrval = PyArray_FromAny(val, &type, 0, 0, 0);\n\tif (arrval==NULL) return -1;\n\tval_it = (PyArrayIterObject *)PyArray_IterNew(arrval);\n\tif (val_it==NULL) goto fail;\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\n copyswap = PyArray_DESCR(arrval)->copyswap;\n\tswap = (PyArray_ISNOTSWAPPED(self->ao)!=PyArray_ISNOTSWAPPED(arrval));\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n copyswap(self->dataptr, PyArray_DATA(arrval), \n swap, itemsize);\n\t\t}\n\t\tgoto succeed;\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) goto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start);\n\t\tif (n_steps == SingleIndex) { /* Integer */\n copyswap(self->dataptr, PyArray_DATA(arrval),\n swap, itemsize);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\tgoto succeed;\n\t\t}\n\t\twhile(n_steps--) {\n copyswap(self->dataptr, val_it->dataptr,\n swap, itemsize);\n\t\t\tfor(i=0; i < step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tPyArray_ITER_NEXT(val_it);\n\t\t\tif (val_it->index == val_it->size) \n\t\t\t\tPyArray_ITER_RESET(val_it);\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\tgoto succeed;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer))\n\t\tobj = PyArray_FromScalar(ind, &indtype);\n\telse if (PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tif (iter_ass_sub_Bool(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tPy_DECREF(obj);\n\t\t\tobj = new;\n\t\t\tif (iter_ass_sub_int(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t}\n\t\telse goto fail;\n\t\tPy_DECREF(obj);\n\t\tgoto succeed;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\tgoto fail;\n\n succeed:\n\tPy_DECREF(val_it);\n\tPy_DECREF(arrval);\n\treturn 0;\n\n fail:\n\tPy_XDECREF(val_it);\n\tPy_XDECREF(arrval);\n\treturn -1;\n\t\n}\n\n\nstatic PyMappingMethods iter_as_mapping = {\n (inquiry)iter_length,\t\t /*mp_length*/\n (binaryfunc)iter_subscript,\t /*mp_subscript*/\n (objobjargproc)iter_ass_subscript,\t/*mp_ass_subscript*/\n};\n\nstatic char doc_iter_array[] = \"__array__(type=None)\\n Get array \"\\\n \"from iterator\";\n\nstatic PyObject *\niter_array(PyArrayIterObject *it, PyObject *op) \n{\n \n PyObject *r;\n intp size;\n\n /* Any argument ignored */\n\n /* Two options: \n 1) underlying array is contiguous\n -- return 1-d wrapper around it \n 2) underlying array is not contiguous\n -- make new 1-d contiguous array with updateifcopy flag set\n to copy back to the old array\n */\n\n size = PyArray_SIZE(it->ao);\n if (PyArray_ISCONTIGUOUS(it->ao)) {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n\t\t\t\tit->ao->flags,\n (PyObject *)it->ao); \n\t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, NULL, it->ao->itemsize, 0, \n (PyObject *)it->ao);\n\t\tif (r==NULL) return NULL;\n\t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n\t\t\tPy_DECREF(r); \n\t\t\treturn NULL;\n\t\t}\n PyArray_FLAGS(r) |= UPDATEIFCOPY;\n it->ao->flags &= ~WRITEABLE;\n }\n Py_INCREF(it->ao);\n PyArray_BASE(r) = (PyObject *)it->ao;\n return r;\n \n}\n\nstatic char doc_iter_copy[] = \"copy()\\n Get a copy of 1-d array\";\n\nstatic PyObject *\niter_copy(PyArrayIterObject *it, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\t\n\treturn PyArray_Flatten(it->ao, 0);\n}\n\nstatic PyMethodDef iter_methods[] = {\n /* to get array */\n {\"__array__\", (PyCFunction)iter_array, 1, doc_iter_array},\n\t{\"copy\", (PyCFunction)iter_copy, 1, doc_iter_copy},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\nstatic PyTypeObject PyArrayIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.flatiter\",\t\t /* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arrayiter_dealloc,\t\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0, \t\t\t /* tp_as_sequence */\n &iter_as_mapping, \t /* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0,\t \t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arrayiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arrayiter_next,\t\t/* tp_iternext */\n iter_methods,\t\t\t\t/* tp_methods */\n};\n\n/** END of Array Iterator **/\n\n\n\n/*********************** Subscript Array Iterator *************************\n * *\n * This object handles subscript behavior for array objects. *\n * It is an iterator object with a next method *\n * It abstracts the n-dimensional mapping behavior to make the looping *\n * code more understandable (maybe) *\n * and so that indexing can be set up ahead of time *\n */ \n\n/* This checks the args for any fancy indexing objects */\n\n#define SOBJ_NOTFANCY 0 \n#define SOBJ_ISFANCY 1\n#define SOBJ_BADARRAY 2\n#define SOBJ_TOOMANY 3\n#define SOBJ_LISTTUP 4\n\nstatic int\nfancy_indexing_check(PyObject *args)\n{\n\tint i, n;\n\tPyObject *obj;\n\tint retval = SOBJ_NOTFANCY;\n\n\tif (PyTuple_Check(args)) {\n\t\tn = PyTuple_GET_SIZE(args);\n\t\tif (n >= MAX_DIMS) return SOBJ_TOOMANY;\n\t\tfor (i=0; i=MAX_DIMS) return SOBJ_ISFANCY;\n\t\tfor (i=0; i SOBJ_ISFANCY) return retval;\n\t\t}\n\t}\n\n\treturn retval;\n}\n\n/* convert an indexing object to an INTP indexing array iterator\n if possible -- otherwise, it is a Slice or Ellipsis object\n and has to be interpreted on bind to a particular \n array so leave it NULL for now.\n */\nstatic int\n_convert_obj(PyObject *obj, PyArrayIterObject **iter)\n{\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tPyObject *arr;\n\n\tif (PySlice_Check(obj) || (obj == Py_Ellipsis))\n\t\t*iter = NULL;\n\telse {\n\t\tarr = PyArray_FromAny(obj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) return -1;\n\t\t*iter = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (*iter == NULL) return -1;\n\t}\n\treturn 0;\n}\n\n/* Adjust dimensionality and strides for index object iterators \n --- i.e. broadcast\n */\nstatic int\nPyArray_Broadcast(PyArrayMultiIterObject *mit)\n{\n\tint i, nd, k, j;\n\tintp tmp;\n\tPyArrayIterObject *it;\n\t\n\t/* Discover the broadcast number of dimensions */\n\tfor (i=0, nd=0; inumiter; i++) \n\t\tnd = MAX(nd, mit->iters[i]->ao->nd);\n\tmit->nd = nd;\n\n\t/* Discover the broadcast shape in each dimension */\n\tfor (i=0; idimensions[i] = 1;\n\t\tfor (j=0; jnumiter; j++) {\n\t\t\tit = mit->iters[j];\n\t\t\t/* This prepends 1 to shapes not already \n\t\t\t equal to nd */\n\t\t\tk = i + it->ao->nd - nd;\n\t\t\tif (k>=0) {\n\t\t\t\ttmp = it->ao->dimensions[k];\n\t\t\t\tif (tmp == 1) continue;\n\t\t\t\tif (mit->dimensions[i] == 1) \n\t\t\t\t\tmit->dimensions[i] = tmp;\n\t\t\t\telse if (mit->dimensions[i] != tmp) {\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\t\"index objects are \" \\\n\t\t\t\t\t\t\t\"not broadcastable \" \\\n\t\t\t\t\t\t\t\"to a single shape.\");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Reset the iterator dimensions and strides of each iterator\n\t object -- using 0 valued strides for broadcasting */\n\n\ttmp = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tmit->size = tmp;\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tit->nd_m1 = mit->nd - 1;\n\t\tit->size = tmp;\n\t\tnd = it->ao->nd;\n\t\tit->factors[mit->nd-1] = 1;\n\t\tfor (j=0; j < mit->nd; j++) {\n\t\t\tit->dims_m1[j] = mit->dimensions[j] - 1;\n\t\t\tk = j + nd - mit->nd;\n\t\t\t/* If this dimension was added or shape\n\t\t\t of underlying array was 1 */\n\t\t\tif ((k < 0) || \\\n\t\t\t it->ao->dimensions[k] != mit->dimensions[j]) {\n\t\t\t\tit->contiguous = 0;\n\t\t\t\tit->strides[j] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tit->strides[j] = it->ao->strides[k];\n\t\t\t}\n\t\t\tit->backstrides[j] = it->strides[j] *\t\\\n\t\t\t\tit->dims_m1[j];\n\t\t\tif (j > 0)\n\t\t\t\tit->factors[mit->nd-j-1] =\t\t\\\n\t\t\t\t\tit->factors[mit->nd-j] *\t\\\n\t\t\t\t\tmit->dimensions[mit->nd-j];\n\t\t}\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn 0;\n}\n\n/* Reset the map iterator to the beginning */\nstatic void\nPyArray_MapIterReset(PyArrayMapIterObject *mit)\n{\n\tint i,j; intp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index = 0;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\n\tif (mit->subspace != NULL) {\n\t\tmemcpy(coord, mit->bscoord, sizeof(intp)*mit->ait->ao->nd);\n\t\tPyArray_ITER_RESET(mit->subspace);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tj = mit->iteraxes[i];\n\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* This function needs to update the state of the map iterator\n and point mit->dataptr to the memory-location of the next object\n*/\nstatic void\nPyArray_MapIterNext(PyArrayMapIterObject *mit)\n{\n\tint i, j;\n\tintp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index += 1;\n\tif (mit->index >= mit->size) return;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\t/* Sub-space iteration */\n\tif (mit->subspace != NULL) {\n\t\tPyArray_ITER_NEXT(mit->subspace);\n\t\tif (mit->subspace->index == mit->subspace->size) {\n\t\t\t/* reset coord to coordinates of \n\t\t\t beginning of the subspace */\n\t\t\tmemcpy(coord, mit->bscoord, \n\t\t\t sizeof(intp)*mit->ait->ao->nd);\n\t\t\tPyArray_ITER_RESET(mit->subspace);\n\t\t\tfor (i=0; inumiter; i++) {\n\t\t\t\tit = mit->iters[i];\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t\tj = mit->iteraxes[i];\n\t\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t\t sizeof(intp));\n\t\t\t}\n\t\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\t}\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* Bind a mapiteration to a particular array */\n\n/* Determine if subspace iteration is necessary. If so, \n 1) Fill in mit->iteraxes\n\t 2) Create subspace iterator\n\t 3) Update nd, dimensions, and size. \n\n Subspace iteration is necessary if: arr->nd > mit->numiter\n*/\n\n/* Need to check for index-errors somewhere. \n\n Let's do it at bind time and also convert all <0 values to >0 here\n as well. \n*/\nstatic void\nPyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n{\n\tint subnd;\n\tPyObject *sub=NULL, *obj=NULL;\n\tint i, j, n, curraxis, ellipexp, noellip;\n\tPyArrayIterObject *it;\n\tintp dimsize;\n\tintp *indptr;\n\n\t/* Remove old binding if any */\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\n\tPy_XDECREF(mit->subspace);\n\tmit->subspace = NULL;\n\t\n\tsubnd = arr->nd - mit->numiter;\n\tif (subnd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Too many indices for array.\");\n\t\treturn;\n\t}\n\n\tmit->ait = (PyArrayIterObject *)PyArray_IterNew((PyObject *)arr);\n\tif (mit->ait == NULL) return;\n\n\t/* If this is just a view, then do nothing more */\n\t/* views are handled by just adjusting the strides\n\t and dimensions of the object.\n\t*/\n\t \n\tif (mit->view) return;\n\n\t/* no subspace iteration needed. Return */\n\tif (subnd == 0) {\n\t\tn = arr->nd;\n\t\tfor (i=0; iiteraxes[i] = i;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\t/* all indexing arrays have been converted to 0 \n\t therefore we can extract the subspace with a simple\n\t getitem call which will use view semantics\n\t*/\n\t\n\tsub = PyObject_GetItem((PyObject *)arr, mit->indexobj);\n\tif (sub == NULL) goto fail;\n\tmit->subspace = (PyArrayIterObject *)PyArray_IterNew(sub);\n\tif (mit->subspace == NULL) goto fail;\n\tPy_DECREF(sub);\n\n\t/* Expand dimensions of result */\n\tn = mit->subspace->ao->nd;\n\tfor (i=0; idimensions[mit->nd+i] = mit->subspace->ao->dimensions[i];\n\tmit->nd += n;\n\n\t/* Now, we still need to interpret the ellipsis and slice objects \n\t to determine which axes the indexing arrays are referring to\n\t*/\n\tn = PyTuple_GET_SIZE(mit->indexobj);\n\n\t/* The number of dimensions an ellipsis takes up */\n\tellipexp = arr->nd - n + 1;\n\t/* Now fill in iteraxes -- remember indexing arrays have been \n converted to 0's in mit->indexobj */\n\tcurraxis = 0;\n\tj = 0;\n\tnoellip = 1; /* Only expand the first ellipsis */\n\tmemset(mit->bscoord, '\\0', sizeof(intp)*arr->nd);\n\tfor (i=0; iindexobj, i);\n\t\tif (PyInt_Check(obj) || PyLong_Check(obj)) \n\t\t\tmit->iteraxes[j++] = curraxis++;\n\t\telse if (noellip && obj == Py_Ellipsis) {\n\t\t\tcurraxis += ellipexp;\n\t\t\tnoellip = 0;\n\t\t}\n\t\telse {\n\t\t\tint start=0;\n\t\t\tint stop, step;\n\t\t\t/* Should be slice object or\n\t\t\t another Ellipsis */\n\t\t\tif (obj == Py_Ellipsis) {\n\t\t\t\tmit->bscoord[curraxis] = 0;\n\t\t\t}\n\t\t\telse if (!PySlice_Check(obj) || \\\n\t\t\t\t (slice_GetIndices((PySliceObject *)obj, \n\t\t\t\t\t\t arr->dimensions[curraxis],\n\t\t\t\t\t\t &start, &stop, &step,\n\t\t\t\t\t\t &dimsize) < 0)) {\n\t\t\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t\t\t \"unexpected object \"\t\\\n\t\t\t\t\t \"(%s) in selection position %d\",\n\t\t\t\t\t obj->ob_type->tp_name, i);\n\t\t\t goto fail;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmit->bscoord[curraxis] = start;\n\t\t\t}\n\t\t\tcurraxis += 1; \n\t\t}\n\t}\n finish:\n\t/* Here check the indexes (now that we have iteraxes) */\n\tmit->size = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tPyArray_ITER_RESET(it);\n\t\tdimsize = arr->dimensions[mit->iteraxes[i]];\n\t\twhile(it->index < it->size) {\n\t\t\tindptr = ((intp *)it->dataptr);\n\t\t\tif (*indptr < 0) *indptr += dimsize;\n\t\t\tif (*indptr < 0 || *indptr >= dimsize) {\n\t\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t\t \"index (%d) out of range \"\\\n\t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n\t\t\t\t\t *indptr, dimsize-1, \n\t\t\t\t\t mit->iteraxes[i]);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn;\n\n fail:\n\tPy_XDECREF(sub);\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\treturn;\n}\n\n/* This function takes a Boolean array and constructs index objects and\n iterators as if nonzero(Bool) had been called\n*/\nstatic int\n_nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)\n{\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\tPyArrayObject *ba =NULL, *new=NULL;\n\tint nd, j;\n\tintp size, i, count;\n\tBool *ptr;\n\tintp coords[MAX_DIMS], dims_m1[MAX_DIMS];\n\tintp *dptr[MAX_DIMS];\n\n\tba = (PyArrayObject *)PyArray_FromAny(myBool, &typecode, 0, 0, \n\t\t\t\t\t CARRAY_FLAGS);\n\tif (ba == NULL) return -1;\n\tnd = ba->nd;\n\tfor (j=0; jdata;\n\tcount = 0;\n\n\t/* pre-determine how many nonzero entries there are */\n\tfor (i=0; iao->data;\n\t\tcoords[j] = 0;\n\t\tdims_m1[j] = ba->dimensions[j]-1;\n\t}\n\n\tptr = (Bool *)ba->data;\n\n\tif (count == 0) return nd;\n\n\t/* Loop through the Boolean array and copy coordinates\n\t for non-zero entries */\n\tfor (i=0; i=0; j--) {\n\t\t\tif (coords[j] < dims_m1[j]) {\n\t\t\t\tcoords[j]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcoords[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn nd;\n\n fail:\n\tfor (j=0; jiters[i] = NULL;\n \tmit->view = 0;\n \tmit->index = 0;\n \tmit->ait = NULL;\n \tmit->subspace = NULL;\n\tmit->numiter = 0;\n\tmit->consec = 1;\n\tfancy = fancy_indexing_check(indexobj);\n\tPy_INCREF(indexobj);\n\tmit->indexobj = indexobj;\n\tif (fancy == SOBJ_NOTFANCY) { /* bail out */\n\t\tmit->view = 1;\n\t\tgoto ret;\n\t}\n\n\tif (fancy == SOBJ_BADARRAY) {\n\t\tPyErr_SetString(PyExc_TypeError,\t\t\t\\\n\t\t\t\t\"Arrays used as indexes must be of \" \\\n\t\t\t\t\"integer type\");\n\t\tgoto fail;\n\t}\n\tif (fancy == SOBJ_TOOMANY) {\n\t\tPyErr_SetString(PyExc_TypeError,\"Too many indicies\");\n\t\tgoto fail;\n\t}\n\n\tif (fancy == SOBJ_LISTTUP) {\n\t\tPyObject *newobj;\n\t\tnewobj = PySequence_Tuple(indexobj);\n\t\tif (newobj == NULL) goto fail;\n\t\tPy_DECREF(indexobj);\n\t\tindexobj = newobj;\n\t\tmit->indexobj = indexobj;\n\t}\n\n#undef SOBJ_NOTFANCY \n#undef SOBJ_ISFANCY \n#undef SOBJ_BADARRAY \n#undef SOBJ_TOOMANY \n#undef SOBJ_LISTTUP \n\n\n\t/* Must have some kind of fancy indexing if we are here */\n\t/* indexobj is either a list, an arrayobject, or a tuple \n\t (with at least 1 list or arrayobject or Bool object), */\n\t\n\t/* convert all inputs to iterators */\n\tif (PyArray_Check(indexobj) &&\t\t\t\\\n\t (PyArray_TYPE(indexobj) == PyArray_BOOL)) {\n\t\tmit->numiter = _nonzero_indices(indexobj, mit->iters);\n\t\tif (mit->numiter < 0) goto fail;\n\t\tmit->nd = 1;\n\t\tmit->dimensions[0] = mit->iters[0]->dims_m1[0]+1;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = PyTuple_New(mit->numiter);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tPyTuple_SET_ITEM(mit->indexobj, i, \n\t\t\t\t\t PyInt_FromLong(0));\n\t\t}\n\t}\n\n\telse if (PyList_Check(indexobj) || PyArray_Check(indexobj)) {\n\t\tmit->numiter = 1;\n\t\tarr = PyArray_FromAny(indexobj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) goto fail;\n\t\tmit->iters[0] = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (mit->iters[0] == NULL) goto fail;\n\t\tmit->nd = PyArray_NDIM(arr);\n\t\tmemcpy(mit->dimensions,PyArray_DIMS(arr),mit->nd*sizeof(intp));\n\t\tmit->size = PyArray_SIZE(arr);\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = Py_BuildValue(\"(N)\", PyInt_FromLong(0));\n\t}\n\telse { /* must be a tuple */\n\t\tPyObject *obj;\n\t\tPyArrayIterObject *iter;\n\t\tPyObject *new;\n\t\t/* Make a copy of the tuple -- we will be replacing \n\t\t index objects with 0's */\n\t\tn = PyTuple_GET_SIZE(indexobj);\n\t\tnew = PyTuple_New(n);\n\t\tif (new == NULL) goto fail;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = new;\n\t\tstarted = 0;\n\t\tnonindex = 0;\n\t\tfor (i=0; iconsec = 0;\n\t\t\t\tmit->iters[(mit->numiter)++] = iter;\n\t\t\t\tPyTuple_SET_ITEM(new,i,\n\t\t\t\t\t\t PyInt_FromLong(0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (started) nonindex = 1;\n\t\t\t\tPy_INCREF(obj);\n\t\t\t\tPyTuple_SET_ITEM(new,i,obj);\n\t\t\t}\n\t\t}\n\t\t/* Store the number of iterators actually converted */\n\t\t/* These will be mapped to actual axes at bind time */\n\t\tif (PyArray_Broadcast((PyArrayMultiIterObject *)mit) < 0)\n\t\t\tgoto fail;\n\t}\n\n ret:\n PyObject_GC_Track(mit);\n return (PyObject *)mit;\n \n fail:\n\tPy_XDECREF(arr);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n\treturn NULL;\n}\n\n\n/* return unbound mapiter object */\n\nstatic PyObject *\narraymapiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) \n{\n\tPyObject *newtup, *res;\n\tint n;\n\n\tif (!PyTuple_Check(args)) {\n\t\tPyErr_BadInternalCall();\n\t\treturn NULL;\n\t}\n\n\tn = PyTuple_GET_SIZE(args);\n\t\n\tif (n < 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"must be initialized with >= 1 argument\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n > 1) {\n\t\tnewtup = PyTuple_GetSlice(args, 0, n);\n\t\tif (newtup == NULL) return NULL;\n\t\tres = PyArray_MapIterNew(newtup);\n\t\tPy_DECREF(newtup);\n\t}\n\telse { /* n == 1 */\n\t\tnewtup = PyTuple_GET_ITEM(args, 0);\n\t\tres = PyArray_MapIterNew(newtup);\n\t}\n\n\treturn res; \t\n}\n\n\n/* Returns a 0-dim array holding the element desired */\n\nstatic PyObject *\narraymapiter_next(PyArrayMapIterObject *mit)\n{\n\tPyObject *ret;\n\tif (mit->ait == NULL) return NULL;\n\tif (mit->view) return NULL;\n\tif (mit->index < mit->size) {\n\t\tret = PyArray_ToScalar(mit->dataptr, mit->ait->ao);\n\t\tPyArray_MapIterNext(mit);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narraymapiter_dealloc(PyArrayMapIterObject *mit)\n{\n\tint i;\n PyObject_GC_UnTrack(mit);\n Py_XDECREF(mit->ait);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n}\n\nstatic int\narraymapiter_traverse(PyArrayMapIterObject *mit, visitproc visit, void *arg)\n{\n\tint ret, i;\n if (mit->ait != NULL)\n if ((ret = visit((PyObject *)(mit->ait), arg)) != 0) \n\t\t\treturn ret;\t\n\n\tif (mit->iters != NULL) \n\t\tfor (i=0; inumiter; i++) \n\t\t\tif (mit->iters[i] != NULL) \n\t\t\t\tif ((ret=visit((PyObject *)mit->iters[i], \n\t\t\t\t\t arg)) != 0)\n\t\t\t\t\treturn ret;\n\n\tif (mit->indexobj != NULL)\n\t\tif ((ret = visit(mit->indexobj, arg)) != 0) return ret;\n\t\n return 0;\n}\n\n/* \nstatic char doc_mapiter_bind[] = \"obj.bind(a)\\n Bind an array to the \"\\\n\t\"mapiter object\";\n\nstatic PyObject *\nmapiter_bind(PyArrayMapIterObject *mit, PyObject *args)\n{\n\tPyObject *r;\n intp size, strides;\n int nd;\n\tPyArrayObject *arr;\n\n if (!PyArg_ParseTuple(args, \"O!\", &PyArray_Type, &arr)) return NULL;\n\n\tPyArray_MapIterBind(mit, arr);\n\n\tif (mit->ait == NULL) return NULL;\n\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyMethodDef mapiter_methods[] = {\n\t{\"bind\", (PyCFunction)mapiter_bind, 1, doc_mapiter_bind},\n {NULL,\t\tNULL}\t\t\n};\n*/\n\n\nstatic PyTypeObject PyArrayMapIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.mapiter\",\t\t \t/* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arraymapiter_dealloc,\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0,\t\t\t\t\t/* tp_as_sequence */\n 0,\t\t\t\t\t/* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0, \t\t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arraymapiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arraymapiter_next,\t/* tp_iternext */\n 0,\t \t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n 0,\t\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0, \t /* tp_alloc */\n (newfunc)arraymapiter_new,\t /* tp_new */\n 0,\t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n\n};\n\n/** END of Subscript Iterator **/\n\n\n\n", "methods": [ { "name": "PyArray_PyIntAsIntp", "long_name": "PyArray_PyIntAsIntp( PyObject * o)", "filename": "arrayobject.c", "nloc": 59, "complexity": 19, "token_count": 385, "parameters": [ "o" ], "start_line": 40, "end_line": 103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "PyArray_PyIntAsInt", "long_name": "PyArray_PyIntAsInt( PyObject * o)", "filename": "arrayobject.c", "nloc": 57, "complexity": 19, "token_count": 389, "parameters": [ "o" ], "start_line": 109, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 86, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 191, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "PyArray_Zero", "long_name": "PyArray_Zero( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 190, "parameters": [ "arr" ], "start_line": 208, "end_line": 243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_One", "long_name": "PyArray_One( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 40, "complexity": 7, "token_count": 222, "parameters": [ "arr" ], "start_line": 246, "end_line": 289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "do_sliced_copy", "long_name": "do_sliced_copy( char * dest , intp * dest_strides , intp * dest_dimensions , int dest_nd , char * src , intp * src_strides , intp * src_dimensions , int src_nd , int elsize , int copies)", "filename": "arrayobject.c", "nloc": 48, "complexity": 13, "token_count": 313, "parameters": [ "dest", "dest_strides", "dest_dimensions", "dest_nd", "src", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 295, "end_line": 345, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "optimize_slices", "long_name": "optimize_slices( intp ** dest_strides , intp ** dest_dimensions , int * dest_nd , intp ** src_strides , intp ** src_dimensions , int * src_nd , int * elsize , int * copies)", "filename": "arrayobject.c", "nloc": 32, "complexity": 8, "token_count": 214, "parameters": [ "dest_strides", "dest_dimensions", "dest_nd", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 368, "end_line": 399, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 402, "end_line": 436, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_INCREF", "long_name": "PyArray_INCREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 449, "end_line": 471, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_XDECREF", "long_name": "PyArray_XDECREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 474, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "byte_swap_vector", "long_name": "byte_swap_vector( * p , int n , int size)", "filename": "arrayobject.c", "nloc": 38, "complexity": 10, "token_count": 340, "parameters": [ "p", "n", "size" ], "start_line": 499, "end_line": 537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "copy_and_swap", "long_name": "copy_and_swap( * dst , * src , int itemsize , intp numitems , intp srcstrides , int swap)", "filename": "arrayobject.c", "nloc": 18, "complexity": 5, "token_count": 120, "parameters": [ "dst", "src", "itemsize", "numitems", "srcstrides", "swap" ], "start_line": 542, "end_line": 562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "index2ptr", "long_name": "index2ptr( PyArrayObject * mp , int i)", "filename": "arrayobject.c", "nloc": 10, "complexity": 7, "token_count": 86, "parameters": [ "mp", "i" ], "start_line": 570, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Size", "long_name": "PyArray_Size( PyObject * op)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 33, "parameters": [ "op" ], "start_line": 583, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_CopyInto", "long_name": "PyArray_CopyInto( PyArrayObject * dest , PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 71, "complexity": 16, "token_count": 425, "parameters": [ "dest", "src" ], "start_line": 604, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 16, "complexity": 2, "token_count": 98, "parameters": [ "dest", "src_object" ], "start_line": 688, "end_line": 707, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndDataAndDescr", "long_name": "PyArray_FromDimsAndDataAndDescr( int nd , int * d , PyArray_Descr * descr , char * data)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 144, "parameters": [ "nd", "d", "descr", "data" ], "start_line": 715, "end_line": 736, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 5, "token_count": 137, "parameters": [ "nd", "d", "type", "data" ], "start_line": 740, "end_line": 760, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 5, "token_count": 133, "parameters": [ "nd", "d", "type" ], "start_line": 764, "end_line": 781, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 77, "parameters": [ "m1" ], "start_line": 787, "end_line": 799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_Scalar", "long_name": "PyArray_Scalar( char * data , int type_num , int itemsize , int swap)", "filename": "arrayobject.c", "nloc": 48, "complexity": 8, "token_count": 289, "parameters": [ "data", "type_num", "itemsize", "swap" ], "start_line": 805, "end_line": 854, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyArray_ToScalar", "long_name": "PyArray_ToScalar( char * data , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 51, "parameters": [ "data", "arr" ], "start_line": 861, "end_line": 868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_Return", "long_name": "PyArray_Return( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 85, "parameters": [ "mp" ], "start_line": 874, "end_line": 893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 31, "complexity": 6, "token_count": 177, "parameters": [ "type" ], "start_line": 904, "end_line": 936, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 946, "end_line": 989, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 87, "complexity": 16, "token_count": 571, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 993, "end_line": 1082, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "PyArray_ToList", "long_name": "PyArray_ToList( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 24, "complexity": 5, "token_count": 151, "parameters": [ "self" ], "start_line": 1085, "end_line": 1113, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_ToString", "long_name": "PyArray_ToString( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 191, "parameters": [ "self" ], "start_line": 1116, "end_line": 1151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_dealloc", "long_name": "array_dealloc( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 20, "complexity": 7, "token_count": 144, "parameters": [ "self" ], "start_line": 1160, "end_line": 1197, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_length", "long_name": "array_length( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 1204, "end_line": 1212, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 150, "parameters": [ "self", "i" ], "start_line": 1216, "end_line": 1240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_item_nice", "long_name": "array_item_nice( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "i" ], "start_line": 1243, "end_line": 1246, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_ass_item", "long_name": "array_ass_item( PyArrayObject * self , int i , PyObject * v)", "filename": "arrayobject.c", "nloc": 27, "complexity": 8, "token_count": 177, "parameters": [ "self", "i", "v" ], "start_line": 1250, "end_line": 1280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "slice_coerce_index", "long_name": "slice_coerce_index( PyObject * o , int * v)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "o", "v" ], "start_line": 1284, "end_line": 1292, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "slice_GetIndices", "long_name": "slice_GetIndices( PySliceObject * r , int length , int * start , int * stop , int * step , intp * slicelength)", "filename": "arrayobject.c", "nloc": 45, "complexity": 24, "token_count": 376, "parameters": [ "r", "length", "start", "stop", "step", "slicelength" ], "start_line": 1298, "end_line": 1348, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "parse_subindex", "long_name": "parse_subindex( PyObject * op , int * step_size , intp * n_steps , int max)", "filename": "arrayobject.c", "nloc": 45, "complexity": 11, "token_count": 223, "parameters": [ "op", "step_size", "n_steps", "max" ], "start_line": 1355, "end_line": 1400, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "parse_index", "long_name": "parse_index( PyArrayObject * self , PyObject * op , intp * dimensions , intp * strides , intp * offset_ptr)", "filename": "arrayobject.c", "nloc": 89, "complexity": 20, "token_count": 540, "parameters": [ "self", "op", "dimensions", "strides", "offset_ptr" ], "start_line": 1404, "end_line": 1499, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "_swap_axes", "long_name": "_swap_axes( PyArrayMapIterObject * mit , PyArrayObject ** ret)", "filename": "arrayobject.c", "nloc": 24, "complexity": 4, "token_count": 187, "parameters": [ "mit", "ret" ], "start_line": 1502, "end_line": 1536, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 252, "parameters": [ "mit" ], "start_line": 1541, "end_line": 1591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "PyArray_SetMap", "long_name": "PyArray_SetMap( PyArrayMapIterObject * mit , PyObject * op)", "filename": "arrayobject.c", "nloc": 50, "complexity": 12, "token_count": 392, "parameters": [ "mit", "op" ], "start_line": 1594, "end_line": 1653, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 425, "parameters": [ "self", "op" ], "start_line": 1674, "end_line": 1749, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "array_ass_sub", "long_name": "array_ass_sub( PyArrayObject * self , PyObject * index , PyObject * op)", "filename": "arrayobject.c", "nloc": 43, "complexity": 9, "token_count": 251, "parameters": [ "self", "index", "op" ], "start_line": 1762, "end_line": 1814, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "array_subscript_nice", "long_name": "array_subscript_nice( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "self", "op" ], "start_line": 1822, "end_line": 1825, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_getsegcount", "long_name": "array_getsegcount( PyArrayObject * self , int * lenp)", "filename": "arrayobject.c", "nloc": 11, "complexity": 4, "token_count": 48, "parameters": [ "self", "lenp" ], "start_line": 1844, "end_line": 1856, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_getreadbuf", "long_name": "array_getreadbuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 72, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1859, "end_line": 1874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_getwritebuf", "long_name": "array_getwritebuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1878, "end_line": 1887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_getcharbuf", "long_name": "array_getcharbuf( PyArrayObject * self , int segment , const char ** ptrptr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 3, "token_count": 65, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1890, "end_line": 1901, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_SetNumericOps", "long_name": "PyArray_SetNumericOps( PyObject * dict)", "filename": "arrayobject.c", "nloc": 34, "complexity": 1, "token_count": 162, "parameters": [ "dict" ], "start_line": 1969, "end_line": 2002, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_GetNumericOps", "long_name": "PyArray_GetNumericOps()", "filename": "arrayobject.c", "nloc": 39, "complexity": 2, "token_count": 183, "parameters": [], "start_line": 2008, "end_line": 2047, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_GenericReduceFunction", "long_name": "PyArray_GenericReduceFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2050, "end_line": 2069, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericAccumulateFunction", "long_name": "PyArray_GenericAccumulateFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2073, "end_line": 2092, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericBinaryFunction", "long_name": "PyArray_GenericBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 69, "parameters": [ "m1", "m2", "op" ], "start_line": 2096, "end_line": 2107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericUnaryFunction", "long_name": "PyArray_GenericUnaryFunction( PyArrayObject * m1 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 63, "parameters": [ "m1", "op" ], "start_line": 2110, "end_line": 2121, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericInplaceBinaryFunction", "long_name": "PyArray_GenericInplaceBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 13, "complexity": 2, "token_count": 71, "parameters": [ "m1", "m2", "op" ], "start_line": 2124, "end_line": 2136, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_add", "long_name": "array_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2139, "end_line": 2142, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_subtract", "long_name": "array_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2145, "end_line": 2148, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_multiply", "long_name": "array_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2151, "end_line": 2154, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_divide", "long_name": "array_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2157, "end_line": 2160, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_remainder", "long_name": "array_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2163, "end_line": 2166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_power", "long_name": "array_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2169, "end_line": 2172, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_negative", "long_name": "array_negative( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2175, "end_line": 2178, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_absolute", "long_name": "array_absolute( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2181, "end_line": 2184, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_invert", "long_name": "array_invert( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2187, "end_line": 2190, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_left_shift", "long_name": "array_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2193, "end_line": 2196, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_right_shift", "long_name": "array_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2199, "end_line": 2202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_and", "long_name": "array_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2205, "end_line": 2208, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_or", "long_name": "array_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2211, "end_line": 2214, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_xor", "long_name": "array_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2217, "end_line": 2220, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_add", "long_name": "array_inplace_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2223, "end_line": 2226, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_subtract", "long_name": "array_inplace_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2229, "end_line": 2232, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_multiply", "long_name": "array_inplace_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2235, "end_line": 2238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_divide", "long_name": "array_inplace_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2241, "end_line": 2244, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_remainder", "long_name": "array_inplace_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2247, "end_line": 2250, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_power", "long_name": "array_inplace_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2253, "end_line": 2256, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_left_shift", "long_name": "array_inplace_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2259, "end_line": 2262, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_right_shift", "long_name": "array_inplace_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2265, "end_line": 2268, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_and", "long_name": "array_inplace_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2271, "end_line": 2274, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_or", "long_name": "array_inplace_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2277, "end_line": 2280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_xor", "long_name": "array_inplace_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2283, "end_line": 2286, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_floor_divide", "long_name": "array_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2289, "end_line": 2292, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_TRUE_divide", "long_name": "array_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2295, "end_line": 2298, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_floor_divide", "long_name": "array_inplace_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2301, "end_line": 2305, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_inplace_TRUE_divide", "long_name": "array_inplace_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2308, "end_line": 2312, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_all_nonzero", "long_name": "array_all_nonzero( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 93, "parameters": [ "mp" ], "start_line": 2316, "end_line": 2334, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_divmod", "long_name": "array_divmod( PyArrayObject * op1 , PyObject * op2)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 89, "parameters": [ "op1", "op2" ], "start_line": 2337, "end_line": 2352, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_int", "long_name": "array_int( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2356, "end_line": 2382, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_float", "long_name": "array_float( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2385, "end_line": 2410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_long", "long_name": "array_long( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2413, "end_line": 2435, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_oct", "long_name": "array_oct( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2438, "end_line": 2460, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_hex", "long_name": "array_hex( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2463, "end_line": 2485, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "_array_copy_nice", "long_name": "_array_copy_nice( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 22, "parameters": [ "self" ], "start_line": 2488, "end_line": 2492, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 258, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2553, "end_line": 2591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_ass_slice", "long_name": "array_ass_slice( PyArrayObject * self , int ilow , int ihigh , PyObject * v)", "filename": "arrayobject.c", "nloc": 20, "complexity": 4, "token_count": 108, "parameters": [ "self", "ilow", "ihigh", "v" ], "start_line": 2595, "end_line": 2616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_contains", "long_name": "array_contains( PyArrayObject * self , PyObject * el)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "el" ], "start_line": 2619, "end_line": 2624, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "dump_data", "long_name": "dump_data( char ** string , int * n , int * max_n , char * data , int nd , intp * dimensions , intp * strides , PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 41, "complexity": 7, "token_count": 308, "parameters": [ "string", "n", "max_n", "data", "nd", "dimensions", "strides", "self" ], "start_line": 2645, "end_line": 2692, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "array_repr_builtin", "long_name": "array_repr_builtin( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 30, "complexity": 4, "token_count": 222, "parameters": [ "self" ], "start_line": 2695, "end_line": 2731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_SetStringFunction", "long_name": "PyArray_SetStringFunction( PyObject * op , int repr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 48, "parameters": [ "op", "repr" ], "start_line": 2737, "end_line": 2754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2757, "end_line": 2769, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2772, "end_line": 2784, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_richcompare", "long_name": "array_richcompare( PyArrayObject * self , PyObject * other , int cmp_op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 13, "token_count": 273, "parameters": [ "self", "other", "cmp_op" ], "start_line": 2788, "end_line": 2865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 78, "top_nesting_level": 0 }, { "name": "_check_axis", "long_name": "_check_axis( PyArrayObject * arr , int * axis , int flags)", "filename": "arrayobject.c", "nloc": 29, "complexity": 8, "token_count": 164, "parameters": [ "arr", "axis", "flags" ], "start_line": 2868, "end_line": 2897, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyArray_IntTupleFromIntp", "long_name": "PyArray_IntTupleFromIntp( int len , intp * vals)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 91, "parameters": [ "len", "vals" ], "start_line": 2903, "end_line": 2919, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_IntpFromSequence", "long_name": "PyArray_IntpFromSequence( PyObject * seq , intp * vals , int maxvals)", "filename": "arrayobject.c", "nloc": 21, "complexity": 7, "token_count": 161, "parameters": [ "seq", "vals", "maxvals" ], "start_line": 2924, "end_line": 2947, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "_IsContiguous", "long_name": "_IsContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 109, "parameters": [ "ap" ], "start_line": 2953, "end_line": 2969, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsFortranContiguous", "long_name": "_IsFortranContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 107, "parameters": [ "ap" ], "start_line": 2973, "end_line": 2989, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsAligned", "long_name": "_IsAligned( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 110, "parameters": [ "ap" ], "start_line": 2993, "end_line": 3009, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsWriteable", "long_name": "_IsWriteable( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 16, "complexity": 8, "token_count": 109, "parameters": [ "ap" ], "start_line": 3012, "end_line": 3045, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_UpdateFlags", "long_name": "PyArray_UpdateFlags( PyArrayObject * ret , int flagmask)", "filename": "arrayobject.c", "nloc": 22, "complexity": 9, "token_count": 129, "parameters": [ "ret", "flagmask" ], "start_line": 3049, "end_line": 3071, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_CheckStrides", "long_name": "PyArray_CheckStrides( int elsize , int nd , intp numbytes , intp * dims , intp * newstrides)", "filename": "arrayobject.c", "nloc": 13, "complexity": 4, "token_count": 84, "parameters": [ "elsize", "nd", "numbytes", "dims", "newstrides" ], "start_line": 3078, "end_line": 3093, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "_array_fill_strides", "long_name": "_array_fill_strides( intp * strides , intp * dims , int nd , intp itemsize , int inflag , int * objflags)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 171, "parameters": [ "strides", "dims", "nd", "itemsize", "inflag", "objflags" ], "start_line": 3113, "end_line": 3137, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 672, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3141, "end_line": 3285, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "PyArray_Resize", "long_name": "PyArray_Resize( PyArrayObject * self , PyArray_Dims * newshape)", "filename": "arrayobject.c", "nloc": 87, "complexity": 15, "token_count": 501, "parameters": [ "self", "newshape" ], "start_line": 3290, "end_line": 3395, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_FillObjectArray", "long_name": "PyArray_FillObjectArray( PyArrayObject * arr , PyObject * obj)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 98, "parameters": [ "arr", "obj" ], "start_line": 3399, "end_line": 3416, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_new", "long_name": "array_new( PyTypeObject * subtype , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 100, "complexity": 20, "token_count": 593, "parameters": [ "subtype", "args", "kwds" ], "start_line": 3420, "end_line": 3535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 116, "top_nesting_level": 0 }, { "name": "array_ndim_get", "long_name": "array_ndim_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 3542, "end_line": 3545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flags_get", "long_name": "array_flags_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 10, "complexity": 3, "token_count": 55, "parameters": [ "self" ], "start_line": 3548, "end_line": 3558, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_shape_get", "long_name": "array_shape_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3631, "end_line": 3634, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_shape_set", "long_name": "array_shape_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 33, "complexity": 6, "token_count": 206, "parameters": [ "self", "val" ], "start_line": 3638, "end_line": 3672, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_strides_get", "long_name": "array_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3676, "end_line": 3679, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_strides_set", "long_name": "array_strides_set( PyArrayObject * self , PyObject * obj)", "filename": "arrayobject.c", "nloc": 32, "complexity": 7, "token_count": 209, "parameters": [ "self", "obj" ], "start_line": 3682, "end_line": 3715, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_protocol_strides_get", "long_name": "array_protocol_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 35, "parameters": [ "self" ], "start_line": 3719, "end_line": 3726, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_priority_get", "long_name": "array_priority_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 3, "token_count": 42, "parameters": [ "self" ], "start_line": 3729, "end_line": 3737, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_data_get", "long_name": "array_data_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 82, "parameters": [ "self" ], "start_line": 3741, "end_line": 3755, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_data_set", "long_name": "array_data_set( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 44, "complexity": 9, "token_count": 229, "parameters": [ "self", "op" ], "start_line": 3758, "end_line": 3802, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "array_itemsize_get", "long_name": "array_itemsize_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 3806, "end_line": 3809, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_size_get", "long_name": "array_size_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "self" ], "start_line": 3812, "end_line": 3819, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typechar_get", "long_name": "array_typechar_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 47, "parameters": [ "self" ], "start_line": 3823, "end_line": 3830, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typestr_get", "long_name": "array_typestr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 7, "token_count": 141, "parameters": [ "self" ], "start_line": 3833, "end_line": 3853, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_descr_get", "long_name": "array_descr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 128, "parameters": [ "self" ], "start_line": 3856, "end_line": 3878, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_typenum_get", "long_name": "array_typenum_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 3881, "end_line": 3884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_get", "long_name": "array_type_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 3888, "end_line": 3891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_set", "long_name": "array_type_set( PyArrayObject * self , PyObject * arg)", "filename": "arrayobject.c", "nloc": 41, "complexity": 10, "token_count": 294, "parameters": [ "self", "arg" ], "start_line": 3903, "end_line": 3961, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "array_base_get", "long_name": "array_base_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 41, "parameters": [ "self" ], "start_line": 3966, "end_line": 3976, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 129, "parameters": [ "self" ], "start_line": 3980, "end_line": 4005, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 177, "parameters": [ "self", "val" ], "start_line": 4009, "end_line": 4041, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 3, "token_count": 200, "parameters": [ "self" ], "start_line": 4044, "end_line": 4079, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 203, "parameters": [ "self", "val" ], "start_line": 4082, "end_line": 4119, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_flat_get", "long_name": "array_flat_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 4122, "end_line": 4125, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 51, "complexity": 9, "token_count": 368, "parameters": [ "self", "val" ], "start_line": 4128, "end_line": 4182, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "discover_depth", "long_name": "discover_depth( PyObject * s , int max , int stop_at_string)", "filename": "arrayobject.c", "nloc": 23, "complexity": 14, "token_count": 169, "parameters": [ "s", "max", "stop_at_string" ], "start_line": 4358, "end_line": 4383, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "discover_itemsize", "long_name": "discover_itemsize( PyObject * s , int nd , int * itemsize)", "filename": "arrayobject.c", "nloc": 21, "complexity": 9, "token_count": 161, "parameters": [ "s", "nd", "itemsize" ], "start_line": 4386, "end_line": 4408, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "discover_dimensions", "long_name": "discover_dimensions( PyObject * s , int nd , intp * d , int check_it)", "filename": "arrayobject.c", "nloc": 24, "complexity": 10, "token_count": 188, "parameters": [ "s", "nd", "d", "check_it" ], "start_line": 4415, "end_line": 4441, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_array_small_type", "long_name": "_array_small_type( int chktype , int mintype , int chksize , int minsize , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 100, "parameters": [ "chktype", "mintype", "chksize", "minsize", "outtype" ], "start_line": 4444, "end_line": 4464, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 126, "complexity": 28, "token_count": 671, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4467, "end_line": 4608, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 142, "top_nesting_level": 0 }, { "name": "Assign_Array", "long_name": "Assign_Array( PyArrayObject * self , PyObject * v)", "filename": "arrayobject.c", "nloc": 21, "complexity": 6, "token_count": 121, "parameters": [ "self", "v" ], "start_line": 4611, "end_line": 4634, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromScalar", "long_name": "Array_FromScalar( PyObject * op , PyArray_Typecode * typecode)", "filename": "arrayobject.c", "nloc": 19, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode" ], "start_line": 4638, "end_line": 4661, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromSequence", "long_name": "Array_FromSequence( PyObject * s , PyArray_Typecode * typecode , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 51, "complexity": 17, "token_count": 313, "parameters": [ "s", "typecode", "min_depth", "max_depth" ], "start_line": 4665, "end_line": 4722, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_ValidType", "long_name": "PyArray_ValidType( int type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 2, "token_count": 30, "parameters": [ "type" ], "start_line": 4726, "end_line": 4733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "_bufferedcast", "long_name": "_bufferedcast( PyArrayObject * out , PyArrayObject * in)", "filename": "arrayobject.c", "nloc": 75, "complexity": 16, "token_count": 477, "parameters": [ "out", "in" ], "start_line": 4739, "end_line": 4829, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "PyArray_Cast", "long_name": "PyArray_Cast( PyArrayObject * mp , int type_num)", "filename": "arrayobject.c", "nloc": 10, "complexity": 1, "token_count": 56, "parameters": [ "mp", "type_num" ], "start_line": 4835, "end_line": 4846, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 233, "parameters": [ "mp", "at" ], "start_line": 4849, "end_line": 4884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_CastTo", "long_name": "PyArray_CastTo( PyArrayObject * out , PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 40, "complexity": 10, "token_count": 214, "parameters": [ "out", "mp" ], "start_line": 4891, "end_line": 4937, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 80, "complexity": 26, "token_count": 522, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4940, "end_line": 5034, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "_array_typecode_fromstr", "long_name": "_array_typecode_fromstr( char * str , int * swap , PyArray_Typecode * type)", "filename": "arrayobject.c", "nloc": 94, "complexity": 36, "token_count": 533, "parameters": [ "str", "swap", "type" ], "start_line": 5038, "end_line": 5143, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5146, "end_line": 5240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_fromattr", "long_name": "array_fromattr( PyObject * op , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 21, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode", "flags" ], "start_line": 5243, "end_line": 5264, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_fromobject", "long_name": "array_fromobject( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int flags)", "filename": "arrayobject.c", "nloc": 46, "complexity": 13, "token_count": 270, "parameters": [ "op", "typecode", "min_depth", "max_depth", "flags" ], "start_line": 5268, "end_line": 5330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_ArrayType", "long_name": "PyArray_ArrayType( PyObject * op , PyArray_Typecode * intype , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 29, "parameters": [ "op", "intype", "outtype" ], "start_line": 5333, "end_line": 5338, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ObjectType", "long_name": "PyArray_ObjectType( PyObject * op , int minimum_type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 40, "parameters": [ "op", "minimum_type" ], "start_line": 5341, "end_line": 5347, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_FromAny", "long_name": "PyArray_FromAny( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int requires)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 165, "parameters": [ "op", "typecode", "min_depth", "max_depth", "requires" ], "start_line": 5401, "end_line": 5431, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "PyArray_EnsureArray", "long_name": "PyArray_EnsureArray( PyObject * op)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 82, "parameters": [ "op" ], "start_line": 5441, "end_line": 5457, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5463, "end_line": 5469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5472, "end_line": 5479, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5482, "end_line": 5489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CanCastSafely", "long_name": "PyArray_CanCastSafely( int fromtype , int totype)", "filename": "arrayobject.c", "nloc": 69, "complexity": 35, "token_count": 386, "parameters": [ "fromtype", "totype" ], "start_line": 5495, "end_line": 5566, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_CanCastTo", "long_name": "PyArray_CanCastTo( PyArray_Typecode * from , PyArray_Typecode * to)", "filename": "arrayobject.c", "nloc": 24, "complexity": 7, "token_count": 134, "parameters": [ "from", "to" ], "start_line": 5569, "end_line": 5593, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_IterNew", "long_name": "PyArray_IterNew( PyObject * obj)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 258, "parameters": [ "obj" ], "start_line": 5603, "end_line": 5640, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "arrayiter_next", "long_name": "arrayiter_next( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "it" ], "start_line": 5645, "end_line": 5655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "arrayiter_dealloc", "long_name": "arrayiter_dealloc( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 25, "parameters": [ "it" ], "start_line": 5658, "end_line": 5663, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "arrayiter_traverse", "long_name": "arrayiter_traverse( PyArrayIterObject * it , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 6, "complexity": 2, "token_count": 42, "parameters": [ "it", "visit", "arg" ], "start_line": 5666, "end_line": 5671, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "iter_length", "long_name": "iter_length( PyArrayIterObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 5675, "end_line": 5678, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 272, "parameters": [ "self", "ind" ], "start_line": 5682, "end_line": 5730, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 50, "complexity": 8, "token_count": 341, "parameters": [ "self", "ind" ], "start_line": 5733, "end_line": 5785, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 593, "parameters": [ "self", "ind" ], "start_line": 5789, "end_line": 5908, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "iter_ass_sub_Bool", "long_name": "iter_ass_sub_Bool( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 31, "complexity": 5, "token_count": 176, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5912, "end_line": 5944, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 41, "complexity": 8, "token_count": 283, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5947, "end_line": 5988, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_ass_subscript", "long_name": "iter_ass_subscript( PyArrayIterObject * self , PyObject * ind , PyObject * val)", "filename": "arrayobject.c", "nloc": 103, "complexity": 24, "token_count": 636, "parameters": [ "self", "ind", "val" ], "start_line": 5992, "end_line": 6114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 30, "complexity": 5, "token_count": 221, "parameters": [ "it", "op" ], "start_line": 6127, "end_line": 6169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "iter_copy", "long_name": "iter_copy( PyArrayIterObject * it , PyObject * args)", "filename": "arrayobject.c", "nloc": 5, "complexity": 2, "token_count": 35, "parameters": [ "it", "args" ], "start_line": 6174, "end_line": 6178, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "fancy_indexing_check", "long_name": "fancy_indexing_check( PyObject * args)", "filename": "arrayobject.c", "nloc": 55, "complexity": 22, "token_count": 293, "parameters": [ "args" ], "start_line": 6243, "end_line": 6304, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 62, "top_nesting_level": 0 }, { "name": "_convert_obj", "long_name": "_convert_obj( PyObject * obj , PyArrayIterObject ** iter)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 105, "parameters": [ "obj", "iter" ], "start_line": 6312, "end_line": 6327, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyArray_Broadcast", "long_name": "PyArray_Broadcast( PyArrayMultiIterObject * mit)", "filename": "arrayobject.c", "nloc": 58, "complexity": 13, "token_count": 464, "parameters": [ "mit" ], "start_line": 6333, "end_line": 6402, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterReset", "long_name": "PyArray_MapIterReset( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 35, "complexity": 4, "token_count": 261, "parameters": [ "mit" ], "start_line": 6406, "end_line": 6442, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNext", "long_name": "PyArray_MapIterNext( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 41, "complexity": 6, "token_count": 296, "parameters": [ "mit" ], "start_line": 6448, "end_line": 6492, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 682, "parameters": [ "mit", "arr" ], "start_line": 6510, "end_line": 6646, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "_nonzero_indices", "long_name": "_nonzero_indices( PyObject * myBool , PyArrayIterObject ** iters)", "filename": "arrayobject.c", "nloc": 57, "complexity": 15, "token_count": 454, "parameters": [ "myBool", "iters" ], "start_line": 6652, "end_line": 6721, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNew", "long_name": "PyArray_MapIterNew( PyObject * indexobj)", "filename": "arrayobject.c", "nloc": 111, "complexity": 24, "token_count": 745, "parameters": [ "indexobj" ], "start_line": 6724, "end_line": 6857, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 134, "top_nesting_level": 0 }, { "name": "arraymapiter_new", "long_name": "arraymapiter_new( PyTypeObject * type , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 130, "parameters": [ "type", "args", "kwds" ], "start_line": 6863, "end_line": 6893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "arraymapiter_next", "long_name": "arraymapiter_next( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 12, "complexity": 4, "token_count": 70, "parameters": [ "mit" ], "start_line": 6899, "end_line": 6910, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "arraymapiter_dealloc", "long_name": "arraymapiter_dealloc( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 60, "parameters": [ "mit" ], "start_line": 6913, "end_line": 6922, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "arraymapiter_traverse", "long_name": "arraymapiter_traverse( PyArrayMapIterObject * mit , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 16, "complexity": 9, "token_count": 146, "parameters": [ "mit", "visit", "arg" ], "start_line": 6925, "end_line": 6943, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyArray_PyIntAsIntp", "long_name": "PyArray_PyIntAsIntp( PyObject * o)", "filename": "arrayobject.c", "nloc": 59, "complexity": 19, "token_count": 385, "parameters": [ "o" ], "start_line": 40, "end_line": 103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "PyArray_PyIntAsInt", "long_name": "PyArray_PyIntAsInt( PyObject * o)", "filename": "arrayobject.c", "nloc": 57, "complexity": 19, "token_count": 389, "parameters": [ "o" ], "start_line": 109, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 86, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 191, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "PyArray_Zero", "long_name": "PyArray_Zero( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 190, "parameters": [ "arr" ], "start_line": 208, "end_line": 243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_One", "long_name": "PyArray_One( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 40, "complexity": 7, "token_count": 222, "parameters": [ "arr" ], "start_line": 246, "end_line": 289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "do_sliced_copy", "long_name": "do_sliced_copy( char * dest , intp * dest_strides , intp * dest_dimensions , int dest_nd , char * src , intp * src_strides , intp * src_dimensions , int src_nd , int elsize , int copies)", "filename": "arrayobject.c", "nloc": 48, "complexity": 13, "token_count": 313, "parameters": [ "dest", "dest_strides", "dest_dimensions", "dest_nd", "src", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 295, "end_line": 345, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "optimize_slices", "long_name": "optimize_slices( intp ** dest_strides , intp ** dest_dimensions , int * dest_nd , intp ** src_strides , intp ** src_dimensions , int * src_nd , int * elsize , int * copies)", "filename": "arrayobject.c", "nloc": 32, "complexity": 8, "token_count": 214, "parameters": [ "dest_strides", "dest_dimensions", "dest_nd", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 368, "end_line": 399, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 402, "end_line": 436, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_INCREF", "long_name": "PyArray_INCREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 449, "end_line": 471, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_XDECREF", "long_name": "PyArray_XDECREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 474, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "byte_swap_vector", "long_name": "byte_swap_vector( * p , int n , int size)", "filename": "arrayobject.c", "nloc": 38, "complexity": 10, "token_count": 340, "parameters": [ "p", "n", "size" ], "start_line": 499, "end_line": 537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "copy_and_swap", "long_name": "copy_and_swap( * dst , * src , int itemsize , intp numitems , intp srcstrides , int swap)", "filename": "arrayobject.c", "nloc": 18, "complexity": 5, "token_count": 120, "parameters": [ "dst", "src", "itemsize", "numitems", "srcstrides", "swap" ], "start_line": 542, "end_line": 562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "index2ptr", "long_name": "index2ptr( PyArrayObject * mp , int i)", "filename": "arrayobject.c", "nloc": 10, "complexity": 7, "token_count": 86, "parameters": [ "mp", "i" ], "start_line": 570, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Size", "long_name": "PyArray_Size( PyObject * op)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 33, "parameters": [ "op" ], "start_line": 583, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_CopyInto", "long_name": "PyArray_CopyInto( PyArrayObject * dest , PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 71, "complexity": 16, "token_count": 425, "parameters": [ "dest", "src" ], "start_line": 604, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 15, "complexity": 2, "token_count": 88, "parameters": [ "dest", "src_object" ], "start_line": 688, "end_line": 704, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndDataAndDescr", "long_name": "PyArray_FromDimsAndDataAndDescr( int nd , int * d , PyArray_Descr * descr , char * data)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 144, "parameters": [ "nd", "d", "descr", "data" ], "start_line": 712, "end_line": 733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 5, "token_count": 137, "parameters": [ "nd", "d", "type", "data" ], "start_line": 737, "end_line": 757, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 5, "token_count": 133, "parameters": [ "nd", "d", "type" ], "start_line": 761, "end_line": 778, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 77, "parameters": [ "m1" ], "start_line": 784, "end_line": 796, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_Scalar", "long_name": "PyArray_Scalar( char * data , int type_num , int itemsize , int swap)", "filename": "arrayobject.c", "nloc": 48, "complexity": 8, "token_count": 289, "parameters": [ "data", "type_num", "itemsize", "swap" ], "start_line": 802, "end_line": 851, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyArray_ToScalar", "long_name": "PyArray_ToScalar( char * data , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 51, "parameters": [ "data", "arr" ], "start_line": 858, "end_line": 865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_Return", "long_name": "PyArray_Return( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 85, "parameters": [ "mp" ], "start_line": 871, "end_line": 890, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 31, "complexity": 6, "token_count": 177, "parameters": [ "type" ], "start_line": 901, "end_line": 933, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 943, "end_line": 986, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 87, "complexity": 16, "token_count": 571, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 990, "end_line": 1079, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "PyArray_ToList", "long_name": "PyArray_ToList( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 24, "complexity": 5, "token_count": 151, "parameters": [ "self" ], "start_line": 1082, "end_line": 1110, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_ToString", "long_name": "PyArray_ToString( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 191, "parameters": [ "self" ], "start_line": 1113, "end_line": 1148, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_dealloc", "long_name": "array_dealloc( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 20, "complexity": 7, "token_count": 144, "parameters": [ "self" ], "start_line": 1157, "end_line": 1194, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_length", "long_name": "array_length( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 1201, "end_line": 1209, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 150, "parameters": [ "self", "i" ], "start_line": 1213, "end_line": 1237, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_item_nice", "long_name": "array_item_nice( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "i" ], "start_line": 1240, "end_line": 1243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_ass_item", "long_name": "array_ass_item( PyArrayObject * self , int i , PyObject * v)", "filename": "arrayobject.c", "nloc": 27, "complexity": 8, "token_count": 177, "parameters": [ "self", "i", "v" ], "start_line": 1247, "end_line": 1277, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "slice_coerce_index", "long_name": "slice_coerce_index( PyObject * o , int * v)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "o", "v" ], "start_line": 1281, "end_line": 1289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "slice_GetIndices", "long_name": "slice_GetIndices( PySliceObject * r , int length , int * start , int * stop , int * step , intp * slicelength)", "filename": "arrayobject.c", "nloc": 45, "complexity": 24, "token_count": 376, "parameters": [ "r", "length", "start", "stop", "step", "slicelength" ], "start_line": 1295, "end_line": 1345, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "parse_subindex", "long_name": "parse_subindex( PyObject * op , int * step_size , intp * n_steps , int max)", "filename": "arrayobject.c", "nloc": 45, "complexity": 11, "token_count": 223, "parameters": [ "op", "step_size", "n_steps", "max" ], "start_line": 1352, "end_line": 1397, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "parse_index", "long_name": "parse_index( PyArrayObject * self , PyObject * op , intp * dimensions , intp * strides , intp * offset_ptr)", "filename": "arrayobject.c", "nloc": 89, "complexity": 20, "token_count": 540, "parameters": [ "self", "op", "dimensions", "strides", "offset_ptr" ], "start_line": 1401, "end_line": 1496, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "_swap_axes", "long_name": "_swap_axes( PyArrayMapIterObject * mit , PyArrayObject ** ret)", "filename": "arrayobject.c", "nloc": 24, "complexity": 4, "token_count": 187, "parameters": [ "mit", "ret" ], "start_line": 1499, "end_line": 1533, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 252, "parameters": [ "mit" ], "start_line": 1538, "end_line": 1588, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "PyArray_SetMap", "long_name": "PyArray_SetMap( PyArrayMapIterObject * mit , PyObject * op)", "filename": "arrayobject.c", "nloc": 50, "complexity": 12, "token_count": 392, "parameters": [ "mit", "op" ], "start_line": 1591, "end_line": 1650, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 425, "parameters": [ "self", "op" ], "start_line": 1671, "end_line": 1746, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "array_ass_sub", "long_name": "array_ass_sub( PyArrayObject * self , PyObject * index , PyObject * op)", "filename": "arrayobject.c", "nloc": 43, "complexity": 9, "token_count": 251, "parameters": [ "self", "index", "op" ], "start_line": 1759, "end_line": 1811, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "array_subscript_nice", "long_name": "array_subscript_nice( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "self", "op" ], "start_line": 1819, "end_line": 1822, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_getsegcount", "long_name": "array_getsegcount( PyArrayObject * self , int * lenp)", "filename": "arrayobject.c", "nloc": 11, "complexity": 4, "token_count": 48, "parameters": [ "self", "lenp" ], "start_line": 1841, "end_line": 1853, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_getreadbuf", "long_name": "array_getreadbuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 72, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1856, "end_line": 1871, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_getwritebuf", "long_name": "array_getwritebuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1875, "end_line": 1884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_getcharbuf", "long_name": "array_getcharbuf( PyArrayObject * self , int segment , const char ** ptrptr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 3, "token_count": 65, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1887, "end_line": 1898, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_SetNumericOps", "long_name": "PyArray_SetNumericOps( PyObject * dict)", "filename": "arrayobject.c", "nloc": 34, "complexity": 1, "token_count": 162, "parameters": [ "dict" ], "start_line": 1966, "end_line": 1999, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_GetNumericOps", "long_name": "PyArray_GetNumericOps()", "filename": "arrayobject.c", "nloc": 39, "complexity": 2, "token_count": 183, "parameters": [], "start_line": 2005, "end_line": 2044, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_GenericReduceFunction", "long_name": "PyArray_GenericReduceFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2047, "end_line": 2066, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericAccumulateFunction", "long_name": "PyArray_GenericAccumulateFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2070, "end_line": 2089, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericBinaryFunction", "long_name": "PyArray_GenericBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 69, "parameters": [ "m1", "m2", "op" ], "start_line": 2093, "end_line": 2104, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericUnaryFunction", "long_name": "PyArray_GenericUnaryFunction( PyArrayObject * m1 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 63, "parameters": [ "m1", "op" ], "start_line": 2107, "end_line": 2118, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericInplaceBinaryFunction", "long_name": "PyArray_GenericInplaceBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 13, "complexity": 2, "token_count": 71, "parameters": [ "m1", "m2", "op" ], "start_line": 2121, "end_line": 2133, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_add", "long_name": "array_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2136, "end_line": 2139, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_subtract", "long_name": "array_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2142, "end_line": 2145, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_multiply", "long_name": "array_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2148, "end_line": 2151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_divide", "long_name": "array_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2154, "end_line": 2157, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_remainder", "long_name": "array_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2160, "end_line": 2163, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_power", "long_name": "array_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2166, "end_line": 2169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_negative", "long_name": "array_negative( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2172, "end_line": 2175, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_absolute", "long_name": "array_absolute( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2178, "end_line": 2181, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_invert", "long_name": "array_invert( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2184, "end_line": 2187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_left_shift", "long_name": "array_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2190, "end_line": 2193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_right_shift", "long_name": "array_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2196, "end_line": 2199, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_and", "long_name": "array_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2202, "end_line": 2205, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_or", "long_name": "array_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2208, "end_line": 2211, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_xor", "long_name": "array_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2214, "end_line": 2217, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_add", "long_name": "array_inplace_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2220, "end_line": 2223, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_subtract", "long_name": "array_inplace_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2226, "end_line": 2229, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_multiply", "long_name": "array_inplace_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2232, "end_line": 2235, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_divide", "long_name": "array_inplace_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2238, "end_line": 2241, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_remainder", "long_name": "array_inplace_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2244, "end_line": 2247, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_power", "long_name": "array_inplace_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2250, "end_line": 2253, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_left_shift", "long_name": "array_inplace_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2256, "end_line": 2259, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_right_shift", "long_name": "array_inplace_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2262, "end_line": 2265, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_and", "long_name": "array_inplace_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2268, "end_line": 2271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_or", "long_name": "array_inplace_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2274, "end_line": 2277, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_xor", "long_name": "array_inplace_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2280, "end_line": 2283, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_floor_divide", "long_name": "array_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2286, "end_line": 2289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_TRUE_divide", "long_name": "array_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2292, "end_line": 2295, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_floor_divide", "long_name": "array_inplace_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2298, "end_line": 2302, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_inplace_TRUE_divide", "long_name": "array_inplace_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2305, "end_line": 2309, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_all_nonzero", "long_name": "array_all_nonzero( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 93, "parameters": [ "mp" ], "start_line": 2313, "end_line": 2331, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_divmod", "long_name": "array_divmod( PyArrayObject * op1 , PyObject * op2)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 89, "parameters": [ "op1", "op2" ], "start_line": 2334, "end_line": 2349, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_int", "long_name": "array_int( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2353, "end_line": 2379, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_float", "long_name": "array_float( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2382, "end_line": 2407, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_long", "long_name": "array_long( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2410, "end_line": 2432, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_oct", "long_name": "array_oct( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2435, "end_line": 2457, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_hex", "long_name": "array_hex( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2460, "end_line": 2482, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "_array_copy_nice", "long_name": "_array_copy_nice( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 22, "parameters": [ "self" ], "start_line": 2485, "end_line": 2489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 258, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2550, "end_line": 2588, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_ass_slice", "long_name": "array_ass_slice( PyArrayObject * self , int ilow , int ihigh , PyObject * v)", "filename": "arrayobject.c", "nloc": 20, "complexity": 4, "token_count": 108, "parameters": [ "self", "ilow", "ihigh", "v" ], "start_line": 2592, "end_line": 2613, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_contains", "long_name": "array_contains( PyArrayObject * self , PyObject * el)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "el" ], "start_line": 2616, "end_line": 2621, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "dump_data", "long_name": "dump_data( char ** string , int * n , int * max_n , char * data , int nd , intp * dimensions , intp * strides , PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 41, "complexity": 7, "token_count": 308, "parameters": [ "string", "n", "max_n", "data", "nd", "dimensions", "strides", "self" ], "start_line": 2642, "end_line": 2689, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "array_repr_builtin", "long_name": "array_repr_builtin( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 30, "complexity": 4, "token_count": 222, "parameters": [ "self" ], "start_line": 2692, "end_line": 2728, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_SetStringFunction", "long_name": "PyArray_SetStringFunction( PyObject * op , int repr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 48, "parameters": [ "op", "repr" ], "start_line": 2734, "end_line": 2751, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2754, "end_line": 2766, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2769, "end_line": 2781, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_richcompare", "long_name": "array_richcompare( PyArrayObject * self , PyObject * other , int cmp_op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 13, "token_count": 273, "parameters": [ "self", "other", "cmp_op" ], "start_line": 2785, "end_line": 2862, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 78, "top_nesting_level": 0 }, { "name": "_check_axis", "long_name": "_check_axis( PyArrayObject * arr , int * axis , int flags)", "filename": "arrayobject.c", "nloc": 29, "complexity": 8, "token_count": 164, "parameters": [ "arr", "axis", "flags" ], "start_line": 2865, "end_line": 2894, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyArray_IntTupleFromIntp", "long_name": "PyArray_IntTupleFromIntp( int len , intp * vals)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 91, "parameters": [ "len", "vals" ], "start_line": 2900, "end_line": 2916, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_IntpFromSequence", "long_name": "PyArray_IntpFromSequence( PyObject * seq , intp * vals , int maxvals)", "filename": "arrayobject.c", "nloc": 21, "complexity": 7, "token_count": 161, "parameters": [ "seq", "vals", "maxvals" ], "start_line": 2921, "end_line": 2944, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "_IsContiguous", "long_name": "_IsContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 109, "parameters": [ "ap" ], "start_line": 2950, "end_line": 2966, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsFortranContiguous", "long_name": "_IsFortranContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 107, "parameters": [ "ap" ], "start_line": 2970, "end_line": 2986, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsAligned", "long_name": "_IsAligned( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 110, "parameters": [ "ap" ], "start_line": 2990, "end_line": 3006, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsWriteable", "long_name": "_IsWriteable( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 16, "complexity": 8, "token_count": 109, "parameters": [ "ap" ], "start_line": 3009, "end_line": 3042, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_UpdateFlags", "long_name": "PyArray_UpdateFlags( PyArrayObject * ret , int flagmask)", "filename": "arrayobject.c", "nloc": 22, "complexity": 9, "token_count": 129, "parameters": [ "ret", "flagmask" ], "start_line": 3046, "end_line": 3068, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_CheckStrides", "long_name": "PyArray_CheckStrides( int elsize , int nd , intp numbytes , intp * dims , intp * newstrides)", "filename": "arrayobject.c", "nloc": 13, "complexity": 4, "token_count": 84, "parameters": [ "elsize", "nd", "numbytes", "dims", "newstrides" ], "start_line": 3075, "end_line": 3090, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "_array_fill_strides", "long_name": "_array_fill_strides( intp * strides , intp * dims , int nd , intp itemsize , int inflag , int * objflags)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 171, "parameters": [ "strides", "dims", "nd", "itemsize", "inflag", "objflags" ], "start_line": 3110, "end_line": 3134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 672, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3138, "end_line": 3282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "PyArray_Resize", "long_name": "PyArray_Resize( PyArrayObject * self , PyArray_Dims * newshape)", "filename": "arrayobject.c", "nloc": 87, "complexity": 15, "token_count": 501, "parameters": [ "self", "newshape" ], "start_line": 3287, "end_line": 3392, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_FillObjectArray", "long_name": "PyArray_FillObjectArray( PyArrayObject * arr , PyObject * obj)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 98, "parameters": [ "arr", "obj" ], "start_line": 3396, "end_line": 3413, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_new", "long_name": "array_new( PyTypeObject * subtype , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 100, "complexity": 20, "token_count": 593, "parameters": [ "subtype", "args", "kwds" ], "start_line": 3417, "end_line": 3532, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 116, "top_nesting_level": 0 }, { "name": "array_ndim_get", "long_name": "array_ndim_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 3539, "end_line": 3542, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flags_get", "long_name": "array_flags_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 10, "complexity": 3, "token_count": 55, "parameters": [ "self" ], "start_line": 3545, "end_line": 3555, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_shape_get", "long_name": "array_shape_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3628, "end_line": 3631, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_shape_set", "long_name": "array_shape_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 33, "complexity": 6, "token_count": 206, "parameters": [ "self", "val" ], "start_line": 3635, "end_line": 3669, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_strides_get", "long_name": "array_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3673, "end_line": 3676, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_strides_set", "long_name": "array_strides_set( PyArrayObject * self , PyObject * obj)", "filename": "arrayobject.c", "nloc": 32, "complexity": 7, "token_count": 209, "parameters": [ "self", "obj" ], "start_line": 3679, "end_line": 3712, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_protocol_strides_get", "long_name": "array_protocol_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 35, "parameters": [ "self" ], "start_line": 3716, "end_line": 3723, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_priority_get", "long_name": "array_priority_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 3, "token_count": 42, "parameters": [ "self" ], "start_line": 3726, "end_line": 3734, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_data_get", "long_name": "array_data_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 82, "parameters": [ "self" ], "start_line": 3738, "end_line": 3752, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_data_set", "long_name": "array_data_set( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 44, "complexity": 9, "token_count": 229, "parameters": [ "self", "op" ], "start_line": 3755, "end_line": 3799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "array_itemsize_get", "long_name": "array_itemsize_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 3803, "end_line": 3806, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_size_get", "long_name": "array_size_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "self" ], "start_line": 3809, "end_line": 3816, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typechar_get", "long_name": "array_typechar_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 47, "parameters": [ "self" ], "start_line": 3820, "end_line": 3827, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typestr_get", "long_name": "array_typestr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 7, "token_count": 141, "parameters": [ "self" ], "start_line": 3830, "end_line": 3850, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_descr_get", "long_name": "array_descr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 128, "parameters": [ "self" ], "start_line": 3853, "end_line": 3875, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_typenum_get", "long_name": "array_typenum_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 3878, "end_line": 3881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_get", "long_name": "array_type_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 3885, "end_line": 3888, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_set", "long_name": "array_type_set( PyArrayObject * self , PyObject * arg)", "filename": "arrayobject.c", "nloc": 41, "complexity": 10, "token_count": 294, "parameters": [ "self", "arg" ], "start_line": 3900, "end_line": 3958, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "array_base_get", "long_name": "array_base_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 41, "parameters": [ "self" ], "start_line": 3963, "end_line": 3973, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 129, "parameters": [ "self" ], "start_line": 3977, "end_line": 4002, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 177, "parameters": [ "self", "val" ], "start_line": 4006, "end_line": 4038, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 33, "complexity": 3, "token_count": 190, "parameters": [ "self" ], "start_line": 4041, "end_line": 4074, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 203, "parameters": [ "self", "val" ], "start_line": 4077, "end_line": 4114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_flat_get", "long_name": "array_flat_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 4117, "end_line": 4120, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 50, "complexity": 9, "token_count": 358, "parameters": [ "self", "val" ], "start_line": 4123, "end_line": 4175, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "discover_depth", "long_name": "discover_depth( PyObject * s , int max , int stop_at_string)", "filename": "arrayobject.c", "nloc": 23, "complexity": 14, "token_count": 169, "parameters": [ "s", "max", "stop_at_string" ], "start_line": 4351, "end_line": 4376, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "discover_itemsize", "long_name": "discover_itemsize( PyObject * s , int nd , int * itemsize)", "filename": "arrayobject.c", "nloc": 21, "complexity": 9, "token_count": 161, "parameters": [ "s", "nd", "itemsize" ], "start_line": 4379, "end_line": 4401, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "discover_dimensions", "long_name": "discover_dimensions( PyObject * s , int nd , intp * d , int check_it)", "filename": "arrayobject.c", "nloc": 24, "complexity": 10, "token_count": 188, "parameters": [ "s", "nd", "d", "check_it" ], "start_line": 4408, "end_line": 4434, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_array_small_type", "long_name": "_array_small_type( int chktype , int mintype , int chksize , int minsize , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 100, "parameters": [ "chktype", "mintype", "chksize", "minsize", "outtype" ], "start_line": 4437, "end_line": 4457, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 123, "complexity": 28, "token_count": 661, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4460, "end_line": 4598, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "Assign_Array", "long_name": "Assign_Array( PyArrayObject * self , PyObject * v)", "filename": "arrayobject.c", "nloc": 21, "complexity": 6, "token_count": 121, "parameters": [ "self", "v" ], "start_line": 4601, "end_line": 4624, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromScalar", "long_name": "Array_FromScalar( PyObject * op , PyArray_Typecode * typecode)", "filename": "arrayobject.c", "nloc": 19, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode" ], "start_line": 4628, "end_line": 4651, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromSequence", "long_name": "Array_FromSequence( PyObject * s , PyArray_Typecode * typecode , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 51, "complexity": 17, "token_count": 313, "parameters": [ "s", "typecode", "min_depth", "max_depth" ], "start_line": 4655, "end_line": 4712, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_ValidType", "long_name": "PyArray_ValidType( int type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 2, "token_count": 30, "parameters": [ "type" ], "start_line": 4716, "end_line": 4723, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "_bufferedcast", "long_name": "_bufferedcast( PyArrayObject * out , PyArrayObject * in)", "filename": "arrayobject.c", "nloc": 75, "complexity": 16, "token_count": 477, "parameters": [ "out", "in" ], "start_line": 4729, "end_line": 4819, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "PyArray_Cast", "long_name": "PyArray_Cast( PyArrayObject * mp , int type_num)", "filename": "arrayobject.c", "nloc": 10, "complexity": 1, "token_count": 56, "parameters": [ "mp", "type_num" ], "start_line": 4825, "end_line": 4836, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 233, "parameters": [ "mp", "at" ], "start_line": 4839, "end_line": 4874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_CastTo", "long_name": "PyArray_CastTo( PyArrayObject * out , PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 40, "complexity": 10, "token_count": 214, "parameters": [ "out", "mp" ], "start_line": 4881, "end_line": 4927, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 77, "complexity": 26, "token_count": 512, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4930, "end_line": 5020, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "_array_typecode_fromstr", "long_name": "_array_typecode_fromstr( char * str , int * swap , PyArray_Typecode * type)", "filename": "arrayobject.c", "nloc": 94, "complexity": 36, "token_count": 533, "parameters": [ "str", "swap", "type" ], "start_line": 5024, "end_line": 5129, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5132, "end_line": 5226, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_fromattr", "long_name": "array_fromattr( PyObject * op , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 21, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode", "flags" ], "start_line": 5229, "end_line": 5250, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_fromobject", "long_name": "array_fromobject( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int flags)", "filename": "arrayobject.c", "nloc": 46, "complexity": 13, "token_count": 270, "parameters": [ "op", "typecode", "min_depth", "max_depth", "flags" ], "start_line": 5254, "end_line": 5316, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_ArrayType", "long_name": "PyArray_ArrayType( PyObject * op , PyArray_Typecode * intype , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 29, "parameters": [ "op", "intype", "outtype" ], "start_line": 5319, "end_line": 5324, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ObjectType", "long_name": "PyArray_ObjectType( PyObject * op , int minimum_type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 40, "parameters": [ "op", "minimum_type" ], "start_line": 5327, "end_line": 5333, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_FromAny", "long_name": "PyArray_FromAny( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int requires)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 165, "parameters": [ "op", "typecode", "min_depth", "max_depth", "requires" ], "start_line": 5387, "end_line": 5417, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "PyArray_EnsureArray", "long_name": "PyArray_EnsureArray( PyObject * op)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 82, "parameters": [ "op" ], "start_line": 5427, "end_line": 5443, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5449, "end_line": 5454, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5457, "end_line": 5463, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 43, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5466, "end_line": 5472, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_CanCastSafely", "long_name": "PyArray_CanCastSafely( int fromtype , int totype)", "filename": "arrayobject.c", "nloc": 69, "complexity": 35, "token_count": 386, "parameters": [ "fromtype", "totype" ], "start_line": 5478, "end_line": 5549, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_CanCastTo", "long_name": "PyArray_CanCastTo( PyArray_Typecode * from , PyArray_Typecode * to)", "filename": "arrayobject.c", "nloc": 24, "complexity": 7, "token_count": 134, "parameters": [ "from", "to" ], "start_line": 5552, "end_line": 5576, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_IterNew", "long_name": "PyArray_IterNew( PyObject * obj)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 258, "parameters": [ "obj" ], "start_line": 5586, "end_line": 5623, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "arrayiter_next", "long_name": "arrayiter_next( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "it" ], "start_line": 5628, "end_line": 5638, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "arrayiter_dealloc", "long_name": "arrayiter_dealloc( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 25, "parameters": [ "it" ], "start_line": 5641, "end_line": 5646, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "arrayiter_traverse", "long_name": "arrayiter_traverse( PyArrayIterObject * it , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 6, "complexity": 2, "token_count": 42, "parameters": [ "it", "visit", "arg" ], "start_line": 5649, "end_line": 5654, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "iter_length", "long_name": "iter_length( PyArrayIterObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 5658, "end_line": 5661, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 272, "parameters": [ "self", "ind" ], "start_line": 5665, "end_line": 5713, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 50, "complexity": 8, "token_count": 341, "parameters": [ "self", "ind" ], "start_line": 5716, "end_line": 5768, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 593, "parameters": [ "self", "ind" ], "start_line": 5772, "end_line": 5891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "iter_ass_sub_Bool", "long_name": "iter_ass_sub_Bool( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 31, "complexity": 5, "token_count": 176, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5895, "end_line": 5927, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 41, "complexity": 8, "token_count": 283, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5930, "end_line": 5971, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_ass_subscript", "long_name": "iter_ass_subscript( PyArrayIterObject * self , PyObject * ind , PyObject * val)", "filename": "arrayobject.c", "nloc": 103, "complexity": 24, "token_count": 636, "parameters": [ "self", "ind", "val" ], "start_line": 5975, "end_line": 6097, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 30, "complexity": 5, "token_count": 221, "parameters": [ "it", "op" ], "start_line": 6110, "end_line": 6152, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "iter_copy", "long_name": "iter_copy( PyArrayIterObject * it , PyObject * args)", "filename": "arrayobject.c", "nloc": 5, "complexity": 2, "token_count": 35, "parameters": [ "it", "args" ], "start_line": 6157, "end_line": 6161, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "fancy_indexing_check", "long_name": "fancy_indexing_check( PyObject * args)", "filename": "arrayobject.c", "nloc": 55, "complexity": 22, "token_count": 293, "parameters": [ "args" ], "start_line": 6226, "end_line": 6287, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 62, "top_nesting_level": 0 }, { "name": "_convert_obj", "long_name": "_convert_obj( PyObject * obj , PyArrayIterObject ** iter)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 105, "parameters": [ "obj", "iter" ], "start_line": 6295, "end_line": 6310, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyArray_Broadcast", "long_name": "PyArray_Broadcast( PyArrayMultiIterObject * mit)", "filename": "arrayobject.c", "nloc": 58, "complexity": 13, "token_count": 464, "parameters": [ "mit" ], "start_line": 6316, "end_line": 6385, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterReset", "long_name": "PyArray_MapIterReset( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 35, "complexity": 4, "token_count": 261, "parameters": [ "mit" ], "start_line": 6389, "end_line": 6425, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNext", "long_name": "PyArray_MapIterNext( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 41, "complexity": 6, "token_count": 296, "parameters": [ "mit" ], "start_line": 6431, "end_line": 6475, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 682, "parameters": [ "mit", "arr" ], "start_line": 6493, "end_line": 6629, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "_nonzero_indices", "long_name": "_nonzero_indices( PyObject * myBool , PyArrayIterObject ** iters)", "filename": "arrayobject.c", "nloc": 57, "complexity": 15, "token_count": 454, "parameters": [ "myBool", "iters" ], "start_line": 6635, "end_line": 6704, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNew", "long_name": "PyArray_MapIterNew( PyObject * indexobj)", "filename": "arrayobject.c", "nloc": 111, "complexity": 24, "token_count": 745, "parameters": [ "indexobj" ], "start_line": 6707, "end_line": 6840, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 134, "top_nesting_level": 0 }, { "name": "arraymapiter_new", "long_name": "arraymapiter_new( PyTypeObject * type , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 130, "parameters": [ "type", "args", "kwds" ], "start_line": 6846, "end_line": 6876, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "arraymapiter_next", "long_name": "arraymapiter_next( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 12, "complexity": 4, "token_count": 70, "parameters": [ "mit" ], "start_line": 6882, "end_line": 6893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "arraymapiter_dealloc", "long_name": "arraymapiter_dealloc( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 60, "parameters": [ "mit" ], "start_line": 6896, "end_line": 6905, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "arraymapiter_traverse", "long_name": "arraymapiter_traverse( PyArrayMapIterObject * mit , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 16, "complexity": 9, "token_count": 146, "parameters": [ "mit", "visit", "arg" ], "start_line": 6908, "end_line": 6926, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5482, "end_line": 5489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 16, "complexity": 2, "token_count": 98, "parameters": [ "dest", "src_object" ], "start_line": 688, "end_line": 707, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 80, "complexity": 26, "token_count": 522, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4940, "end_line": 5034, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 3, "token_count": 200, "parameters": [ "self" ], "start_line": 4044, "end_line": 4079, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5472, "end_line": 5479, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 51, "complexity": 9, "token_count": 368, "parameters": [ "self", "val" ], "start_line": 4128, "end_line": 4182, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5463, "end_line": 5469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 126, "complexity": 28, "token_count": 671, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4467, "end_line": 4608, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 142, "top_nesting_level": 0 } ], "nloc": 5493, "complexity": 1207, "token_count": 32870, "diff_parsed": { "added": [ "\tPyArray_Typecode typecode;", "", "", "\ttypecode.type_num = dest->descr->type_num;", "\ttypecode.itemsize = dest->itemsize;", "\ttypecode.fortran = PyArray_ISFORTRAN(dest);", "", " PyArray_Typecode type;", "", "\ttype.type_num = self->descr->type_num;", "\ttype.itemsize = self->itemsize;", "\ttype.fortran = PyArray_ISFORTRAN(self);", "\tPyArray_Typecode typecode;", "", "\ttypecode.type_num = self->descr->type_num;", "\ttypecode.itemsize = self->itemsize;", "\ttypecode.fortran = PyArray_ISFORTRAN(self);", "\t\tPyArray_Typecode newtype;", "\t\tnewtype.type_num = mintype;", "\t\tnewtype.itemsize = minsize;", "\t\tnewtype.fortran = 0;", "\tPyArray_Typecode oldtype;", "", "\toldtype.type_num = PyArray_TYPE(arr);", "\toldtype.itemsize = PyArray_ITEMSIZE(arr);", "\toldtype.fortran = 0;", "", "\tPyArray_Typecode typecode = {0, 0, 0};", "\ttypecode.type_num = type;", "\tPyArray_Typecode typecode = {0, 0, 0};", "\ttypecode.type_num = type;", "\tPyArray_Typecode typecode = {0, 0, 0};", "\ttypecode.type_num = type;" ], "deleted": [ "\tPyArray_Typecode typecode = {dest->descr->type_num,", "\t\t\t\t dest->itemsize,", "\t\t\t\t PyArray_ISFORTRAN(dest)};", "", " PyArray_Typecode type = {self->descr->type_num,", " self->itemsize,", " PyArray_ISFORTRAN(self)};", "\tPyArray_Typecode typecode = {self->descr->type_num,", "\t\t\t\t self->itemsize,", "\t\t\t\t PyArray_ISFORTRAN(self)};", "\t\tPyArray_Typecode newtype = {mintype, minsize, 0};", "\tPyArray_Typecode oldtype={PyArray_TYPE(arr),PyArray_ITEMSIZE(arr),0};", "", "\tPyArray_Typecode typecode = {type, 0, 0};", "\tPyArray_Typecode typecode = {type, 0, 0};", "\tPyArray_Typecode typecode = {type, 0, 0};" ] } }, { "old_path": "scipy/base/src/multiarraymodule.c", "new_path": "scipy/base/src/multiarraymodule.c", "filename": "multiarraymodule.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -751,9 +751,12 @@ PyArray_Diagonal(PyArrayObject *self, int offset, int axis1, int axis2)\n \t\tPyObject *mydiagonal=NULL, *new=NULL, *ret=NULL, *sel=NULL;\n \t\tintp i, n1;\n \t\tint res;\n-\t\tPyArray_Typecode typecode = {self->descr->type_num,\n-\t\t\t\t\t self->itemsize, 0};\n-\t\t\n+\t\tPyArray_Typecode typecode;\n+\n+\t\ttypecode.type_num = self->descr->type_num;\n+\t\ttypecode.itemsize = self->itemsize;\n+\t\ttypecode.fortran = 0;\n+\n \t\tmydiagonal = PyList_New(0);\n \t\tif (mydiagonal == NULL) {Py_DECREF(self); return NULL;}\n \t\tn1 = self->dimensions[0];\n@@ -806,11 +809,12 @@ static int\n PyArray_AsCArray(PyObject **op, void *ptr, intp *dims, int nd, int type_num) \n {\n \tPyArrayObject *ap;\n-\tPyArray_Typecode typecode = {type_num, 0, 0};\n+\tPyArray_Typecode typecode = {0, 0, 0};\n \tintp n, m, i, j;\n \tchar **ptr2;\n \tchar ***ptr3;\n \n+\ttypecode.type_num = type_num;\n \tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n \t\tPyErr_SetString(PyExc_TypeError, \n \t\t\t\t\"Cannot treat flexible type as C array.\");\n@@ -995,7 +999,8 @@ PyArray_Concatenate(PyObject *op, int axis)\n \tsubtype = &PyArray_Type;\n \tret = NULL;\n \tfor(i=0; iitemsize, \n+\t\t\t\t\tPyArray_TypestrConvert(at->itemsize,\n \t\t\t\t\t\t\t check_num);\n \t\t\t at->itemsize = 0;\n \t\t\t\tif (check_num == PyArray_NOTYPE) goto fail;\n@@ -2780,9 +2785,14 @@ PyArray_EquivalentTypes(PyArray_Typecode *typ1, PyArray_Typecode *typ2)\n static Bool \n PyArray_EquivArrTypes(PyArrayObject *a1, PyArrayObject *a2)\n {\n- PyArray_Typecode type1={PyArray_TYPE(a1), PyArray_ITEMSIZE(a1), 0};\n- PyArray_Typecode type2={PyArray_TYPE(a2), PyArray_ITEMSIZE(a2), 0};\n- \n+ PyArray_Typecode type1={0,0,0};\n+ PyArray_Typecode type2={0,0,0};\n+\n+\ttype1.type_num = PyArray_TYPE(a1);\n+\ttype2.type_num = PyArray_TYPE(a2);\n+\ttype1.itemsize = PyArray_ITEMSIZE(a1);\n+\ttype2.itemsize = PyArray_ITEMSIZE(a2);\n+\t\t\t\n return PyArray_EquivalentTypes(&type1, &type2);\n }\n \n", "added_lines": 19, "deleted_lines": 9, "source_code": "\n/*\n Python Multiarray Module -- A useful collection of functions for creating and\n using ndarrays\n\n Original file \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n Modified for scipy_core in 2005 \n\n Travis E. Oliphant\n Assistant Professor at\n Brigham Young University\n \n*/\n\n/* $Id: multiarraymodule.c,v 1.36 2005/09/14 00:14:00 teoliphant Exp $ */\n\n#include \"Python.h\"\n#include \"structmember.h\"\n/*#include \n#include \n*/\n\n#define _MULTIARRAYMODULE\n#include \"scipy/arrayobject.h\"\n\n#define PyAO PyArrayObject\n\nstatic PyObject *typeDict=NULL; /* Must be explicitly loaded */\n\n/* Including this file is the only way I know how to declare functions\n static in each file, and store the pointers from functions in both\n arrayobject.c and multiarraymodule.c for the C-API \n\n Declarying an external pointer-containing variable in arrayobject.c\n and trying to copy it to PyArray_API, did not work.\n\n Think about two modules with a common api that import each other...\n\n This file would just be the module calls. \n*/\n\n#include \"arrayobject.c\"\n\n\n/* An Error object -- rarely used? */\nstatic PyObject *MultiArrayError;\n\nstatic intp \nPyArray_MultiplyList(intp *l1, int n) \n{\n\tregister intp s=1;\n\tregister int i=0;\n while (i++ < n) s *= (*l1++);\n return s;\n}\n\n\nstatic int \nPyArray_AxisConverter(PyObject *obj, int *axis)\n{\n\tif (obj == Py_None) {\n\t\t*axis = MAX_DIMS;\n\t}\n\telse {\n\t\t*axis = (int) PyInt_AsLong(obj);\n\t\tif (PyErr_Occurred()) {\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n\treturn PY_SUCCEED;\n}\n\nstatic int \nPyArray_CompareLists(intp *l1, intp *l2, int n) \n{\n int i;\n for(i=0;itype_num;\n\t}\n\n\tnew = PyArray_New(self->ob_type,\n\t\t\t self->nd, self->dimensions,\n\t\t\t self->descr->type_num,\n\t\t\t self->strides,\n\t\t\t self->data,\n\t\t\t self->itemsize,\n\t\t\t self->flags, (PyObject *)self);\n\n\tif (new==NULL) return NULL;\n\t\n Py_INCREF(self);\n PyArray_BASE(new) = (PyObject *)self;\n if ((type_num != PyArray_NOTYPE) && \\\n (type_num != self->descr->type_num)) {\n if (!PyTypeNum_ISFLEXIBLE(type_num)) {\n v = PyArray_TypeObjectFromType(type_num);\n }\n else {\n PyArray_Descr *descr;\n int itemsize = type->itemsize;\n descr = PyArray_DescrFromType(type_num);\n if (type_num == PyArray_UNICODE) \n itemsize /= sizeof(Py_UNICODE);\n /* construct a string representation */\n v = PyString_FromFormat(\"%c%d\", descr->type, \n itemsize);\n }\n if (v == NULL) goto fail;\n /* set attribute new.dtype = newtype */\n if (PyObject_SetAttrString(new, \"dtype\", v) < 0) goto fail;\n Py_DECREF(v);\n }\n\treturn new;\t\n\n fail:\n Py_XDECREF(v);\n Py_XDECREF(new);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Ravel(PyArrayObject *a, int fortran)\n{\n\tPyArray_Dims newdim = {NULL,1};\n\tintp val[1] = {-1};\n\n if (a->nd == 1) {\n Py_INCREF(a);\n return (PyObject *)a;\n }\n\tnewdim.ptr = val;\n\tif (!fortran && PyArray_ISCONTIGUOUS(a)) \n\t\treturn PyArray_Newshape(a, &newdim);\n\telse\n\t return PyArray_Flatten(a, fortran);\n}\n\nstatic PyObject *\nPyArray_Flatten(PyArrayObject *a, int fortran)\n{\n\tPyObject *ret, *new;\n\tintp size;\n\n\tsize = PyArray_SIZE(a);\n\tret = PyArray_New(a->ob_type,\n\t\t\t 1, &size,\n\t\t\t a->descr->type_num,\n\t\t\t NULL,\n NULL,\n\t\t\t a->itemsize,\n\t\t\t 0, (PyObject *)a);\n\n\tif (ret== NULL) return NULL;\n\tif (fortran) {\n\t\tnew = PyArray_Transpose(a, NULL);\n\t\tif (new == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\telse {\n\t\tPy_INCREF(a);\n\t\tnew = (PyObject *)a;\n\t}\n\tif (PyArray_CopyInto((PyArrayObject *)ret, (PyArrayObject *)new) < 0) {\n\t\tPy_DECREF(ret);\n\t\tPy_DECREF(new);\n\t\treturn NULL;\n\t}\n\tPy_DECREF(new);\n\treturn ret;\n}\n\n\n/* For back-ward compatability *\n\n/ * Not recommended */\n\nstatic PyObject *\nPyArray_Reshape(PyArrayObject *self, PyObject *shape) \n{\n PyObject *ret;\n PyArray_Dims newdims;\n\n if (!PyArray_IntpConverter(shape, &newdims)) return NULL;\n ret = PyArray_Newshape(self, &newdims);\n PyDimMem_FREE(newdims.ptr);\n return ret;\n}\n\n/* Returns a new array \n with the a new shape from the data\n in the old array\n*/\n\nstatic PyObject * \nPyArray_Newshape(PyArrayObject *self, PyArray_Dims *newdims)\n{\n intp i, s_original, i_unknown, s_known;\n intp *dimensions = newdims->ptr;\n PyArrayObject *ret;\n\tchar msg[] = \"total size of new array must be unchanged\";\n\tint n = newdims->len;\n Bool same;\n\n /* Quick check to make sure anything needs to be done */\n if (n == self->nd) {\n same = TRUE;\n i=0;\n while(same && i= 0) {\n if ((s_known == 0) || (s_original % s_known != 0)) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n dimensions[i_unknown] = s_original/s_known;\n } else {\n if (s_original != s_known) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n }\n \n\tret = (PyAO *)PyArray_New(self->ob_type,\n\t\t\t\t n, dimensions,\n\t\t\t\t self->descr->type_num,\n\t\t\t\t NULL,\n\t\t\t\t self->data,\n\t\t\t\t self->itemsize,\n\t\t\t\t self->flags, (PyObject *)self);\n\n\tif (ret== NULL)\n goto fail;\n\t\n Py_INCREF(self);\n ret->base = (PyObject *)self;\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n return (PyObject *)ret;\n\t\n fail:\n return NULL;\n}\n\n/* return a new view of the array object with all of its unit-length \n dimensions squeezed out if needed, otherwise\n return the same array.\n */\n\nstatic PyObject *\nPyArray_Squeeze(PyArrayObject *self)\n{\n\tint nd = self->nd;\n\tint newnd = nd;\n\tintp dimensions[MAX_DIMS];\n\tintp strides[MAX_DIMS];\n\tint i,j;\n\tPyObject *ret;\n\n\tif (nd == 0) {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n\tfor (j=0, i=0; idimensions[i] == 1) {\n\t\t\tnewnd -= 1;\n\t\t}\n\t\telse {\n\t\t\tdimensions[j] = self->dimensions[i];\n\t\t\tstrides[j++] = self->strides[i];\n\t\t}\n\t}\n\t\n\tret = PyArray_New(self->ob_type, newnd, dimensions, \n\t\t\t self->descr->type_num, strides,\n\t\t\t self->data, self->itemsize, self->flags,\n\t\t\t (PyObject *)self);\n\tself->flags &= ~OWN_DATA;\n\tself->base = (PyObject *)self;\n\tPy_INCREF(self);\n\treturn (PyObject *)ret;\n}\n\n\nstatic PyObject *\nPyArray_Mean(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL;\n\tPyObject *new, *ret;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\n\tobj1 = PyArray_GenericReduceFunction((PyAO *)new, n_ops.add, axis,\n\t\t\t\t\t rtype);\n\tobj2 = PyFloat_FromDouble((double) PyArray_DIM(new,axis));\n Py_DECREF(new);\n\tif (obj1 == NULL || obj2 == NULL) {\n\t\tPy_XDECREF(obj1);\n\t\tPy_XDECREF(obj2);\n\t\treturn NULL;\n\t}\n\n\tret = PyNumber_Divide(obj1, obj2);\n\tPy_DECREF(obj1);\n\tPy_DECREF(obj2);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Std(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL, *new=NULL;\n\tPyObject *ret=NULL, *newshape=NULL;\n\tint i, n;\n\tintp val;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\t\n\t/* Compute and reshape mean */\n\tobj1 = PyArray_EnsureArray(PyArray_Mean((PyAO *)new, axis, rtype));\n\tif (obj1 == NULL) {Py_DECREF(new); return NULL;} \n\tn = PyArray_NDIM(new);\n\tnewshape = PyTuple_New(n);\n\tif (newshape == NULL) {Py_DECREF(obj1); Py_DECREF(new); return NULL;}\n\tfor (i=0; ind != 1) {\n Py_DECREF(cond);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Condition must be 1-d array.\");\n return NULL;\n }\n\n res = PyArray_Nonzero(cond);\n Py_DECREF(cond);\n\tret = PyArray_Take(self, res, axis);\n\tPy_DECREF(res);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Nonzero(PyArrayObject *self)\n{\n int n=self->nd, j;\n\tintp count=0, i, size;\n\tPyArrayIterObject *it=NULL;\n\tPyObject *ret=NULL, *item;\n\tintp *dptr[MAX_DIMS];\n\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (it==NULL) return NULL;\n\n\tsize = it->size;\n\tfor (i=0; idescr->nonzero(it->dataptr, self)) count++;\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\n\tPyArray_ITER_RESET(it);\n\tif (n==1) {\n\t\tret = PyArray_New(self->ob_type, 1, &count, PyArray_INTP, \n\t\t\t\t NULL, NULL, 0, 0, (PyObject *)self);\n\t\tif (ret == NULL) goto fail;\n\t\tdptr[0] = (intp *)PyArray_DATA(ret);\n\t\t\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\t*(dptr[0])++ = i;\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t}\n\telse {\n\t\tret = PyTuple_New(n);\n\t\tfor (j=0; job_type, 1, &count, \n\t\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0,\n\t\t\t\t\t (PyObject *)self);\n\t\t\tPyTuple_SET_ITEM(ret, j, item);\n\t\t\tif (item == NULL) goto fail;\n\t\t\tdptr[j] = (intp *)PyArray_DATA(item);\n\t\t}\n\t\t\n\t\t/* reset contiguous so that coordinates gets updated */\n\t\tit->contiguous = 0;\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\tfor (j=0; jcoordinates[j];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\n\t}\n\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ret);\n\tPy_XDECREF(it);\n\treturn NULL;\n \n}\n\nstatic PyObject *\nPyArray_Clip(PyArrayObject *self, PyObject *min, PyObject *max)\n{\n\tPyObject *selector=NULL, *newtup=NULL, *ret=NULL;\n\tPyObject *res1=NULL, *res2=NULL, *res3=NULL;\n\tPyObject *two;\n\n\ttwo = PyInt_FromLong((long)2);\n\tres1 = PyArray_GenericBinaryFunction(self, max, n_ops.greater);\n\tres2 = PyArray_GenericBinaryFunction(self, min, n_ops.less);\n\tif ((res1 == NULL) || (res2 == NULL)) goto fail;\n\tres3 = PyNumber_Multiply(two, res1);\n\tPy_DECREF(two);\n\tPy_DECREF(res1);\n\tif (res3 == NULL) return NULL;\n\n\tselector = PyArray_EnsureArray(PyNumber_Add(res2, res3));\n\tPy_DECREF(res2);\n\tPy_DECREF(res3);\n\tif (selector == NULL) return NULL;\n\n\tnewtup = Py_BuildValue(\"(OOO)\", (PyObject *)self, min, max);\n\tif (newtup == NULL) goto fail;\n\tret = PyArray_Choose((PyAO *)selector, newtup);\n\tPy_DECREF(selector);\n\tPy_DECREF(newtup);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(res1);\n\tPy_XDECREF(res2);\n\tPy_XDECREF(two);\n\tPy_XDECREF(selector);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Conjugate(PyArrayObject *self)\n{\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyObject *new;\n\t\tintp size, i;\n\t\t/* Make a copy */\n\t\tnew = PyArray_Copy(self);\n\t\tif (new==NULL) return NULL;\n\t\tsize = PyArray_SIZE(new);\n\t\tif (self->descr->type_num == PyArray_CFLOAT) {\n\t\t\tcfloat *dptr = (cfloat *) PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CDOUBLE) {\n\t\t\tcdouble *dptr = (cdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CLONGDOUBLE) {\n\t\t\tclongdouble *dptr = (clongdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\t\t\t\n\t\t}\t\t\n\t\treturn new;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *) self;\n\t}\n}\n\nstatic PyObject *\nPyArray_Trace(PyArrayObject *self, int offset, int axis1, int axis2, \nint rtype)\n{\n\tPyObject *diag=NULL, *ret=NULL;\n\n\tdiag = PyArray_Diagonal(self, offset, axis1, axis2);\n\tif (diag == NULL) return NULL;\n\tret = PyArray_GenericReduceFunction((PyAO *)diag, n_ops.add, -1, rtype);\n\tPy_DECREF(diag);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Diagonal(PyArrayObject *self, int offset, int axis1, int axis2)\n{\n\tint n = self->nd;\n\tPyObject *new;\n\tPyObject *newaxes;\n\tint i, pos;\t\n\n\tif (n < 2) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"array.ndim must be >= 2\");\n\t\treturn NULL;\n\t}\n\tif (axis1 < 0) axis1 += n;\n\tif (axis2 < 0) axis2 += n;\n\tif ((axis1 == axis2) || (axis1 < 0) || (axis1 >= n) ||\t\\\n\t (axis2 < 0) || (axis2 >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \"axis1(=%d) and axis2(=%d) \"\\\n\t\t\t \"must be different and within range (nd=%d)\",\n\t\t\t axis1, axis2, n);\n\t\treturn NULL;\n\t}\n \n\tnewaxes = PyTuple_New(n);\n\tif (newaxes==NULL) return NULL;\n\t/* insert at the end */\n\tPyTuple_SET_ITEM(newaxes, n-2, PyInt_FromLong((long)axis1));\n\tPyTuple_SET_ITEM(newaxes, n-1, PyInt_FromLong((long)axis2));\n\tpos = 0;\n\tfor (i=0; idimensions[0];\n\t\tn2 = self->dimensions[1];\n\t\tstep = n2+1;\n\t\tif (offset < 0) {\n\t\t\tstart = -n2 * offset;\n\t\t\tstop = MIN(n2, n1+offset)*(n2+1) - n2*offset;\n\t\t}\n\t\telse {\n\t\t\tstart = offset;\n\t\t\tstop = MIN(n1, n2-offset)*(n2+1) + offset;\n\t\t}\n\t\t\n\t\t/* count = ceil((stop-start)/step) */\n\t\tcount = ((stop-start) / step) + (((stop-start) % step) != 0);\n\t\t\t\n\t\tindices = PyArray_New(&PyArray_Type, 1, &count, \n\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0, NULL);\n\t\tif (indices == NULL) {\n\t\t\tPy_DECREF(self); return NULL;\n\t\t}\n\t\tdptr = (intp *)PyArray_DATA(indices);\n\t\tfor (n1=start; n1descr->type_num;\n\t\ttypecode.itemsize = self->itemsize;\n\t\ttypecode.fortran = 0;\n\n\t\tmydiagonal = PyList_New(0);\n\t\tif (mydiagonal == NULL) {Py_DECREF(self); return NULL;}\n\t\tn1 = self->dimensions[0];\n\t\tfor (i=0; i 3)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"Only Carrays of 1-3 dimensions available.\");\n\t\treturn -1;\n\t}\n\tif ((ap = (PyArrayObject*)PyArray_FromAny(*op, &typecode, nd, nd,\n\t\t\t\t\t\t CARRAY_FLAGS)) == NULL)\n\t\treturn -1;\n\tswitch(nd) {\n\tcase 1:\n\t\t*((char **)ptr) = ap->data;\n\t\tbreak;\n\tcase 2:\n\t\tn = ap->dimensions[0];\n\t\tptr2 = (char **)malloc(n * sizeof(char *));\n\t\tif (!ptr2) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0];\n\t\t}\n\t\t*((char ***)ptr) = ptr2;\n\t\tbreak;\t\t\n\tcase 3:\n\t\tn = ap->dimensions[0];\n\t\tm = ap->dimensions[1];\n\t\tptr3 = (char ***)malloc(n*(m+1) * sizeof(char *));\n\t\tif (!ptr3) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0] + \\\n\t\t\t\t\tj*ap->strides[1];\n\t\t\t}\n\t\t}\n\t\t*((char ****)ptr) = ptr3;\n\t}\n\tmemcpy(dims, ap->dimensions, nd*sizeof(intp));\n\t*op = (PyObject *)ap;\n\treturn 0;\n\n fail:\n\tPyErr_SetString(PyExc_MemoryError, \"No memory.\");\n\treturn -1;\n}\n\n/* Deprecated --- Use PyArray_AsCArray instead */\n\nstatic int \nPyArray_As1D(PyObject **op, char **ptr, int *d1, int typecode) \n{\n\tintp newd1;\n\t\n\tif (PyArray_AsCArray(op, (void *)ptr, &newd1, 1, typecode) == -1)\n\t\treturn -1;\t\n\t*d1 = (int) newd1;\n\treturn 0;\n}\n\n\nstatic int \nPyArray_As2D(PyObject **op, char ***ptr, int *d1, int *d2, int typecode) \n{\n\tintp newdims[2];\n\n\tif (PyArray_AsCArray(op, (void *)ptr, newdims, 2, typecode) == -1)\n\t\treturn -1;\n\n\t*d1 = (int ) newdims[0];\n\t*d2 = (int ) newdims[1];\n return 0;\n}\n\n/* End Deprecated */\n\nstatic int \nPyArray_Free(PyObject *op, void *ptr) \n{\n PyArrayObject *ap = (PyArrayObject *)op;\n\t\n if ((ap->nd < 1) || (ap->nd > 3)) \n\t\treturn -1;\n if (ap->nd >= 2) {\n\t\tfree(ptr);\n }\n Py_DECREF(ap);\n return 0;\n}\n\n\nstatic PyObject *\n_swap_and_concat(PyObject *op, int axis, int n)\n{\n\tPyObject *newtup=NULL;\n\tPyObject *otmp, *arr;\n\tint i;\n\n\tnewtup = PyTuple_New(n);\n\tif (newtup==NULL) return NULL;\n\tfor (i=0; i= MAX_DIMS) {\n\t\t\totmp = PyArray_Ravel(mps[i],0);\n\t\t\tPy_DECREF(mps[i]);\n\t\t\tmps[i] = (PyArrayObject *)otmp;\n\t\t}\n\t\tprior2 = PyArray_GetPriority((PyObject *)(mps[i]), 0.0);\n\t\tif (prior2 > prior1) {\n\t\t\tprior1 = prior2;\n\t\t\tsubtype = mps[i]->ob_type;\n\t\t\tret = mps[i];\n\t\t}\n\t}\n\t\n\tnew_dim = 0;\n\tfor(i=0; ind;\n\t\telse {\n\t\t\tif (nd != mps[i]->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"arrays must have same \"\\\n\t\t\t\t\t\t\"number of dimensions\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tif (!PyArray_CompareLists(mps[0]->dimensions+1, \n\t\t\t\t\t\t mps[i]->dimensions+1, \n\t\t\t\t\t\t nd-1)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"array dimensions must \"\\\n\t\t\t\t\t\t\"agree except for d_0\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t}\n\t\tif (nd == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"0d arrays can't be concatenated\");\n\t\t\tgoto fail;\n\t\t}\n\t\tnew_dim += mps[i]->dimensions[0];\n\t}\n\t\n\ttmp = mps[0]->dimensions[0];\n\tmps[0]->dimensions[0] = new_dim;\n\tret = (PyArrayObject *)PyArray_New(subtype, nd,\n\t\t\t\t\t mps[0]->dimensions, \n\t\t\t\t\t type_num, NULL, NULL, 0, 0,\n (PyObject *)ret);\n\tmps[0]->dimensions[0] = tmp;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tdata = ret->data;\n\tfor(i=0; idata, numbytes);\n\t\tdata += numbytes;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; ind;\n\tif (n <= 1) {\n\t\tPy_INCREF(ap);\n\t\treturn (PyObject *)ap;\n\t}\n\n\tif (a1 < 0) a1 += n;\n\tif (a2 < 0) a2 += n;\n\tif ((a1 < 0) || (a1 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis1 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tif ((a2 < 0) || (a2 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis2 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tnew_axes = PyTuple_New(n);\n\tfor (i=0; ind;\n\t\tpermutation = (intp *)malloc(n*sizeof(int));\n\t\tfor(i=0; ind+axis;\n\t\t\tif (axis < 0 || axis >= ap->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"invalid axis for this array\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tpermutation[i] = axis;\n\t\t}\n\t}\n\t\n\t/* this allocates memory for dimensions and strides (but fills them\n\t incorrectly), sets up descr, and points data at ap->data. */\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, n, permutation, \n\t\t\t\t\t ap->descr->type_num, NULL,\n\t\t\t\t\t ap->data, ap->itemsize, ap->flags,\n\t\t\t\t\t (PyObject *)ap);\n\tif (ret == NULL) goto fail;\n\t\n\t/* point at true owner of memory: */\n\tret->base = (PyObject *)ap;\n\tPy_INCREF(ap);\n\t\n\tfor(i=0; idimensions[i] = ap->dimensions[permutation[i]];\n\t\tret->strides[i] = ap->strides[permutation[i]];\n\t}\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n\tif (op && (op != Py_None))\n\t\tPyArray_Free(op, (char *)axes);\n\tfree(permutation);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ret);\n\tif (permutation != NULL) free(permutation);\n\tif (op != Py_None)\n\t\tPyArray_Free(op, (char *)axes);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Repeat(PyArrayObject *aop, PyObject *op, int axis) {\n\tintp *counts;\n\tintp n, n_outer, i, j, k, chunk, total;\n\tintp tmp;\n\tint nd;\n\tPyArrayObject *repeats=NULL;\n\tPyObject *ap=NULL;\n\tPyArrayObject *ret=NULL;\n\tchar *new_data, *old_data;\n\n\trepeats = (PyAO *)PyArray_ContiguousFromObject(op, PyArray_INTP, 0, 1);\n\tif (repeats == NULL) return NULL;\n\tnd = repeats->nd;\n\tcounts = (intp *)repeats->data;\n\n\tif ((ap=_check_axis(aop, &axis, CARRAY_FLAGS))==NULL) {\n\t\tPy_DECREF(repeats);\n\t\treturn NULL;\n\t}\n\n\taop = (PyAO *)ap;\n\n\tif (nd == 1)\n\t\tn = repeats->dimensions[0];\n\telse /* nd == 0 */\n\t\tn = aop->dimensions[axis];\n\n\tif (aop->dimensions[axis] != n) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"a.shape[axis] != len(repeats)\");\n\t\tgoto fail;\n\t}\n\n\t\n\tif (nd == 0) \n\t\ttotal = counts[0]*n;\n\telse {\n\t\t\n\t\ttotal = 0;\n\t\tfor(j=0; jdimensions[axis] = total;\n\tret = (PyArrayObject *)PyArray_New(aop->ob_type, aop->nd,\n\t\t\t\t\t aop->dimensions, \n\t\t\t\t\t aop->descr->type_num,\n\t\t\t\t\t NULL, NULL, aop->itemsize, 0,\n\t\t\t\t\t (PyObject *)aop);\n\taop->dimensions[axis] = n;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tnew_data = ret->data;\n\told_data = aop->data;\n\t\n\tchunk = aop->itemsize;\n\tfor(i=axis+1; ind; i++) {\n\t\tchunk *= aop->dimensions[i];\n\t}\n\t\n\tn_outer = 1;\n\tfor(i=0; idimensions[i];\n\n\tfor(i=0; ind < mps[i]->nd) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"too many dimensions\");\n\t\t\tgoto fail;\n\t\t}\n\t\tif (!PyArray_CompareLists(ap->dimensions+(ap->nd-mps[i]->nd),\n\t\t\t\t mps[i]->dimensions, mps[i]->nd)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"array dimensions must agree\");\n\t\t\tgoto fail;\n\t\t}\n\t\tsizes[i] = PyArray_NBYTES(mps[i]);\n\t}\n\t\n\t/* why not ??? \n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tPyErr_SetString(PyExc_NotImplementedError, \n\t\t\t\t\"Not implemented for flexible sizes\");\n\t\treturn NULL;\n\t}\n\t*/\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap);\n\tif (ret == NULL) goto fail;\n\t\n\telsize = ret->itemsize;\n\tm = PyArray_SIZE(ret);\n\tself_data = (intp *)ap->data;\n\tret_data = ret->data;\n\t\n\tfor (i=0; i= n) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"invalid entry in choice array\");\n\t\t\tgoto fail;\n\t\t}\n\t\toffset = i*elsize;\n\t\tif (offset >= sizes[mi]) {offset = offset % sizes[mi]; }\n\t\tmemmove(ret_data, mps[mi]->data+offset, elsize);\n\t\tret_data += elsize; self_data++;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; idescr->compare(a,b,global_obj);\n}\n\n#define SWAPAXES(op, ap) {\t\t\t\t\t\t\\\n\t\torign = (ap)->nd-1;\t\t\t\t\t\\\n\t\tif (axis != orign) {\t\t\t\t\t\\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\n#define SWAPBACK(op, ap) { \\\n\t\tif (axis != orign) { \\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\nstatic PyObject *\nPyArray_Sort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap=NULL, *store_arr=NULL;\n\tchar *ip;\n\tint i, n, m, elsize, orign;\n\n\tif ((ap = (PyAO*) _check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_CopyFromObject((PyObject *)op, \n\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tPy_DECREF(ap);\n\t\treturn NULL;\n\t}\n\t\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\n\t/* Store global -- allows re-entry -- restore before leaving*/\n\tstore_arr = global_obj; \n\tglobal_obj = ap;\n\t\n\tfor (ip=ap->data, i=0; iitemsize;\n\tconst intp *ipa = ip1;\n\tconst intp *ipb = ip2;\t\n\treturn global_obj->descr->compare(global_data + (isize * *ipa),\n global_data + (isize * *ipb), \n\t\t\t\t\t global_obj);\n}\n\nstatic PyObject *\nPyArray_ArgSort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap, *ret, *store;\n\tintp *ip;\n\tintp i, j, n, m, orign;\n\tint argsort_elsize;\n\tchar *store_ptr;\n\n\tif ((ap = (PyAO *)_check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op, \n\t\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap);\n\tif (ret == NULL) goto fail;\n\t\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tip = (intp *)ret->data;\n\targsort_elsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\tstore_ptr = global_data;\n\tglobal_data = ap->data;\n\tstore = global_obj;\n\tglobal_obj = ap;\n\tfor (i=0; idescr->compare;\n\tintp min_i, max_i, i, j;\n\tint location, elsize = ap1->itemsize;\n\tintp elements = ap1->dimensions[ap1->nd-1];\n\tintp n = PyArray_Size((PyObject *)ap2);\n\tintp *rp = (intp *)ret->data;\n\tchar *ip = ap2->data;\n\tchar *vp = ap1->data;\n\n\tfor (j=0; j 0) {\n\t\t\t\t\tif (compare(ip, vp+elsize*(--i), ap2) \\\n\t\t\t\t\t != 0) {\n\t\t\t\t\t\ti = i+1; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmin_i = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (location < 0) {\n\t\t\t\tmax_i = i;\n\t\t\t} else {\n\t\t\t\tmin_i = i+1;\n\t\t\t}\n\t\t}\n\t\t*rp = min_i;\n\t}\n}\n\nstatic PyObject *\nPyArray_SearchSorted(PyArrayObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tint typenum = 0;\n\n\t/* \n PyObject *args;\n args = Py_BuildValue(\"O\",op2);\n\tPy_DELEGATE_ARGS(((PyObject *)op1), searchsorted, args);\n Py_XDECREF(args);\n\t*/\n\n\ttypenum = PyArray_ObjectType((PyObject *)op1, 0);\n\ttypenum = PyArray_ObjectType(op2, typenum);\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op1, \n\t\t\t\t\t\t\t typenum, \n\t\t\t\t\t\t\t 1, 1);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap2->ob_type, ap2->nd, \n\t\t\t\t\t ap2->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap2);\n\tif (ret == NULL) goto fail;\n\n\tif (ap2->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tlocal_where(ap1, ap2, ret); \n\t\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ret);\n\treturn NULL;\n}\n\n\n\n/* Could perhaps be redone to not make contiguous arrays \n */\n\nstatic PyObject *\nPyArray_InnerProduct(PyObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tintp i, j, l, i1, i2, n1, n2;\n\tint typenum;\n\tintp is1, is2, os;\n\tchar *ip1, *ip2, *op;\n\tintp dimensions[MAX_DIMS], nd;\n\tPyArray_DotFunc *dot;\n\tPyTypeObject *subtype;\n double prior1, prior2;\n\t\n\ttypenum = PyArray_ObjectType(op1, 0); \n\ttypenum = PyArray_ObjectType(op2, typenum);\n\t\t\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject(op1, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tif (ap1->nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\t\n\tif (ap2->dimensions[ap2->nd-1] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"matrices are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\n\n\t/* Need to choose an output array that can hold a sum \n\t -- use priority to determine which subtype.\n\t */\n prior2 = PyArray_GetPriority((PyObject *)ap2, 0.0);\n prior1 = PyArray_GetPriority((PyObject *)ap1, 0.0);\n subtype = (prior2 > prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n (PyObject *)\n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = (ret->descr->dotfunc);\n\t\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\n\t\n\tis1 = ap1->strides[ap1->nd-1]; \n\tis2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\tif (ap2->nd > 1) {\n\t\tmatchDim = ap2->nd - 2;\n\t\totherDim = ap2->nd - 1;\n\t}\n\telse {\n\t\tmatchDim = 0;\n\t\totherDim = 0;\n\t}\n\n\tif (ap2->dimensions[matchDim] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"objects are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-2; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\tif(ap2->nd > 1) {\n\t\tdimensions[j++] = ap2->dimensions[ap2->nd-1];\n\t}\n\t/*\n\tfprintf(stderr, \"nd=%d dimensions=\", nd);\n\t for(i=0; i prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n (PyObject *)\n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\t\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[matchDim];\n\tif(ap1->nd > 1)\n\t\tis1r = ap1->strides[ap1->nd-2];\n\telse\n\t\tis1r = ap1->strides[ap1->nd-1];\n\tis2r = ap2->strides[otherDim];\n\n\top = ret->data; os = ret->itemsize;\n\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2ob_type, 2, dims, PyArray_TYPE(arr),\n\t\t\t NULL, NULL, elsize, 0, arr);\n\n\tif (ret == NULL) {\n\t\tPy_DECREF(arr);\n\t\treturn NULL;\n\t}\n\t/* do 2-d loop */\n\toptr = PyArray_DATA(ret);\n\tstr2 = elsize*dims[0];\n\tfor (i=0; idimensions[ap1->nd-1];\n\tn2 = ap2->dimensions[ap2->nd-1];\n\n\tif (n1 < n2) { \n\t\tret = ap1; ap1 = ap2; ap2 = ret; \n\t\tret = NULL; i = n1;n1=n2;n2=i;\n\t}\n\tlength = n1;\n\tn = n2;\n\tswitch(mode) {\n\tcase 0:\t\n\t\tlength = length-n+1;\n\t\tn_left = n_right = 0;\n\t\tbreak;\n\tcase 1:\n\t\tn_left = (int)(n/2);\n\t\tn_right = n-n_left-1;\n\t\tbreak;\n\tcase 2:\n\t\tn_right = n-1;\n\t\tn_left = n-1;\n\t\tlength = length+n-1;\n\t\tbreak;\n\tdefault:\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"mode must be 0,1, or 2\");\n\t\tgoto fail;\n\t}\n\t\n\tret = (PyArrayObject *)PyArray_New(ap1->ob_type, 1,\n\t\t\t\t\t &length, typenum, \n\t\t\t\t\t NULL, NULL, 0, 0, \n (PyObject *)ap1);\n\tif (ret == NULL) goto fail;\n\n\t\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"function not available for this type\");\n\t\tgoto fail;\n\t}\n\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data; ip2 = ap2->data+n_left*is2;\n\tn = n-n_left;\n\tfor(i=0; idescr->argmax;\n\tif (arg_func == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"data type not ordered\");\n\t\tgoto fail;\n\t}\n\n\trp = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd-1,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, \n (PyObject *)ap);\n\tif (rp == NULL) goto fail;\n\n\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) {\n\t\tPyErr_SetString(MultiArrayError, \n\t\t\t\t\"Attempt to get argmax/argmin \"\\\n\t\t\t\t\"of an empty sequence??\");\n\t\tgoto fail;\n\t}\n\tn = PyArray_SIZE(ap)/m;\n\trptr = (intp *)rp->data;\n\tfor (ip = ap->data, i=0; ind + indices->nd - 1;\n for (i=0; i< nd; i++) {\n if (i < axis) {\n shape[i] = self->dimensions[i];\n n *= shape[i];\n } else {\n if (i < axis+indices->nd) {\n shape[i] = indices->dimensions[i-axis];\n m *= shape[i];\n } else {\n shape[i] = self->dimensions[i-indices->nd+1];\n chunk *= shape[i];\n }\n }\n }\n ret = (PyArrayObject *)PyArray_New(self->ob_type, nd, shape, \n\t\t\t\t\t self->descr->type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, \n (PyObject *)self);\n\t\n if (ret == NULL) goto fail;\n\t\n max_item = self->dimensions[axis];\n chunk = chunk * ret->itemsize;\n src = self->data;\n dest = ret->data;\n\t\n for(i=0; idata))[j];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"Index out of range for \"\\\n\t\t\t\t\t\t\"array\");\n goto fail;\n }\n memmove(dest, src+tmp*chunk, chunk);\n dest += chunk;\n }\n src += chunk*max_item;\n }\n\t\n PyArray_INCREF(ret);\n\n Py_XDECREF(indices);\n Py_XDECREF(self);\n\n return (PyObject *)ret;\n\t\n\t\n fail:\n Py_XDECREF(ret);\n Py_XDECREF(indices);\n Py_XDECREF(self);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Put(PyArrayObject *self, PyObject *indices0, PyObject* values0) \n{\n PyArrayObject *indices, *values;\n int i, chunk, ni, max_item, nv, tmp; \n char *src, *dest;\n\n indices = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be contiguous\");\n return NULL;\n }\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n indices = (PyArrayObject *)PyArray_ContiguousFromObject(indices0, PyArray_INTP, 0, 0);\n if (indices == NULL) goto fail;\n ni = PyArray_SIZE(indices);\n\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, self->descr->type_num, \n\t\t\t\t\t 0, 0);\n if (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\n if (nv > 0) { /* nv == 0 for a null array */\n for(i=0; idata + chunk * (i % nv);\n tmp = ((intp *)(indices->data))[i];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \"Index out of range for array\");\n goto fail;\n }\n memmove(dest + tmp * chunk, src, chunk);\n }\n }\n\n Py_XDECREF(values);\n Py_XDECREF(indices);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(indices);\n Py_XDECREF(values);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_PutMask(PyArrayObject *self, PyObject *mask0, PyObject* values0) \n{\n PyArrayObject *mask, *values;\n int i, chunk, ni, max_item, nv, tmp, thistype;\n char *src, *dest;\n\n mask = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must \"\\\n\t\t\t\t\"be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must be contiguous\");\n return NULL;\n }\n\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n mask = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(mask0, PyArray_BOOL, 0, 0);\n if (mask == NULL) goto fail;\n ni = PyArray_SIZE(mask);\n if (ni != max_item) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: mask and data must be \"\\\n\t\t\t\t\"the same size.\");\n goto fail;\n }\n\n\tthistype = self->descr->type_num;\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, thistype, 0, 0);\n\tif (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\t /* zero if null array */\n if (nv > 0) {\n\t\tfor(i=0; idata + chunk * (i % nv);\n\t\t\ttmp = ((Bool *)(mask->data))[i];\n\t\t\tif (tmp) {\n\t\t\t\tmemmove(dest + i * chunk, src, chunk);\n\t\t\t\tif (thistype == PyArray_OBJECT)\n\t\t\t\t\tPy_INCREF(*((PyObject **)src));\n\t\t\t}\n\t\t}\n }\n\n Py_XDECREF(values);\n Py_XDECREF(mask);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(mask);\n Py_XDECREF(values);\n return NULL;\n}\n\n\n/* This conversion function can be used with the \"O&\" argument for\n PyArg_ParseTuple. It will immediately return an object of array type\n or will convert to a CARRAY any other object. \n\n If you use PyArray_Converter, you must DECREF the array when finished\n as you get a new reference to it.\n*/\n \nstatic int \nPyArray_Converter(PyObject *object, PyObject **address) \n{\n if (PyArray_Check(object)) {\n *address = object;\n\t\tPy_INCREF(object);\n return PY_SUCCEED;\n }\n else {\n\t\t*address = PyArray_FromAny(object, NULL, 0, 0, CARRAY_FLAGS);\n\t\tif (*address == NULL) return PY_FAIL;\n\t\treturn PY_SUCCEED;\n }\n}\n\nstatic int\nPyArray_BoolConverter(PyObject *object, Bool *val)\n{\n\tif (PyObject_IsTrue(object)) *val=TRUE;\n\telse *val=FALSE;\n\tif (PyErr_Occurred()) return PY_FAIL;\n\treturn PY_SUCCEED;\n}\n\n\nstatic int\nPyArray_TypestrConvert(int itemsize, int gentype)\n{\n\tregister int newtype = gentype;\n\t\n\tif (gentype == PyArray_SIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_INT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_INT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_INT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_INT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_INT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\n\t}\n\n\telse if (gentype == PyArray_UNSIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_UINT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_UINT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_UINT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_UINT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_UINT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t\tbreak;\n\t\t}\n\t}\n\telse if (gentype == PyArray_FLOATINGLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 4:\n\t\t\tnewtype = PyArray_FLOAT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_FLOAT64;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 10:\n\t\t\tnewtype = PyArray_FLOAT80;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 12:\n\t\t\tnewtype = PyArray_FLOAT96;\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_FLOAT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\t\n\telse if (gentype == PyArray_COMPLEXLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 8:\n\t\t\tnewtype = PyArray_COMPLEX64;\n\t\t\tbreak;\n\t\tcase 16:\n\t\t\tnewtype = PyArray_COMPLEX128;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 20:\n\t\t\tnewtype = PyArray_COMPLEX160;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 24:\n\t\t\tnewtype = PyArray_COMPLEX192;\t\t\t\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 32:\n\t\t\tnewtype = PyArray_COMPLEX256;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\n\treturn newtype;\n}\n\n\n/* this function takes a Python object which exposes the (single-segment)\n buffer interface and returns a pointer to the data segment\n \n You should increment the reference count by one of buf->base\n if you will hang on to a reference\n\n You only get a borrowed reference to the object. Do not free the\n memory...\n*/\n\n\nstatic int\nPyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf)\n{\n int buflen;\n\n buf->ptr = NULL;\n buf->flags = WRITEABLE;\n buf->base = NULL;\n\n\tif (obj == Py_None)\n\t\treturn PY_SUCCEED;\n\n if (PyObject_AsWriteBuffer(obj, &(buf->ptr), &buflen) < 0) {\n PyErr_Clear();\n buf->flags &= ~WRITEABLE;\n if (PyObject_AsReadBuffer(obj, (const void **)&(buf->ptr), \n &buflen) < 0)\n return PY_FAIL;\n }\n buf->len = (intp) buflen;\n \n /* Point to the base of the buffer object if present */\n if (PyBuffer_Check(obj)) buf->base = ((PyArray_Chunk *)obj)->base;\n if (buf->base == NULL) buf->base = obj;\n \n return PY_SUCCEED; \n}\n\n\n\n/* This function takes a Python sequence object and allocates and\n fills in an intp array with the converted values.\n\n **Remember to free the pointer seq.ptr when done using\n PyDimMem_FREE(seq.ptr)**\n*/\n\nstatic int\nPyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq)\n{\n int len;\n int nd;\n\n seq->ptr = NULL;\n if (obj == Py_None) return PY_SUCCEED;\n len = PySequence_Size(obj);\n if (len == -1) { /* Check to see if it is a number */\n if (PyNumber_Check(obj)) len = 1;\n }\n if (len < 0) {\n PyErr_SetString(PyExc_TypeError, \n \"Expected sequence object with len >= 0\");\n return PY_FAIL;\n }\n if (len > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError, \"Sequence too large, \" \\\n \"must be smaller than %d\", MAX_DIMS);\n return PY_FAIL;\n }\n\tif (len > 0) {\n\t\tseq->ptr = PyDimMem_NEW(len);\n\t\tif (seq->ptr == NULL) {\n\t\t\tPyErr_NoMemory();\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n seq->len = len;\n nd = PyArray_IntpFromSequence(obj, (intp *)seq->ptr, len);\n if (nd == -1 || nd != len) goto fail;\n return PY_SUCCEED;\n\n fail:\n\tPyDimMem_FREE(seq->ptr);\n\treturn PY_FAIL;\n}\n\n/* This function takes a Python object representing a type and converts it \n to a C type_num and an itemsize (elements of PyArray_Typecode structure)\n \n Many objects can be used to represent a type.\n */\n\nstatic int\nPyArray_TypecodeConverter(PyObject *obj, PyArray_Typecode *at)\n{\n char *type;\n PyArray_Descr *descr;\n int check_num=PyArray_NOTYPE+10;\n\tint len;\n\tPyObject *item, *attr=NULL;\n\n\tat->itemsize = 0;\n if (obj == Py_None) {\n at->type_num = PyArray_NOTYPE;\n return PY_SUCCEED;\n }\n\n if (PyType_Check(obj) && PyType_IsSubtype((PyTypeObject *)obj, \n &PyGenericArrType_Type)) {\n PyArray_TypecodeFromTypeObject(obj, at);\n return PY_SUCCEED;\n }\n\n\n\t/* type object could be an array */\n\tif (PyArray_Check(obj)) {\n\t\tat->type_num = PyArray_TYPE(obj);\n\t\tat->itemsize = PyArray_ITEMSIZE(obj);\n\t\treturn PY_SUCCEED;\n\t}\n\n\t/* or an array scalar */\n if (PyArray_IsScalar(obj, Generic)) {\n PyArray_TypecodeFromScalar(obj, at);\n return PY_SUCCEED;\n }\n\n\t/* or a typecode string */\n\n\tif (PyString_Check(obj)) {\n\t\t/* Check for a string typecode. */\n\t\ttype = PyString_AS_STRING(obj);\n\t\tlen = PyString_GET_SIZE(obj);\t\t\n\t\tif (len > 0) {\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tif (len > 1) {\n\t\t\tat->itemsize = atoi(type+1);\n\t\t\t/* When specifying length of UNICODE\n\t\t\t the number of characters is given to match \n\t\t\t the STRING interface. Each character can be\n\t\t\t more than one byte and itemsize must be\n\t\t\t the number of bytes.\n\t\t\t*/\n\t\t\tif (check_num == PyArray_UNICODELTR ||\t\\\n\t\t\t check_num == PyArray_UNICODE) \n\t\t\t at->itemsize *= sizeof(Py_UNICODE);\n\n\t\t\t/* Support for generic processing */\n\t\t\telse if ((check_num != PyArray_STRINGLTR) &&\n\t\t\t\t (check_num != PyArray_VOIDLTR) &&\n\t\t\t\t (check_num != PyArray_STRING) &&\n\t\t\t\t (check_num != PyArray_VOID)) {\n\t\t\t\tcheck_num = \\\n\t\t\t\t\tPyArray_TypestrConvert(at->itemsize,\n\t\t\t\t\t\t\t check_num);\n\t\t\t at->itemsize = 0;\n\t\t\t\tif (check_num == PyArray_NOTYPE) goto fail;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Arbitray object with dtypenum and itemsize attributes. */\n\telse if (PyObject_HasAttrString(obj, \"dtypenum\") && \n\t PyObject_HasAttrString(obj, \"itemsize\")) {\n\t\tattr = PyObject_GetAttrString(obj, \"dtypenum\");\n\t\tcheck_num = PyInt_AsLong(attr);\n\t\tif (PyErr_Occurred()) { /* not an integer, try character */\n\t\t\tPyErr_Clear();\n\t\t\ttype = PyString_AsString(attr);\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tPy_XDECREF(attr);\n\t\tif (!PyErr_Occurred()) {\n\t\t\tattr = PyObject_GetAttrString(obj, \"itemsize\");\n\t\t\tat->itemsize = PyInt_AsLong(attr);\n\t\t\tPy_XDECREF(attr);\n\t\t}\t\t\t\n\t}\t\t\n\telse if (PyType_Check(obj)) {\n\t\tcheck_num = PyArray_OBJECT;\n\t\tif (obj == (PyObject *)(&PyInt_Type)) \n\t\t\tcheck_num = PyArray_LONG;\n\t\telse if (obj == (PyObject *)(&PyBool_Type))\n\t\t\tcheck_num = PyArray_BOOL;\n\t\telse if (obj == (PyObject *)(&PyFloat_Type)) \n\t\t\tcheck_num = PyArray_DOUBLE;\n\t\telse if (obj == (PyObject *)(&PyComplex_Type)) \n\t\t\tcheck_num = PyArray_CDOUBLE;\n else if (obj == (PyObject *)(&PyString_Type))\n check_num = PyArray_STRING;\n else if (obj == (PyObject *)(&PyUnicode_Type))\n check_num = PyArray_UNICODE;\n\t}\t\n else { /* Default -- try integer conversion */\n check_num = PyInt_AsLong(obj);\n\t}\n\n\tif (PyErr_Occurred()) goto fail;\n\n\t/*\n\tif (check_num == PyArray_NOTYPE) return PY_FAIL;\n\t*/\n\tif (check_num == PyArray_NOTYPE) {\n\t\tat->type_num = PyArray_NOTYPE;\n\t\tat->itemsize = 0;\n\t\treturn PY_SUCCEED;\n\t}\n\n if ((descr = PyArray_DescrFromType(check_num))==NULL) {\n\t\t/* Now check to see if the object is registered\n\t\t in typeDict */\n\t\tif (typeDict != NULL) {\n\t\t\titem = PyDict_GetItem(typeDict, obj);\n\t\t\tif (item) {\n\t\t\t\tPyArray_TypecodeFromTypeObject(obj, at);\n\t\t\t\tPyErr_Clear();\n\t\t\t\treturn PY_SUCCEED;\n\t\t\t}\n\t\t}\n return PY_FAIL;\n\t}\n\t\n at->type_num = descr->type_num;\n\tif (at->itemsize == 0) at->itemsize = descr->elsize;\n\t\n return PY_SUCCEED;\n fail:\n\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\"data type not understood\");\n\treturn PY_FAIL;\n}\t\n\n\n/* This function returns true if the two typecodes are \n equivalent (same basic kind and same itemsize).\n*/\n\nstatic Bool\nPyArray_EquivalentTypes(PyArray_Typecode *typ1, PyArray_Typecode *typ2)\n{\n\tregister int typenum1=typ1->type_num;\n\tregister int typenum2=typ2->type_num;\n\tregister int size1=typ1->itemsize;\n\tregister int size2=typ2->itemsize;\n\n\tif (size1 != size2) return FALSE;\n\tif (typenum1==typenum2) return TRUE;\n\n\t/* If we are here then size1 == size2 */\n\tif (typenum1 < PyArray_FLOAT) {\n\t\tif (PyTypeNum_ISBOOL(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISBOOL(typenum2));\n\t\telse if (PyTypeNum_ISUNSIGNED(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISUNSIGNED(typenum2));\n\t\telse \n\t\t\treturn (Bool)(PyTypeNum_ISSIGNED(typenum2));\n\t}\n\telse {\n\t\tif (PyTypeNum_ISFLOAT(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISFLOAT(typenum2));\n\t\telse if (PyTypeNum_ISCOMPLEX(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISCOMPLEX(typenum2));\n\t}\n\t/* Default size1 != size2 and typenum1 != typenum2 */\n\treturn FALSE;\t\n}\n\nstatic Bool \nPyArray_EquivArrTypes(PyArrayObject *a1, PyArrayObject *a2)\n{\n PyArray_Typecode type1={0,0,0};\n PyArray_Typecode type2={0,0,0};\n\n\ttype1.type_num = PyArray_TYPE(a1);\n\ttype2.type_num = PyArray_TYPE(a2);\n\ttype1.itemsize = PyArray_ITEMSIZE(a1);\n\ttype2.itemsize = PyArray_ITEMSIZE(a2);\n\t\t\t\n return PyArray_EquivalentTypes(&type1, &type2);\n}\n\n\n/*** END C-API FUNCTIONS **/\n\n\n#define _ARET(x) PyArray_Return((PyArrayObject *)(x))\n\nstatic char doc_fromobject[] = \"array(object, dtype=None, copy=1, fortran=0) will return a new array formed from the given object type given. Object can anything with an __array__ method, or any (nested) sequence. If no type is given, then the type will be determined as the minimum type required to hold the objects in the sequence. If copy is zero and sequence is already an array with the right type, a reference will be returned. If the sequence is an array, type can be used only to upcast the array. For downcasting use .astype(t) method.\";\n\nstatic PyObject *\n_array_fromobject(PyObject *ignored, PyObject *args, PyObject *kws)\n{\n\tPyObject *op, *ret=NULL;\n\tstatic char *kwd[]= {\"object\", \"dtype\", \"copy\", \"fortran\", NULL};\n\tBool copy=TRUE;\n\tPyArray_Typecode type = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode oldtype = {PyArray_NOTYPE, 0, 0};\n\tint type_num;\n\tBool fortran=FALSE;\n\tint flags=0;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|O&O&O&\", kwd, &op, \n\t\t\t\t\tPyArray_TypecodeConverter,\n &type, \n\t\t\t\t\tPyArray_BoolConverter, ©, \n\t\t\t\t\tPyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\ttype_num = type.type_num;\n\n\t/* fast exit if simple call */\n\tif (PyArray_Check(op) && (copy==0) &&\t\t\t\\\n\t (fortran == PyArray_CHKFLAGS(op, FORTRAN))) {\n\t\tif (type_num == PyArray_NOTYPE) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t\t/* One more chance */\n\t\toldtype.type_num = PyArray_TYPE(op);\n\t\toldtype.itemsize = PyArray_ITEMSIZE(op);\n\t\tif (PyArray_EquivalentTypes(&oldtype, &type)) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t}\n\n\ttype.fortran = fortran; \n\tif (copy) {\n\t\tflags = ENSURECOPY;\n\t}\n\n\tif ((ret = PyArray_FromAny(op, &type, 0, 0, flags)) == NULL) \n\t\treturn NULL;\n\n\treturn _ARET(ret);\n}\n\nstatic PyObject *\nPyArray_Empty(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n \n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n PyArray_FillObjectArray(ret, Py_None);\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic char doc_empty[] = \"empty((d1,...,dn),dtype=intp,fortran=0) will return a new array\\n of shape (d1,...,dn) and given type with all its entries uninitialized. This can be faster than zeros.\";\n\nstatic PyObject *\narray_empty(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Empty(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_scalar[] = \"scalar(dtypestr,obj) will return a new scalar array of the given type initialized with obj. Mainly for pickle support. typestr must be a valid data typestr (complete with < > or |). If dtypestr is object, then obj can be any object, otherwise obj must be a string. If obj is not given it will be interpreted as None for object type and zeros for all other types.\";\n\nstatic PyObject *\narray_scalar(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"dtypestr\",\"obj\", NULL};\n\tPyArray_Typecode typecode;\n\tPyObject *obj=NULL;\n\tchar *typestr;\n\tint typestrlen;\n\tint swap, alloc=0;\n\tvoid *dptr;\n\tPyObject *ret;\n\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"z#|O\",\n\t\t\t\t\t kwlist, &typestr, &typestrlen,\n\t\t\t\t\t &obj)) \n\t\treturn NULL;\n\t\n\tif (_array_typecode_fromstr(typestr, &swap, &typecode) < 0) \n\t\treturn NULL;\n\t\n\tif (typecode.itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\t\t\\\n\t\t\t\t\"itemsize cannot be zero\");\n\t\treturn NULL;\n\t}\n\n\tif (typecode.type_num == PyArray_OBJECT) {\n\t\tif (obj == NULL) obj = Py_None;\n\t\tdptr = &obj;\n\t\tswap = 0;\n\t}\n\telse {\n\t\tif (obj == NULL) {\n\t\t\tdptr = malloc(typecode.itemsize);\n\t\t\tif (dptr == NULL) {\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tmemset(dptr, '\\0', typecode.itemsize);\n\t\t\talloc = 1;\n\t\t}\n\t\telse {\n\t\t\tif (!PyString_Check(obj)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"initializing object must \"\\\n\t\t\t\t\t\t\"be a string.\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (PyString_GET_SIZE(obj) < typecode.itemsize) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"initialization string is too\"\\\n\t\t\t\t\t\t\" small\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = PyString_AS_STRING(obj);\n\t\t}\n\t}\n\n\tret = PyArray_Scalar(dptr, typecode.type_num,\n\t\t\t typecode.itemsize, swap); \n\n\t/* free dptr which contains zeros */\n\tif (alloc) free(dptr);\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_Zeros(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n\t\tPyObject *zero = PyInt_FromLong(0);\n PyArray_FillObjectArray(ret, zero);\n Py_DECREF(zero);\n\t}\n\telse {\t\t\n\t\tmemset(ret->data, 0, n*(ret->itemsize));\n\t}\n\treturn (PyObject *)ret;\n\n}\n\nstatic char doc_zeros[] = \"zeros((d1,...,dn),dtype=intp,fortran=0) will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero.\";\n\n\nstatic PyObject *\narray_zeros(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Zeros(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_set_typeDict[] = \"set_typeDict(dict) set the internal \"\\\n\t\"dictionary that can look up an array type using a registered \"\\\n\t\"code\";\n\nstatic PyObject *\narray_set_typeDict(PyObject *ignored, PyObject *args)\n{\n\tPyObject *dict;\n\tif (!PyArg_ParseTuple(args, \"O\", &dict)) return NULL;\n\tPy_XDECREF(typeDict); /* Decrement old reference (if any)*/\n\ttypeDict = dict;\n\tPy_INCREF(dict); /* Create an internal reference to it */\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char doc_fromString[] = \"fromstring(string, dtype=intp, count=-1, swap=False) returns a new 1d array initialized from the raw binary data in string. If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.\";\n\nstatic PyObject *\narray_fromString(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyArrayObject *ret; \n\tchar *data;\n\tlonglong nin=-1;\n\tintp s, n;\n\tstatic char *kwlist[] = {\"string\", \"dtype\", \"count\", \"swap\",NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint itemsize;\n\tint swapped=FALSE;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"s#|O&LO&\", kwlist, \n\t\t\t\t\t &data, &s, \n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &swapped)) {\n\t\treturn NULL;\n\t}\n\t\n\tn = (intp) nin;\n\n\titemsize = type.itemsize;\n\tif (itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \"zero-valued itemsize.\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype.type_num, NULL, \n\t\t\t\t\t\tNULL, itemsize, 0,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\t\n\tmemcpy(ret->data, data, n*ret->itemsize);\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPyArray_INCREF(ret);\n\treturn (PyObject *)ret;\n}\n\n\n/* This needs an open file object and reads it in directly. \n memory-mapped files handled differently through buffer interface.\n\nfile pointer number in resulting 1d array \n(can easily reshape later, -1 for to end of file)\ntype of array\nsep is a separator string for character-based data (or NULL for binary)\n \" \" means whitespace\n*/\n\nstatic char doc_fromfile[] = \"\";\n\nstatic int\n_fill_in_itemsize(PyArray_Typecode *typecode)\n{\n\tPyArray_Descr *descr;\n\tdescr = PyArray_DescrFromType(typecode->type_num);\n\tif (descr==NULL) return -1;\n\ttypecode->itemsize = descr->elsize;\n\treturn 0;\n}\n\n\nstatic PyObject *\nPyArray_FromFile(FILE *fp, PyArray_Typecode *typecode, intp num, char *sep)\n{\n\tPyArrayObject *r;\n\tsize_t nread = 0;\n\tPyArray_ScanFunc *scan;\n\n\tif (typecode->itemsize == 0) {\n\t\tif (_fill_in_itemsize(typecode) < 0) \n\t\t\treturn NULL;\n\t}\n\n\tif (num == -1 && sep == NULL) { /* Get size for binary file*/\n\t\tintp start, numbytes;\n\t\tstart = (intp )ftell(fp);\n\t\tfseek(fp, 0, SEEK_END);\n\t\tnumbytes = (intp )ftell(fp) - start;\n\t\tfseek(fp, (long) start, SEEK_SET);\n\t\tif (numbytes == -1) {\n\t\t\tPyErr_SetString(PyExc_IOError, \"Could not seek in file.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tif (typecode->itemsize == 0) {\n\t\t\ttypecode->itemsize = numbytes;\n\t\t\tnum = 1;\n\t\t}\n\t\telse {\n\t\t\tnum = numbytes / typecode->itemsize;\n\t\t}\n\t}\n\t\n\tif (sep==NULL) { /* binary data */\n\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &num, \n\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t typecode->itemsize, 0, NULL);\n\t\tif (r==NULL) return NULL;\n\t\tnread = fread(r->data, typecode->itemsize, num, fp);\n\t}\n\telse { /* character reading */\n\t\tintp i;\n\t\tchar *dptr;\n\n\t\tif (num != -1) { /* number to read is known */\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &num, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = r->data;\n\t\t\tfor (i=0; i < num-1; i++) {\n\t\t\t\tif (scan(fp, dptr, r->itemsize, sep, NULL))\n\t\t\t\t\tbreak;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (!(scan(fp, dptr, r->itemsize, NULL, NULL)))\n\t\t\t\tnread += 1;\n\t\t}\n\t\telse { /* we have to watch for the end of the file and \n\t\t\t reallocate at the end */\n#define _FILEBUFNUM 4096\n\t\t\tintp thisbuf=0;\n\t\t\tintp size = _FILEBUFNUM;\n\t\t\tintp bytes;\n\t\t\tintp totalbytes;\n\t\t\tint done=0;\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &size, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\ttotalbytes = bytes = size * typecode->itemsize;\n\t\t\tdptr = r->data;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\twhile (!done) {\n\t\t\t\tdone = scan(fp, dptr, r->itemsize, sep, NULL);\n\t\t\t\t/* end of file reached trying to \n\t\t\t\t scan value \n\t\t\t\t*/\n\t\t\t\tif (done == 1 || done < 0) break;\n\t\t\t\n\t\t\t\tthisbuf += 1;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t\tif (!done && thisbuf == size) {\n\t\t\t\t\ttotalbytes += bytes;\n\t\t\t\t\tr->data = PyDataMem_RENEW(r->data, \n\t\t\t\t\t\t\t\t totalbytes);\n\t\t\t\t\tdptr = r->data + (totalbytes - bytes);\n\t\t\t\t\tthisbuf = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr->data = PyDataMem_RENEW(r->data, nread*r->itemsize);\n\t\t\tPyArray_DIM(r,0) = nread;\n\t\t\tnum = nread;\n#undef _FILEBUFNUM\n\t\t}\n\t}\n\tif (nread < num) {\n\t\tchar msg[80];\n\t\tsnprintf(msg, 80, \n\t\t\t \"%ld items requested only %ld read\", (long) num, \n (long) nread);\n\t\tif (PyErr_Warn(PyExc_RuntimeWarning, msg) < 0) {\n\t\t\tPy_DECREF(r);\n\t\t\treturn NULL;\n\t\t}\n\t\tr->data = PyDataMem_RENEW(r->data, nread * r->itemsize);\n\t\tPyArray_DIM(r,0) = nread;\n\t}\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_fromfile(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *file=NULL, *ret;\n\tFILE *fp;\n\tchar *sep=\"\";\n\tchar *mode=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"file\", \"dtype\", \"count\", \"sep\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Ls\", kwlist, \n\t\t\t\t\t &file,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &sep)) {\n\t\treturn NULL;\n\t}\n\n\tif (PyString_Check(file)) {\n\t\tif (sep == \"\") mode=\"rb\";\n\t\telse mode=\"r\";\n\t\tfile = PyFile_FromString(PyString_AS_STRING(file), mode);\n\t\tif (file==NULL) return NULL;\n\t}\n\telse {\n\t\tPy_INCREF(file);\n\t}\n\tfp = PyFile_AsFile(file);\n\tif (fp == NULL) {\n\t\tPyErr_SetString(PyExc_IOError, \"First argument must be an open file\");\n\t\tPy_DECREF(file);\n\t\treturn NULL;\n\t}\n\tret = PyArray_FromFile(fp, &type, (intp) nin, sep);\n\tPy_DECREF(file);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_FromBuffer(PyObject *buf, PyArray_Typecode *type, \n\t\t intp count, int swapped) \n{\n\tPyArrayObject *ret;\n\tchar *data;\n\tint ts;\n\tintp s, n;\n\tint itemsize;\n\tint write=1;\n\n\tif (type->type_num == PyArray_OBJECT) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Cannot create an OBJECT array from memory\"\\\n\t\t\t\t\" buffer.\");\n\t\treturn NULL;\n\t}\n\tif (type->itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Itemsize cannot be zero in type\");\n\t\treturn NULL;\n\t}\n\n\tif (PyObject_AsWriteBuffer(buf, (void *)&data, &ts)==-1) {\n\t\twrite = 0;\n\t\tPyErr_Clear();\n\t\tif (PyObject_AsReadBuffer(buf, (void *)&data, &ts)==-1) {\n\t\t\treturn NULL;\n\t\t}\n\t}\n\ts = (intp)ts;\t\n\tn = (intp)count;\n\titemsize = type->itemsize;\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype->type_num, NULL, \n\t\t\t\t\t\tdata, itemsize, DEFAULT_FLAGS,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\n\tif (!write) ret->flags &= ~WRITEABLE;\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPy_INCREF(buf);\n\t/* Store a reference for decref on deallocation */\n\tret->base = buf;\n\tPyArray_UpdateFlags(ret, ALIGNED);\n\treturn (PyObject *)ret; \t\n}\n\nstatic char doc_frombuffer[] = \"\";\n\nstatic PyObject *\narray_frombuffer(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *obj=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"buffer\", \"dtype\", \"count\", \n\t\t\t\t \"swap\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint swapped=0;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Li\", kwlist, \n\t\t\t\t\t &obj,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &swapped)) {\n\t\treturn NULL;\n\t}\n\n\treturn PyArray_FromBuffer(obj, &type, (intp)nin, swapped);\n}\n\n\n\nstatic char doc_concatenate[] = \"concatenate((a1,a2,...),axis=None).\";\n\nstatic PyObject *\narray_concatenate(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *a0;\n\tint axis=0;\n\tstatic char *kwlist[] = {\"seq\", \"axis\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist,\n\t\t\t\t\t &a0,\n\t\t\t\t\t PyArray_AxisConverter, &axis))\n\t\treturn NULL;\n\treturn PyArray_Concatenate(a0, axis);\n}\n\nstatic char doc_innerproduct[] = \\\n\t\"inner(a,b) returns the dot product of two arrays, which has\\n\"\\\n\t\"shape a.shape[:-1] + b.shape[:-1] with elements computed by\\n\" \\\n\t\"the product of the elements from the last dimensions of a and b.\";\n\nstatic PyObject *array_innerproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *b0, *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a0, &b0)) return NULL;\n\t\n\treturn _ARET(PyArray_InnerProduct(a0, b0));\n}\n\nstatic char doc_matrixproduct[] = \\\n\t\"dot(a,v) returns matrix-multiplication between a and b. \\n\"\\\n\t\"The product-sum is over the last dimension of a and the \\n\"\\\n\t\"second-to-last dimension of b.\";\n\nstatic PyObject *array_matrixproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *v, *a;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a, &v)) return NULL;\n\t\n\treturn _ARET(PyArray_MatrixProduct(a, v));\n}\n\nstatic char doc_fastCopyAndTranspose[] = \"_fastCopyAndTranspose(a)\";\n\nstatic PyObject *array_fastCopyAndTranspose(PyObject *dummy, PyObject *args) {\n\tPyObject *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &a0)) return NULL;\n\t\n\treturn _ARET(PyArray_CopyAndTranspose(a0));\n}\n\nstatic char doc_correlate[] = \"cross_correlate(a,v, mode=0)\";\n\nstatic PyObject *array_correlate(PyObject *dummy, PyObject *args, PyObject *kwds) {\n\tPyObject *shape, *a0;\n\tint mode=0;\n\tstatic char *kwlist[] = {\"a\", \"v\", \"mode\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|i\", kwlist, \n\t\t\t\t\t &a0, &shape, &mode)) return NULL;\n\t\n\treturn PyArray_Correlate(a0, shape, mode);\n}\n\n\nstatic PyObject *\nPyArray_Arange(double start, double stop, double step, int type_num)\n{\n\tintp length, i;\n\tPyObject *range;\n\tchar *rptr;\n\tint elsize, type;\n\tdouble value;\n\tPyArray_Descr *dbl_descr;\n\n\tlength = (intp ) ceil((stop - start)/step);\n \n\tif (length <= 0) {\n\t\tlength = 0;\n\t\treturn PyArray_New(&PyArray_Type, 1, &length, type_num,\n\t\t\t\t NULL, NULL, 0, 0, NULL);\n\t}\n\n\trange = PyArray_New(&PyArray_Type, 1, &length, type_num, \n\t\t\t NULL, NULL, 0, 0, NULL);\n\tif (range == NULL) return NULL;\n\tdbl_descr = PyArray_DescrFromType(PyArray_DOUBLE);\n \n\trptr = ((PyArrayObject *)range)->data;\n\telsize = ((PyArrayObject *)range)->itemsize;\n\ttype = ((PyArrayObject *)range)->descr->type_num;\n\tfor (i=0; i < length; i++) {\n\t\tvalue = start + i*step;\n\t\tdbl_descr->cast[type]((char*)&value, rptr, 1, NULL, \n\t\t\t\t (PyArrayObject *)range);\n\t\trptr += elsize;\n\t}\n \n\treturn range;\n}\n\n\nstatic char doc_arange[] = \"arange(start, stop=None, step=1, dtype=intp)\\n\\n Just like range() except it returns an array whose type can be\\n specified by the keyword argument typecode.\";\n\nstatic PyObject *\narray_arange(PyObject *ignored, PyObject *args, PyObject *kws) {\n\tPyObject *o_start=NULL, *o_stop=Py_None, *o_step=NULL;\n\tstatic char *kwd[]= {\"start\", \"stop\", \"step\", \"dtype\", NULL};\n\tdouble start, stop, step;\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0};\n\tint type_num;\n\tint deftype = PyArray_INTP;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|OOO&\", kwd, &o_start,\n\t\t\t\t\t&o_stop, &o_step, \n\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t&typecode)) \n\t\treturn NULL;\n\n\tdeftype = PyArray_ObjectType(o_start, deftype);\n\tif (o_stop != Py_None) {\n\t\tdeftype = PyArray_ObjectType(o_stop, deftype);\n\t}\n\tif (o_step != NULL) {\n\t\tdeftype = PyArray_ObjectType(o_step, deftype);\n\t}\n\n\ttype_num = typecode.type_num;\n\tif (type_num == PyArray_NOTYPE) {\n\t\ttype_num = deftype;\n\t}\n\n\tstart = PyFloat_AsDouble(o_start);\n\tif error_converting(start) return NULL;\n\n\tif (o_step == NULL) {\n\t\tstep = 1;\n\t}\n\telse {\n\t\tstep = PyFloat_AsDouble(o_step);\n\t\tif error_converting(step) return NULL;\n\t}\n\n\tif (o_stop == Py_None) {\n\t\tstop = start;\n\t\tstart = 0;\n\t}\n\telse {\n\t\tstop = PyFloat_AsDouble(o_stop);\n\t\tif error_converting(stop) return NULL;\n\t}\n\n\treturn PyArray_Arange(start, stop, step, type_num);\n}\n\n#undef _ARET\n\n/*****\n static char doc_arrayMap[] = \"arrayMap(func, [a1,...,an])\";\n\n static PyObject *array_arrayMap(PyObject *dummy, PyObject *args) {\n PyObject *shape, *a0;\n \n if (PyArg_ParseTuple(args, \"OO\", &a0, &shape) == NULL) return NULL;\n\t\n return PyArray_Map(a0, shape);\n }\n*****/\n\nstatic char \ndoc_set_string_function[] = \"set_string_function(f, repr=1) sets the python function f to be the function used to obtain a pretty printable string version of a array whenever a array is printed. f(M) should expect a array argument M, and should return a string consisting of the desired representation of M for printing.\";\n\nstatic PyObject *\narray_set_string_function(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *op;\n\tint repr=1;\n\tstatic char *kwlist[] = {\"f\", \"repr\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|i\", kwlist, \n\t\t\t\t\t&op, &repr)) return NULL; \n\tPyArray_SetStringFunction(op, repr);\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char \ndoc_set_ops_function[] = \"set_numeric_ops(op=func, ...) sets some or all of the number methods for all array objects. Don't forget **dict can be used as the argument list. Returns the functions that were replaced -- can be stored and set later.\";\n\nstatic PyObject *\narray_set_ops_function(PyObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *oldops=NULL;\n\t\n\tif ((oldops = PyArray_GetNumericOps())==NULL) return NULL;\n\n\t/* Should probably ensure that objects are at least callable */\n\t/* Leave this to the caller for now --- error will be raised\n\t later when use is attempted \n\t*/\n\tif (PyArray_SetNumericOps(kwds) == -1) {\n\t\tPy_DECREF(oldops);\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"One or more objects is not callable.\");\n\t\treturn NULL;\n\t}\n\treturn oldops;\n}\n\n\nstatic PyObject *\nPyArray_Where(PyObject *condition, PyObject *x, PyObject *y)\n{\n\tPyArrayObject *arr;\n\tPyObject *tup=NULL, *obj=NULL;\n\tPyObject *ret=NULL, *zero=NULL;\n\n\tif ((x==NULL) || (y==NULL)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"either both or neither\"\n\t\t\t\t\"of x and y should be given.\");\n\t\treturn NULL;\n\t}\n\n\tarr = (PyArrayObject *)PyArray_FromAny(condition, NULL, 0, 0, 0);\n\tif (arr == NULL) return NULL;\n\n\tif ((x==NULL) && (y==NULL)) {\n\t\tret = PyArray_Nonzero(arr);\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\n\n\tzero = PyInt_FromLong((long) 0);\n\n\tobj = PyArray_EnsureArray(PyArray_GenericBinaryFunction(arr, zero, n_ops.not_equal));\n\tPy_DECREF(zero);\n\tPy_DECREF(arr);\n\tif (obj == NULL) return NULL;\n\n\ttup = Py_BuildValue(\"(OO)\", y, x);\n\tif (tup == NULL) {Py_DECREF(obj); return NULL;}\n\n\tret = PyArray_Choose((PyAO *)obj, tup);\n\n\tPy_DECREF(obj);\n\tPy_DECREF(tup);\n\treturn ret;\n}\n\nstatic char doc_where[] = \"where(condition, | x, y) is shaped like condition\"\\\n\t\" and has elements of x and y where condition is respectively true or\"\\\n\t\" false. If x or y are not given, then it is equivalent to\"\\\n\t\" nonzero(condition).\";\n\nstatic PyObject *\narray_where(PyObject *ignored, PyObject *args)\n{\n\tPyObject *obj=NULL, *x=NULL, *y=NULL;\n\t\n\tif (!PyArg_ParseTuple(args, \"O|OO\", &obj, &x, &y)) return NULL;\n\n\treturn PyArray_Where(obj, x, y);\n\n}\n\nstatic char doc_register_dtype[] = \\\n\t\"register_dtype(a) registers a new type object -- gives it a typenum\";\n\nstatic PyObject *\narray_register_dtype(PyObject *dummy, PyObject *args)\n{\n\tPyObject *dtype;\n\tint ret;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &dtype)) return NULL;\n\t\n\tret = PyArray_RegisterDataType((PyTypeObject *)dtype);\n\tif (ret < 0)\n\t\treturn NULL;\n\treturn PyInt_FromLong((long) ret);\n}\n\nstatic char doc_can_cast_safely[] = \\\n\t\"can_cast_safely(from=d1, to=d2) returns True if data type d1 \"\\\n\t\"can be cast to data type d2 without losing precision.\";\n\nstatic PyObject *\narray_can_cast_safely(PyObject *dummy, PyObject *args, PyObject *kwds)\n{\n\tPyArray_Typecode d1={PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode d2={PyArray_NOTYPE, 0, 0};\n\tBool ret;\n\tPyObject *retobj;\n\tstatic char *kwlist[] = {\"from\", \"to\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O&O&\", kwlist, \n\t\t\t\t\tPyArray_TypecodeConverter, &d1,\n\t\t\t\t\tPyArray_TypecodeConverter, &d2))\n\t\treturn NULL;\n\tif (d1.type_num == PyArray_NOTYPE || \\\n\t d2.type_num == PyArray_NOTYPE) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"did not understand one of the types. \"\\\n\t\t\t\t\"'None' not accepted.\");\n\t\treturn NULL;\n\t}\n\t\t\n\tret = PyArray_CanCastTo(&d1, &d2);\n\tretobj = (ret ? Py_True : Py_False);\n\tPy_INCREF(retobj);\n\treturn retobj;\n}\n\n\nstatic struct PyMethodDef array_module_methods[] = {\n\t{\"set_string_function\", (PyCFunction)array_set_string_function, \n\t METH_VARARGS|METH_KEYWORDS, doc_set_string_function},\n\t{\"set_numeric_ops\", (PyCFunction)array_set_ops_function,\n\t METH_VARARGS|METH_KEYWORDS, doc_set_ops_function},\n\t{\"set_typeDict\", (PyCFunction)array_set_typeDict,\n\t METH_VARARGS, doc_set_typeDict},\n\n\t{\"array\",\t(PyCFunction)_array_fromobject, \n\t METH_VARARGS|METH_KEYWORDS, doc_fromobject},\n\t{\"arange\", (PyCFunction)array_arange, \n\t METH_VARARGS|METH_KEYWORDS, doc_arange},\n\t{\"zeros\",\t(PyCFunction)array_zeros, \n\t METH_VARARGS|METH_KEYWORDS, doc_zeros},\n\t{\"empty\",\t(PyCFunction)array_empty, \n\t METH_VARARGS|METH_KEYWORDS, doc_empty},\n\t{\"scalar\", (PyCFunction)array_scalar,\n\t METH_VARARGS|METH_KEYWORDS, doc_scalar},\n\t{\"where\", (PyCFunction)array_where,\n\t METH_VARARGS, doc_where},\n\t{\"fromstring\",(PyCFunction)array_fromString,\n\t METH_VARARGS|METH_KEYWORDS, doc_fromString},\n\t{\"concatenate\", (PyCFunction)array_concatenate, \n\t METH_VARARGS|METH_KEYWORDS, doc_concatenate},\n\t{\"inner\", (PyCFunction)array_innerproduct, \n\t METH_VARARGS, doc_innerproduct}, \n\t{\"dot\", (PyCFunction)array_matrixproduct, \n\t METH_VARARGS, doc_matrixproduct}, \n\t{\"_fastCopyAndTranspose\", (PyCFunction)array_fastCopyAndTranspose, \n\t METH_VARARGS, doc_fastCopyAndTranspose},\n\t{\"correlate\", (PyCFunction)array_correlate, \n\t METH_VARARGS | METH_KEYWORDS, doc_correlate},\n\t{\"frombuffer\", (PyCFunction)array_frombuffer,\n\t METH_VARARGS | METH_KEYWORDS, doc_frombuffer},\n\t{\"fromfile\", (PyCFunction)array_fromfile,\n\t METH_VARARGS | METH_KEYWORDS, doc_fromfile},\n\t{\"register_dtype\", (PyCFunction)array_register_dtype,\n\t METH_VARARGS, doc_register_dtype},\n\t{\"can_cast\", (PyCFunction)array_can_cast_safely,\n\t METH_VARARGS | METH_KEYWORDS, doc_can_cast_safely},\t\t\n\t/* {\"arrayMap\",\t(PyCFunction)array_arrayMap, \n\t METH_VARARGS, doc_arrayMap},*/\n\t\n\t{NULL,\t\tNULL, 0}\t\t/* sentinel */\n};\n\n#include \"__multiarray_api.c\"\n\n/* Establish scalar-type hierarchy */\n\n/* For dual inheritance we need to make sure that the objects being\n inherited from have the tp->mro object initialized. This is\n not necessarily true for the basic type objects of Python (it is \n checked for single inheritance but not dual in PyType_Ready).\n\n Thus, we call PyType_Ready on the standard Python Types, here.\n*/ \nstatic int\nsetup_scalartypes(PyObject *dict)\n{\n\n\tinitialize_numeric_types();\n\n if (PyType_Ready(&PyBool_Type) < 0) return -1;\n if (PyType_Ready(&PyInt_Type) < 0) return -1;\n if (PyType_Ready(&PyFloat_Type) < 0) return -1;\n if (PyType_Ready(&PyComplex_Type) < 0) return -1;\n if (PyType_Ready(&PyString_Type) < 0) return -1;\n if (PyType_Ready(&PyUnicode_Type) < 0) return -1;\n\n#define SINGLE_INHERIT(child, parent) \\\n Py##child##ArrType_Type.tp_base = &Py##parent##ArrType_Type;\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) {\t\t\\\n PyErr_Print(); \\\n PyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Tyupe\", \\\n #child); \\\n return -1;\t\t\t\t\t\t\\\n }\n \n if (PyType_Ready(&PyGenericArrType_Type) < 0)\n return -1;\n\n SINGLE_INHERIT(Numeric, Generic);\n SINGLE_INHERIT(Integer, Numeric);\n SINGLE_INHERIT(Inexact, Numeric);\n SINGLE_INHERIT(SignedInteger, Integer);\n SINGLE_INHERIT(UnsignedInteger, Integer);\n SINGLE_INHERIT(Floating, Inexact);\n SINGLE_INHERIT(ComplexFloating, Inexact);\n SINGLE_INHERIT(Flexible, Generic);\n SINGLE_INHERIT(Character, Flexible);\n\t\n#define DUAL_INHERIT(child, parent1, parent2) \\\n Py##child##ArrType_Type.tp_base = &Py##parent2##ArrType_Type;\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent2##ArrType_Type,\t\\\n\t\t\t &Py##parent1##_Type);\t\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n#define DUAL_INHERIT2(child, parent1, parent2)\t\t\t\t\\\n Py##child##ArrType_Type.tp_base = &Py##parent1##_Type;\t\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent1##_Type,\t\t\\\n\t\t\t &Py##parent2##ArrType_Type);\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n SINGLE_INHERIT(Bool, Generic);\n SINGLE_INHERIT(Byte, SignedInteger);\n SINGLE_INHERIT(Short, SignedInteger);\n#if SIZEOF_INT == SIZEOF_LONG\n DUAL_INHERIT(Int, Int, SignedInteger);\n#else\n SINGLE_INHERIT(Int, SignedInteger);\n#endif\n DUAL_INHERIT(Long, Int, SignedInteger);\n#if SIZEOF_LONGLONG == SIZEOF_LONG\n DUAL_INHERIT(LongLong, Int, SignedInteger);\n#else\n SINGLE_INHERIT(LongLong, SignedInteger);\n#endif\n\n SINGLE_INHERIT(UByte, UnsignedInteger);\n SINGLE_INHERIT(UShort, UnsignedInteger);\n SINGLE_INHERIT(UInt, UnsignedInteger);\n SINGLE_INHERIT(ULong, UnsignedInteger);\n SINGLE_INHERIT(ULongLong, UnsignedInteger);\n\n SINGLE_INHERIT(Float, Floating);\n DUAL_INHERIT(Double, Float, Floating);\n SINGLE_INHERIT(LongDouble, Floating);\n\n SINGLE_INHERIT(CFloat, ComplexFloating);\n DUAL_INHERIT(CDouble, Complex, ComplexFloating);\n SINGLE_INHERIT(CLongDouble, ComplexFloating);\n\n DUAL_INHERIT2(String, String, Character);\n DUAL_INHERIT2(Unicode, Unicode, Character);\n\t\n SINGLE_INHERIT(Void, Flexible);\n \n SINGLE_INHERIT(Object, Generic);\n\n return 0;\n\n#undef SINGLE_INHERIT\n#undef DUAL_INHERIT\n\n\t/* Clean up string and unicode array types so they act more like\n\t strings -- get their tables from the standard types.\n\t \n\t \n\t*/\n}\n\n/* place a flag dictionary in d */\n\nstatic void\nset_flaginfo(PyObject *d)\n{\n PyObject *s;\n PyObject *newd;\n \n newd = PyDict_New();\n\n PyDict_SetItemString(newd, \"OWNDATA\", s=PyInt_FromLong(OWNDATA));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"FORTRAN\", s=PyInt_FromLong(FORTRAN));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"CONTIGUOUS\", s=PyInt_FromLong(CONTIGUOUS));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"ALIGNED\", s=PyInt_FromLong(ALIGNED));\n Py_DECREF(s);\n\n PyDict_SetItemString(newd, \"NOTSWAPPED\", s=PyInt_FromLong(NOTSWAPPED));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"UPDATEIFCOPY\", s=PyInt_FromLong(UPDATEIFCOPY));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"WRITEABLE\", s=PyInt_FromLong(WRITEABLE));\n Py_DECREF(s);\n \n PyDict_SetItemString(d, \"_flagdict\", newd);\n Py_DECREF(newd);\n return;\n}\n\n\n/* Initialization function for the module */\n\nDL_EXPORT(void) initmultiarray(void) {\n\tPyObject *m, *d, *s;\n\tPyObject *c_api;\n\t\n\t/* Create the module and add the functions */\n\tm = Py_InitModule(\"multiarray\", array_module_methods);\n\tif (!m) goto err;\n\n\t/* Add some symbolic constants to the module */\n\td = PyModule_GetDict(m);\n\tif (!d) goto err; \n\n\t/* Create the module and add the functions */\n\tif (PyType_Ready(&PyBigArray_Type) < 0) \n\t\treturn;\n\n PyArray_Type.tp_base = &PyBigArray_Type;\n\n PyArray_Type.tp_as_mapping = &array_as_mapping;\n\t/* Even though, this would be inherited, it needs to be set now\n\t so that the __getitem__ will map to the as_mapping descriptor\n\t*/\n PyArray_Type.tp_as_number = &array_as_number; \n\t/* For good measure */\n\tPyArray_Type.tp_as_sequence = &array_as_sequence;\n\tPyArray_Type.tp_as_buffer = &array_as_buffer;\t\n PyArray_Type.tp_flags = (Py_TPFLAGS_DEFAULT \n\t\t\t\t | Py_TPFLAGS_BASETYPE\n\t\t\t\t | Py_TPFLAGS_CHECKTYPES);\n PyArray_Type.tp_doc = Arraytype__doc__;\n\n\tif (PyType_Ready(&PyArray_Type) < 0)\n return;\n\n if (setup_scalartypes(d) < 0) goto err;\n\n\tif (PyType_Ready(&PyArrayIter_Type) < 0)\n\t\treturn; \n \n\tif (PyType_Ready(&PyArrayMapIter_Type) < 0)\n return; \n\n\tc_api = PyCObject_FromVoidPtr((void *)PyArray_API, NULL);\n\tif (PyErr_Occurred()) goto err;\n\tPyDict_SetItemString(d, \"_ARRAY_API\", c_api);\n\tPy_DECREF(c_api);\n\tif (PyErr_Occurred()) goto err;\n\n\tMultiArrayError = PyString_FromString (\"multiarray.error\");\n\tPyDict_SetItemString (d, \"error\", MultiArrayError);\n\t\n\ts = PyString_FromString(\"3.0\");\n\tPyDict_SetItemString(d, \"__version__\", s);\n\tPy_DECREF(s);\n Py_INCREF(&PyBigArray_Type);\n\tPyDict_SetItemString(d, \"bigndarray\", (PyObject *)&PyBigArray_Type);\n Py_INCREF(&PyArray_Type);\n\tPyDict_SetItemString(d, \"ndarray\", (PyObject *)&PyArray_Type);\n Py_INCREF(&PyArrayIter_Type);\n\tPyDict_SetItemString(d, \"flatiter\", (PyObject *)&PyArrayIter_Type);\n Py_INCREF(&PyArrayMapIter_Type);\n\tPyDict_SetItemString(d, \"mapiter\", (PyObject *)&PyArrayMapIter_Type);\n\n set_flaginfo(d);\n\n\tif (set_typeinfo(d) == 0) \n return; /* otherwise there is an error */\n\n\n err:\t\n\t/* Check for errors */\n\tif (PyErr_Occurred())\n PyErr_Print();\n\t\tPy_FatalError(\"can't initialize module multiarray\");\n\n\treturn;\n}\n\n", "source_code_before": "\n/*\n Python Multiarray Module -- A useful collection of functions for creating and\n using ndarrays\n\n Original file \n Copyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\n Modified for scipy_core in 2005 \n\n Travis E. Oliphant\n Assistant Professor at\n Brigham Young University\n \n*/\n\n/* $Id: multiarraymodule.c,v 1.36 2005/09/14 00:14:00 teoliphant Exp $ */\n\n#include \"Python.h\"\n#include \"structmember.h\"\n/*#include \n#include \n*/\n\n#define _MULTIARRAYMODULE\n#include \"scipy/arrayobject.h\"\n\n#define PyAO PyArrayObject\n\nstatic PyObject *typeDict=NULL; /* Must be explicitly loaded */\n\n/* Including this file is the only way I know how to declare functions\n static in each file, and store the pointers from functions in both\n arrayobject.c and multiarraymodule.c for the C-API \n\n Declarying an external pointer-containing variable in arrayobject.c\n and trying to copy it to PyArray_API, did not work.\n\n Think about two modules with a common api that import each other...\n\n This file would just be the module calls. \n*/\n\n#include \"arrayobject.c\"\n\n\n/* An Error object -- rarely used? */\nstatic PyObject *MultiArrayError;\n\nstatic intp \nPyArray_MultiplyList(intp *l1, int n) \n{\n\tregister intp s=1;\n\tregister int i=0;\n while (i++ < n) s *= (*l1++);\n return s;\n}\n\n\nstatic int \nPyArray_AxisConverter(PyObject *obj, int *axis)\n{\n\tif (obj == Py_None) {\n\t\t*axis = MAX_DIMS;\n\t}\n\telse {\n\t\t*axis = (int) PyInt_AsLong(obj);\n\t\tif (PyErr_Occurred()) {\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n\treturn PY_SUCCEED;\n}\n\nstatic int \nPyArray_CompareLists(intp *l1, intp *l2, int n) \n{\n int i;\n for(i=0;itype_num;\n\t}\n\n\tnew = PyArray_New(self->ob_type,\n\t\t\t self->nd, self->dimensions,\n\t\t\t self->descr->type_num,\n\t\t\t self->strides,\n\t\t\t self->data,\n\t\t\t self->itemsize,\n\t\t\t self->flags, (PyObject *)self);\n\n\tif (new==NULL) return NULL;\n\t\n Py_INCREF(self);\n PyArray_BASE(new) = (PyObject *)self;\n if ((type_num != PyArray_NOTYPE) && \\\n (type_num != self->descr->type_num)) {\n if (!PyTypeNum_ISFLEXIBLE(type_num)) {\n v = PyArray_TypeObjectFromType(type_num);\n }\n else {\n PyArray_Descr *descr;\n int itemsize = type->itemsize;\n descr = PyArray_DescrFromType(type_num);\n if (type_num == PyArray_UNICODE) \n itemsize /= sizeof(Py_UNICODE);\n /* construct a string representation */\n v = PyString_FromFormat(\"%c%d\", descr->type, \n itemsize);\n }\n if (v == NULL) goto fail;\n /* set attribute new.dtype = newtype */\n if (PyObject_SetAttrString(new, \"dtype\", v) < 0) goto fail;\n Py_DECREF(v);\n }\n\treturn new;\t\n\n fail:\n Py_XDECREF(v);\n Py_XDECREF(new);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Ravel(PyArrayObject *a, int fortran)\n{\n\tPyArray_Dims newdim = {NULL,1};\n\tintp val[1] = {-1};\n\n if (a->nd == 1) {\n Py_INCREF(a);\n return (PyObject *)a;\n }\n\tnewdim.ptr = val;\n\tif (!fortran && PyArray_ISCONTIGUOUS(a)) \n\t\treturn PyArray_Newshape(a, &newdim);\n\telse\n\t return PyArray_Flatten(a, fortran);\n}\n\nstatic PyObject *\nPyArray_Flatten(PyArrayObject *a, int fortran)\n{\n\tPyObject *ret, *new;\n\tintp size;\n\n\tsize = PyArray_SIZE(a);\n\tret = PyArray_New(a->ob_type,\n\t\t\t 1, &size,\n\t\t\t a->descr->type_num,\n\t\t\t NULL,\n NULL,\n\t\t\t a->itemsize,\n\t\t\t 0, (PyObject *)a);\n\n\tif (ret== NULL) return NULL;\n\tif (fortran) {\n\t\tnew = PyArray_Transpose(a, NULL);\n\t\tif (new == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\telse {\n\t\tPy_INCREF(a);\n\t\tnew = (PyObject *)a;\n\t}\n\tif (PyArray_CopyInto((PyArrayObject *)ret, (PyArrayObject *)new) < 0) {\n\t\tPy_DECREF(ret);\n\t\tPy_DECREF(new);\n\t\treturn NULL;\n\t}\n\tPy_DECREF(new);\n\treturn ret;\n}\n\n\n/* For back-ward compatability *\n\n/ * Not recommended */\n\nstatic PyObject *\nPyArray_Reshape(PyArrayObject *self, PyObject *shape) \n{\n PyObject *ret;\n PyArray_Dims newdims;\n\n if (!PyArray_IntpConverter(shape, &newdims)) return NULL;\n ret = PyArray_Newshape(self, &newdims);\n PyDimMem_FREE(newdims.ptr);\n return ret;\n}\n\n/* Returns a new array \n with the a new shape from the data\n in the old array\n*/\n\nstatic PyObject * \nPyArray_Newshape(PyArrayObject *self, PyArray_Dims *newdims)\n{\n intp i, s_original, i_unknown, s_known;\n intp *dimensions = newdims->ptr;\n PyArrayObject *ret;\n\tchar msg[] = \"total size of new array must be unchanged\";\n\tint n = newdims->len;\n Bool same;\n\n /* Quick check to make sure anything needs to be done */\n if (n == self->nd) {\n same = TRUE;\n i=0;\n while(same && i= 0) {\n if ((s_known == 0) || (s_original % s_known != 0)) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n dimensions[i_unknown] = s_original/s_known;\n } else {\n if (s_original != s_known) {\n PyErr_SetString(PyExc_ValueError, msg);\n goto fail;\n }\n }\n \n\tret = (PyAO *)PyArray_New(self->ob_type,\n\t\t\t\t n, dimensions,\n\t\t\t\t self->descr->type_num,\n\t\t\t\t NULL,\n\t\t\t\t self->data,\n\t\t\t\t self->itemsize,\n\t\t\t\t self->flags, (PyObject *)self);\n\n\tif (ret== NULL)\n goto fail;\n\t\n Py_INCREF(self);\n ret->base = (PyObject *)self;\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n return (PyObject *)ret;\n\t\n fail:\n return NULL;\n}\n\n/* return a new view of the array object with all of its unit-length \n dimensions squeezed out if needed, otherwise\n return the same array.\n */\n\nstatic PyObject *\nPyArray_Squeeze(PyArrayObject *self)\n{\n\tint nd = self->nd;\n\tint newnd = nd;\n\tintp dimensions[MAX_DIMS];\n\tintp strides[MAX_DIMS];\n\tint i,j;\n\tPyObject *ret;\n\n\tif (nd == 0) {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n\tfor (j=0, i=0; idimensions[i] == 1) {\n\t\t\tnewnd -= 1;\n\t\t}\n\t\telse {\n\t\t\tdimensions[j] = self->dimensions[i];\n\t\t\tstrides[j++] = self->strides[i];\n\t\t}\n\t}\n\t\n\tret = PyArray_New(self->ob_type, newnd, dimensions, \n\t\t\t self->descr->type_num, strides,\n\t\t\t self->data, self->itemsize, self->flags,\n\t\t\t (PyObject *)self);\n\tself->flags &= ~OWN_DATA;\n\tself->base = (PyObject *)self;\n\tPy_INCREF(self);\n\treturn (PyObject *)ret;\n}\n\n\nstatic PyObject *\nPyArray_Mean(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL;\n\tPyObject *new, *ret;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\n\tobj1 = PyArray_GenericReduceFunction((PyAO *)new, n_ops.add, axis,\n\t\t\t\t\t rtype);\n\tobj2 = PyFloat_FromDouble((double) PyArray_DIM(new,axis));\n Py_DECREF(new);\n\tif (obj1 == NULL || obj2 == NULL) {\n\t\tPy_XDECREF(obj1);\n\t\tPy_XDECREF(obj2);\n\t\treturn NULL;\n\t}\n\n\tret = PyNumber_Divide(obj1, obj2);\n\tPy_DECREF(obj1);\n\tPy_DECREF(obj2);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Std(PyArrayObject *self, int axis, int rtype)\n{\n\tPyObject *obj1=NULL, *obj2=NULL, *new=NULL;\n\tPyObject *ret=NULL, *newshape=NULL;\n\tint i, n;\n\tintp val;\n\n\tif ((new = _check_axis(self, &axis, 0))==NULL) return NULL;\n\t\n\t/* Compute and reshape mean */\n\tobj1 = PyArray_EnsureArray(PyArray_Mean((PyAO *)new, axis, rtype));\n\tif (obj1 == NULL) {Py_DECREF(new); return NULL;} \n\tn = PyArray_NDIM(new);\n\tnewshape = PyTuple_New(n);\n\tif (newshape == NULL) {Py_DECREF(obj1); Py_DECREF(new); return NULL;}\n\tfor (i=0; ind != 1) {\n Py_DECREF(cond);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Condition must be 1-d array.\");\n return NULL;\n }\n\n res = PyArray_Nonzero(cond);\n Py_DECREF(cond);\n\tret = PyArray_Take(self, res, axis);\n\tPy_DECREF(res);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Nonzero(PyArrayObject *self)\n{\n int n=self->nd, j;\n\tintp count=0, i, size;\n\tPyArrayIterObject *it=NULL;\n\tPyObject *ret=NULL, *item;\n\tintp *dptr[MAX_DIMS];\n\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (it==NULL) return NULL;\n\n\tsize = it->size;\n\tfor (i=0; idescr->nonzero(it->dataptr, self)) count++;\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\n\tPyArray_ITER_RESET(it);\n\tif (n==1) {\n\t\tret = PyArray_New(self->ob_type, 1, &count, PyArray_INTP, \n\t\t\t\t NULL, NULL, 0, 0, (PyObject *)self);\n\t\tif (ret == NULL) goto fail;\n\t\tdptr[0] = (intp *)PyArray_DATA(ret);\n\t\t\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\t*(dptr[0])++ = i;\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t}\n\telse {\n\t\tret = PyTuple_New(n);\n\t\tfor (j=0; job_type, 1, &count, \n\t\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0,\n\t\t\t\t\t (PyObject *)self);\n\t\t\tPyTuple_SET_ITEM(ret, j, item);\n\t\t\tif (item == NULL) goto fail;\n\t\t\tdptr[j] = (intp *)PyArray_DATA(item);\n\t\t}\n\t\t\n\t\t/* reset contiguous so that coordinates gets updated */\n\t\tit->contiguous = 0;\n\t\tfor (i=0; idescr->nonzero(it->dataptr, self)) \n\t\t\t\tfor (j=0; jcoordinates[j];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\n\t}\n\n\treturn ret;\n\n fail:\n\tPy_XDECREF(ret);\n\tPy_XDECREF(it);\n\treturn NULL;\n \n}\n\nstatic PyObject *\nPyArray_Clip(PyArrayObject *self, PyObject *min, PyObject *max)\n{\n\tPyObject *selector=NULL, *newtup=NULL, *ret=NULL;\n\tPyObject *res1=NULL, *res2=NULL, *res3=NULL;\n\tPyObject *two;\n\n\ttwo = PyInt_FromLong((long)2);\n\tres1 = PyArray_GenericBinaryFunction(self, max, n_ops.greater);\n\tres2 = PyArray_GenericBinaryFunction(self, min, n_ops.less);\n\tif ((res1 == NULL) || (res2 == NULL)) goto fail;\n\tres3 = PyNumber_Multiply(two, res1);\n\tPy_DECREF(two);\n\tPy_DECREF(res1);\n\tif (res3 == NULL) return NULL;\n\n\tselector = PyArray_EnsureArray(PyNumber_Add(res2, res3));\n\tPy_DECREF(res2);\n\tPy_DECREF(res3);\n\tif (selector == NULL) return NULL;\n\n\tnewtup = Py_BuildValue(\"(OOO)\", (PyObject *)self, min, max);\n\tif (newtup == NULL) goto fail;\n\tret = PyArray_Choose((PyAO *)selector, newtup);\n\tPy_DECREF(selector);\n\tPy_DECREF(newtup);\n\treturn ret;\n\n fail:\n\tPy_XDECREF(res1);\n\tPy_XDECREF(res2);\n\tPy_XDECREF(two);\n\tPy_XDECREF(selector);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Conjugate(PyArrayObject *self)\n{\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyObject *new;\n\t\tintp size, i;\n\t\t/* Make a copy */\n\t\tnew = PyArray_Copy(self);\n\t\tif (new==NULL) return NULL;\n\t\tsize = PyArray_SIZE(new);\n\t\tif (self->descr->type_num == PyArray_CFLOAT) {\n\t\t\tcfloat *dptr = (cfloat *) PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CDOUBLE) {\n\t\t\tcdouble *dptr = (cdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\n\t\t}\n\t\telse if (self->descr->type_num == PyArray_CLONGDOUBLE) {\n\t\t\tclongdouble *dptr = (clongdouble *)PyArray_DATA(new);\n\t\t\tfor (i=0; iimag = -dptr->imag;\n\t\t\t\tdptr++;\n\t\t\t}\t\t\t\n\t\t}\t\t\n\t\treturn new;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *) self;\n\t}\n}\n\nstatic PyObject *\nPyArray_Trace(PyArrayObject *self, int offset, int axis1, int axis2, \nint rtype)\n{\n\tPyObject *diag=NULL, *ret=NULL;\n\n\tdiag = PyArray_Diagonal(self, offset, axis1, axis2);\n\tif (diag == NULL) return NULL;\n\tret = PyArray_GenericReduceFunction((PyAO *)diag, n_ops.add, -1, rtype);\n\tPy_DECREF(diag);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_Diagonal(PyArrayObject *self, int offset, int axis1, int axis2)\n{\n\tint n = self->nd;\n\tPyObject *new;\n\tPyObject *newaxes;\n\tint i, pos;\t\n\n\tif (n < 2) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"array.ndim must be >= 2\");\n\t\treturn NULL;\n\t}\n\tif (axis1 < 0) axis1 += n;\n\tif (axis2 < 0) axis2 += n;\n\tif ((axis1 == axis2) || (axis1 < 0) || (axis1 >= n) ||\t\\\n\t (axis2 < 0) || (axis2 >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \"axis1(=%d) and axis2(=%d) \"\\\n\t\t\t \"must be different and within range (nd=%d)\",\n\t\t\t axis1, axis2, n);\n\t\treturn NULL;\n\t}\n \n\tnewaxes = PyTuple_New(n);\n\tif (newaxes==NULL) return NULL;\n\t/* insert at the end */\n\tPyTuple_SET_ITEM(newaxes, n-2, PyInt_FromLong((long)axis1));\n\tPyTuple_SET_ITEM(newaxes, n-1, PyInt_FromLong((long)axis2));\n\tpos = 0;\n\tfor (i=0; idimensions[0];\n\t\tn2 = self->dimensions[1];\n\t\tstep = n2+1;\n\t\tif (offset < 0) {\n\t\t\tstart = -n2 * offset;\n\t\t\tstop = MIN(n2, n1+offset)*(n2+1) - n2*offset;\n\t\t}\n\t\telse {\n\t\t\tstart = offset;\n\t\t\tstop = MIN(n1, n2-offset)*(n2+1) + offset;\n\t\t}\n\t\t\n\t\t/* count = ceil((stop-start)/step) */\n\t\tcount = ((stop-start) / step) + (((stop-start) % step) != 0);\n\t\t\t\n\t\tindices = PyArray_New(&PyArray_Type, 1, &count, \n\t\t\t\t PyArray_INTP, NULL, NULL, 0, 0, NULL);\n\t\tif (indices == NULL) {\n\t\t\tPy_DECREF(self); return NULL;\n\t\t}\n\t\tdptr = (intp *)PyArray_DATA(indices);\n\t\tfor (n1=start; n1descr->type_num,\n\t\t\t\t\t self->itemsize, 0};\n\t\t\n\t\tmydiagonal = PyList_New(0);\n\t\tif (mydiagonal == NULL) {Py_DECREF(self); return NULL;}\n\t\tn1 = self->dimensions[0];\n\t\tfor (i=0; i 3)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"Only Carrays of 1-3 dimensions available.\");\n\t\treturn -1;\n\t}\n\tif ((ap = (PyArrayObject*)PyArray_FromAny(*op, &typecode, nd, nd,\n\t\t\t\t\t\t CARRAY_FLAGS)) == NULL)\n\t\treturn -1;\n\tswitch(nd) {\n\tcase 1:\n\t\t*((char **)ptr) = ap->data;\n\t\tbreak;\n\tcase 2:\n\t\tn = ap->dimensions[0];\n\t\tptr2 = (char **)malloc(n * sizeof(char *));\n\t\tif (!ptr2) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0];\n\t\t}\n\t\t*((char ***)ptr) = ptr2;\n\t\tbreak;\t\t\n\tcase 3:\n\t\tn = ap->dimensions[0];\n\t\tm = ap->dimensions[1];\n\t\tptr3 = (char ***)malloc(n*(m+1) * sizeof(char *));\n\t\tif (!ptr3) goto fail;\n\t\tfor (i=0; idata + i*ap->strides[0] + \\\n\t\t\t\t\tj*ap->strides[1];\n\t\t\t}\n\t\t}\n\t\t*((char ****)ptr) = ptr3;\n\t}\n\tmemcpy(dims, ap->dimensions, nd*sizeof(intp));\n\t*op = (PyObject *)ap;\n\treturn 0;\n\n fail:\n\tPyErr_SetString(PyExc_MemoryError, \"No memory.\");\n\treturn -1;\n}\n\n/* Deprecated --- Use PyArray_AsCArray instead */\n\nstatic int \nPyArray_As1D(PyObject **op, char **ptr, int *d1, int typecode) \n{\n\tintp newd1;\n\t\n\tif (PyArray_AsCArray(op, (void *)ptr, &newd1, 1, typecode) == -1)\n\t\treturn -1;\t\n\t*d1 = (int) newd1;\n\treturn 0;\n}\n\n\nstatic int \nPyArray_As2D(PyObject **op, char ***ptr, int *d1, int *d2, int typecode) \n{\n\tintp newdims[2];\n\n\tif (PyArray_AsCArray(op, (void *)ptr, newdims, 2, typecode) == -1)\n\t\treturn -1;\n\n\t*d1 = (int ) newdims[0];\n\t*d2 = (int ) newdims[1];\n return 0;\n}\n\n/* End Deprecated */\n\nstatic int \nPyArray_Free(PyObject *op, void *ptr) \n{\n PyArrayObject *ap = (PyArrayObject *)op;\n\t\n if ((ap->nd < 1) || (ap->nd > 3)) \n\t\treturn -1;\n if (ap->nd >= 2) {\n\t\tfree(ptr);\n }\n Py_DECREF(ap);\n return 0;\n}\n\n\nstatic PyObject *\n_swap_and_concat(PyObject *op, int axis, int n)\n{\n\tPyObject *newtup=NULL;\n\tPyObject *otmp, *arr;\n\tint i;\n\n\tnewtup = PyTuple_New(n);\n\tif (newtup==NULL) return NULL;\n\tfor (i=0; i= MAX_DIMS) {\n\t\t\totmp = PyArray_Ravel(mps[i],0);\n\t\t\tPy_DECREF(mps[i]);\n\t\t\tmps[i] = (PyArrayObject *)otmp;\n\t\t}\n\t\tprior2 = PyArray_GetPriority((PyObject *)(mps[i]), 0.0);\n\t\tif (prior2 > prior1) {\n\t\t\tprior1 = prior2;\n\t\t\tsubtype = mps[i]->ob_type;\n\t\t\tret = mps[i];\n\t\t}\n\t}\n\t\n\tnew_dim = 0;\n\tfor(i=0; ind;\n\t\telse {\n\t\t\tif (nd != mps[i]->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"arrays must have same \"\\\n\t\t\t\t\t\t\"number of dimensions\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tif (!PyArray_CompareLists(mps[0]->dimensions+1, \n\t\t\t\t\t\t mps[i]->dimensions+1, \n\t\t\t\t\t\t nd-1)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"array dimensions must \"\\\n\t\t\t\t\t\t\"agree except for d_0\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t}\n\t\tif (nd == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"0d arrays can't be concatenated\");\n\t\t\tgoto fail;\n\t\t}\n\t\tnew_dim += mps[i]->dimensions[0];\n\t}\n\t\n\ttmp = mps[0]->dimensions[0];\n\tmps[0]->dimensions[0] = new_dim;\n\tret = (PyArrayObject *)PyArray_New(subtype, nd,\n\t\t\t\t\t mps[0]->dimensions, \n\t\t\t\t\t type_num, NULL, NULL, 0, 0,\n (PyObject *)ret);\n\tmps[0]->dimensions[0] = tmp;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tdata = ret->data;\n\tfor(i=0; idata, numbytes);\n\t\tdata += numbytes;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; ind;\n\tif (n <= 1) {\n\t\tPy_INCREF(ap);\n\t\treturn (PyObject *)ap;\n\t}\n\n\tif (a1 < 0) a1 += n;\n\tif (a2 < 0) a2 += n;\n\tif ((a1 < 0) || (a1 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis1 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tif ((a2 < 0) || (a2 >= n)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Bad axis2 argument to swapaxes.\");\n\t\treturn NULL;\n\t}\n\tnew_axes = PyTuple_New(n);\n\tfor (i=0; ind;\n\t\tpermutation = (intp *)malloc(n*sizeof(int));\n\t\tfor(i=0; ind+axis;\n\t\t\tif (axis < 0 || axis >= ap->nd) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"invalid axis for this array\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tpermutation[i] = axis;\n\t\t}\n\t}\n\t\n\t/* this allocates memory for dimensions and strides (but fills them\n\t incorrectly), sets up descr, and points data at ap->data. */\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, n, permutation, \n\t\t\t\t\t ap->descr->type_num, NULL,\n\t\t\t\t\t ap->data, ap->itemsize, ap->flags,\n\t\t\t\t\t (PyObject *)ap);\n\tif (ret == NULL) goto fail;\n\t\n\t/* point at true owner of memory: */\n\tret->base = (PyObject *)ap;\n\tPy_INCREF(ap);\n\t\n\tfor(i=0; idimensions[i] = ap->dimensions[permutation[i]];\n\t\tret->strides[i] = ap->strides[permutation[i]];\n\t}\n\tPyArray_UpdateFlags(ret, CONTIGUOUS | FORTRAN);\n\t\n\tif (op && (op != Py_None))\n\t\tPyArray_Free(op, (char *)axes);\n\tfree(permutation);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ret);\n\tif (permutation != NULL) free(permutation);\n\tif (op != Py_None)\n\t\tPyArray_Free(op, (char *)axes);\n\treturn NULL;\n}\n\nstatic PyObject *\nPyArray_Repeat(PyArrayObject *aop, PyObject *op, int axis) {\n\tintp *counts;\n\tintp n, n_outer, i, j, k, chunk, total;\n\tintp tmp;\n\tint nd;\n\tPyArrayObject *repeats=NULL;\n\tPyObject *ap=NULL;\n\tPyArrayObject *ret=NULL;\n\tchar *new_data, *old_data;\n\n\trepeats = (PyAO *)PyArray_ContiguousFromObject(op, PyArray_INTP, 0, 1);\n\tif (repeats == NULL) return NULL;\n\tnd = repeats->nd;\n\tcounts = (intp *)repeats->data;\n\n\tif ((ap=_check_axis(aop, &axis, CARRAY_FLAGS))==NULL) {\n\t\tPy_DECREF(repeats);\n\t\treturn NULL;\n\t}\n\n\taop = (PyAO *)ap;\n\n\tif (nd == 1)\n\t\tn = repeats->dimensions[0];\n\telse /* nd == 0 */\n\t\tn = aop->dimensions[axis];\n\n\tif (aop->dimensions[axis] != n) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"a.shape[axis] != len(repeats)\");\n\t\tgoto fail;\n\t}\n\n\t\n\tif (nd == 0) \n\t\ttotal = counts[0]*n;\n\telse {\n\t\t\n\t\ttotal = 0;\n\t\tfor(j=0; jdimensions[axis] = total;\n\tret = (PyArrayObject *)PyArray_New(aop->ob_type, aop->nd,\n\t\t\t\t\t aop->dimensions, \n\t\t\t\t\t aop->descr->type_num,\n\t\t\t\t\t NULL, NULL, aop->itemsize, 0,\n\t\t\t\t\t (PyObject *)aop);\n\taop->dimensions[axis] = n;\n\t\n\tif (ret == NULL) goto fail;\n\t\n\tnew_data = ret->data;\n\told_data = aop->data;\n\t\n\tchunk = aop->itemsize;\n\tfor(i=axis+1; ind; i++) {\n\t\tchunk *= aop->dimensions[i];\n\t}\n\t\n\tn_outer = 1;\n\tfor(i=0; idimensions[i];\n\n\tfor(i=0; ind < mps[i]->nd) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"too many dimensions\");\n\t\t\tgoto fail;\n\t\t}\n\t\tif (!PyArray_CompareLists(ap->dimensions+(ap->nd-mps[i]->nd),\n\t\t\t\t mps[i]->dimensions, mps[i]->nd)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"array dimensions must agree\");\n\t\t\tgoto fail;\n\t\t}\n\t\tsizes[i] = PyArray_NBYTES(mps[i]);\n\t}\n\t\n\t/* why not ??? \n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tPyErr_SetString(PyExc_NotImplementedError, \n\t\t\t\t\"Not implemented for flexible sizes\");\n\t\treturn NULL;\n\t}\n\t*/\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap);\n\tif (ret == NULL) goto fail;\n\t\n\telsize = ret->itemsize;\n\tm = PyArray_SIZE(ret);\n\tself_data = (intp *)ap->data;\n\tret_data = ret->data;\n\t\n\tfor (i=0; i= n) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"invalid entry in choice array\");\n\t\t\tgoto fail;\n\t\t}\n\t\toffset = i*elsize;\n\t\tif (offset >= sizes[mi]) {offset = offset % sizes[mi]; }\n\t\tmemmove(ret_data, mps[mi]->data+offset, elsize);\n\t\tret_data += elsize; self_data++;\n\t}\n\t\n\tPyArray_INCREF(ret);\n\tfor(i=0; idescr->compare(a,b,global_obj);\n}\n\n#define SWAPAXES(op, ap) {\t\t\t\t\t\t\\\n\t\torign = (ap)->nd-1;\t\t\t\t\t\\\n\t\tif (axis != orign) {\t\t\t\t\t\\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\n#define SWAPBACK(op, ap) { \\\n\t\tif (axis != orign) { \\\n\t\t\t(op) = (PyAO *)PyArray_SwapAxes((ap), axis, orign); \\\n\t\t\tPy_DECREF((ap));\t\t\t\t\\\n\t\t\tif ((op) == NULL) return NULL;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse (op) = (ap);\t\t\t\t\t\\\n\t}\n\nstatic PyObject *\nPyArray_Sort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap=NULL, *store_arr=NULL;\n\tchar *ip;\n\tint i, n, m, elsize, orign;\n\n\tif ((ap = (PyAO*) _check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_CopyFromObject((PyObject *)op, \n\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tPy_DECREF(ap);\n\t\treturn NULL;\n\t}\n\t\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\n\t/* Store global -- allows re-entry -- restore before leaving*/\n\tstore_arr = global_obj; \n\tglobal_obj = ap;\n\t\n\tfor (ip=ap->data, i=0; iitemsize;\n\tconst intp *ipa = ip1;\n\tconst intp *ipb = ip2;\t\n\treturn global_obj->descr->compare(global_data + (isize * *ipa),\n global_data + (isize * *ipb), \n\t\t\t\t\t global_obj);\n}\n\nstatic PyObject *\nPyArray_ArgSort(PyArrayObject *op, int axis) \n{\n\tPyArrayObject *ap, *ret, *store;\n\tintp *ip;\n\tintp i, j, n, m, orign;\n\tint argsort_elsize;\n\tchar *store_ptr;\n\n\tif ((ap = (PyAO *)_check_axis(op, &axis, 0))==NULL) return NULL;\n\n\tSWAPAXES(op, ap);\n\n\tap = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op, \n\t\t\t\t\t\t\t PyArray_NOTYPE,\n\t\t\t\t\t\t\t 1, 0);\n\tPy_DECREF(op);\n\n\tif (ap == NULL) return NULL;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap);\n\tif (ret == NULL) goto fail;\n\t\n\tif (ap->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tip = (intp *)ret->data;\n\targsort_elsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) goto finish;\n\n\tn = PyArray_SIZE(ap)/m;\n\tstore_ptr = global_data;\n\tglobal_data = ap->data;\n\tstore = global_obj;\n\tglobal_obj = ap;\n\tfor (i=0; idescr->compare;\n\tintp min_i, max_i, i, j;\n\tint location, elsize = ap1->itemsize;\n\tintp elements = ap1->dimensions[ap1->nd-1];\n\tintp n = PyArray_Size((PyObject *)ap2);\n\tintp *rp = (intp *)ret->data;\n\tchar *ip = ap2->data;\n\tchar *vp = ap1->data;\n\n\tfor (j=0; j 0) {\n\t\t\t\t\tif (compare(ip, vp+elsize*(--i), ap2) \\\n\t\t\t\t\t != 0) {\n\t\t\t\t\t\ti = i+1; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmin_i = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (location < 0) {\n\t\t\t\tmax_i = i;\n\t\t\t} else {\n\t\t\t\tmin_i = i+1;\n\t\t\t}\n\t\t}\n\t\t*rp = min_i;\n\t}\n}\n\nstatic PyObject *\nPyArray_SearchSorted(PyArrayObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tint typenum = 0;\n\n\t/* \n PyObject *args;\n args = Py_BuildValue(\"O\",op2);\n\tPy_DELEGATE_ARGS(((PyObject *)op1), searchsorted, args);\n Py_XDECREF(args);\n\t*/\n\n\ttypenum = PyArray_ObjectType((PyObject *)op1, 0);\n\ttypenum = PyArray_ObjectType(op2, typenum);\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)op1, \n\t\t\t\t\t\t\t typenum, \n\t\t\t\t\t\t\t 1, 1);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tret = (PyArrayObject *)PyArray_New(ap2->ob_type, ap2->nd, \n\t\t\t\t\t ap2->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, (PyObject *)ap2);\n\tif (ret == NULL) goto fail;\n\n\tif (ap2->descr->compare == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"compare not supported for type\");\n\t\tgoto fail;\n\t}\n\t\n\tlocal_where(ap1, ap2, ret); \n\t\n\tPy_DECREF(ap1);\n\tPy_DECREF(ap2);\n\treturn (PyObject *)ret;\n\t\n fail:\n\tPy_XDECREF(ap1);\n\tPy_XDECREF(ap2);\n\tPy_XDECREF(ret);\n\treturn NULL;\n}\n\n\n\n/* Could perhaps be redone to not make contiguous arrays \n */\n\nstatic PyObject *\nPyArray_InnerProduct(PyObject *op1, PyObject *op2) \n{\n\tPyArrayObject *ap1, *ap2, *ret;\n\tintp i, j, l, i1, i2, n1, n2;\n\tint typenum;\n\tintp is1, is2, os;\n\tchar *ip1, *ip2, *op;\n\tintp dimensions[MAX_DIMS], nd;\n\tPyArray_DotFunc *dot;\n\tPyTypeObject *subtype;\n double prior1, prior2;\n\t\n\ttypenum = PyArray_ObjectType(op1, 0); \n\ttypenum = PyArray_ObjectType(op2, typenum);\n\t\t\n\tret = NULL;\n\tap1 = (PyArrayObject *)PyArray_ContiguousFromObject(op1, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap1 == NULL) return NULL;\n\tap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, \n\t\t\t\t\t\t\t 0, 0);\n\tif (ap2 == NULL) goto fail;\n\t\n\tif (ap1->nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\t\n\tif (ap2->dimensions[ap2->nd-1] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"matrices are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\n\n\t/* Need to choose an output array that can hold a sum \n\t -- use priority to determine which subtype.\n\t */\n prior2 = PyArray_GetPriority((PyObject *)ap2, 0.0);\n prior1 = PyArray_GetPriority((PyObject *)ap1, 0.0);\n subtype = (prior2 > prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n (PyObject *)\n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = (ret->descr->dotfunc);\n\t\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\n\t\n\tis1 = ap1->strides[ap1->nd-1]; \n\tis2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2nd == 0 || ap2->nd == 0) {\n\t\tret = (ap1->nd == 0 ? ap1 : ap2);\n\t\tret = (PyArrayObject *)ret->ob_type->tp_as_number->\\\n\t\t\tnb_multiply((PyObject *)ap1, (PyObject *)ap2);\n\t\tPy_DECREF(ap1);\n\t\tPy_DECREF(ap2);\n\t\treturn (PyObject *)ret;\n\t}\n\t\n\tl = ap1->dimensions[ap1->nd-1];\n\tif (ap2->nd > 1) {\n\t\tmatchDim = ap2->nd - 2;\n\t\totherDim = ap2->nd - 1;\n\t}\n\telse {\n\t\tmatchDim = 0;\n\t\totherDim = 0;\n\t}\n\n\tif (ap2->dimensions[matchDim] != l) {\n\t\tPyErr_SetString(PyExc_ValueError, \"objects are not aligned\");\n\t\tgoto fail;\n\t}\n\t\n\tif (l == 0) n1 = n2 = 0;\n\telse {\n\t\tn1 = PyArray_SIZE(ap1)/l;\n\t\tn2 = PyArray_SIZE(ap2)/l;\n\t}\n\n\tnd = ap1->nd+ap2->nd-2;\n\tj = 0;\n\tfor(i=0; ind-1; i++) {\n\t\tdimensions[j++] = ap1->dimensions[i];\n\t}\n\tfor(i=0; ind-2; i++) {\n\t\tdimensions[j++] = ap2->dimensions[i];\n\t}\n\tif(ap2->nd > 1) {\n\t\tdimensions[j++] = ap2->dimensions[ap2->nd-1];\n\t}\n\t/*\n\tfprintf(stderr, \"nd=%d dimensions=\", nd);\n\t for(i=0; i prior1 ? ap2->ob_type : ap1->ob_type);\n\n\tret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, \n\t\t\t\t\t typenum, NULL, NULL, 0, 0, \n (PyObject *)\n\t\t\t\t\t (prior2 > prior1 ? ap2 : ap1));\n\tif (ret == NULL) goto fail;\n\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"dot not available for this type\");\n\t\tgoto fail;\n\t}\n\t\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[matchDim];\n\tif(ap1->nd > 1)\n\t\tis1r = ap1->strides[ap1->nd-2];\n\telse\n\t\tis1r = ap1->strides[ap1->nd-1];\n\tis2r = ap2->strides[otherDim];\n\n\top = ret->data; os = ret->itemsize;\n\n\tip1 = ap1->data;\n\tfor(i1=0; i1data;\n\t\tfor(i2=0; i2ob_type, 2, dims, PyArray_TYPE(arr),\n\t\t\t NULL, NULL, elsize, 0, arr);\n\n\tif (ret == NULL) {\n\t\tPy_DECREF(arr);\n\t\treturn NULL;\n\t}\n\t/* do 2-d loop */\n\toptr = PyArray_DATA(ret);\n\tstr2 = elsize*dims[0];\n\tfor (i=0; idimensions[ap1->nd-1];\n\tn2 = ap2->dimensions[ap2->nd-1];\n\n\tif (n1 < n2) { \n\t\tret = ap1; ap1 = ap2; ap2 = ret; \n\t\tret = NULL; i = n1;n1=n2;n2=i;\n\t}\n\tlength = n1;\n\tn = n2;\n\tswitch(mode) {\n\tcase 0:\t\n\t\tlength = length-n+1;\n\t\tn_left = n_right = 0;\n\t\tbreak;\n\tcase 1:\n\t\tn_left = (int)(n/2);\n\t\tn_right = n-n_left-1;\n\t\tbreak;\n\tcase 2:\n\t\tn_right = n-1;\n\t\tn_left = n-1;\n\t\tlength = length+n-1;\n\t\tbreak;\n\tdefault:\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"mode must be 0,1, or 2\");\n\t\tgoto fail;\n\t}\n\t\n\tret = (PyArrayObject *)PyArray_New(ap1->ob_type, 1,\n\t\t\t\t\t &length, typenum, \n\t\t\t\t\t NULL, NULL, 0, 0, \n (PyObject *)ap1);\n\tif (ret == NULL) goto fail;\n\n\t\n\tdot = ret->descr->dotfunc;\n\tif (dot == NULL) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"function not available for this type\");\n\t\tgoto fail;\n\t}\n\t\n\tis1 = ap1->strides[ap1->nd-1]; is2 = ap2->strides[ap2->nd-1];\n\top = ret->data; os = ret->itemsize;\n\t\n\tip1 = ap1->data; ip2 = ap2->data+n_left*is2;\n\tn = n-n_left;\n\tfor(i=0; idescr->argmax;\n\tif (arg_func == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"data type not ordered\");\n\t\tgoto fail;\n\t}\n\n\trp = (PyArrayObject *)PyArray_New(ap->ob_type, ap->nd-1,\n\t\t\t\t\t ap->dimensions, PyArray_INTP,\n\t\t\t\t\t NULL, NULL, 0, 0, \n (PyObject *)ap);\n\tif (rp == NULL) goto fail;\n\n\n\telsize = ap->itemsize;\n\tm = ap->dimensions[ap->nd-1];\n\tif (m == 0) {\n\t\tPyErr_SetString(MultiArrayError, \n\t\t\t\t\"Attempt to get argmax/argmin \"\\\n\t\t\t\t\"of an empty sequence??\");\n\t\tgoto fail;\n\t}\n\tn = PyArray_SIZE(ap)/m;\n\trptr = (intp *)rp->data;\n\tfor (ip = ap->data, i=0; ind + indices->nd - 1;\n for (i=0; i< nd; i++) {\n if (i < axis) {\n shape[i] = self->dimensions[i];\n n *= shape[i];\n } else {\n if (i < axis+indices->nd) {\n shape[i] = indices->dimensions[i-axis];\n m *= shape[i];\n } else {\n shape[i] = self->dimensions[i-indices->nd+1];\n chunk *= shape[i];\n }\n }\n }\n ret = (PyArrayObject *)PyArray_New(self->ob_type, nd, shape, \n\t\t\t\t\t self->descr->type_num,\n\t\t\t\t\t NULL, NULL, 0, 0, \n (PyObject *)self);\n\t\n if (ret == NULL) goto fail;\n\t\n max_item = self->dimensions[axis];\n chunk = chunk * ret->itemsize;\n src = self->data;\n dest = ret->data;\n\t\n for(i=0; idata))[j];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"Index out of range for \"\\\n\t\t\t\t\t\t\"array\");\n goto fail;\n }\n memmove(dest, src+tmp*chunk, chunk);\n dest += chunk;\n }\n src += chunk*max_item;\n }\n\t\n PyArray_INCREF(ret);\n\n Py_XDECREF(indices);\n Py_XDECREF(self);\n\n return (PyObject *)ret;\n\t\n\t\n fail:\n Py_XDECREF(ret);\n Py_XDECREF(indices);\n Py_XDECREF(self);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_Put(PyArrayObject *self, PyObject *indices0, PyObject* values0) \n{\n PyArrayObject *indices, *values;\n int i, chunk, ni, max_item, nv, tmp; \n char *src, *dest;\n\n indices = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \"put: first argument must be contiguous\");\n return NULL;\n }\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n indices = (PyArrayObject *)PyArray_ContiguousFromObject(indices0, PyArray_INTP, 0, 0);\n if (indices == NULL) goto fail;\n ni = PyArray_SIZE(indices);\n\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, self->descr->type_num, \n\t\t\t\t\t 0, 0);\n if (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\n if (nv > 0) { /* nv == 0 for a null array */\n for(i=0; idata + chunk * (i % nv);\n tmp = ((intp *)(indices->data))[i];\n if (tmp < 0) tmp = tmp+max_item;\n if ((tmp < 0) || (tmp >= max_item)) {\n PyErr_SetString(PyExc_IndexError, \"Index out of range for array\");\n goto fail;\n }\n memmove(dest + tmp * chunk, src, chunk);\n }\n }\n\n Py_XDECREF(values);\n Py_XDECREF(indices);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(indices);\n Py_XDECREF(values);\n return NULL;\n}\n\nstatic PyObject *\nPyArray_PutMask(PyArrayObject *self, PyObject *mask0, PyObject* values0) \n{\n PyArrayObject *mask, *values;\n int i, chunk, ni, max_item, nv, tmp, thistype;\n char *src, *dest;\n\n mask = NULL;\n values = NULL;\n\n if (!PyArray_Check(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must \"\\\n\t\t\t\t\"be an array\");\n return NULL;\n }\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: first argument must be contiguous\");\n return NULL;\n }\n\n max_item = PyArray_SIZE(self);\n dest = self->data;\n chunk = self->itemsize;\n\n mask = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(mask0, PyArray_BOOL, 0, 0);\n if (mask == NULL) goto fail;\n ni = PyArray_SIZE(mask);\n if (ni != max_item) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"putmask: mask and data must be \"\\\n\t\t\t\t\"the same size.\");\n goto fail;\n }\n\n\tthistype = self->descr->type_num;\n values = (PyArrayObject *)\\\n\t\tPyArray_ContiguousFromObject(values0, thistype, 0, 0);\n\tif (values == NULL) goto fail;\n nv = PyArray_SIZE(values);\t /* zero if null array */\n if (nv > 0) {\n\t\tfor(i=0; idata + chunk * (i % nv);\n\t\t\ttmp = ((Bool *)(mask->data))[i];\n\t\t\tif (tmp) {\n\t\t\t\tmemmove(dest + i * chunk, src, chunk);\n\t\t\t\tif (thistype == PyArray_OBJECT)\n\t\t\t\t\tPy_INCREF(*((PyObject **)src));\n\t\t\t}\n\t\t}\n }\n\n Py_XDECREF(values);\n Py_XDECREF(mask);\n Py_INCREF(Py_None);\n return Py_None;\n\t\n fail:\n Py_XDECREF(mask);\n Py_XDECREF(values);\n return NULL;\n}\n\n\n/* This conversion function can be used with the \"O&\" argument for\n PyArg_ParseTuple. It will immediately return an object of array type\n or will convert to a CARRAY any other object. \n\n If you use PyArray_Converter, you must DECREF the array when finished\n as you get a new reference to it.\n*/\n \nstatic int \nPyArray_Converter(PyObject *object, PyObject **address) \n{\n if (PyArray_Check(object)) {\n *address = object;\n\t\tPy_INCREF(object);\n return PY_SUCCEED;\n }\n else {\n\t\t*address = PyArray_FromAny(object, NULL, 0, 0, CARRAY_FLAGS);\n\t\tif (*address == NULL) return PY_FAIL;\n\t\treturn PY_SUCCEED;\n }\n}\n\nstatic int\nPyArray_BoolConverter(PyObject *object, Bool *val)\n{\n\tif (PyObject_IsTrue(object)) *val=TRUE;\n\telse *val=FALSE;\n\tif (PyErr_Occurred()) return PY_FAIL;\n\treturn PY_SUCCEED;\n}\n\n\nstatic int\nPyArray_TypestrConvert(int itemsize, int gentype)\n{\n\tregister int newtype = gentype;\n\t\n\tif (gentype == PyArray_SIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_INT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_INT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_INT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_INT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_INT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\n\t}\n\n\telse if (gentype == PyArray_UNSIGNEDLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 1:\n\t\t\tnewtype = PyArray_UINT8;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tnewtype = PyArray_UINT16;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tnewtype = PyArray_UINT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_UINT64;\n\t\t\tbreak;\n#ifdef PyArray_INT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_UINT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t\tbreak;\n\t\t}\n\t}\n\telse if (gentype == PyArray_FLOATINGLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 4:\n\t\t\tnewtype = PyArray_FLOAT32;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tnewtype = PyArray_FLOAT64;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 10:\n\t\t\tnewtype = PyArray_FLOAT80;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 12:\n\t\t\tnewtype = PyArray_FLOAT96;\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 16:\n\t\t\tnewtype = PyArray_FLOAT128;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\t\n\telse if (gentype == PyArray_COMPLEXLTR) {\n\t\tswitch(itemsize) {\n\t\tcase 8:\n\t\t\tnewtype = PyArray_COMPLEX64;\n\t\t\tbreak;\n\t\tcase 16:\n\t\t\tnewtype = PyArray_COMPLEX128;\n\t\t\tbreak;\n#ifdef PyArray_FLOAT80\n case 20:\n\t\t\tnewtype = PyArray_COMPLEX160;\n\t\t\tbreak;\n#endif\n#ifdef PyArray_FLOAT96\n\t\tcase 24:\n\t\t\tnewtype = PyArray_COMPLEX192;\t\t\t\n\t\t\tbreak;\n#endif\t\t \n#ifdef PyArray_FLOAT128\n\t\tcase 32:\n\t\t\tnewtype = PyArray_COMPLEX256;\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tnewtype = PyArray_NOTYPE;\n\t\t}\t\t\n\t}\n\n\treturn newtype;\n}\n\n\n/* this function takes a Python object which exposes the (single-segment)\n buffer interface and returns a pointer to the data segment\n \n You should increment the reference count by one of buf->base\n if you will hang on to a reference\n\n You only get a borrowed reference to the object. Do not free the\n memory...\n*/\n\n\nstatic int\nPyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf)\n{\n int buflen;\n\n buf->ptr = NULL;\n buf->flags = WRITEABLE;\n buf->base = NULL;\n\n\tif (obj == Py_None)\n\t\treturn PY_SUCCEED;\n\n if (PyObject_AsWriteBuffer(obj, &(buf->ptr), &buflen) < 0) {\n PyErr_Clear();\n buf->flags &= ~WRITEABLE;\n if (PyObject_AsReadBuffer(obj, (const void **)&(buf->ptr), \n &buflen) < 0)\n return PY_FAIL;\n }\n buf->len = (intp) buflen;\n \n /* Point to the base of the buffer object if present */\n if (PyBuffer_Check(obj)) buf->base = ((PyArray_Chunk *)obj)->base;\n if (buf->base == NULL) buf->base = obj;\n \n return PY_SUCCEED; \n}\n\n\n\n/* This function takes a Python sequence object and allocates and\n fills in an intp array with the converted values.\n\n **Remember to free the pointer seq.ptr when done using\n PyDimMem_FREE(seq.ptr)**\n*/\n\nstatic int\nPyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq)\n{\n int len;\n int nd;\n\n seq->ptr = NULL;\n if (obj == Py_None) return PY_SUCCEED;\n len = PySequence_Size(obj);\n if (len == -1) { /* Check to see if it is a number */\n if (PyNumber_Check(obj)) len = 1;\n }\n if (len < 0) {\n PyErr_SetString(PyExc_TypeError, \n \"Expected sequence object with len >= 0\");\n return PY_FAIL;\n }\n if (len > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError, \"Sequence too large, \" \\\n \"must be smaller than %d\", MAX_DIMS);\n return PY_FAIL;\n }\n\tif (len > 0) {\n\t\tseq->ptr = PyDimMem_NEW(len);\n\t\tif (seq->ptr == NULL) {\n\t\t\tPyErr_NoMemory();\n\t\t\treturn PY_FAIL;\n\t\t}\n\t}\n seq->len = len;\n nd = PyArray_IntpFromSequence(obj, (intp *)seq->ptr, len);\n if (nd == -1 || nd != len) goto fail;\n return PY_SUCCEED;\n\n fail:\n\tPyDimMem_FREE(seq->ptr);\n\treturn PY_FAIL;\n}\n\n/* This function takes a Python object representing a type and converts it \n to a C type_num and an itemsize (elements of PyArray_Typecode structure)\n \n Many objects can be used to represent a type.\n */\n\nstatic int\nPyArray_TypecodeConverter(PyObject *obj, PyArray_Typecode *at)\n{\n char *type;\n PyArray_Descr *descr;\n int check_num=PyArray_NOTYPE+10;\n\tint len;\n\tPyObject *item, *attr=NULL;\n\n\tat->itemsize = 0;\n if (obj == Py_None) {\n at->type_num = PyArray_NOTYPE;\n return PY_SUCCEED;\n }\n\n if (PyType_Check(obj) && PyType_IsSubtype((PyTypeObject *)obj, \n &PyGenericArrType_Type)) {\n PyArray_TypecodeFromTypeObject(obj, at);\n return PY_SUCCEED;\n }\n\n\n\t/* type object could be an array */\n\tif (PyArray_Check(obj)) {\n\t\tat->type_num = PyArray_TYPE(obj);\n\t\tat->itemsize = PyArray_ITEMSIZE(obj);\n\t\treturn PY_SUCCEED;\n\t}\n\n\t/* or an array scalar */\n if (PyArray_IsScalar(obj, Generic)) {\n PyArray_TypecodeFromScalar(obj, at);\n return PY_SUCCEED;\n }\n\n\t/* or a typecode string */\n\n\tif (PyString_Check(obj)) {\n\t\t/* Check for a string typecode. */\n\t\ttype = PyString_AS_STRING(obj);\n\t\tlen = PyString_GET_SIZE(obj);\t\t\n\t\tif (len > 0) {\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tif (len > 1) {\n\t\t\tat->itemsize = atoi(type+1);\n\t\t\t/* When specifying length of UNICODE\n\t\t\t the number of characters is given to match \n\t\t\t the STRING interface. Each character can be\n\t\t\t more than one byte and itemsize must be\n\t\t\t the number of bytes.\n\t\t\t*/\n\t\t\tif (check_num == PyArray_UNICODELTR ||\t\\\n\t\t\t check_num == PyArray_UNICODE) \n\t\t\t at->itemsize *= sizeof(Py_UNICODE);\n\n\t\t\t/* Support for generic processing */\n\t\t\telse if ((check_num != PyArray_STRINGLTR) &&\n\t\t\t\t (check_num != PyArray_VOIDLTR) &&\n\t\t\t\t (check_num != PyArray_STRING) &&\n\t\t\t\t (check_num != PyArray_VOID)) {\n\t\t\t\tcheck_num = \\\n\t\t\t\t\tPyArray_TypestrConvert(at->itemsize, \n\t\t\t\t\t\t\t check_num);\n\t\t\t at->itemsize = 0;\n\t\t\t\tif (check_num == PyArray_NOTYPE) goto fail;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Arbitray object with dtypenum and itemsize attributes. */\n\telse if (PyObject_HasAttrString(obj, \"dtypenum\") && \n\t PyObject_HasAttrString(obj, \"itemsize\")) {\n\t\tattr = PyObject_GetAttrString(obj, \"dtypenum\");\n\t\tcheck_num = PyInt_AsLong(attr);\n\t\tif (PyErr_Occurred()) { /* not an integer, try character */\n\t\t\tPyErr_Clear();\n\t\t\ttype = PyString_AsString(attr);\n\t\t\tcheck_num = (int) type[0];\n\t\t}\n\t\tPy_XDECREF(attr);\n\t\tif (!PyErr_Occurred()) {\n\t\t\tattr = PyObject_GetAttrString(obj, \"itemsize\");\n\t\t\tat->itemsize = PyInt_AsLong(attr);\n\t\t\tPy_XDECREF(attr);\n\t\t}\t\t\t\n\t}\t\t\n\telse if (PyType_Check(obj)) {\n\t\tcheck_num = PyArray_OBJECT;\n\t\tif (obj == (PyObject *)(&PyInt_Type)) \n\t\t\tcheck_num = PyArray_LONG;\n\t\telse if (obj == (PyObject *)(&PyBool_Type))\n\t\t\tcheck_num = PyArray_BOOL;\n\t\telse if (obj == (PyObject *)(&PyFloat_Type)) \n\t\t\tcheck_num = PyArray_DOUBLE;\n\t\telse if (obj == (PyObject *)(&PyComplex_Type)) \n\t\t\tcheck_num = PyArray_CDOUBLE;\n else if (obj == (PyObject *)(&PyString_Type))\n check_num = PyArray_STRING;\n else if (obj == (PyObject *)(&PyUnicode_Type))\n check_num = PyArray_UNICODE;\n\t}\t\n else { /* Default -- try integer conversion */\n check_num = PyInt_AsLong(obj);\n\t}\n\n\tif (PyErr_Occurred()) goto fail;\n\n\t/*\n\tif (check_num == PyArray_NOTYPE) return PY_FAIL;\n\t*/\n\tif (check_num == PyArray_NOTYPE) {\n\t\tat->type_num = PyArray_NOTYPE;\n\t\tat->itemsize = 0;\n\t\treturn PY_SUCCEED;\n\t}\n\n if ((descr = PyArray_DescrFromType(check_num))==NULL) {\n\t\t/* Now check to see if the object is registered\n\t\t in typeDict */\n\t\tif (typeDict != NULL) {\n\t\t\titem = PyDict_GetItem(typeDict, obj);\n\t\t\tif (item) {\n\t\t\t\tPyArray_TypecodeFromTypeObject(obj, at);\n\t\t\t\tPyErr_Clear();\n\t\t\t\treturn PY_SUCCEED;\n\t\t\t}\n\t\t}\n return PY_FAIL;\n\t}\n\t\n at->type_num = descr->type_num;\n\tif (at->itemsize == 0) at->itemsize = descr->elsize;\n\t\n return PY_SUCCEED;\n fail:\n\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\"data type not understood\");\n\treturn PY_FAIL;\n}\t\n\n\n/* This function returns true if the two typecodes are \n equivalent (same basic kind and same itemsize).\n*/\n\nstatic Bool\nPyArray_EquivalentTypes(PyArray_Typecode *typ1, PyArray_Typecode *typ2)\n{\n\tregister int typenum1=typ1->type_num;\n\tregister int typenum2=typ2->type_num;\n\tregister int size1=typ1->itemsize;\n\tregister int size2=typ2->itemsize;\n\n\tif (size1 != size2) return FALSE;\n\tif (typenum1==typenum2) return TRUE;\n\n\t/* If we are here then size1 == size2 */\n\tif (typenum1 < PyArray_FLOAT) {\n\t\tif (PyTypeNum_ISBOOL(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISBOOL(typenum2));\n\t\telse if (PyTypeNum_ISUNSIGNED(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISUNSIGNED(typenum2));\n\t\telse \n\t\t\treturn (Bool)(PyTypeNum_ISSIGNED(typenum2));\n\t}\n\telse {\n\t\tif (PyTypeNum_ISFLOAT(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISFLOAT(typenum2));\n\t\telse if (PyTypeNum_ISCOMPLEX(typenum1))\n\t\t\treturn (Bool)(PyTypeNum_ISCOMPLEX(typenum2));\n\t}\n\t/* Default size1 != size2 and typenum1 != typenum2 */\n\treturn FALSE;\t\n}\n\nstatic Bool \nPyArray_EquivArrTypes(PyArrayObject *a1, PyArrayObject *a2)\n{\n PyArray_Typecode type1={PyArray_TYPE(a1), PyArray_ITEMSIZE(a1), 0};\n PyArray_Typecode type2={PyArray_TYPE(a2), PyArray_ITEMSIZE(a2), 0};\n \n return PyArray_EquivalentTypes(&type1, &type2);\n}\n\n\n/*** END C-API FUNCTIONS **/\n\n\n#define _ARET(x) PyArray_Return((PyArrayObject *)(x))\n\nstatic char doc_fromobject[] = \"array(object, dtype=None, copy=1, fortran=0) will return a new array formed from the given object type given. Object can anything with an __array__ method, or any (nested) sequence. If no type is given, then the type will be determined as the minimum type required to hold the objects in the sequence. If copy is zero and sequence is already an array with the right type, a reference will be returned. If the sequence is an array, type can be used only to upcast the array. For downcasting use .astype(t) method.\";\n\nstatic PyObject *\n_array_fromobject(PyObject *ignored, PyObject *args, PyObject *kws)\n{\n\tPyObject *op, *ret=NULL;\n\tstatic char *kwd[]= {\"object\", \"dtype\", \"copy\", \"fortran\", NULL};\n\tBool copy=TRUE;\n\tPyArray_Typecode type = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode oldtype = {PyArray_NOTYPE, 0, 0};\n\tint type_num;\n\tBool fortran=FALSE;\n\tint flags=0;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|O&O&O&\", kwd, &op, \n\t\t\t\t\tPyArray_TypecodeConverter,\n &type, \n\t\t\t\t\tPyArray_BoolConverter, ©, \n\t\t\t\t\tPyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\ttype_num = type.type_num;\n\n\t/* fast exit if simple call */\n\tif (PyArray_Check(op) && (copy==0) &&\t\t\t\\\n\t (fortran == PyArray_CHKFLAGS(op, FORTRAN))) {\n\t\tif (type_num == PyArray_NOTYPE) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t\t/* One more chance */\n\t\toldtype.type_num = PyArray_TYPE(op);\n\t\toldtype.itemsize = PyArray_ITEMSIZE(op);\n\t\tif (PyArray_EquivalentTypes(&oldtype, &type)) {\n\t\t\tPy_INCREF(op);\n\t\t\treturn op;\n\t\t}\n\t}\n\n\ttype.fortran = fortran; \n\tif (copy) {\n\t\tflags = ENSURECOPY;\n\t}\n\n\tif ((ret = PyArray_FromAny(op, &type, 0, 0, flags)) == NULL) \n\t\treturn NULL;\n\n\treturn _ARET(ret);\n}\n\nstatic PyObject *\nPyArray_Empty(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n \n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n PyArray_FillObjectArray(ret, Py_None);\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic char doc_empty[] = \"empty((d1,...,dn),dtype=intp,fortran=0) will return a new array\\n of shape (d1,...,dn) and given type with all its entries uninitialized. This can be faster than zeros.\";\n\nstatic PyObject *\narray_empty(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter, &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Empty(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_scalar[] = \"scalar(dtypestr,obj) will return a new scalar array of the given type initialized with obj. Mainly for pickle support. typestr must be a valid data typestr (complete with < > or |). If dtypestr is object, then obj can be any object, otherwise obj must be a string. If obj is not given it will be interpreted as None for object type and zeros for all other types.\";\n\nstatic PyObject *\narray_scalar(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n \n\tstatic char *kwlist[] = {\"dtypestr\",\"obj\", NULL};\n\tPyArray_Typecode typecode;\n\tPyObject *obj=NULL;\n\tchar *typestr;\n\tint typestrlen;\n\tint swap, alloc=0;\n\tvoid *dptr;\n\tPyObject *ret;\n\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"z#|O\",\n\t\t\t\t\t kwlist, &typestr, &typestrlen,\n\t\t\t\t\t &obj)) \n\t\treturn NULL;\n\t\n\tif (_array_typecode_fromstr(typestr, &swap, &typecode) < 0) \n\t\treturn NULL;\n\t\n\tif (typecode.itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\t\t\\\n\t\t\t\t\"itemsize cannot be zero\");\n\t\treturn NULL;\n\t}\n\n\tif (typecode.type_num == PyArray_OBJECT) {\n\t\tif (obj == NULL) obj = Py_None;\n\t\tdptr = &obj;\n\t\tswap = 0;\n\t}\n\telse {\n\t\tif (obj == NULL) {\n\t\t\tdptr = malloc(typecode.itemsize);\n\t\t\tif (dptr == NULL) {\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tmemset(dptr, '\\0', typecode.itemsize);\n\t\t\talloc = 1;\n\t\t}\n\t\telse {\n\t\t\tif (!PyString_Check(obj)) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"initializing object must \"\\\n\t\t\t\t\t\t\"be a string.\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (PyString_GET_SIZE(obj) < typecode.itemsize) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"initialization string is too\"\\\n\t\t\t\t\t\t\" small\");\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = PyString_AS_STRING(obj);\n\t\t}\n\t}\n\n\tret = PyArray_Scalar(dptr, typecode.type_num,\n\t\t\t typecode.itemsize, swap); \n\n\t/* free dptr which contains zeros */\n\tif (alloc) free(dptr);\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_Zeros(int nd, intp *dims, PyArray_Typecode *type)\n{\n\tPyArrayObject *ret;\n\tintp n;\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, nd, dims, \n\t\t\t\t\t type->type_num,\n\t\t\t\t\t NULL, NULL, type->itemsize, \n\t\t\t\t\t type->fortran, NULL);\n\tif (ret == NULL) return NULL;\n \n\tn = PyArray_SIZE(ret);\n\tif ((PyArray_TYPE(ret) == PyArray_OBJECT)) {\n\t\tPyObject *zero = PyInt_FromLong(0);\n PyArray_FillObjectArray(ret, zero);\n Py_DECREF(zero);\n\t}\n\telse {\t\t\n\t\tmemset(ret->data, 0, n*(ret->itemsize));\n\t}\n\treturn (PyObject *)ret;\n\n}\n\nstatic char doc_zeros[] = \"zeros((d1,...,dn),dtype=intp,fortran=0) will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero.\";\n\n\nstatic PyObject *\narray_zeros(PyObject *ignored, PyObject *args, PyObject *kwds) \n{\n\tstatic char *kwlist[] = {\"shape\",\"dtype\",\"fortran\",NULL};\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n PyArray_Dims shape;\n\tBool fortran = FALSE;\t\n PyObject *ret;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&|O&O&\",\n\t\t\t\t\t kwlist, PyArray_IntpConverter,\n &shape, \n PyArray_TypecodeConverter,\n\t\t\t\t\t &typecode, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &fortran)) \n\t\treturn NULL;\n\t\n\ttypecode.fortran = fortran;\n if (typecode.type_num ==PyArray_NOTYPE) \n\t\ttypecode.type_num = PyArray_INTP;\n \n\tret = PyArray_Zeros(shape.len, shape.ptr, &typecode); \n PyDimMem_FREE(shape.ptr);\n return ret;\n}\n\nstatic char doc_set_typeDict[] = \"set_typeDict(dict) set the internal \"\\\n\t\"dictionary that can look up an array type using a registered \"\\\n\t\"code\";\n\nstatic PyObject *\narray_set_typeDict(PyObject *ignored, PyObject *args)\n{\n\tPyObject *dict;\n\tif (!PyArg_ParseTuple(args, \"O\", &dict)) return NULL;\n\tPy_XDECREF(typeDict); /* Decrement old reference (if any)*/\n\ttypeDict = dict;\n\tPy_INCREF(dict); /* Create an internal reference to it */\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char doc_fromString[] = \"fromstring(string, dtype=intp, count=-1, swap=False) returns a new 1d array initialized from the raw binary data in string. If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.\";\n\nstatic PyObject *\narray_fromString(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyArrayObject *ret; \n\tchar *data;\n\tlonglong nin=-1;\n\tintp s, n;\n\tstatic char *kwlist[] = {\"string\", \"dtype\", \"count\", \"swap\",NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint itemsize;\n\tint swapped=FALSE;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"s#|O&LO&\", kwlist, \n\t\t\t\t\t &data, &s, \n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, \n\t\t\t\t\t PyArray_BoolConverter,\n\t\t\t\t\t &swapped)) {\n\t\treturn NULL;\n\t}\n\t\n\tn = (intp) nin;\n\n\titemsize = type.itemsize;\n\tif (itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \"zero-valued itemsize.\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"string is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype.type_num, NULL, \n\t\t\t\t\t\tNULL, itemsize, 0,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\t\n\tmemcpy(ret->data, data, n*ret->itemsize);\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPyArray_INCREF(ret);\n\treturn (PyObject *)ret;\n}\n\n\n/* This needs an open file object and reads it in directly. \n memory-mapped files handled differently through buffer interface.\n\nfile pointer number in resulting 1d array \n(can easily reshape later, -1 for to end of file)\ntype of array\nsep is a separator string for character-based data (or NULL for binary)\n \" \" means whitespace\n*/\n\nstatic char doc_fromfile[] = \"\";\n\nstatic int\n_fill_in_itemsize(PyArray_Typecode *typecode)\n{\n\tPyArray_Descr *descr;\n\tdescr = PyArray_DescrFromType(typecode->type_num);\n\tif (descr==NULL) return -1;\n\ttypecode->itemsize = descr->elsize;\n\treturn 0;\n}\n\n\nstatic PyObject *\nPyArray_FromFile(FILE *fp, PyArray_Typecode *typecode, intp num, char *sep)\n{\n\tPyArrayObject *r;\n\tsize_t nread = 0;\n\tPyArray_ScanFunc *scan;\n\n\tif (typecode->itemsize == 0) {\n\t\tif (_fill_in_itemsize(typecode) < 0) \n\t\t\treturn NULL;\n\t}\n\n\tif (num == -1 && sep == NULL) { /* Get size for binary file*/\n\t\tintp start, numbytes;\n\t\tstart = (intp )ftell(fp);\n\t\tfseek(fp, 0, SEEK_END);\n\t\tnumbytes = (intp )ftell(fp) - start;\n\t\tfseek(fp, (long) start, SEEK_SET);\n\t\tif (numbytes == -1) {\n\t\t\tPyErr_SetString(PyExc_IOError, \"Could not seek in file.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tif (typecode->itemsize == 0) {\n\t\t\ttypecode->itemsize = numbytes;\n\t\t\tnum = 1;\n\t\t}\n\t\telse {\n\t\t\tnum = numbytes / typecode->itemsize;\n\t\t}\n\t}\n\t\n\tif (sep==NULL) { /* binary data */\n\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &num, \n\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t typecode->itemsize, 0, NULL);\n\t\tif (r==NULL) return NULL;\n\t\tnread = fread(r->data, typecode->itemsize, num, fp);\n\t}\n\telse { /* character reading */\n\t\tintp i;\n\t\tchar *dptr;\n\n\t\tif (num != -1) { /* number to read is known */\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &num, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tdptr = r->data;\n\t\t\tfor (i=0; i < num-1; i++) {\n\t\t\t\tif (scan(fp, dptr, r->itemsize, sep, NULL))\n\t\t\t\t\tbreak;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tif (!(scan(fp, dptr, r->itemsize, NULL, NULL)))\n\t\t\t\tnread += 1;\n\t\t}\n\t\telse { /* we have to watch for the end of the file and \n\t\t\t reallocate at the end */\n#define _FILEBUFNUM 4096\n\t\t\tintp thisbuf=0;\n\t\t\tintp size = _FILEBUFNUM;\n\t\t\tintp bytes;\n\t\t\tintp totalbytes;\n\t\t\tint done=0;\n\t\t\tr = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, \n\t\t\t\t\t\t\t &size, \n\t\t\t\t\t\t\t typecode->type_num,\n\t\t\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t\t\t typecode->itemsize, \n\t\t\t\t\t\t\t 0, NULL);\n\t\t\tif (r==NULL) return NULL;\n\t\t\ttotalbytes = bytes = size * typecode->itemsize;\n\t\t\tdptr = r->data;\n\t\t\tscan = r->descr->scanfunc;\n\t\t\tif (scan == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"Don't know how to read \"\\\n\t\t\t\t\t\t\"character files with that \"\\\n\t\t\t\t\t\t\"array type\");\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\twhile (!done) {\n\t\t\t\tdone = scan(fp, dptr, r->itemsize, sep, NULL);\n\t\t\t\t/* end of file reached trying to \n\t\t\t\t scan value \n\t\t\t\t*/\n\t\t\t\tif (done == 1 || done < 0) break;\n\t\t\t\n\t\t\t\tthisbuf += 1;\n\t\t\t\tnread += 1;\n\t\t\t\tdptr += r->itemsize;\n\t\t\t\tif (!done && thisbuf == size) {\n\t\t\t\t\ttotalbytes += bytes;\n\t\t\t\t\tr->data = PyDataMem_RENEW(r->data, \n\t\t\t\t\t\t\t\t totalbytes);\n\t\t\t\t\tdptr = r->data + (totalbytes - bytes);\n\t\t\t\t\tthisbuf = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (PyErr_Occurred()) {\n\t\t\t\tPy_DECREF(r);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tr->data = PyDataMem_RENEW(r->data, nread*r->itemsize);\n\t\t\tPyArray_DIM(r,0) = nread;\n\t\t\tnum = nread;\n#undef _FILEBUFNUM\n\t\t}\n\t}\n\tif (nread < num) {\n\t\tchar msg[80];\n\t\tsnprintf(msg, 80, \n\t\t\t \"%ld items requested only %ld read\", (long) num, \n (long) nread);\n\t\tif (PyErr_Warn(PyExc_RuntimeWarning, msg) < 0) {\n\t\t\tPy_DECREF(r);\n\t\t\treturn NULL;\n\t\t}\n\t\tr->data = PyDataMem_RENEW(r->data, nread * r->itemsize);\n\t\tPyArray_DIM(r,0) = nread;\n\t}\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_fromfile(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *file=NULL, *ret;\n\tFILE *fp;\n\tchar *sep=\"\";\n\tchar *mode=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"file\", \"dtype\", \"count\", \"sep\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Ls\", kwlist, \n\t\t\t\t\t &file,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &sep)) {\n\t\treturn NULL;\n\t}\n\n\tif (PyString_Check(file)) {\n\t\tif (sep == \"\") mode=\"rb\";\n\t\telse mode=\"r\";\n\t\tfile = PyFile_FromString(PyString_AS_STRING(file), mode);\n\t\tif (file==NULL) return NULL;\n\t}\n\telse {\n\t\tPy_INCREF(file);\n\t}\n\tfp = PyFile_AsFile(file);\n\tif (fp == NULL) {\n\t\tPyErr_SetString(PyExc_IOError, \"First argument must be an open file\");\n\t\tPy_DECREF(file);\n\t\treturn NULL;\n\t}\n\tret = PyArray_FromFile(fp, &type, (intp) nin, sep);\n\tPy_DECREF(file);\n\treturn ret;\n}\n\nstatic PyObject *\nPyArray_FromBuffer(PyObject *buf, PyArray_Typecode *type, \n\t\t intp count, int swapped) \n{\n\tPyArrayObject *ret;\n\tchar *data;\n\tint ts;\n\tintp s, n;\n\tint itemsize;\n\tint write=1;\n\n\tif (type->type_num == PyArray_OBJECT) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Cannot create an OBJECT array from memory\"\\\n\t\t\t\t\" buffer.\");\n\t\treturn NULL;\n\t}\n\tif (type->itemsize == 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Itemsize cannot be zero in type\");\n\t\treturn NULL;\n\t}\n\n\tif (PyObject_AsWriteBuffer(buf, (void *)&data, &ts)==-1) {\n\t\twrite = 0;\n\t\tPyErr_Clear();\n\t\tif (PyObject_AsReadBuffer(buf, (void *)&data, &ts)==-1) {\n\t\t\treturn NULL;\n\t\t}\n\t}\n\ts = (intp)ts;\t\n\tn = (intp)count;\n\titemsize = type->itemsize;\n\t\n\tif (n < 0 ) {\n\t\tif (s % itemsize != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer size must be a multiple\"\\\n\t\t\t\t\t\" of element size\");\n\t\t\treturn NULL;\n\t\t}\n\t\tn = s/itemsize;\n\t} else {\n\t\tif (s < n*itemsize) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"buffer is smaller than requested\"\\\n\t\t\t\t\t\" size\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tif ((ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 1, &n, \n\t\t\t\t\t\ttype->type_num, NULL, \n\t\t\t\t\t\tdata, itemsize, DEFAULT_FLAGS,\n\t\t\t\t\t\tNULL)) == NULL)\n\t\treturn NULL;\n\t\n\tif (!write) ret->flags &= ~WRITEABLE;\n\tif (swapped) ret->flags &= ~NOTSWAPPED;\n\tPy_INCREF(buf);\n\t/* Store a reference for decref on deallocation */\n\tret->base = buf;\n\tPyArray_UpdateFlags(ret, ALIGNED);\n\treturn (PyObject *)ret; \t\n}\n\nstatic char doc_frombuffer[] = \"\";\n\nstatic PyObject *\narray_frombuffer(PyObject *ignored, PyObject *args, PyObject *keywds)\n{\n\tPyObject *obj=NULL;\n\tlonglong nin=-1;\n\tstatic char *kwlist[] = {\"buffer\", \"dtype\", \"count\", \n\t\t\t\t \"swap\", NULL};\n\tPyArray_Typecode type = {PyArray_INTP, sizeof(intp), 0};\n\tint swapped=0;\n\n\tif (!PyArg_ParseTupleAndKeywords(args, keywds, \"O|O&Li\", kwlist, \n\t\t\t\t\t &obj,\n\t\t\t\t\t PyArray_TypecodeConverter, &type,\n\t\t\t\t\t &nin, &swapped)) {\n\t\treturn NULL;\n\t}\n\n\treturn PyArray_FromBuffer(obj, &type, (intp)nin, swapped);\n}\n\n\n\nstatic char doc_concatenate[] = \"concatenate((a1,a2,...),axis=None).\";\n\nstatic PyObject *\narray_concatenate(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *a0;\n\tint axis=0;\n\tstatic char *kwlist[] = {\"seq\", \"axis\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"O|O&\", kwlist,\n\t\t\t\t\t &a0,\n\t\t\t\t\t PyArray_AxisConverter, &axis))\n\t\treturn NULL;\n\treturn PyArray_Concatenate(a0, axis);\n}\n\nstatic char doc_innerproduct[] = \\\n\t\"inner(a,b) returns the dot product of two arrays, which has\\n\"\\\n\t\"shape a.shape[:-1] + b.shape[:-1] with elements computed by\\n\" \\\n\t\"the product of the elements from the last dimensions of a and b.\";\n\nstatic PyObject *array_innerproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *b0, *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a0, &b0)) return NULL;\n\t\n\treturn _ARET(PyArray_InnerProduct(a0, b0));\n}\n\nstatic char doc_matrixproduct[] = \\\n\t\"dot(a,v) returns matrix-multiplication between a and b. \\n\"\\\n\t\"The product-sum is over the last dimension of a and the \\n\"\\\n\t\"second-to-last dimension of b.\";\n\nstatic PyObject *array_matrixproduct(PyObject *dummy, PyObject *args) {\n\tPyObject *v, *a;\n\t\n\tif (!PyArg_ParseTuple(args, \"OO\", &a, &v)) return NULL;\n\t\n\treturn _ARET(PyArray_MatrixProduct(a, v));\n}\n\nstatic char doc_fastCopyAndTranspose[] = \"_fastCopyAndTranspose(a)\";\n\nstatic PyObject *array_fastCopyAndTranspose(PyObject *dummy, PyObject *args) {\n\tPyObject *a0;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &a0)) return NULL;\n\t\n\treturn _ARET(PyArray_CopyAndTranspose(a0));\n}\n\nstatic char doc_correlate[] = \"cross_correlate(a,v, mode=0)\";\n\nstatic PyObject *array_correlate(PyObject *dummy, PyObject *args, PyObject *kwds) {\n\tPyObject *shape, *a0;\n\tint mode=0;\n\tstatic char *kwlist[] = {\"a\", \"v\", \"mode\", NULL};\n\t\n\tif (!PyArg_ParseTupleAndKeywords(args, kwds, \"OO|i\", kwlist, \n\t\t\t\t\t &a0, &shape, &mode)) return NULL;\n\t\n\treturn PyArray_Correlate(a0, shape, mode);\n}\n\n\nstatic PyObject *\nPyArray_Arange(double start, double stop, double step, int type_num)\n{\n\tintp length, i;\n\tPyObject *range;\n\tchar *rptr;\n\tint elsize, type;\n\tdouble value;\n\tPyArray_Descr *dbl_descr;\n\n\tlength = (intp ) ceil((stop - start)/step);\n \n\tif (length <= 0) {\n\t\tlength = 0;\n\t\treturn PyArray_New(&PyArray_Type, 1, &length, type_num,\n\t\t\t\t NULL, NULL, 0, 0, NULL);\n\t}\n\n\trange = PyArray_New(&PyArray_Type, 1, &length, type_num, \n\t\t\t NULL, NULL, 0, 0, NULL);\n\tif (range == NULL) return NULL;\n\tdbl_descr = PyArray_DescrFromType(PyArray_DOUBLE);\n \n\trptr = ((PyArrayObject *)range)->data;\n\telsize = ((PyArrayObject *)range)->itemsize;\n\ttype = ((PyArrayObject *)range)->descr->type_num;\n\tfor (i=0; i < length; i++) {\n\t\tvalue = start + i*step;\n\t\tdbl_descr->cast[type]((char*)&value, rptr, 1, NULL, \n\t\t\t\t (PyArrayObject *)range);\n\t\trptr += elsize;\n\t}\n \n\treturn range;\n}\n\n\nstatic char doc_arange[] = \"arange(start, stop=None, step=1, dtype=intp)\\n\\n Just like range() except it returns an array whose type can be\\n specified by the keyword argument typecode.\";\n\nstatic PyObject *\narray_arange(PyObject *ignored, PyObject *args, PyObject *kws) {\n\tPyObject *o_start=NULL, *o_stop=Py_None, *o_step=NULL;\n\tstatic char *kwd[]= {\"start\", \"stop\", \"step\", \"dtype\", NULL};\n\tdouble start, stop, step;\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0};\n\tint type_num;\n\tint deftype = PyArray_INTP;\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kws, \"O|OOO&\", kwd, &o_start,\n\t\t\t\t\t&o_stop, &o_step, \n\t\t\t\t\tPyArray_TypecodeConverter, \n\t\t\t\t\t&typecode)) \n\t\treturn NULL;\n\n\tdeftype = PyArray_ObjectType(o_start, deftype);\n\tif (o_stop != Py_None) {\n\t\tdeftype = PyArray_ObjectType(o_stop, deftype);\n\t}\n\tif (o_step != NULL) {\n\t\tdeftype = PyArray_ObjectType(o_step, deftype);\n\t}\n\n\ttype_num = typecode.type_num;\n\tif (type_num == PyArray_NOTYPE) {\n\t\ttype_num = deftype;\n\t}\n\n\tstart = PyFloat_AsDouble(o_start);\n\tif error_converting(start) return NULL;\n\n\tif (o_step == NULL) {\n\t\tstep = 1;\n\t}\n\telse {\n\t\tstep = PyFloat_AsDouble(o_step);\n\t\tif error_converting(step) return NULL;\n\t}\n\n\tif (o_stop == Py_None) {\n\t\tstop = start;\n\t\tstart = 0;\n\t}\n\telse {\n\t\tstop = PyFloat_AsDouble(o_stop);\n\t\tif error_converting(stop) return NULL;\n\t}\n\n\treturn PyArray_Arange(start, stop, step, type_num);\n}\n\n#undef _ARET\n\n/*****\n static char doc_arrayMap[] = \"arrayMap(func, [a1,...,an])\";\n\n static PyObject *array_arrayMap(PyObject *dummy, PyObject *args) {\n PyObject *shape, *a0;\n \n if (PyArg_ParseTuple(args, \"OO\", &a0, &shape) == NULL) return NULL;\n\t\n return PyArray_Map(a0, shape);\n }\n*****/\n\nstatic char \ndoc_set_string_function[] = \"set_string_function(f, repr=1) sets the python function f to be the function used to obtain a pretty printable string version of a array whenever a array is printed. f(M) should expect a array argument M, and should return a string consisting of the desired representation of M for printing.\";\n\nstatic PyObject *\narray_set_string_function(PyObject *dummy, PyObject *args, PyObject *kwds) \n{\n\tPyObject *op;\n\tint repr=1;\n\tstatic char *kwlist[] = {\"f\", \"repr\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O|i\", kwlist, \n\t\t\t\t\t&op, &repr)) return NULL; \n\tPyArray_SetStringFunction(op, repr);\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic char \ndoc_set_ops_function[] = \"set_numeric_ops(op=func, ...) sets some or all of the number methods for all array objects. Don't forget **dict can be used as the argument list. Returns the functions that were replaced -- can be stored and set later.\";\n\nstatic PyObject *\narray_set_ops_function(PyObject *self, PyObject *args, PyObject *kwds) \n{\n\tPyObject *oldops=NULL;\n\t\n\tif ((oldops = PyArray_GetNumericOps())==NULL) return NULL;\n\n\t/* Should probably ensure that objects are at least callable */\n\t/* Leave this to the caller for now --- error will be raised\n\t later when use is attempted \n\t*/\n\tif (PyArray_SetNumericOps(kwds) == -1) {\n\t\tPy_DECREF(oldops);\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"One or more objects is not callable.\");\n\t\treturn NULL;\n\t}\n\treturn oldops;\n}\n\n\nstatic PyObject *\nPyArray_Where(PyObject *condition, PyObject *x, PyObject *y)\n{\n\tPyArrayObject *arr;\n\tPyObject *tup=NULL, *obj=NULL;\n\tPyObject *ret=NULL, *zero=NULL;\n\n\tif ((x==NULL) || (y==NULL)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"either both or neither\"\n\t\t\t\t\"of x and y should be given.\");\n\t\treturn NULL;\n\t}\n\n\tarr = (PyArrayObject *)PyArray_FromAny(condition, NULL, 0, 0, 0);\n\tif (arr == NULL) return NULL;\n\n\tif ((x==NULL) && (y==NULL)) {\n\t\tret = PyArray_Nonzero(arr);\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\n\n\tzero = PyInt_FromLong((long) 0);\n\n\tobj = PyArray_EnsureArray(PyArray_GenericBinaryFunction(arr, zero, n_ops.not_equal));\n\tPy_DECREF(zero);\n\tPy_DECREF(arr);\n\tif (obj == NULL) return NULL;\n\n\ttup = Py_BuildValue(\"(OO)\", y, x);\n\tif (tup == NULL) {Py_DECREF(obj); return NULL;}\n\n\tret = PyArray_Choose((PyAO *)obj, tup);\n\n\tPy_DECREF(obj);\n\tPy_DECREF(tup);\n\treturn ret;\n}\n\nstatic char doc_where[] = \"where(condition, | x, y) is shaped like condition\"\\\n\t\" and has elements of x and y where condition is respectively true or\"\\\n\t\" false. If x or y are not given, then it is equivalent to\"\\\n\t\" nonzero(condition).\";\n\nstatic PyObject *\narray_where(PyObject *ignored, PyObject *args)\n{\n\tPyObject *obj=NULL, *x=NULL, *y=NULL;\n\t\n\tif (!PyArg_ParseTuple(args, \"O|OO\", &obj, &x, &y)) return NULL;\n\n\treturn PyArray_Where(obj, x, y);\n\n}\n\nstatic char doc_register_dtype[] = \\\n\t\"register_dtype(a) registers a new type object -- gives it a typenum\";\n\nstatic PyObject *\narray_register_dtype(PyObject *dummy, PyObject *args)\n{\n\tPyObject *dtype;\n\tint ret;\n\t\n\tif (!PyArg_ParseTuple(args, \"O\", &dtype)) return NULL;\n\t\n\tret = PyArray_RegisterDataType((PyTypeObject *)dtype);\n\tif (ret < 0)\n\t\treturn NULL;\n\treturn PyInt_FromLong((long) ret);\n}\n\nstatic char doc_can_cast_safely[] = \\\n\t\"can_cast_safely(from=d1, to=d2) returns True if data type d1 \"\\\n\t\"can be cast to data type d2 without losing precision.\";\n\nstatic PyObject *\narray_can_cast_safely(PyObject *dummy, PyObject *args, PyObject *kwds)\n{\n\tPyArray_Typecode d1={PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode d2={PyArray_NOTYPE, 0, 0};\n\tBool ret;\n\tPyObject *retobj;\n\tstatic char *kwlist[] = {\"from\", \"to\", NULL};\n\n\tif(!PyArg_ParseTupleAndKeywords(args, kwds, \"O&O&\", kwlist, \n\t\t\t\t\tPyArray_TypecodeConverter, &d1,\n\t\t\t\t\tPyArray_TypecodeConverter, &d2))\n\t\treturn NULL;\n\tif (d1.type_num == PyArray_NOTYPE || \\\n\t d2.type_num == PyArray_NOTYPE) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"did not understand one of the types. \"\\\n\t\t\t\t\"'None' not accepted.\");\n\t\treturn NULL;\n\t}\n\t\t\n\tret = PyArray_CanCastTo(&d1, &d2);\n\tretobj = (ret ? Py_True : Py_False);\n\tPy_INCREF(retobj);\n\treturn retobj;\n}\n\n\nstatic struct PyMethodDef array_module_methods[] = {\n\t{\"set_string_function\", (PyCFunction)array_set_string_function, \n\t METH_VARARGS|METH_KEYWORDS, doc_set_string_function},\n\t{\"set_numeric_ops\", (PyCFunction)array_set_ops_function,\n\t METH_VARARGS|METH_KEYWORDS, doc_set_ops_function},\n\t{\"set_typeDict\", (PyCFunction)array_set_typeDict,\n\t METH_VARARGS, doc_set_typeDict},\n\n\t{\"array\",\t(PyCFunction)_array_fromobject, \n\t METH_VARARGS|METH_KEYWORDS, doc_fromobject},\n\t{\"arange\", (PyCFunction)array_arange, \n\t METH_VARARGS|METH_KEYWORDS, doc_arange},\n\t{\"zeros\",\t(PyCFunction)array_zeros, \n\t METH_VARARGS|METH_KEYWORDS, doc_zeros},\n\t{\"empty\",\t(PyCFunction)array_empty, \n\t METH_VARARGS|METH_KEYWORDS, doc_empty},\n\t{\"scalar\", (PyCFunction)array_scalar,\n\t METH_VARARGS|METH_KEYWORDS, doc_scalar},\n\t{\"where\", (PyCFunction)array_where,\n\t METH_VARARGS, doc_where},\n\t{\"fromstring\",(PyCFunction)array_fromString,\n\t METH_VARARGS|METH_KEYWORDS, doc_fromString},\n\t{\"concatenate\", (PyCFunction)array_concatenate, \n\t METH_VARARGS|METH_KEYWORDS, doc_concatenate},\n\t{\"inner\", (PyCFunction)array_innerproduct, \n\t METH_VARARGS, doc_innerproduct}, \n\t{\"dot\", (PyCFunction)array_matrixproduct, \n\t METH_VARARGS, doc_matrixproduct}, \n\t{\"_fastCopyAndTranspose\", (PyCFunction)array_fastCopyAndTranspose, \n\t METH_VARARGS, doc_fastCopyAndTranspose},\n\t{\"correlate\", (PyCFunction)array_correlate, \n\t METH_VARARGS | METH_KEYWORDS, doc_correlate},\n\t{\"frombuffer\", (PyCFunction)array_frombuffer,\n\t METH_VARARGS | METH_KEYWORDS, doc_frombuffer},\n\t{\"fromfile\", (PyCFunction)array_fromfile,\n\t METH_VARARGS | METH_KEYWORDS, doc_fromfile},\n\t{\"register_dtype\", (PyCFunction)array_register_dtype,\n\t METH_VARARGS, doc_register_dtype},\n\t{\"can_cast\", (PyCFunction)array_can_cast_safely,\n\t METH_VARARGS | METH_KEYWORDS, doc_can_cast_safely},\t\t\n\t/* {\"arrayMap\",\t(PyCFunction)array_arrayMap, \n\t METH_VARARGS, doc_arrayMap},*/\n\t\n\t{NULL,\t\tNULL, 0}\t\t/* sentinel */\n};\n\n#include \"__multiarray_api.c\"\n\n/* Establish scalar-type hierarchy */\n\n/* For dual inheritance we need to make sure that the objects being\n inherited from have the tp->mro object initialized. This is\n not necessarily true for the basic type objects of Python (it is \n checked for single inheritance but not dual in PyType_Ready).\n\n Thus, we call PyType_Ready on the standard Python Types, here.\n*/ \nstatic int\nsetup_scalartypes(PyObject *dict)\n{\n\n\tinitialize_numeric_types();\n\n if (PyType_Ready(&PyBool_Type) < 0) return -1;\n if (PyType_Ready(&PyInt_Type) < 0) return -1;\n if (PyType_Ready(&PyFloat_Type) < 0) return -1;\n if (PyType_Ready(&PyComplex_Type) < 0) return -1;\n if (PyType_Ready(&PyString_Type) < 0) return -1;\n if (PyType_Ready(&PyUnicode_Type) < 0) return -1;\n\n#define SINGLE_INHERIT(child, parent) \\\n Py##child##ArrType_Type.tp_base = &Py##parent##ArrType_Type;\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) {\t\t\\\n PyErr_Print(); \\\n PyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Tyupe\", \\\n #child); \\\n return -1;\t\t\t\t\t\t\\\n }\n \n if (PyType_Ready(&PyGenericArrType_Type) < 0)\n return -1;\n\n SINGLE_INHERIT(Numeric, Generic);\n SINGLE_INHERIT(Integer, Numeric);\n SINGLE_INHERIT(Inexact, Numeric);\n SINGLE_INHERIT(SignedInteger, Integer);\n SINGLE_INHERIT(UnsignedInteger, Integer);\n SINGLE_INHERIT(Floating, Inexact);\n SINGLE_INHERIT(ComplexFloating, Inexact);\n SINGLE_INHERIT(Flexible, Generic);\n SINGLE_INHERIT(Character, Flexible);\n\t\n#define DUAL_INHERIT(child, parent1, parent2) \\\n Py##child##ArrType_Type.tp_base = &Py##parent2##ArrType_Type;\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent2##ArrType_Type,\t\\\n\t\t\t &Py##parent1##_Type);\t\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n#define DUAL_INHERIT2(child, parent1, parent2)\t\t\t\t\\\n Py##child##ArrType_Type.tp_base = &Py##parent1##_Type;\t\t\\\n Py##child##ArrType_Type.tp_bases = \\\n Py_BuildValue(\"(OO)\", &Py##parent1##_Type,\t\t\\\n\t\t\t &Py##parent2##ArrType_Type);\t\t\\\n if (PyType_Ready(&Py##child##ArrType_Type) < 0) { \\\n PyErr_Print(); \\\n\t\tPyErr_Format(PyExc_SystemError, \\\n\t\t\t \"Could not initialize Py%sArrType_Type\", \\\n #child); \\\n return -1; \\\n }\\\n Py##child##ArrType_Type.tp_hash = Py##parent1##_Type.tp_hash;\n\n SINGLE_INHERIT(Bool, Generic);\n SINGLE_INHERIT(Byte, SignedInteger);\n SINGLE_INHERIT(Short, SignedInteger);\n#if SIZEOF_INT == SIZEOF_LONG\n DUAL_INHERIT(Int, Int, SignedInteger);\n#else\n SINGLE_INHERIT(Int, SignedInteger);\n#endif\n DUAL_INHERIT(Long, Int, SignedInteger);\n#if SIZEOF_LONGLONG == SIZEOF_LONG\n DUAL_INHERIT(LongLong, Int, SignedInteger);\n#else\n SINGLE_INHERIT(LongLong, SignedInteger);\n#endif\n\n SINGLE_INHERIT(UByte, UnsignedInteger);\n SINGLE_INHERIT(UShort, UnsignedInteger);\n SINGLE_INHERIT(UInt, UnsignedInteger);\n SINGLE_INHERIT(ULong, UnsignedInteger);\n SINGLE_INHERIT(ULongLong, UnsignedInteger);\n\n SINGLE_INHERIT(Float, Floating);\n DUAL_INHERIT(Double, Float, Floating);\n SINGLE_INHERIT(LongDouble, Floating);\n\n SINGLE_INHERIT(CFloat, ComplexFloating);\n DUAL_INHERIT(CDouble, Complex, ComplexFloating);\n SINGLE_INHERIT(CLongDouble, ComplexFloating);\n\n DUAL_INHERIT2(String, String, Character);\n DUAL_INHERIT2(Unicode, Unicode, Character);\n\t\n SINGLE_INHERIT(Void, Flexible);\n \n SINGLE_INHERIT(Object, Generic);\n\n return 0;\n\n#undef SINGLE_INHERIT\n#undef DUAL_INHERIT\n\n\t/* Clean up string and unicode array types so they act more like\n\t strings -- get their tables from the standard types.\n\t \n\t \n\t*/\n}\n\n/* place a flag dictionary in d */\n\nstatic void\nset_flaginfo(PyObject *d)\n{\n PyObject *s;\n PyObject *newd;\n \n newd = PyDict_New();\n\n PyDict_SetItemString(newd, \"OWNDATA\", s=PyInt_FromLong(OWNDATA));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"FORTRAN\", s=PyInt_FromLong(FORTRAN));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"CONTIGUOUS\", s=PyInt_FromLong(CONTIGUOUS));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"ALIGNED\", s=PyInt_FromLong(ALIGNED));\n Py_DECREF(s);\n\n PyDict_SetItemString(newd, \"NOTSWAPPED\", s=PyInt_FromLong(NOTSWAPPED));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"UPDATEIFCOPY\", s=PyInt_FromLong(UPDATEIFCOPY));\n Py_DECREF(s);\n PyDict_SetItemString(newd, \"WRITEABLE\", s=PyInt_FromLong(WRITEABLE));\n Py_DECREF(s);\n \n PyDict_SetItemString(d, \"_flagdict\", newd);\n Py_DECREF(newd);\n return;\n}\n\n\n/* Initialization function for the module */\n\nDL_EXPORT(void) initmultiarray(void) {\n\tPyObject *m, *d, *s;\n\tPyObject *c_api;\n\t\n\t/* Create the module and add the functions */\n\tm = Py_InitModule(\"multiarray\", array_module_methods);\n\tif (!m) goto err;\n\n\t/* Add some symbolic constants to the module */\n\td = PyModule_GetDict(m);\n\tif (!d) goto err; \n\n\t/* Create the module and add the functions */\n\tif (PyType_Ready(&PyBigArray_Type) < 0) \n\t\treturn;\n\n PyArray_Type.tp_base = &PyBigArray_Type;\n\n PyArray_Type.tp_as_mapping = &array_as_mapping;\n\t/* Even though, this would be inherited, it needs to be set now\n\t so that the __getitem__ will map to the as_mapping descriptor\n\t*/\n PyArray_Type.tp_as_number = &array_as_number; \n\t/* For good measure */\n\tPyArray_Type.tp_as_sequence = &array_as_sequence;\n\tPyArray_Type.tp_as_buffer = &array_as_buffer;\t\n PyArray_Type.tp_flags = (Py_TPFLAGS_DEFAULT \n\t\t\t\t | Py_TPFLAGS_BASETYPE\n\t\t\t\t | Py_TPFLAGS_CHECKTYPES);\n PyArray_Type.tp_doc = Arraytype__doc__;\n\n\tif (PyType_Ready(&PyArray_Type) < 0)\n return;\n\n if (setup_scalartypes(d) < 0) goto err;\n\n\tif (PyType_Ready(&PyArrayIter_Type) < 0)\n\t\treturn; \n \n\tif (PyType_Ready(&PyArrayMapIter_Type) < 0)\n return; \n\n\tc_api = PyCObject_FromVoidPtr((void *)PyArray_API, NULL);\n\tif (PyErr_Occurred()) goto err;\n\tPyDict_SetItemString(d, \"_ARRAY_API\", c_api);\n\tPy_DECREF(c_api);\n\tif (PyErr_Occurred()) goto err;\n\n\tMultiArrayError = PyString_FromString (\"multiarray.error\");\n\tPyDict_SetItemString (d, \"error\", MultiArrayError);\n\t\n\ts = PyString_FromString(\"3.0\");\n\tPyDict_SetItemString(d, \"__version__\", s);\n\tPy_DECREF(s);\n Py_INCREF(&PyBigArray_Type);\n\tPyDict_SetItemString(d, \"bigndarray\", (PyObject *)&PyBigArray_Type);\n Py_INCREF(&PyArray_Type);\n\tPyDict_SetItemString(d, \"ndarray\", (PyObject *)&PyArray_Type);\n Py_INCREF(&PyArrayIter_Type);\n\tPyDict_SetItemString(d, \"flatiter\", (PyObject *)&PyArrayIter_Type);\n Py_INCREF(&PyArrayMapIter_Type);\n\tPyDict_SetItemString(d, \"mapiter\", (PyObject *)&PyArrayMapIter_Type);\n\n set_flaginfo(d);\n\n\tif (set_typeinfo(d) == 0) \n return; /* otherwise there is an error */\n\n\n err:\t\n\t/* Check for errors */\n\tif (PyErr_Occurred())\n PyErr_Print();\n\t\tPy_FatalError(\"can't initialize module multiarray\");\n\n\treturn;\n}\n\n", "methods": [ { "name": "PyArray_MultiplyList", "long_name": "PyArray_MultiplyList( intp * l1 , int n)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 2, "token_count": 42, "parameters": [ "l1", "n" ], "start_line": 51, "end_line": 57, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_AxisConverter", "long_name": "PyArray_AxisConverter( PyObject * obj , int * axis)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 53, "parameters": [ "obj", "axis" ], "start_line": 61, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_CompareLists", "long_name": "PyArray_CompareLists( intp * l1 , intp * l2 , int n)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 3, "token_count": 51, "parameters": [ "l1", "l2", "n" ], "start_line": 76, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_View", "long_name": "PyArray_View( PyArrayObject * self , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 9, "token_count": 245, "parameters": [ "self", "type" ], "start_line": 86, "end_line": 134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "PyArray_Ravel", "long_name": "PyArray_Ravel( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 14, "complexity": 4, "token_count": 87, "parameters": [ "a", "fortran" ], "start_line": 137, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "PyArray_Flatten", "long_name": "PyArray_Flatten( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 32, "complexity": 5, "token_count": 162, "parameters": [ "a", "fortran" ], "start_line": 154, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Reshape", "long_name": "PyArray_Reshape( PyArrayObject * self , PyObject * shape)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 53, "parameters": [ "self", "shape" ], "start_line": 195, "end_line": 204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Newshape", "long_name": "PyArray_Newshape( PyArrayObject * self , PyArray_Dims * newdims)", "filename": "multiarraymodule.c", "nloc": 68, "complexity": 15, "token_count": 366, "parameters": [ "self", "newdims" ], "start_line": 212, "end_line": 291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 80, "top_nesting_level": 0 }, { "name": "PyArray_Squeeze", "long_name": "PyArray_Squeeze( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 4, "token_count": 192, "parameters": [ "self" ], "start_line": 299, "end_line": 330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyArray_Mean", "long_name": "PyArray_Mean( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 19, "complexity": 4, "token_count": 139, "parameters": [ "self", "axis", "rtype" ], "start_line": 334, "end_line": 355, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_Std", "long_name": "PyArray_Std( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 43, "complexity": 12, "token_count": 433, "parameters": [ "self", "axis", "rtype" ], "start_line": 358, "end_line": 413, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_Sum", "long_name": "PyArray_Sum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 417, "end_line": 427, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Prod", "long_name": "PyArray_Prod( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 430, "end_line": 440, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumSum", "long_name": "PyArray_CumSum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 443, "end_line": 453, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumProd", "long_name": "PyArray_CumProd( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 456, "end_line": 467, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Any", "long_name": "PyArray_Any( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 470, "end_line": 481, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_All", "long_name": "PyArray_All( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 484, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Compress", "long_name": "PyArray_Compress( PyArrayObject * self , PyObject * condition , int axis)", "filename": "multiarraymodule.c", "nloc": 18, "complexity": 3, "token_count": 110, "parameters": [ "self", "condition", "axis" ], "start_line": 499, "end_line": 519, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_Nonzero", "long_name": "PyArray_Nonzero( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 13, "token_count": 403, "parameters": [ "self" ], "start_line": 522, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "PyArray_Clip", "long_name": "PyArray_Clip( PyArrayObject * self , PyObject * min , PyObject * max)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 6, "token_count": 241, "parameters": [ "self", "min", "max" ], "start_line": 583, "end_line": 616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Conjugate", "long_name": "PyArray_Conjugate( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 9, "token_count": 225, "parameters": [ "self" ], "start_line": 619, "end_line": 655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_Trace", "long_name": "PyArray_Trace( PyArrayObject * self , int offset , int axis1 , int axis2 , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 81, "parameters": [ "self", "offset", "axis1", "axis2", "rtype" ], "start_line": 658, "end_line": 668, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Diagonal", "long_name": "PyArray_Diagonal( PyArrayObject * self , int offset , int axis1 , int axis2)", "filename": "multiarraymodule.c", "nloc": 106, "complexity": 24, "token_count": 808, "parameters": [ "self", "offset", "axis1", "axis2" ], "start_line": 671, "end_line": 792, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 122, "top_nesting_level": 0 }, { "name": "PyArray_AsCArray", "long_name": "PyArray_AsCArray( PyObject ** op , * ptr , intp * dims , int nd , int type_num)", "filename": "multiarraymodule.c", "nloc": 55, "complexity": 13, "token_count": 432, "parameters": [ "op", "ptr", "dims", "nd", "type_num" ], "start_line": 809, "end_line": 865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 57, "top_nesting_level": 0 }, { "name": "PyArray_As1D", "long_name": "PyArray_As1D( PyObject ** op , char ** ptr , int * d1 , int typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 60, "parameters": [ "op", "ptr", "d1", "typecode" ], "start_line": 870, "end_line": 878, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_As2D", "long_name": "PyArray_As2D( PyObject ** op , char ** * ptr , int * d1 , int * d2 , int typecode)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 81, "parameters": [ "op", "ptr", "d1", "d2", "typecode" ], "start_line": 882, "end_line": 892, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Free", "long_name": "PyArray_Free( PyObject * op , * ptr)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 4, "token_count": 67, "parameters": [ "op", "ptr" ], "start_line": 897, "end_line": 908, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "_swap_and_concat", "long_name": "_swap_and_concat( PyObject * op , int axis , int n)", "filename": "multiarraymodule.c", "nloc": 27, "complexity": 6, "token_count": 185, "parameters": [ "op", "axis", "n" ], "start_line": 912, "end_line": 940, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_Concatenate", "long_name": "PyArray_Concatenate( PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 114, "complexity": 24, "token_count": 771, "parameters": [ "op", "axis" ], "start_line": 949, "end_line": 1077, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 129, "top_nesting_level": 0 }, { "name": "PyArray_SwapAxes", "long_name": "PyArray_SwapAxes( PyArrayObject * ap , int a1 , int a2)", "filename": "multiarraymodule.c", "nloc": 37, "complexity": 12, "token_count": 227, "parameters": [ "ap", "a1", "a2" ], "start_line": 1080, "end_line": 1119, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_Transpose", "long_name": "PyArray_Transpose( PyArrayObject * ap , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 49, "complexity": 15, "token_count": 403, "parameters": [ "ap", "op" ], "start_line": 1123, "end_line": 1182, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "PyArray_Repeat", "long_name": "PyArray_Repeat( PyArrayObject * aop , PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 75, "complexity": 15, "token_count": 520, "parameters": [ "aop", "op", "axis" ], "start_line": 1185, "end_line": 1277, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 93, "top_nesting_level": 0 }, { "name": "PyArray_Choose", "long_name": "PyArray_Choose( PyArrayObject * ip , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 89, "complexity": 18, "token_count": 650, "parameters": [ "ip", "op" ], "start_line": 1281, "end_line": 1393, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 113, "top_nesting_level": 0 }, { "name": "qsortCompare", "long_name": "qsortCompare( const * a , const * b)", "filename": "multiarraymodule.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "a", "b" ], "start_line": 1401, "end_line": 1404, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "PyArray_Sort", "long_name": "PyArray_Sort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 7, "token_count": 250, "parameters": [ "op", "axis" ], "start_line": 1426, "end_line": 1475, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "argsort_static_compare", "long_name": "argsort_static_compare( const * ip1 , const * ip2)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 1, "token_count": 63, "parameters": [ "ip1", "ip2" ], "start_line": 1481, "end_line": 1489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_ArgSort", "long_name": "PyArray_ArgSort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 48, "complexity": 8, "token_count": 350, "parameters": [ "op", "axis" ], "start_line": 1492, "end_line": 1551, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "local_where", "long_name": "local_where( PyArrayObject * ap1 , PyArrayObject * ap2 , PyArrayObject * ret)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 7, "token_count": 243, "parameters": [ "ap1", "ap2", "ret" ], "start_line": 1554, "end_line": 1589, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_SearchSorted", "long_name": "PyArray_SearchSorted( PyArrayObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 33, "complexity": 5, "token_count": 223, "parameters": [ "op1", "op2" ], "start_line": 1592, "end_line": 1637, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "PyArray_InnerProduct", "long_name": "PyArray_InnerProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 83, "complexity": 17, "token_count": 657, "parameters": [ "op1", "op2" ], "start_line": 1645, "end_line": 1748, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 104, "top_nesting_level": 0 }, { "name": "PyArray_MatrixProduct", "long_name": "PyArray_MatrixProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 99, "complexity": 20, "token_count": 760, "parameters": [ "op1", "op2" ], "start_line": 1753, "end_line": 1875, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "PyArray_CopyAndTranspose", "long_name": "PyArray_CopyAndTranspose( PyObject * op)", "filename": "multiarraymodule.c", "nloc": 44, "complexity": 6, "token_count": 278, "parameters": [ "op" ], "start_line": 1878, "end_line": 1929, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "PyArray_Correlate", "long_name": "PyArray_Correlate( PyObject * op1 , PyObject * op2 , int mode)", "filename": "multiarraymodule.c", "nloc": 87, "complexity": 13, "token_count": 602, "parameters": [ "op1", "op2", "mode" ], "start_line": 1932, "end_line": 2028, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 97, "top_nesting_level": 0 }, { "name": "PyArray_ArgMin", "long_name": "PyArray_ArgMin( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 5, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2031, "end_line": 2056, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_Max", "long_name": "PyArray_Max( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2059, "end_line": 2070, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Min", "long_name": "PyArray_Min( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2073, "end_line": 2084, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Ptp", "long_name": "PyArray_Ptp( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 4, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2087, "end_line": 2110, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "PyArray_ArgMax", "long_name": "PyArray_ArgMax( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 47, "complexity": 7, "token_count": 322, "parameters": [ "op", "axis" ], "start_line": 2114, "end_line": 2171, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_Take", "long_name": "PyArray_Take( PyArrayObject * self0 , PyObject * indices0 , int axis)", "filename": "multiarraymodule.c", "nloc": 62, "complexity": 12, "token_count": 468, "parameters": [ "self0", "indices0", "axis" ], "start_line": 2175, "end_line": 2247, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 73, "top_nesting_level": 0 }, { "name": "PyArray_Put", "long_name": "PyArray_Put( PyArrayObject * self , PyObject * indices0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 47, "complexity": 10, "token_count": 319, "parameters": [ "self", "indices0", "values0" ], "start_line": 2250, "end_line": 2302, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "PyArray_PutMask", "long_name": "PyArray_PutMask( PyArrayObject * self , PyObject * mask0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 10, "token_count": 334, "parameters": [ "self", "mask0", "values0" ], "start_line": 2305, "end_line": 2367, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_Converter", "long_name": "PyArray_Converter( PyObject * object , PyObject ** address)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 66, "parameters": [ "object", "address" ], "start_line": 2379, "end_line": 2391, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_BoolConverter", "long_name": "PyArray_BoolConverter( PyObject * object , Bool * val)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 3, "token_count": 42, "parameters": [ "object", "val" ], "start_line": 2394, "end_line": 2400, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_TypestrConvert", "long_name": "PyArray_TypestrConvert( int itemsize , int gentype)", "filename": "multiarraymodule.c", "nloc": 90, "complexity": 33, "token_count": 284, "parameters": [ "itemsize", "gentype" ], "start_line": 2404, "end_line": 2513, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "PyArray_BufferConverter", "long_name": "PyArray_BufferConverter( PyObject * obj , PyArray_Chunk * buf)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 6, "token_count": 147, "parameters": [ "obj", "buf" ], "start_line": 2528, "end_line": 2553, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_IntpConverter", "long_name": "PyArray_IntpConverter( PyObject * obj , PyArray_Dims * seq)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 10, "token_count": 186, "parameters": [ "obj", "seq" ], "start_line": 2565, "end_line": 2601, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_TypecodeConverter", "long_name": "PyArray_TypecodeConverter( PyObject * obj , PyArray_Typecode * at)", "filename": "multiarraymodule.c", "nloc": 108, "complexity": 33, "token_count": 639, "parameters": [ "obj", "at" ], "start_line": 2610, "end_line": 2748, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "PyArray_EquivalentTypes", "long_name": "PyArray_EquivalentTypes( PyArray_Typecode * typ1 , PyArray_Typecode * typ2)", "filename": "multiarraymodule.c", "nloc": 24, "complexity": 8, "token_count": 162, "parameters": [ "typ1", "typ2" ], "start_line": 2756, "end_line": 2783, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyArray_EquivArrTypes", "long_name": "PyArray_EquivArrTypes( PyArrayObject * a1 , PyArrayObject * a2)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 1, "token_count": 80, "parameters": [ "a1", "a2" ], "start_line": 2786, "end_line": 2797, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "_array_fromobject", "long_name": "_array_fromobject( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 38, "complexity": 9, "token_count": 254, "parameters": [ "ignored", "args", "kws" ], "start_line": 2808, "end_line": 2852, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_Empty", "long_name": "PyArray_Empty( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 15, "complexity": 3, "token_count": 99, "parameters": [ "nd", "dims", "type" ], "start_line": 2855, "end_line": 2871, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "array_empty", "long_name": "array_empty( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2877, "end_line": 2901, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_scalar", "long_name": "array_scalar( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 11, "token_count": 290, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2906, "end_line": 2970, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 65, "top_nesting_level": 0 }, { "name": "PyArray_Zeros", "long_name": "PyArray_Zeros( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 3, "token_count": 133, "parameters": [ "nd", "dims", "type" ], "start_line": 2974, "end_line": 2996, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_zeros", "long_name": "array_zeros( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 3002, "end_line": 3026, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_set_typeDict", "long_name": "array_set_typeDict( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "ignored", "args" ], "start_line": 3033, "end_line": 3042, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_fromString", "long_name": "array_fromString( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 8, "token_count": 283, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3047, "end_line": 3102, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "_fill_in_itemsize", "long_name": "_fill_in_itemsize( PyArray_Typecode * typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 42, "parameters": [ "typecode" ], "start_line": 3118, "end_line": 3125, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_FromFile", "long_name": "PyArray_FromFile( FILE * fp , PyArray_Typecode * typecode , intp num , char * sep)", "filename": "multiarraymodule.c", "nloc": 130, "complexity": 26, "token_count": 764, "parameters": [ "fp", "typecode", "num", "sep" ], "start_line": 3129, "end_line": 3269, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 141, "top_nesting_level": 0 }, { "name": "array_fromfile", "long_name": "array_fromfile( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 34, "complexity": 6, "token_count": 221, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3272, "end_line": 3307, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_FromBuffer", "long_name": "PyArray_FromBuffer( PyObject * buf , PyArray_Typecode * type , intp count , int swapped)", "filename": "multiarraymodule.c", "nloc": 58, "complexity": 11, "token_count": 306, "parameters": [ "buf", "type", "count", "swapped" ], "start_line": 3310, "end_line": 3373, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "array_frombuffer", "long_name": "array_frombuffer( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 16, "complexity": 2, "token_count": 115, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3378, "end_line": 3395, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_concatenate", "long_name": "array_concatenate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 73, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3402, "end_line": 3413, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_innerproduct", "long_name": "array_innerproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3420, "end_line": 3426, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_matrixproduct", "long_name": "array_matrixproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3433, "end_line": 3439, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_fastCopyAndTranspose", "long_name": "array_fastCopyAndTranspose( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 41, "parameters": [ "dummy", "args" ], "start_line": 3443, "end_line": 3449, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_correlate", "long_name": "array_correlate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 81, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3453, "end_line": 3462, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Arange", "long_name": "PyArray_Arange( double start , double stop , double step , int type_num)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 4, "token_count": 229, "parameters": [ "start", "stop", "step", "type_num" ], "start_line": 3466, "end_line": 3499, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_arange", "long_name": "array_arange( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 10, "token_count": 258, "parameters": [ "ignored", "args", "kws" ], "start_line": 3505, "end_line": 3553, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "array_set_string_function", "long_name": "array_set_string_function( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 78, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3573, "end_line": 3584, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_set_ops_function", "long_name": "array_set_ops_function( PyObject * self , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 12, "complexity": 3, "token_count": 67, "parameters": [ "self", "args", "kwds" ], "start_line": 3590, "end_line": 3607, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Where", "long_name": "PyArray_Where( PyObject * condition , PyObject * x , PyObject * y)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 8, "token_count": 226, "parameters": [ "condition", "x", "y" ], "start_line": 3611, "end_line": 3647, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "array_where", "long_name": "array_where( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 2, "token_count": 60, "parameters": [ "ignored", "args" ], "start_line": 3655, "end_line": 3663, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_register_dtype", "long_name": "array_register_dtype( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 3, "token_count": 64, "parameters": [ "dummy", "args" ], "start_line": 3669, "end_line": 3680, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_can_cast_safely", "long_name": "array_can_cast_safely( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 5, "token_count": 145, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3687, "end_line": 3711, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "setup_scalartypes", "long_name": "setup_scalartypes( PyObject * dict)", "filename": "multiarraymodule.c", "nloc": 45, "complexity": 10, "token_count": 351, "parameters": [ "dict" ], "start_line": 3772, "end_line": 3881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "set_flaginfo", "long_name": "set_flaginfo( PyObject * d)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 1, "token_count": 171, "parameters": [ "d" ], "start_line": 3886, "end_line": 3912, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "initmultiarray", "long_name": "initmultiarray()", "filename": "multiarraymodule.c", "nloc": 52, "complexity": 12, "token_count": 361, "parameters": [], "start_line": 3917, "end_line": 3993, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyArray_MultiplyList", "long_name": "PyArray_MultiplyList( intp * l1 , int n)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 2, "token_count": 42, "parameters": [ "l1", "n" ], "start_line": 51, "end_line": 57, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_AxisConverter", "long_name": "PyArray_AxisConverter( PyObject * obj , int * axis)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 53, "parameters": [ "obj", "axis" ], "start_line": 61, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_CompareLists", "long_name": "PyArray_CompareLists( intp * l1 , intp * l2 , int n)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 3, "token_count": 51, "parameters": [ "l1", "l2", "n" ], "start_line": 76, "end_line": 83, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_View", "long_name": "PyArray_View( PyArrayObject * self , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 9, "token_count": 245, "parameters": [ "self", "type" ], "start_line": 86, "end_line": 134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "PyArray_Ravel", "long_name": "PyArray_Ravel( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 14, "complexity": 4, "token_count": 87, "parameters": [ "a", "fortran" ], "start_line": 137, "end_line": 151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "PyArray_Flatten", "long_name": "PyArray_Flatten( PyArrayObject * a , int fortran)", "filename": "multiarraymodule.c", "nloc": 32, "complexity": 5, "token_count": 162, "parameters": [ "a", "fortran" ], "start_line": 154, "end_line": 187, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Reshape", "long_name": "PyArray_Reshape( PyArrayObject * self , PyObject * shape)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 53, "parameters": [ "self", "shape" ], "start_line": 195, "end_line": 204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Newshape", "long_name": "PyArray_Newshape( PyArrayObject * self , PyArray_Dims * newdims)", "filename": "multiarraymodule.c", "nloc": 68, "complexity": 15, "token_count": 366, "parameters": [ "self", "newdims" ], "start_line": 212, "end_line": 291, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 80, "top_nesting_level": 0 }, { "name": "PyArray_Squeeze", "long_name": "PyArray_Squeeze( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 4, "token_count": 192, "parameters": [ "self" ], "start_line": 299, "end_line": 330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "PyArray_Mean", "long_name": "PyArray_Mean( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 19, "complexity": 4, "token_count": 139, "parameters": [ "self", "axis", "rtype" ], "start_line": 334, "end_line": 355, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_Std", "long_name": "PyArray_Std( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 43, "complexity": 12, "token_count": 433, "parameters": [ "self", "axis", "rtype" ], "start_line": 358, "end_line": 413, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_Sum", "long_name": "PyArray_Sum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 417, "end_line": 427, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Prod", "long_name": "PyArray_Prod( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 430, "end_line": 440, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumSum", "long_name": "PyArray_CumSum( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 443, "end_line": 453, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_CumProd", "long_name": "PyArray_CumProd( PyArrayObject * self , int axis , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 69, "parameters": [ "self", "axis", "rtype" ], "start_line": 456, "end_line": 467, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Any", "long_name": "PyArray_Any( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 470, "end_line": 481, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_All", "long_name": "PyArray_All( PyArrayObject * self , int axis)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 66, "parameters": [ "self", "axis" ], "start_line": 484, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Compress", "long_name": "PyArray_Compress( PyArrayObject * self , PyObject * condition , int axis)", "filename": "multiarraymodule.c", "nloc": 18, "complexity": 3, "token_count": 110, "parameters": [ "self", "condition", "axis" ], "start_line": 499, "end_line": 519, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_Nonzero", "long_name": "PyArray_Nonzero( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 13, "token_count": 403, "parameters": [ "self" ], "start_line": 522, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "PyArray_Clip", "long_name": "PyArray_Clip( PyArrayObject * self , PyObject * min , PyObject * max)", "filename": "multiarraymodule.c", "nloc": 30, "complexity": 6, "token_count": 241, "parameters": [ "self", "min", "max" ], "start_line": 583, "end_line": 616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_Conjugate", "long_name": "PyArray_Conjugate( PyArrayObject * self)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 9, "token_count": 225, "parameters": [ "self" ], "start_line": 619, "end_line": 655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_Trace", "long_name": "PyArray_Trace( PyArrayObject * self , int offset , int axis1 , int axis2 , int rtype)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 81, "parameters": [ "self", "offset", "axis1", "axis2", "rtype" ], "start_line": 658, "end_line": 668, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Diagonal", "long_name": "PyArray_Diagonal( PyArrayObject * self , int offset , int axis1 , int axis2)", "filename": "multiarraymodule.c", "nloc": 104, "complexity": 24, "token_count": 798, "parameters": [ "self", "offset", "axis1", "axis2" ], "start_line": 671, "end_line": 789, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 119, "top_nesting_level": 0 }, { "name": "PyArray_AsCArray", "long_name": "PyArray_AsCArray( PyObject ** op , * ptr , intp * dims , int nd , int type_num)", "filename": "multiarraymodule.c", "nloc": 54, "complexity": 13, "token_count": 426, "parameters": [ "op", "ptr", "dims", "nd", "type_num" ], "start_line": 806, "end_line": 861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "PyArray_As1D", "long_name": "PyArray_As1D( PyObject ** op , char ** ptr , int * d1 , int typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 60, "parameters": [ "op", "ptr", "d1", "typecode" ], "start_line": 866, "end_line": 874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_As2D", "long_name": "PyArray_As2D( PyObject ** op , char ** * ptr , int * d1 , int * d2 , int typecode)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 2, "token_count": 81, "parameters": [ "op", "ptr", "d1", "d2", "typecode" ], "start_line": 878, "end_line": 888, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Free", "long_name": "PyArray_Free( PyObject * op , * ptr)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 4, "token_count": 67, "parameters": [ "op", "ptr" ], "start_line": 893, "end_line": 904, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "_swap_and_concat", "long_name": "_swap_and_concat( PyObject * op , int axis , int n)", "filename": "multiarraymodule.c", "nloc": 27, "complexity": 6, "token_count": 185, "parameters": [ "op", "axis", "n" ], "start_line": 908, "end_line": 936, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_Concatenate", "long_name": "PyArray_Concatenate( PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 113, "complexity": 24, "token_count": 765, "parameters": [ "op", "axis" ], "start_line": 945, "end_line": 1072, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 128, "top_nesting_level": 0 }, { "name": "PyArray_SwapAxes", "long_name": "PyArray_SwapAxes( PyArrayObject * ap , int a1 , int a2)", "filename": "multiarraymodule.c", "nloc": 37, "complexity": 12, "token_count": 227, "parameters": [ "ap", "a1", "a2" ], "start_line": 1075, "end_line": 1114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_Transpose", "long_name": "PyArray_Transpose( PyArrayObject * ap , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 49, "complexity": 15, "token_count": 403, "parameters": [ "ap", "op" ], "start_line": 1118, "end_line": 1177, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "PyArray_Repeat", "long_name": "PyArray_Repeat( PyArrayObject * aop , PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 75, "complexity": 15, "token_count": 520, "parameters": [ "aop", "op", "axis" ], "start_line": 1180, "end_line": 1272, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 93, "top_nesting_level": 0 }, { "name": "PyArray_Choose", "long_name": "PyArray_Choose( PyArrayObject * ip , PyObject * op)", "filename": "multiarraymodule.c", "nloc": 89, "complexity": 18, "token_count": 650, "parameters": [ "ip", "op" ], "start_line": 1276, "end_line": 1388, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 113, "top_nesting_level": 0 }, { "name": "qsortCompare", "long_name": "qsortCompare( const * a , const * b)", "filename": "multiarraymodule.c", "nloc": 4, "complexity": 1, "token_count": 28, "parameters": [ "a", "b" ], "start_line": 1396, "end_line": 1399, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "PyArray_Sort", "long_name": "PyArray_Sort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 36, "complexity": 7, "token_count": 250, "parameters": [ "op", "axis" ], "start_line": 1421, "end_line": 1470, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "argsort_static_compare", "long_name": "argsort_static_compare( const * ip1 , const * ip2)", "filename": "multiarraymodule.c", "nloc": 9, "complexity": 1, "token_count": 63, "parameters": [ "ip1", "ip2" ], "start_line": 1476, "end_line": 1484, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_ArgSort", "long_name": "PyArray_ArgSort( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 48, "complexity": 8, "token_count": 350, "parameters": [ "op", "axis" ], "start_line": 1487, "end_line": 1546, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "local_where", "long_name": "local_where( PyArrayObject * ap1 , PyArrayObject * ap2 , PyArrayObject * ret)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 7, "token_count": 243, "parameters": [ "ap1", "ap2", "ret" ], "start_line": 1549, "end_line": 1584, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_SearchSorted", "long_name": "PyArray_SearchSorted( PyArrayObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 33, "complexity": 5, "token_count": 223, "parameters": [ "op1", "op2" ], "start_line": 1587, "end_line": 1632, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "PyArray_InnerProduct", "long_name": "PyArray_InnerProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 83, "complexity": 17, "token_count": 657, "parameters": [ "op1", "op2" ], "start_line": 1640, "end_line": 1743, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 104, "top_nesting_level": 0 }, { "name": "PyArray_MatrixProduct", "long_name": "PyArray_MatrixProduct( PyObject * op1 , PyObject * op2)", "filename": "multiarraymodule.c", "nloc": 99, "complexity": 20, "token_count": 760, "parameters": [ "op1", "op2" ], "start_line": 1748, "end_line": 1870, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "PyArray_CopyAndTranspose", "long_name": "PyArray_CopyAndTranspose( PyObject * op)", "filename": "multiarraymodule.c", "nloc": 44, "complexity": 6, "token_count": 278, "parameters": [ "op" ], "start_line": 1873, "end_line": 1924, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "PyArray_Correlate", "long_name": "PyArray_Correlate( PyObject * op1 , PyObject * op2 , int mode)", "filename": "multiarraymodule.c", "nloc": 87, "complexity": 13, "token_count": 602, "parameters": [ "op1", "op2", "mode" ], "start_line": 1927, "end_line": 2023, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 97, "top_nesting_level": 0 }, { "name": "PyArray_ArgMin", "long_name": "PyArray_ArgMin( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 5, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2026, "end_line": 2051, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_Max", "long_name": "PyArray_Max( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2054, "end_line": 2065, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Min", "long_name": "PyArray_Min( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 67, "parameters": [ "ap", "axis" ], "start_line": 2068, "end_line": 2079, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Ptp", "long_name": "PyArray_Ptp( PyArrayObject * ap , int axis)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 4, "token_count": 138, "parameters": [ "ap", "axis" ], "start_line": 2082, "end_line": 2105, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "PyArray_ArgMax", "long_name": "PyArray_ArgMax( PyArrayObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 47, "complexity": 7, "token_count": 322, "parameters": [ "op", "axis" ], "start_line": 2109, "end_line": 2166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_Take", "long_name": "PyArray_Take( PyArrayObject * self0 , PyObject * indices0 , int axis)", "filename": "multiarraymodule.c", "nloc": 62, "complexity": 12, "token_count": 468, "parameters": [ "self0", "indices0", "axis" ], "start_line": 2170, "end_line": 2242, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 73, "top_nesting_level": 0 }, { "name": "PyArray_Put", "long_name": "PyArray_Put( PyArrayObject * self , PyObject * indices0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 47, "complexity": 10, "token_count": 319, "parameters": [ "self", "indices0", "values0" ], "start_line": 2245, "end_line": 2297, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "PyArray_PutMask", "long_name": "PyArray_PutMask( PyArrayObject * self , PyObject * mask0 , PyObject * values0)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 10, "token_count": 334, "parameters": [ "self", "mask0", "values0" ], "start_line": 2300, "end_line": 2362, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_Converter", "long_name": "PyArray_Converter( PyObject * object , PyObject ** address)", "filename": "multiarraymodule.c", "nloc": 13, "complexity": 3, "token_count": 66, "parameters": [ "object", "address" ], "start_line": 2374, "end_line": 2386, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_BoolConverter", "long_name": "PyArray_BoolConverter( PyObject * object , Bool * val)", "filename": "multiarraymodule.c", "nloc": 7, "complexity": 3, "token_count": 42, "parameters": [ "object", "val" ], "start_line": 2389, "end_line": 2395, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_TypestrConvert", "long_name": "PyArray_TypestrConvert( int itemsize , int gentype)", "filename": "multiarraymodule.c", "nloc": 90, "complexity": 33, "token_count": 284, "parameters": [ "itemsize", "gentype" ], "start_line": 2399, "end_line": 2508, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "PyArray_BufferConverter", "long_name": "PyArray_BufferConverter( PyObject * obj , PyArray_Chunk * buf)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 6, "token_count": 147, "parameters": [ "obj", "buf" ], "start_line": 2523, "end_line": 2548, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "PyArray_IntpConverter", "long_name": "PyArray_IntpConverter( PyObject * obj , PyArray_Dims * seq)", "filename": "multiarraymodule.c", "nloc": 35, "complexity": 10, "token_count": 186, "parameters": [ "obj", "seq" ], "start_line": 2560, "end_line": 2596, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_TypecodeConverter", "long_name": "PyArray_TypecodeConverter( PyObject * obj , PyArray_Typecode * at)", "filename": "multiarraymodule.c", "nloc": 108, "complexity": 33, "token_count": 639, "parameters": [ "obj", "at" ], "start_line": 2605, "end_line": 2743, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "PyArray_EquivalentTypes", "long_name": "PyArray_EquivalentTypes( PyArray_Typecode * typ1 , PyArray_Typecode * typ2)", "filename": "multiarraymodule.c", "nloc": 24, "complexity": 8, "token_count": 162, "parameters": [ "typ1", "typ2" ], "start_line": 2751, "end_line": 2778, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 28, "top_nesting_level": 0 }, { "name": "PyArray_EquivArrTypes", "long_name": "PyArray_EquivArrTypes( PyArrayObject * a1 , PyArrayObject * a2)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 1, "token_count": 56, "parameters": [ "a1", "a2" ], "start_line": 2781, "end_line": 2787, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "_array_fromobject", "long_name": "_array_fromobject( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 38, "complexity": 9, "token_count": 254, "parameters": [ "ignored", "args", "kws" ], "start_line": 2798, "end_line": 2842, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_Empty", "long_name": "PyArray_Empty( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 15, "complexity": 3, "token_count": 99, "parameters": [ "nd", "dims", "type" ], "start_line": 2845, "end_line": 2861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "array_empty", "long_name": "array_empty( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 21, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2867, "end_line": 2891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_scalar", "long_name": "array_scalar( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 56, "complexity": 11, "token_count": 290, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2896, "end_line": 2960, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 65, "top_nesting_level": 0 }, { "name": "PyArray_Zeros", "long_name": "PyArray_Zeros( int nd , intp * dims , PyArray_Typecode * type)", "filename": "multiarraymodule.c", "nloc": 20, "complexity": 3, "token_count": 133, "parameters": [ "nd", "dims", "type" ], "start_line": 2964, "end_line": 2986, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_zeros", "long_name": "array_zeros( PyObject * ignored , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 22, "complexity": 3, "token_count": 134, "parameters": [ "ignored", "args", "kwds" ], "start_line": 2992, "end_line": 3016, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_set_typeDict", "long_name": "array_set_typeDict( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "ignored", "args" ], "start_line": 3023, "end_line": 3032, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_fromString", "long_name": "array_fromString( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 50, "complexity": 8, "token_count": 283, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3037, "end_line": 3092, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "_fill_in_itemsize", "long_name": "_fill_in_itemsize( PyArray_Typecode * typecode)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 42, "parameters": [ "typecode" ], "start_line": 3108, "end_line": 3115, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_FromFile", "long_name": "PyArray_FromFile( FILE * fp , PyArray_Typecode * typecode , intp num , char * sep)", "filename": "multiarraymodule.c", "nloc": 130, "complexity": 26, "token_count": 764, "parameters": [ "fp", "typecode", "num", "sep" ], "start_line": 3119, "end_line": 3259, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 141, "top_nesting_level": 0 }, { "name": "array_fromfile", "long_name": "array_fromfile( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 34, "complexity": 6, "token_count": 221, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3262, "end_line": 3297, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_FromBuffer", "long_name": "PyArray_FromBuffer( PyObject * buf , PyArray_Typecode * type , intp count , int swapped)", "filename": "multiarraymodule.c", "nloc": 58, "complexity": 11, "token_count": 306, "parameters": [ "buf", "type", "count", "swapped" ], "start_line": 3300, "end_line": 3363, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "array_frombuffer", "long_name": "array_frombuffer( PyObject * ignored , PyObject * args , PyObject * keywds)", "filename": "multiarraymodule.c", "nloc": 16, "complexity": 2, "token_count": 115, "parameters": [ "ignored", "args", "keywds" ], "start_line": 3368, "end_line": 3385, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_concatenate", "long_name": "array_concatenate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 73, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3392, "end_line": 3403, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_innerproduct", "long_name": "array_innerproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3410, "end_line": 3416, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_matrixproduct", "long_name": "array_matrixproduct( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 49, "parameters": [ "dummy", "args" ], "start_line": 3423, "end_line": 3429, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_fastCopyAndTranspose", "long_name": "array_fastCopyAndTranspose( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 5, "complexity": 2, "token_count": 41, "parameters": [ "dummy", "args" ], "start_line": 3433, "end_line": 3439, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "array_correlate", "long_name": "array_correlate( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 8, "complexity": 2, "token_count": 81, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3443, "end_line": 3452, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "PyArray_Arange", "long_name": "PyArray_Arange( double start , double stop , double step , int type_num)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 4, "token_count": 229, "parameters": [ "start", "stop", "step", "type_num" ], "start_line": 3456, "end_line": 3489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_arange", "long_name": "array_arange( PyObject * ignored , PyObject * args , PyObject * kws)", "filename": "multiarraymodule.c", "nloc": 42, "complexity": 10, "token_count": 258, "parameters": [ "ignored", "args", "kws" ], "start_line": 3495, "end_line": 3543, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "array_set_string_function", "long_name": "array_set_string_function( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 11, "complexity": 2, "token_count": 78, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3563, "end_line": 3574, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_set_ops_function", "long_name": "array_set_ops_function( PyObject * self , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 12, "complexity": 3, "token_count": 67, "parameters": [ "self", "args", "kwds" ], "start_line": 3580, "end_line": 3597, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Where", "long_name": "PyArray_Where( PyObject * condition , PyObject * x , PyObject * y)", "filename": "multiarraymodule.c", "nloc": 29, "complexity": 8, "token_count": 226, "parameters": [ "condition", "x", "y" ], "start_line": 3601, "end_line": 3637, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "array_where", "long_name": "array_where( PyObject * ignored , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 6, "complexity": 2, "token_count": 60, "parameters": [ "ignored", "args" ], "start_line": 3645, "end_line": 3653, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_register_dtype", "long_name": "array_register_dtype( PyObject * dummy , PyObject * args)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 3, "token_count": 64, "parameters": [ "dummy", "args" ], "start_line": 3659, "end_line": 3670, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "array_can_cast_safely", "long_name": "array_can_cast_safely( PyObject * dummy , PyObject * args , PyObject * kwds)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 5, "token_count": 145, "parameters": [ "dummy", "args", "kwds" ], "start_line": 3677, "end_line": 3701, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "setup_scalartypes", "long_name": "setup_scalartypes( PyObject * dict)", "filename": "multiarraymodule.c", "nloc": 45, "complexity": 10, "token_count": 351, "parameters": [ "dict" ], "start_line": 3762, "end_line": 3871, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 110, "top_nesting_level": 0 }, { "name": "set_flaginfo", "long_name": "set_flaginfo( PyObject * d)", "filename": "multiarraymodule.c", "nloc": 23, "complexity": 1, "token_count": 171, "parameters": [ "d" ], "start_line": 3876, "end_line": 3902, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "initmultiarray", "long_name": "initmultiarray()", "filename": "multiarraymodule.c", "nloc": 52, "complexity": 12, "token_count": 361, "parameters": [], "start_line": 3907, "end_line": 3983, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "PyArray_EquivArrTypes", "long_name": "PyArray_EquivArrTypes( PyArrayObject * a1 , PyArrayObject * a2)", "filename": "multiarraymodule.c", "nloc": 10, "complexity": 1, "token_count": 80, "parameters": [ "a1", "a2" ], "start_line": 2786, "end_line": 2797, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_Concatenate", "long_name": "PyArray_Concatenate( PyObject * op , int axis)", "filename": "multiarraymodule.c", "nloc": 114, "complexity": 24, "token_count": 771, "parameters": [ "op", "axis" ], "start_line": 949, "end_line": 1077, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 129, "top_nesting_level": 0 }, { "name": "PyArray_Diagonal", "long_name": "PyArray_Diagonal( PyArrayObject * self , int offset , int axis1 , int axis2)", "filename": "multiarraymodule.c", "nloc": 106, "complexity": 24, "token_count": 808, "parameters": [ "self", "offset", "axis1", "axis2" ], "start_line": 671, "end_line": 792, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 122, "top_nesting_level": 0 }, { "name": "PyArray_AsCArray", "long_name": "PyArray_AsCArray( PyObject ** op , * ptr , intp * dims , int nd , int type_num)", "filename": "multiarraymodule.c", "nloc": 55, "complexity": 13, "token_count": 432, "parameters": [ "op", "ptr", "dims", "nd", "type_num" ], "start_line": 809, "end_line": 865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 57, "top_nesting_level": 0 }, { "name": "PyArray_TypecodeConverter", "long_name": "PyArray_TypecodeConverter( PyObject * obj , PyArray_Typecode * at)", "filename": "multiarraymodule.c", "nloc": 108, "complexity": 33, "token_count": 639, "parameters": [ "obj", "at" ], "start_line": 2610, "end_line": 2748, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 } ], "nloc": 3090, "complexity": 636, "token_count": 20283, "diff_parsed": { "added": [ "\t\tPyArray_Typecode typecode;", "", "\t\ttypecode.type_num = self->descr->type_num;", "\t\ttypecode.itemsize = self->itemsize;", "\t\ttypecode.fortran = 0;", "", "\tPyArray_Typecode typecode = {0, 0, 0};", "\ttypecode.type_num = type_num;", "\t\tPyArray_Typecode typecode = {0, 0, 0};", "\t\ttypecode.type_num = type_num;", "\t\t\t\t\tPyArray_TypestrConvert(at->itemsize,", " PyArray_Typecode type1={0,0,0};", " PyArray_Typecode type2={0,0,0};", "", "\ttype1.type_num = PyArray_TYPE(a1);", "\ttype2.type_num = PyArray_TYPE(a2);", "\ttype1.itemsize = PyArray_ITEMSIZE(a1);", "\ttype2.itemsize = PyArray_ITEMSIZE(a2);", "" ], "deleted": [ "\t\tPyArray_Typecode typecode = {self->descr->type_num,", "\t\t\t\t\t self->itemsize, 0};", "", "\tPyArray_Typecode typecode = {type_num, 0, 0};", "\t\tPyArray_Typecode typecode = {type_num, 0, 0};", "\t\t\t\t\tPyArray_TypestrConvert(at->itemsize,", " PyArray_Typecode type1={PyArray_TYPE(a1), PyArray_ITEMSIZE(a1), 0};", " PyArray_Typecode type2={PyArray_TYPE(a2), PyArray_ITEMSIZE(a2), 0};", "" ] } }, { "old_path": "scipy/base/tests/test_index_tricks.py", "new_path": "scipy/base/tests/test_index_tricks.py", "filename": "test_index_tricks.py", "extension": "py", "change_type": "MODIFY", "diff": "@@ -38,13 +38,11 @@ def check_1d(self):\n b = ones(5)\n c = r_[b,0,0,b]\n assert_array_equal(c,[1,1,1,1,1,0,0,1,1,1,1,1])\n- c = c_[b,0,0,b]\n- assert_array_equal(c,[1,1,1,1,1,0,0,1,1,1,1,1])\n \n def check_2d(self):\n b = rand(5,5)\n c = rand(5,5)\n- d = c_[b,c] # append columns\n+ d = r_[b,c,'1'] # append columns\n assert(d.shape == (5,10))\n assert_array_equal(d[:,:5],b)\n assert_array_equal(d[:,5:],c)\n", "added_lines": 1, "deleted_lines": 3, "source_code": "import unittest\nimport sys\n\nfrom scipy.test.testing import *\nset_package_path()\nimport scipy.base;reload(scipy.base)\nfrom scipy.base import *\ndel sys.path[0]\n\nclass test_grid(unittest.TestCase):\n def check_basic(self):\n a = mgrid[-1:1:10j]\n b = mgrid[-1:1:0.1]\n assert(a.shape == (10,))\n assert(b.shape == (20,))\n assert(a[0] == -1)\n assert_almost_equal(a[-1],1)\n assert(b[0] == -1)\n assert_almost_equal(b[1]-b[0],0.1,11)\n assert_almost_equal(b[-1],b[0]+19*0.1,11)\n assert_almost_equal(a[1]-a[0],2.0/9.0,11)\n\n def check_nd(self):\n c = mgrid[-1:1:10j,-2:2:10j]\n d = mgrid[-1:1:0.1,-2:2:0.2]\n assert(c.shape == (2,10,10))\n assert(d.shape == (2,20,20))\n assert_array_equal(c[0][0,:],-ones(10,'d'))\n assert_array_equal(c[1][:,0],-2*ones(10,'d'))\n assert_array_almost_equal(c[0][-1,:],ones(10,'d'),11)\n assert_array_almost_equal(c[1][:,-1],2*ones(10,'d'),11)\n assert_array_almost_equal(d[0,1,:]-d[0,0,:], 0.1*ones(20,'d'),11)\n assert_array_almost_equal(d[1,:,1]-d[1,:,0], 0.2*ones(20,'d'),11)\n\nclass test_concatenator(unittest.TestCase):\n def check_1d(self):\n assert_array_equal(r_[1,2,3,4,5,6],array([1,2,3,4,5,6]))\n b = ones(5)\n c = r_[b,0,0,b]\n assert_array_equal(c,[1,1,1,1,1,0,0,1,1,1,1,1])\n\n def check_2d(self):\n b = rand(5,5)\n c = rand(5,5)\n d = r_[b,c,'1'] # append columns\n assert(d.shape == (5,10))\n assert_array_equal(d[:,:5],b)\n assert_array_equal(d[:,5:],c)\n d = r_[b,c]\n assert(d.shape == (10,5))\n assert_array_equal(d[:5,:],b)\n assert_array_equal(d[5:,:],c)\n\nif __name__ == \"__main__\":\n ScipyTest('scipy.base.index_tricks').run()\n", "source_code_before": "import unittest\nimport sys\n\nfrom scipy.test.testing import *\nset_package_path()\nimport scipy.base;reload(scipy.base)\nfrom scipy.base import *\ndel sys.path[0]\n\nclass test_grid(unittest.TestCase):\n def check_basic(self):\n a = mgrid[-1:1:10j]\n b = mgrid[-1:1:0.1]\n assert(a.shape == (10,))\n assert(b.shape == (20,))\n assert(a[0] == -1)\n assert_almost_equal(a[-1],1)\n assert(b[0] == -1)\n assert_almost_equal(b[1]-b[0],0.1,11)\n assert_almost_equal(b[-1],b[0]+19*0.1,11)\n assert_almost_equal(a[1]-a[0],2.0/9.0,11)\n\n def check_nd(self):\n c = mgrid[-1:1:10j,-2:2:10j]\n d = mgrid[-1:1:0.1,-2:2:0.2]\n assert(c.shape == (2,10,10))\n assert(d.shape == (2,20,20))\n assert_array_equal(c[0][0,:],-ones(10,'d'))\n assert_array_equal(c[1][:,0],-2*ones(10,'d'))\n assert_array_almost_equal(c[0][-1,:],ones(10,'d'),11)\n assert_array_almost_equal(c[1][:,-1],2*ones(10,'d'),11)\n assert_array_almost_equal(d[0,1,:]-d[0,0,:], 0.1*ones(20,'d'),11)\n assert_array_almost_equal(d[1,:,1]-d[1,:,0], 0.2*ones(20,'d'),11)\n\nclass test_concatenator(unittest.TestCase):\n def check_1d(self):\n assert_array_equal(r_[1,2,3,4,5,6],array([1,2,3,4,5,6]))\n b = ones(5)\n c = r_[b,0,0,b]\n assert_array_equal(c,[1,1,1,1,1,0,0,1,1,1,1,1])\n c = c_[b,0,0,b]\n assert_array_equal(c,[1,1,1,1,1,0,0,1,1,1,1,1])\n\n def check_2d(self):\n b = rand(5,5)\n c = rand(5,5)\n d = c_[b,c] # append columns\n assert(d.shape == (5,10))\n assert_array_equal(d[:,:5],b)\n assert_array_equal(d[:,5:],c)\n d = r_[b,c]\n assert(d.shape == (10,5))\n assert_array_equal(d[:5,:],b)\n assert_array_equal(d[5:,:],c)\n\nif __name__ == \"__main__\":\n ScipyTest('scipy.base.index_tricks').run()\n", "methods": [ { "name": "check_basic", "long_name": "check_basic( self )", "filename": "test_index_tricks.py", "nloc": 11, "complexity": 1, "token_count": 142, "parameters": [ "self" ], "start_line": 11, "end_line": 21, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 1 }, { "name": "check_nd", "long_name": "check_nd( self )", "filename": "test_index_tricks.py", "nloc": 11, "complexity": 1, "token_count": 227, "parameters": [ "self" ], "start_line": 23, "end_line": 33, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 1 }, { "name": "check_1d", "long_name": "check_1d( self )", "filename": "test_index_tricks.py", "nloc": 5, "complexity": 1, "token_count": 87, "parameters": [ "self" ], "start_line": 36, "end_line": 40, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 1 }, { "name": "check_2d", "long_name": "check_2d( self )", "filename": "test_index_tricks.py", "nloc": 11, "complexity": 1, "token_count": 111, "parameters": [ "self" ], "start_line": 42, "end_line": 52, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 1 } ], "methods_before": [ { "name": "check_basic", "long_name": "check_basic( self )", "filename": "test_index_tricks.py", "nloc": 11, "complexity": 1, "token_count": 142, "parameters": [ "self" ], "start_line": 11, "end_line": 21, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 1 }, { "name": "check_nd", "long_name": "check_nd( self )", "filename": "test_index_tricks.py", "nloc": 11, "complexity": 1, "token_count": 227, "parameters": [ "self" ], "start_line": 23, "end_line": 33, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 1 }, { "name": "check_1d", "long_name": "check_1d( self )", "filename": "test_index_tricks.py", "nloc": 7, "complexity": 1, "token_count": 129, "parameters": [ "self" ], "start_line": 36, "end_line": 42, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 1 }, { "name": "check_2d", "long_name": "check_2d( self )", "filename": "test_index_tricks.py", "nloc": 11, "complexity": 1, "token_count": 109, "parameters": [ "self" ], "start_line": 44, "end_line": 54, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 1 } ], "changed_methods": [ { "name": "check_1d", "long_name": "check_1d( self )", "filename": "test_index_tricks.py", "nloc": 7, "complexity": 1, "token_count": 129, "parameters": [ "self" ], "start_line": 36, "end_line": 42, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 1 }, { "name": "check_2d", "long_name": "check_2d( self )", "filename": "test_index_tricks.py", "nloc": 11, "complexity": 1, "token_count": 111, "parameters": [ "self" ], "start_line": 42, "end_line": 52, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 1 } ], "nloc": 49, "complexity": 4, "token_count": 639, "diff_parsed": { "added": [ " d = r_[b,c,'1'] # append columns" ], "deleted": [ " c = c_[b,0,0,b]", " assert_array_equal(c,[1,1,1,1,1,0,0,1,1,1,1,1])", " d = c_[b,c] # append columns" ] } } ] }, { "hash": "fdfefd74949d72956c21c10ae4f1ef1469ffb5ab", "msg": "More 64 bit fixes.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-08T19:20:53+00:00", "author_timezone": 0, "committer_date": "2005-10-08T19:20:53+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "21d16bd6429b919f33056ce88d05aa2404f1a65e" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 610, "insertions": 613, "lines": 1223, "files": 5, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.0, "dmm_unit_interfacing": 0.5, "modified_files": [ { "old_path": "scipy/base/src/arrayobject.c", "new_path": "scipy/base/src/arrayobject.c", "filename": "arrayobject.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -948,7 +948,7 @@ PyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n \tPyArray_Descr *old;\n \tint i;\n \n-\tif (!PyArray_ISUSERDEF(typenum)) {\n+\tif (!PyTypeNum_ISUSERDEF(typenum)) {\n \t\tPyErr_SetString(PyExc_TypeError, \n \t\t\t\t\"Data type not registered.\");\n \t\treturn -1;\n", "added_lines": 1, "deleted_lines": 1, "source_code": " /*\n Provide multidimensional arrays as a basic object type in python. \n\nBased on Original Numeric implementation\nCopyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\nwith contributions from many Numeric Python developers 1995-2004 *\n\nHeavily modified in 2005 with inspiration from Numarray \n\nby\n\nTravis Oliphant\nAssistant Professor at\nBrigham Young University \n\nmaintainer email: oliphant.travis@ieee.org\n\nNumarray design (which provided guidance) by \nSpace Science Telescope Institute \n (J. Todd Miller, Perry Greenfield, Rick White)\n\n*/\n\n/* $Id: arrayobject.c,v 1.59 2005/09/14 00:14:00 teoliphant Exp $ */\n\n/*\n#include \"Python.h\"\n#include \"structmember.h\"\n\n#define _MULTIARRAYMODULE\n#include \"Numeric3/arrayobject.h\"\n*/\n\n/* Helper functions */\n\n#define error_converting(x) (((x) == -1) && PyErr_Occurred())\n\nstatic intp\nPyArray_PyIntAsIntp(PyObject *o)\n{\n\tlonglong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INTP, 0, 0};\n\tintp ret;\n\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((intp *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (longlong) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (longlong) PyLong_AsLongLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\t\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONGLONG != SIZEOF_PY_INTPTR_T)\n\tif ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C intp\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (intp) long_value;\n}\n\n\nstatic PyObject *array_int(PyArrayObject *v);\n\nstatic int\nPyArray_PyIntAsInt(PyObject *o)\n{\n\tlong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INT, 0, 0};\n\tint ret;\n\t\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((int *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (long) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (long) PyLong_AsLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONG != SIZEOF_INT)\n\tif ((long_value < INT_MIN) || (long_value > INT_MAX)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C int\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (int) long_value;\n}\n\n\nstatic double\nPyArray_GetPriority(PyObject *obj, double default_) \n{\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n\n\tif (PyArray_CheckExact(obj))\n\t\treturn priority;\n if (PyBigArray_CheckExact(obj)) \n return PyArray_BIG_PRIORITY;\n\n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n if (PyErr_Occurred()) {\n PyErr_Clear(); \n priority = default_;\n }\n Py_XDECREF(ret);\n return priority; \n}\n\n/* Backward compatibility only */\n/* In both Zero and One\n\n ***You must free the memory once you are done with it\n using PyDataMem_FREE(ptr) or you create a memory leak***\n\n If arr is an Object array you are getting a \n BORROWED reference to Zero or One.\n Do not DECREF.\n Please INCREF if you will be hanging on to it.\n\n The memory for the ptr still must be freed in any case;\n*/\n\nstatic char *\nPyArray_Zero(PyArrayObject *arr)\n{\n char *zeroval;\n char *buf;\n int buf_len;\n PyObject *obj, *ret;\n\n zeroval = PyDataMem_NEW(arr->itemsize);\n if (zeroval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n if (PyArray_ISOBJECT(arr)) {\n obj=PyInt_FromLong((long) 0);\n memcpy(zeroval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return zeroval;\n }\n ret = PyObject_GetAttrString((PyObject *)arr, \"_zero\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_zero not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n return NULL;\n }\n memcpy(zeroval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n memset(zeroval, 0, arr->itemsize);\n return zeroval;\n}\n\nstatic char *\nPyArray_One(PyArrayObject *arr)\n{\n char *oneval;\n char *buf;\n int buf_len, ret2;\n PyObject *obj, *ret;\n\n oneval = PyDataMem_NEW(arr->itemsize);\n if (oneval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n obj = PyInt_FromLong((long) 1);\n if (PyArray_ISOBJECT(arr)) {\n memcpy(oneval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return oneval;\n }\n \n ret = PyObject_GetAttrString((PyObject *)arr, \"_one\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_one not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n PyDataMem_FREE(oneval);\n return NULL;\n }\n memcpy(oneval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n\n ret2 = arr->descr->setitem(obj, oneval, arr);\n Py_DECREF(obj);\n if (ret < 0) {\n PyDataMem_FREE(oneval);\n return NULL;\n }\n return oneval;\n}\n\n/* End deprecated */\n\n\nstatic int \ndo_sliced_copy(char *dest, intp *dest_strides, intp *dest_dimensions,\n\t int dest_nd, char *src, intp *src_strides, \n\t intp *src_dimensions, int src_nd, int elsize, \n\t int copies) {\n intp i, j;\n\t\n if (src_nd == 0 && dest_nd == 0) {\n for(j=0; j src_nd) {\n for(i=0; i<*dest_dimensions; i++, dest += *dest_strides) {\n if (do_sliced_copy(dest, dest_strides+1, \n dest_dimensions+1, dest_nd-1,\n src, src_strides, \n src_dimensions, src_nd, \n elsize, copies) == -1) \n return -1;\n }\n return 0;\n }\n\t\n if (dest_nd == 1) {\n if (*dest_dimensions != *src_dimensions) {\n PyErr_SetString(PyExc_ValueError, \n \"matrices are not aligned for copy\");\n return -1;\n }\n for(i=0; i<*dest_dimensions; i++, src += *src_strides) {\n for(j=0; j 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize) && \n ((*src_strides)[*src_nd-1] == *elsize)) {\n if ((*dest_dimensions)[*dest_nd-1] != \n (*src_dimensions)[*src_nd-1]) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"matrices are not aligned\");\n return -1;\n }\n *elsize *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1; *src_nd-=1;\n } else {\n break;\n }\n }\n if (*src_nd == 0) {\n while (*dest_nd > 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize)) {\n *copies *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1;\n } else {\n break;\n }\n }\n }\n return 0;\n}\n\nstatic char *\ncontiguous_data(PyArrayObject *src) \n{\n intp dest_strides[MAX_DIMS], *dest_strides_ptr;\n intp *dest_dimensions=src->dimensions;\n int dest_nd=src->nd;\n intp *src_strides = src->strides;\n intp *src_dimensions=src->dimensions;\n int src_nd=src->nd;\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n intp stride=elsize;\n char *new_data;\n\t\n for(i=dest_nd-1; i>=0; i--) {\n dest_strides[i] = stride;\n stride *= dest_dimensions[i];\n }\n\t\n dest_strides_ptr = dest_strides;\n\t\n if (optimize_slices(&dest_strides_ptr, &dest_dimensions, &dest_nd,\n &src_strides, &src_dimensions, &src_nd,\n &elsize, &copies) == -1) \n return NULL;\n\t\n new_data = (char *)malloc(stride);\n\t\n ret = do_sliced_copy(new_data, dest_strides_ptr, dest_dimensions, \n dest_nd, src->data, src_strides, \n src_dimensions, src_nd, elsize, copies);\n\t\n if (ret != -1) { return new_data; }\n else { free(new_data); return NULL; }\n}\n\n/* end Helper functions */\n\n\nstatic PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n int, intp *, char *, int, int, PyObject *);\n\n/* C-API functions */\n\n/* Used for arrays of python objects to increment the reference count of */\n/* every python object in the array. */\nstatic int \nPyArray_INCREF(PyArrayObject *mp) \n{\n\tintp i, n;\n\n PyObject **data, **data2;\n\t\n if (mp->descr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data;\n for(i=0; idescr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data; \n for(i=0; i 0; n--, a += 1) {\n b = a + 1;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 4:\n for (a = (char*)p ; n > 0; n--, a += 2) {\n b = a + 3;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 8:\n for (a = (char*)p ; n > 0; n--, a += 4) {\n b = a + 7;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n default:\n m = size / 2;\n for (a = (char *)p ; n > 0; n--, a += m) {\n b = a + (size-1);\n for (j=0; j 1, then dst must be contiguous */\nstatic void\ncopy_and_swap(void *dst, void *src, int itemsize, intp numitems,\n intp srcstrides, int swap) \n{\n int i;\n char *s1 = (char *)src;\n char *d1 = (char *)dst;\n \n\n if ((numitems == 1) || (itemsize == srcstrides)) \n memcpy(d1, s1, itemsize*numitems);\n else { \n for (i = 0; i < numitems; i++) {\n memcpy(d1, s1, itemsize);\n d1 += itemsize;\n s1 += srcstrides;\n } \n }\n\n if (swap)\n byte_swap_vector(d1, numitems, itemsize);\n}\n\n\n/* Computer-generated arraytype and scalartype code */\n#include \"scalartypes.inc\"\n#include \"arraytypes.inc\"\n\nstatic char *\nindex2ptr(PyArrayObject *mp, int i) \n{\n\tif (i==0 && (mp->nd == 0 || mp->dimensions[0] > 0)) \n\t\treturn mp->data;\n\t\n if (mp->nd>0 && i>0 && i < mp->dimensions[0]) {\n return mp->data+i*mp->strides[0];\n }\n PyErr_SetString(PyExc_IndexError,\"index out of bounds\");\n return NULL;\n}\n\nstatic intp \nPyArray_Size(PyObject *op) \n{\n if (PyArray_Check(op)) {\n return PyArray_SIZE((PyArrayObject *)op);\n } \n\telse {\n return 0;\n }\n}\n\n/* If destination is not the right type, then src \n will be cast to destination. \n*/\n\n/* Does a flat iterator-based copy. \n\n The arrays are assumed to have the same number of elements\n They can be different sizes and have different types however. \n*/\n\nstatic int\nPyArray_CopyInto(PyArrayObject *dest, PyArrayObject *src)\n{\n intp dsize, ssize, sbytes;\n\tint ncopies, elsize, index;\n PyArrayIterObject *dit=NULL;\n PyArrayIterObject *sit=NULL;\n\tchar *dptr;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n PyArray_CopySwapNFunc *copyswapn;\n \n if (!PyArray_ISWRITEABLE(dest)) {\n PyErr_SetString(PyExc_RuntimeError, \n \"Cannot write to array.\");\n return -1;\n }\n\n if (!PyArray_EquivArrTypes(dest, src)) {\n return PyArray_CastTo(dest, src);\n }\n\n dsize = PyArray_SIZE(dest);\n ssize = PyArray_SIZE(src);\n\tif (ssize == 0) return 0;\n if (dsize % ssize != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Destination number of elements must be\"\\\n \"an integer multiple of the source number of\"\\\n \"elements.\");\n return -1;\n }\n ncopies = dsize / ssize;\n\n\tswap = PyArray_ISNOTSWAPPED(dest) != PyArray_ISNOTSWAPPED(src);\n\tcopyswap = dest->descr->copyswap;\n\tcopyswapn = dest->descr->copyswapn;\n\n elsize = dest->itemsize;\n\n if ((PyArray_ISCONTIGUOUS(dest) && PyArray_ISCONTIGUOUS(src)) \\\n\t || (PyArray_ISFORTRAN(dest) && PyArray_ISFORTRAN(src))) {\n \n PyArray_XDECREF(dest);\n dptr = dest->data;\n sbytes = ssize * src->itemsize;\n while(ncopies--) {\n memmove(dptr, src->data, sbytes);\n dptr += sbytes;\n }\n\t\tif (swap)\n\t\t\tcopyswapn(dest->data, NULL, dsize, 1, elsize);\n PyArray_INCREF(dest);\n return 0;\n }\n\n dit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)dest);\n sit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)src);\n\n if ((dit == NULL) || (sit == NULL)) {\n Py_XDECREF(dit);\n Py_XDECREF(sit);\n return -1;\n }\n\n PyArray_XDECREF(dest);\n while(ncopies--) {\n index = ssize;\n while(index--) {\n memmove(dit->dataptr, sit->dataptr, elsize);\n\t\t\tif (swap)\n\t\t\t\tcopyswap(dit->dataptr, NULL, 1, elsize);\n PyArray_ITER_NEXT(dit);\n PyArray_ITER_NEXT(sit);\n }\n PyArray_ITER_RESET(sit);\n } \n PyArray_INCREF(dest);\n Py_DECREF(dit);\n Py_DECREF(sit);\n\treturn 0;\n}\n\n\nstatic int \nPyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) \n{\n PyArrayObject *src;\n int ret;\n\tPyArray_Typecode typecode;\n\n\n\ttypecode.type_num = dest->descr->type_num;\n\ttypecode.itemsize = dest->itemsize;\n\ttypecode.fortran = PyArray_ISFORTRAN(dest);\n\t\t\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n\t\t\t\t\t &typecode, 0,\n\t\t\t\t\t dest->nd, 0);\n if (src == NULL) return -1;\n\n ret = PyArray_CopyInto(dest, src);\n Py_DECREF(src);\n return ret;\n}\n\n\n/* These are also old calls (should use PyArray_New) */\n\n/* They all zero-out the memory as previously done */\n\nstatic PyObject *\nPyArray_FromDimsAndDataAndDescr(int nd, int *d, \n PyArray_Descr *descr,\n char *data) {\n\tPyObject *ret;\n\n#if SIZEOF_INTP != SIZEOF_INT\n\tint i;\n\tintp newd[MAX_DIMS];\n\t\n\tfor (i=0; itype_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#else\n\tret = PyArray_New(&PyArray_Type, nd, (intp *)d, \n descr->type_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#endif\n\tif (descr->type_num != PyArray_OBJECT)\n\t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_FromDimsAndData(int nd, int *d, int type, char *data) \n{\n\tPyObject *ret;\n#if SIZEOF_INTP != SIZEOF_INT\n\tintp newd[MAX_DIMS];\n\tint i;\t\n\tfor (i=0; iob_type, m1->nd, \n\t\t\t\t\t m1->dimensions,\n\t\t\t\t\t m1->descr->type_num,\n\t\t\t\t\t NULL, NULL, m1->itemsize,\n\t\t\t\t\t 0, (PyObject *)m1);\n\t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n\t\n return (PyObject *)ret;\n}\n\n\nstatic PyObject *array_item(PyArrayObject *, int);\n\nstatic PyObject *\nPyArray_Scalar(char *data, int type_num, int itemsize, int swap)\n{\n PyArray_Descr *descr;\n\tPyTypeObject *type;\n\tPyObject *obj;\t\n\tchar *destptr;\n PyArray_CopySwapFunc *copyswap;\n\n descr = PyArray_DescrFromType(type_num);\n if (descr == NULL) return NULL;\n type = descr->typeobj;\n copyswap = descr->copyswap;\n\tif (type_num == PyArray_STRING) \n\t\tobj = type->tp_alloc(type, itemsize);\n\telse\n\t\tobj = type->tp_alloc(type, 0);\n\tif (obj == NULL) return NULL;\n\tif PyTypeNum_ISFLEXIBLE(type_num) { \n\t\tif (type_num == PyArray_STRING) {\n\t\t\tdestptr = PyString_AS_STRING(obj);\n\t\t\t((PyStringObject *)obj)->ob_shash = -1;\n\t\t\t((PyStringObject *)obj)->ob_sstate =\t\\\n\t\t\t\tSSTATE_NOT_INTERNED; \n\t\t}\n\t\telse {\n\t\t\tdestptr = PyDataMem_NEW(itemsize);\n\t\t\tif (destptr == NULL) {\n\t\t\t\tPyObject_Del(obj);\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tif (type_num == PyArray_UNICODE) {\n\t\t\t\tPyUnicode_AS_UNICODE(obj) = \\\n\t\t\t\t\t(Py_UNICODE *)destptr;\n\t\t\t\t((PyUnicodeObject*)obj)->length = itemsize / \\\n\t\t\t\t\tsizeof(Py_UNICODE);\n\t\t\t\t((PyUnicodeObject*)obj)->hash = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t((PyVoidScalarObject *)obj)->obval = destptr;\n\t\t\t\t((PyVoidScalarObject *)obj)->ob_size = itemsize;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tdestptr = &(((PyScalarObject*)obj)->obval);\n\t}\n\t/* copyswap for OBJECT increments the reference count */\n copyswap(destptr, data, swap, itemsize);\n\treturn obj;\n}\n\n/* returns an Array-Scalar Object of the type of arr\n from the given pointer to memory -- main Scalar creation function\n default new method calls this. \n*/\nstatic PyObject *\nPyArray_ToScalar(char *data, PyArrayObject *arr)\n{\n\tint type_num = arr->descr->type_num;\n\tint itemsize = arr->itemsize;\n int swap = !(PyArray_ISNOTSWAPPED(arr));\n\n\treturn PyArray_Scalar(data, type_num, itemsize, swap);\n}\n\n\n/* Return Python scalar if 0-d array object is encountered */\n\nstatic PyObject *\nPyArray_Return(PyArrayObject *mp) \n{\n \n\tif (mp == NULL) return NULL;\n\n if (PyErr_Occurred()) {\n Py_XDECREF(mp);\n return NULL;\n }\n\n\tif (PyArray_Check((PyObject *)mp) && mp->nd == 0) {\n\t\tPyObject *ret;\n\t\tret = PyArray_ToScalar(mp->data, mp);\n\t\tPy_DECREF(mp);\n\t\treturn ret;\n\t}\n\telse {\n\t\treturn (PyObject *)mp;\n\t}\n}\n\n/*\n returns typenum to associate with this type >=PyArray_USERDEF.\n Also creates a copy of the VOID_DESCR table inserting it's typeobject in\n and it's typenum in the appropriate place.\n \n needs the userdecrs table and PyArray_NUMUSER variables\n defined in arratypes.inc\n*/\nstatic int \nPyArray_RegisterDataType(PyTypeObject *type)\n{\n\tPyArray_Descr *descr;\n\tint typenum;\n\tint i;\n\t\n\tif ((type == &PyVoidArrType_Type) ||\t\t\t\\\n\t !PyType_IsSubtype(type, &PyVoidArrType_Type)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can only register void subtypes.\");\n\t\treturn -1;\n\t}\n\t/* See if this type is already registered */\n\tfor (i=0; itypeobj == type)\n\t\t\treturn descr->type_num;\n\t}\n\tdescr = malloc(sizeof(PyArray_Descr));\n\tmemcpy(descr, PyArray_DescrFromType(PyArray_VOID), \n\t sizeof(PyArray_Descr));\n\ttypenum = PyArray_USERDEF + PyArray_NUMUSERTYPES;\n\tdescr->type_num = typenum;\n\tdescr->typeobj = type;\n\tuserdescrs = realloc(userdescrs, \n\t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n if (userdescrs == NULL) {\n PyErr_SetString(PyExc_MemoryError, \"RegisterDataType\");\n return -1;\n }\n\tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n\treturn typenum;\n}\n\n\n/* \n copyies over from the old descr table for anything\n NULL or zero in what is given. \n frees the copy of the Descr_table already there.\n places a pointer to the new one into the slot.\n*/\nstatic int\nPyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n{\n\tPyArray_Descr *old;\n\tint i;\n\n\tif (!PyTypeNum_ISUSERDEF(typenum)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Data type not registered.\");\n\t\treturn -1;\n\t}\n\told = userdescrs[typenum-PyArray_USERDEF];\n\tdescr->typeobj = old->typeobj;\n\tdescr->type_num = typenum;\n\n#define _NULL_CHECK(member) \\\n\tif (descr->member == NULL) descr->member = old->member\n\n\tfor (i=0; imember == 0) descr->member = old->member\n\n\t_ZERO_CHECK(kind);\n\t_ZERO_CHECK(type);\n\t_ZERO_CHECK(elsize);\n\t_ZERO_CHECK(alignment);\n#undef _ZERO_CHECK\n\n\tfree(old);\n\tuserdescrs[typenum-PyArray_USERDEF] = descr;\n\treturn 0;\n}\n\n\nstatic int\nPyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) \n{\n intp size;\n intp n, n2;\n int n3, n4;\n PyArrayIterObject *it;\n PyObject *obj, *strobj, *tupobj;\n\n n3 = strlen((const char *)sep);\n if (n3 == 0) { /* binary data */\n if (PyArray_ISOBJECT(self)) {\n PyErr_SetString(PyExc_ValueError, \"Cannot write \"\\\n\t\t\t\t\t\"object arrays to a file in \"\\\n\t\t\t\t\t\"binary mode.\");\n return -1;\n }\n\n if (PyArray_ISCONTIGUOUS(self)) {\n size = PyArray_SIZE(self);\n if ((n=fwrite((const void *)self->data, \n (size_t) self->itemsize,\n (size_t) size, fp)) < size) {\n PyErr_Format(PyExc_ValueError, \n \"%ld requested and %ld written\",\n (long) size, (long) n);\n return -1;\n }\n }\n else {\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n while(it->index < it->size) {\n if (fwrite((const void *)it->dataptr, \n (size_t) self->itemsize,\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n \" %d to file\", it->index);\n Py_DECREF(it);\n return -1;\n }\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n } \n }\n else { /* text data */\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n\t\tn4 = strlen((const char *)format);\n while(it->index < it->size) {\n obj = self->descr->getitem(it->dataptr, self);\n if (obj == NULL) {Py_DECREF(it); return -1;}\n\t\t\tif (n4 == 0) { /* standard writing */\n\t\t\t\tstrobj = PyObject_Str(obj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n\t\t\telse { /* use format string */\n\t\t\t\ttupobj = PyTuple_New(1);\n\t\t\t\tif (tupobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t\tPyTuple_SET_ITEM(tupobj,0,obj);\n\t\t\t\tobj = PyString_FromString((const char *)format);\n\t\t\t\tif (obj == NULL) {Py_DECREF(tupobj); \n\t\t\t\t\tPy_DECREF(it); return -1;}\n\t\t\t\tstrobj = PyString_Format(obj, tupobj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tPy_DECREF(tupobj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n if ((n=fwrite(PyString_AS_STRING(strobj), \n 1, n2=PyString_GET_SIZE(strobj),\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n \" to file\", it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n }\n /* write separator for all but last one */\n if (it->index != it->size-1) \n fwrite(sep, 1, n3, fp);\n Py_DECREF(strobj);\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n return 0;\n}\n\nstatic PyObject *\nPyArray_ToList(PyArrayObject *self) \n{\n PyObject *lp;\n PyArrayObject *v;\n intp sz, i;\n\t\n if (!PyArray_Check(self)) return (PyObject *)self;\n\n if (self->nd == 0) \n\t\treturn self->descr->getitem(self->data,self);\n\t\n sz = self->dimensions[0];\n lp = PyList_New(sz);\n\t\n for (i=0; ind >= self->nd) {\n\t\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\t\"array_item not returning smaller\" \\\n\t\t\t\t\t\" dimensional array\");\n\t\t\tPy_DECREF(lp);\n\t\t\treturn NULL;\n\t\t}\n PyList_SetItem(lp, i, PyArray_ToList(v));\n\t\tPy_DECREF(v);\n }\n\t\n return lp;\n}\n\nstatic PyObject *\nPyArray_ToString(PyArrayObject *self)\n{\n intp numbytes;\n intp index;\n char *dptr;\n int elsize;\n PyObject *ret;\n PyArrayIterObject *it;\n \n if (PyArray_TYPE(self) == PyArray_OBJECT) {\n PyErr_SetString(PyExc_ValueError, \"a string for the data\"\\\n\t\t\t\t\"in an object array is not appropriate.\");\n return NULL;\n }\n\n numbytes = PyArray_NBYTES(self);\n if (PyArray_ISONESEGMENT(self)) {\n ret = PyString_FromStringAndSize(self->data, (int) numbytes);\n }\n else {\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it==NULL) return NULL;\n ret = PyString_FromStringAndSize(NULL, (int) numbytes);\n if (ret == NULL) {Py_DECREF(it); return NULL;}\n dptr = PyString_AS_STRING(ret);\n index = it->size;\n elsize = self->itemsize;\n while(index--) {\n memcpy(dptr, it->dataptr, elsize);\n dptr += elsize;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n\treturn ret;\n}\n\n\n/*********************** end C-API functions **********************/\n\n\n/* array object functions */\n\nstatic void \narray_dealloc(PyArrayObject *self) {\n\n if (self->weakreflist != NULL)\n PyObject_ClearWeakRefs((PyObject *)self);\n\n if(self->base) {\n\t\t/* UPDATEIFCOPY means that base points to an \n\t\t array that should be updated with the contents\n\t\t of this array upon destruction.\n self->base->flags must have been WRITEABLE \n (checked previously) and it was locked here\n thus, unlock it.\n\t\t*/\n\t\tif (self->flags & UPDATEIFCOPY) {\n ((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tPy_INCREF(self); /* hold on to self in next call */\n PyArray_CopyInto((PyArrayObject *)self->base, self);\n\t\t\t/* Don't need to DECREF -- because we are deleting\n\t\t\t self already... */\n\t\t}\n\t\t/* In any case base is pointing to something that we need\n\t\t to DECREF -- either a view or a buffer object */\n Py_DECREF(self->base);\n }\n \n if ((self->flags & OWN_DATA) && (self->data != NULL)) {\n\t\t/* Free internal references if an Object array */\n\t\tPyArray_XDECREF(self);\n\n PyDataMem_FREE(self->data);\n }\n\t\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t}\n\t\n self->ob_type->tp_free((PyObject *)self);\n}\n\n/*************************************************************************\n **************** Implement Mapping Protocol ***************************\n *************************************************************************/\n\nstatic int \narray_length(PyArrayObject *self) \n{\n if (self->nd != 0) {\n return self->dimensions[0];\n } else {\n\t\tPyErr_SetString(PyExc_TypeError, \"len() of unsized object.\");\n\t\treturn -1;\n }\n}\n\n\nstatic PyObject *\narray_item(PyArrayObject *self, int i) \n{\n char *item;\n PyArrayObject *r;\n\n\n\tif(self->nd == 0) {\n\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\"0-d arrays can't be indexed.\");\n\t\treturn NULL;\n\t}\n if ((item = index2ptr(self, i)) == NULL) return NULL;\n\n\tr = (PyArrayObject *)PyArray_New(self->ob_type, \n\t\t\t\t\t self->nd-1, self->dimensions+1, \n\t\t\t\t\t self->descr->type_num, \n\t\t\t\t\t self->strides+1, item, \n\t\t\t\t\t self->itemsize, self->flags,\n\t\t\t\t\t (PyObject *)self);\n\tif (r == NULL) return NULL;\n\tPy_INCREF(self);\n\tr->base = (PyObject *)self;\n PyArray_UpdateFlags(r, CONTIGUOUS | FORTRAN);\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_item_nice(PyArrayObject *self, int i) \n{\n\treturn PyArray_Return((PyArrayObject *)array_item(self, i));\n}\n\n\nstatic int \narray_ass_item(PyArrayObject *self, int i, PyObject *v) \n{\n PyArrayObject *tmp;\n char *item;\n int ret;\n\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n if (i < 0) i = i+self->dimensions[0];\n\n if (self->nd > 1) {\n if((tmp = (PyArrayObject *)array_item(self, i)) == NULL)\n return -1;\n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n return ret; \n }\n\t\n if ((item = index2ptr(self, i)) == NULL) return -1;\n if (self->descr->setitem(v, item, self) == -1) return -1;\n return 0;\n}\n\n/* -------------------------------------------------------------- */\nstatic int\nslice_coerce_index(PyObject *o, int *v)\n{\n\t*v = PyArray_PyIntAsInt(o);\n\tif (error_converting(*v)) {\n\t\tPyErr_Clear();\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\n/* This is basically PySlice_GetIndicesEx, but with our coercion\n * of indices to integers (plus, that function is new in Python 2.3) */\nstatic int\nslice_GetIndices(PySliceObject *r, int length,\n int *start, int *stop, int *step,\n intp *slicelength)\n{\n\tint defstart, defstop;\n\t\n\tif (r->step == Py_None) {\n\t\t*step = 1;\n\t} else {\n\t\tif (!slice_coerce_index(r->step, step)) return -1;\n\t\tif (*step == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"slice step can not be zero\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tdefstart = *step < 0 ? length - 1 : 0;\n\tdefstop = *step < 0 ? -1 : length;\n\t\n\tif (r->start == Py_None) {\n\t\t*start = *step < 0 ? length-1 : 0;\n\t} else {\n\t\tif (!slice_coerce_index(r->start, start)) return -1;\n\t\tif (*start < 0) *start += length;\n\t\tif (*start < 0) *start = (*step < 0) ? -1 : 0;\n\t\tif (*start >= length) {\n\t\t\t*start = (*step < 0) ? length - 1 : length;\n\t\t}\n\t}\n\t\n\tif (r->stop == Py_None) {\n\t\t*stop = defstop;\n\t} else {\n\t\tif (!slice_coerce_index(r->stop, stop)) return -1;\n\t\tif (*stop < 0) *stop += length;\n if (*stop < 0) *stop = -1;\n if (*stop > length) *stop = length;\n\t}\n\t\n\tif ((*step < 0 && *stop >= *start) || \\\n\t (*step > 0 && *start >= *stop)) {\n\t\t*slicelength = 0;\n\t} else if (*step < 0) {\n\t\t*slicelength = (*stop - *start + 1) / (*step) + 1;\n\t} else {\n\t\t*slicelength = (*stop - *start - 1) / (*step) + 1;\n\t}\n\t\n\treturn 0;\n}\n\n#define PseudoIndex -1\n#define RubberIndex -2\n#define SingleIndex -3\n\nstatic int\nparse_subindex(PyObject *op, int *step_size, intp *n_steps, int max)\n{\n\tint index;\n\t\n\tif (op == Py_None) {\n\t\t*n_steps = PseudoIndex;\n\t\tindex = 0;\n\t} else if (op == Py_Ellipsis) {\n\t\t*n_steps = RubberIndex;\n\t\tindex = 0;\n\t} else if (PySlice_Check(op)) {\n\t\tint stop;\n\t\tif (slice_GetIndices((PySliceObject *)op, max,\n\t\t\t\t &index, &stop, step_size, n_steps) < 0) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"invalid slice\");\n\t\t\t}\n\t\t\tgoto fail;\n\t\t}\n\t\tif (*n_steps <= 0) {\n\t\t\t*n_steps = 0;\n\t\t\t*step_size = 1;\n\t\t\tindex = 0;\n\t\t}\n\t} else {\n\t\tindex = PyArray_PyIntAsInt(op);\n\t\tif (error_converting(index)) {\n\t\t\tPyErr_SetString(PyExc_IndexError,\n\t\t\t\t\t\"each subindex must be either a \"\\\n\t\t\t\t\t\"slice, an integer, Ellipsis, or \"\\\n\t\t\t\t\t\"newaxis\");\n\t\t\tgoto fail;\n\t\t}\n\t\t*n_steps = SingleIndex;\n\t\t*step_size = 0;\n\t\tif (index < 0) index += max;\n\t\tif (index >= max || index < 0) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \"invalid index\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn index;\n fail:\n\treturn -1;\n}\n\n\nstatic int \nparse_index(PyArrayObject *self, PyObject *op, \n intp *dimensions, intp *strides, intp *offset_ptr)\n{\n int i, j, n;\n int nd_old, nd_new, start, offset, n_add, n_pseudo;\n int step_size;\n\tintp n_steps;\n PyObject *op1=NULL;\n int is_slice;\n\n\n if (PySlice_Check(op) || op == Py_Ellipsis || op == Py_None) {\n n = 1;\n op1 = op;\n Py_INCREF(op);\t\n /* this relies on the fact that n==1 for loop below */\n is_slice = 1;\n }\n else {\n if (!PySequence_Check(op)) {\n PyErr_SetString(PyExc_IndexError, \n \"index must be either an int \"\\\n \"or a sequence\");\n return -1;\n }\n n = PySequence_Length(op);\n is_slice = 0;\n }\n\t\n nd_old = nd_new = 0;\n\t\n offset = 0;\n for(i=0; ind ? \\\n self->dimensions[nd_old] : 0);\n Py_DECREF(op1);\n if (start == -1) break;\n\t\t\n if (n_steps == PseudoIndex) {\n dimensions[nd_new] = 1; strides[nd_new] = 0; nd_new++;\n } else {\n if (n_steps == RubberIndex) {\n for(j=i+1, n_pseudo=0; jnd-(n-i-n_pseudo-1+nd_old);\n if (n_add < 0) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = \\\n self->strides[nd_old];\n nd_new++; nd_old++;\n }\n } else {\n if (nd_old >= self->nd) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n offset += self->strides[nd_old]*start;\n nd_old++;\n if (n_steps != SingleIndex) {\n dimensions[nd_new] = n_steps;\n strides[nd_new] = step_size * \\\n self->strides[nd_old-1];\n nd_new++;\n }\n }\n }\n }\n if (i < n) return -1;\n n_add = self->nd-nd_old;\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = self->strides[nd_old];\n nd_new++; nd_old++;\n }\t \n *offset_ptr = offset;\n return nd_new;\n}\n\nstatic void\n_swap_axes(PyArrayMapIterObject *mit, PyArrayObject **ret)\n{\n\tPyObject *new, *tup;\n\tint n1, n2, n3, val;\n\tint i;\n\n\ttup = PyTuple_New(mit->nd);\n\t/* tuple for transpose is \n\t (n1,..,n1+n2-1,0,..,n1-1,n1+n2,...,n3-1)\n\t n1 is the number of dimensions of \n\t the broadcasted index array \n\t n2 is the number of dimensions skipped at the\n\t start\n\t n3 is the number of dimensions of the \n\t result \n\t*/\n\tn1 = mit->iters[0]->nd_m1 + 1;\n\tn2 = mit->iteraxes[0];\n\tn3 = mit->nd;\n\tval = n1;\n\ti = 0;\n\twhile(val < n1+n2) \n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = 0;\n\twhile(val < n1)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = n1+n2;\n\twhile(val < n3)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\n\tnew = PyArray_Transpose(*ret, tup);\n\tPy_DECREF(tup);\n\tPy_DECREF(*ret);\n\t*ret = (PyArrayObject *)new;\n}\n\n\n\nstatic PyObject *\nPyArray_GetMap(PyArrayMapIterObject *mit)\n{\n\n\tPyArrayObject *ret, *temp;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\t/* Unbound map iterator --- Bind should have been called */\n\tif (mit->ait == NULL) return NULL;\n\n\t/* This relies on the map iterator object telling us the shape\n\t of the new array in nd and dimensions.\n\t*/\n\ttemp = mit->ait->ao;\n\tret = (PyArrayObject *)\\\n\t\tPyArray_New(temp->ob_type, mit->nd, mit->dimensions, \n\t\t\t temp->descr->type_num, NULL, NULL, \n\t\t\t temp->itemsize, \n\t\t\t PyArray_ISFORTRAN(temp),\n\t\t\t (PyObject *)temp);\n\tif (ret == NULL) return NULL;\n\n\t/* Now just iterate through the new array filling it in\n\t with the next object from the original array as\n\t defined by the mapping iterator */\n\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ret)) \n\t == NULL) \n\t\treturn NULL;\n\tindex = it->size;\n\tswap = ((temp->flags & NOTSWAPPED) != (ret->flags & NOTSWAPPED));\n copyswap = ret->descr->copyswap;\n\tPyArray_MapIterReset(mit);\n\twhile (index--) {\n copyswap(it->dataptr, mit->dataptr, swap, ret->itemsize);\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\t\n\t/* check for consecutive axes */\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, &ret);\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\nstatic int\nPyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)\n{\n\tPyObject *arr=NULL;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n\tPyArray_Typecode typecode = {0, 0, 0};\n PyArray_CopySwapFunc *copyswap;\n\n\t/* Unbound Map Iterator */\n\tif (mit->ait == NULL) return -1;\n\n\ttypecode.type_num = mit->ait->ao->descr->type_num;\n\ttypecode.itemsize = mit->ait->ao->itemsize;\n\n\tarr = PyArray_FromAny(op, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, (PyArrayObject **)&arr);\n\t\t}\n\t}\n\t\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) \n\t\treturn -1;\n\n\tindex = mit->size;\n\tswap = ((mit->ait->ao->flags & NOTSWAPPED) != \\\n\t\t(PyArray_FLAGS(arr) & NOTSWAPPED));\n\n copyswap = PyArray_DESCR(arr)->copyswap;\n\tPyArray_MapIterReset(mit);\n /* Need to decref OBJECT arrays */\n if (PyTypeNum_ISOBJECT(typecode.type_num)) {\n while (index--) {\n Py_XDECREF(*((PyObject **)mit->dataptr));\n Py_INCREF(*((PyObject **)it->dataptr));\n memmove(mit->dataptr, it->dataptr, sizeof(PyObject *));\n copyswap(mit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_MapIterNext(mit);\n PyArray_ITER_NEXT(it);\n if (it->index == it->size)\n PyArray_ITER_RESET(it);\n }\n return 0;\n }\n\n\twhile(index--) {\n\t\tmemmove(mit->dataptr, it->dataptr, PyArray_ITEMSIZE(arr));\n copyswap(mit->dataptr, NULL, swap, PyArray_ITEMSIZE(arr));\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t\tif (it->index == it->size)\n\t\t\tPyArray_ITER_RESET(it);\n\t}\t\t\n\treturn 0;\n}\n\n/* Called when treating array object like a mapping -- called first from \n Python when using a[object] unless object is a standard slice object\n (not an extended one). \n\n*/\n\n/* There are two situations: \n\n 1 - the subscript is a standard view and a reference to the \n array can be returned\n\n 2 - the subscript uses Boolean masks or integer indexing and\n therefore a new array is created and returned. \n\n*/\n\n/* Always returns 0-dimensional arrays */\n\nstatic PyObject *\narray_subscript(PyArrayObject *self, PyObject *op) \n{\n intp dimensions[MAX_DIMS], strides[MAX_DIMS];\n\tintp offset;\n int nd, i;\n PyArrayObject *other;\n\tPyArrayMapIterObject *mit;\n\n if (PyArray_IsScalar(op, Integer) || PyInt_Check(op) || \\\n PyLong_Check(op)) {\n intp value;\n value = PyArray_PyIntAsIntp(op);\n if (PyErr_Occurred())\n PyErr_Clear();\n else if (value >= 0) {\n if (value <= MAX_INT)\n return array_item(self, (int) value);\n }\n else if (value < 0) {\n if (value >= -MAX_INT) {\n if (self->nd > 0) value += self->dimensions[0];\n return array_item(self, (int) value);\n }\n }\n }\n\n\tif (PyArrayMapIter_Check(op)) {\n\t\tmit = (PyArrayMapIterObject *)op;\n\t\t/* bind to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\n\t\t/* If the mapiterator was created with standard indexing\n\t\t behavior, fall through to view-based code */\n\t\tif (!mit->view) return PyArray_GetMap(mit);\n\t\top = mit->indexobj;\n\t}\n\telse { /* wrap arguments into a mapiter object */\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(op);\n\t\tif (mit == NULL) return NULL;\n\t\tif (!mit->view) { /* fancy indexing */\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tother = (PyArrayObject *)PyArray_GetMap(mit);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn (PyObject *)other;\n\t\t}\n\t\tPy_DECREF(mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(op);\n\tif (!error_converting(i)) {\n\t\tif (i < 0 && self->nd > 0) i = i+self->dimensions[0];\n\t\treturn array_item(self, i);\n\t}\n\tPyErr_Clear();\n\n\t/* Standard (view-based) Indexing */\n if ((nd = parse_index(self, op, dimensions, strides, &offset)) \n == -1) \n return NULL;\n\n\t/* This will only work if new array will be a view */\n\tif ((other = (PyArrayObject *)\t\t\t\t\t\\\n\t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n\t\t\t strides, self->data+offset, \n\t\t\t self->itemsize, self->flags,\n\t\t\t (PyObject *)self)) == NULL) \n\t\treturn NULL;\n\n\n\tother->base = (PyObject *)self;\n\tPy_INCREF(self);\n\t\n\tPyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);\n\t\n\treturn (PyObject *)other;\n}\n\n\n/* Another assignment hacked by using CopyObject. */\n\n/* This only works if subscript returns a standard view. */\n\n/* Again there are two cases. In the first case, PyArray_CopyObject\n can be used. In the second case, a new indexing function has to be \n used.\n*/\n\nstatic int \narray_ass_sub(PyArrayObject *self, PyObject *index, PyObject *op) \n{\n int ret, i;\n PyArrayObject *tmp;\n\tPyArrayMapIterObject *mit;\n\t\n if (op == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n\tif (PyArrayMapIter_Check(index)) {\n\t\tmit = (PyArrayMapIterObject *)index;\n\t\t/* bind behavior to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\t\n\t\t/* fall through if standard view-based map iterator */\n\t\tif (!mit->view) return PyArray_SetMap(mit, op);\n\t\tindex = mit->indexobj;\n\t}\n\telse {\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(index);\n\t\tif (mit == NULL) return -1;\n\t\tif (!mit->view) {\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tret = PyArray_SetMap(mit, op);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn ret;\n\t\t}\n\t\tPy_DECREF((PyObject*)mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(index);\n\tif (!error_converting(i)) {\n\t\treturn array_ass_item(self, i, op);\n\t}\n\tPyErr_Clear();\n\t\n\t/* Rest of standard (view-based) indexing */\n\n if ((tmp = (PyArrayObject *)array_subscript(self, index)) == NULL)\n return -1; \n ret = PyArray_CopyObject(tmp, op);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\n/* There are places that require that array_subscript return a PyArrayObject\n and not possibly a scalar. Thus, this is the function exposed to \n Python so that 0-dim arrays are passed as scalars\n*/\n\nstatic PyObject *\narray_subscript_nice(PyArrayObject *self, PyObject *op) \n{\n\treturn PyArray_Return((PyArrayObject *)array_subscript(self, op));\n}\n\n\nstatic PyMappingMethods array_as_mapping = {\n (inquiry)array_length,\t\t /*mp_length*/\n (binaryfunc)array_subscript_nice,\t/*mp_subscript*/\n (objobjargproc)array_ass_sub,\t /*mp_ass_subscript*/\n};\n\n/****************** End of Mapping Protocol ******************************/\n\n\n/*************************************************************************\n **************** Implement Buffer Protocol ****************************\n *************************************************************************/\n\n/* removed multiple segment interface */\n\nstatic int \narray_getsegcount(PyArrayObject *self, int *lenp) \n{\n if (lenp)\n *lenp = PyArray_NBYTES(self);\n\n if (PyArray_ISONESEGMENT(self)) {\n return 1;\n }\n\n if (lenp)\n *lenp = 0;\n return 0;\n}\n\nstatic int \narray_getreadbuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (segment != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Accessing non-existing array segment\");\n return -1;\n }\n \n if (PyArray_ISONESEGMENT(self)) {\n *ptrptr = self->data;\n return PyArray_NBYTES(self);\n }\n PyErr_SetString(PyExc_ValueError, \"Array is not a single segment\");\n *ptrptr = NULL;\n return -1;\n}\n\n\nstatic int \narray_getwritebuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (PyArray_CHKFLAGS(self, WRITEABLE)) \n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_ValueError, \"Array cannot be \"\\\n \"accessed as a writeable buffer.\");\n return -1;\n }\n}\n\nstatic int \narray_getcharbuf(PyArrayObject *self, int segment, const char **ptrptr) \n{\n if (self->descr->type_num == PyArray_STRING || \\\n\t self->descr->type_num == PyArray_UNICODE)\n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_TypeError, \n \"Non-character array cannot be interpreted \"\\\n \"as character buffer.\");\n return -1;\n }\n}\n\nstatic PyBufferProcs array_as_buffer = {\n (getreadbufferproc)array_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)array_getwritebuf, /*bf_getwritebuffer*/\n (getsegcountproc)array_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)array_getcharbuf, /*bf_getcharbuffer*/\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Number Protocol ****************************\n *************************************************************************/\n\n\ntypedef struct {\n PyObject *add,\n *subtract,\n *multiply,\n *divide,\n *remainder,\n *power,\n\t\t*sqrt,\n *negative,\n *absolute,\n *invert,\n *left_shift,\n *right_shift,\n *bitwise_and,\n *bitwise_xor,\n *bitwise_or,\n *less,\n *less_equal,\n *equal,\n *not_equal,\n *greater,\n *greater_equal,\n *floor_divide,\n *TRUE_divide,\n\t\t*logical_or,\n\t\t*logical_and,\n\t\t*floor,\n\t\t*ceil,\n\t\t*maximum,\n\t\t*minimum;\t\n\t\n} NumericOps;\n\nstatic NumericOps n_ops = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL};\n\n/* Dictionary can contain any of the numeric operations, by name. \n Those not present will not be changed\n */\n\n#define SET(op) temp=PyDict_GetItemString(dict, #op);\t\\\n\tif (temp != NULL) {\t\t\t\t\\\n\t\tif (!(PyCallable_Check(temp))) return -1; \\\n Py_XDECREF(n_ops.op); \\\n\t\tn_ops.op = temp; \\\n\t}\n\n \nint \nPyArray_SetNumericOps(PyObject *dict) \n{\n PyObject *temp = NULL;\n SET(add);\n SET(subtract);\n SET(multiply);\n SET(divide);\n SET(remainder);\n SET(power);\n\tSET(sqrt);\n SET(negative);\n SET(absolute);\n SET(invert);\n SET(left_shift);\n SET(right_shift);\n SET(bitwise_and);\n SET(bitwise_or);\n SET(bitwise_xor);\n SET(less);\t \n SET(less_equal);\n SET(equal);\n SET(not_equal);\n SET(greater);\n SET(greater_equal);\n SET(floor_divide);\t\n SET(TRUE_divide);\t\n\tSET(logical_or);\n\tSET(logical_and);\n\tSET(floor);\n\tSET(ceil);\n\tSET(maximum);\n\tSET(minimum);\n return 0;\n}\n\n#define GET(op) if (PyDict_SetItemString(dict, #op, n_ops.op)==-1) \\\n\t\tgoto fail;\n\nstatic PyObject *\nPyArray_GetNumericOps(void) \n{\n\tPyObject *dict;\n\tif ((dict = PyDict_New())==NULL) \n\t\treturn NULL;\t\n\tGET(add);\n GET(subtract);\n GET(multiply);\n GET(divide);\n GET(remainder);\n GET(power);\n\tGET(sqrt);\n GET(negative);\n GET(absolute);\n GET(invert);\n GET(left_shift);\n GET(right_shift);\n GET(bitwise_and);\n GET(bitwise_or);\n GET(bitwise_xor);\n GET(less);\t \n GET(less_equal);\n GET(equal);\n GET(not_equal);\n GET(greater);\n GET(greater_equal);\n GET(floor_divide); \n GET(TRUE_divide); \n\tGET(logical_or);\n\tGET(logical_and);\n\tGET(floor);\n\tGET(ceil);\n\tGET(maximum);\n\tGET(minimum);\n\treturn dict;\t\n\n fail:\n\tPy_DECREF(dict);\n\treturn NULL;\t\t\n}\n\nstatic PyObject *\nPyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"reduce\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"accumulate\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OO)\", m1, m2);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(O)\", m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericInplaceBinaryFunction(PyArrayObject *m1, \n\t\t\t\t PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OOO)\", m1, m2, m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\narray_add(PyArrayObject *m1, PyObject *m2) \n{ \n return PyArray_GenericBinaryFunction(m1, m2, n_ops.add); \n}\n\nstatic PyObject *\narray_subtract(PyArrayObject *m1, PyObject *m2) \n{\n\treturn PyArray_GenericBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_negative(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.negative);\n}\n\nstatic PyObject *\narray_absolute(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.absolute);\n}\n\nstatic PyObject *\narray_invert(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.invert);\n}\n\nstatic PyObject *\narray_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_inplace_add(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.add);\n}\n\nstatic PyObject *\narray_inplace_subtract(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_inplace_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_inplace_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_inplace_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_inplace_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_inplace_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_inplace_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_inplace_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_inplace_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_inplace_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.TRUE_divide);\n}\n\nstatic PyObject *\narray_inplace_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_inplace_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.TRUE_divide);\n}\n\n/* Array evaluates as \"TRUE\" if any of the elements are non-zero */\nstatic int \narray_all_nonzero(PyArrayObject *mp) \n{\n\tintp index;\n\tPyArrayIterObject *it;\n\tBool anyTRUE = 0;\n\t\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)mp);\n\tif (it==NULL) return anyTRUE;\n\tindex = it->size;\n\twhile(index--) {\n\t\tif (mp->descr->nonzero(it->dataptr, mp)) {\n\t\t\tanyTRUE = 1;\n\t\t\tbreak;\n\t\t}\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\treturn anyTRUE;\n}\n\nstatic PyObject *\narray_divmod(PyArrayObject *op1, PyObject *op2) \n{\n PyObject *divp, *modp, *result;\n\n divp = array_divide(op1, op2);\n if (divp == NULL) return NULL;\n modp = array_remainder(op1, op2);\n if (modp == NULL) {\n Py_DECREF(divp);\n return NULL;\n }\n result = Py_BuildValue(\"OO\", divp, modp);\n Py_DECREF(divp);\n Py_DECREF(modp);\n return result;\n}\n\n\nstatic PyObject *\narray_int(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can be\"\\\n\t\t\t\t\" converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_int == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to int\");\n Py_DECREF(pv);\n return NULL;\n }\n\n pv2 = pv->ob_type->tp_as_number->nb_int(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_float(PyArrayObject *v) \n{\n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an \"\\\n\t\t\t\t\"int, scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_float == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to float\");\n Py_DECREF(pv);\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_float(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_long(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_long == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to long\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_long(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_oct(PyArrayObject *v) \n{\t \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_oct == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to oct\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_oct(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_hex(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_hex == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to hex\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_hex(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\n_array_copy_nice(PyArrayObject *self)\n{\n\treturn PyArray_Return((PyArrayObject *)\t\t\\\n\t\t\t PyArray_Copy(self));\n}\n\nstatic PyNumberMethods array_as_number = {\n (binaryfunc)array_add,\t\t /*nb_add*/\n (binaryfunc)array_subtract,\t\t /*nb_subtract*/\n (binaryfunc)array_multiply,\t\t /*nb_multiply*/\n (binaryfunc)array_divide,\t\t /*nb_divide*/\n (binaryfunc)array_remainder,\t /*nb_remainder*/\n (binaryfunc)array_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)array_power,\t\t /*nb_power*/\n (unaryfunc)array_negative, /*nb_neg*/\t\n (unaryfunc)_array_copy_nice,\t\t /*nb_pos*/ \n (unaryfunc)array_absolute,\t\t /*(unaryfunc)array_abs,*/\n (inquiry)array_all_nonzero,\t\t /*nb_nonzero*/\n (unaryfunc)array_invert,\t\t /*nb_invert*/\n (binaryfunc)array_left_shift,\t /*nb_lshift*/\n (binaryfunc)array_right_shift,\t /*nb_rshift*/\n (binaryfunc)array_bitwise_and,\t /*nb_and*/\n (binaryfunc)array_bitwise_xor,\t /*nb_xor*/\n (binaryfunc)array_bitwise_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)array_int,\t\t /*nb_int*/\n (unaryfunc)array_long,\t\t /*nb_long*/\n (unaryfunc)array_float,\t\t /*nb_float*/\n (unaryfunc)array_oct,\t\t /*nb_oct*/\n (unaryfunc)array_hex,\t\t /*nb_hex*/\n\n /*This code adds augmented assignment functionality*/\n /*that was made available in Python 2.0*/\n (binaryfunc)array_inplace_add,\t /*inplace_add*/\n (binaryfunc)array_inplace_subtract,\t /*inplace_subtract*/\n (binaryfunc)array_inplace_multiply,\t /*inplace_multiply*/\n (binaryfunc)array_inplace_divide,\t /*inplace_divide*/\n (binaryfunc)array_inplace_remainder, /*inplace_remainder*/\n (ternaryfunc)array_inplace_power,\t /*inplace_power*/\n (binaryfunc)array_inplace_left_shift, /*inplace_lshift*/\n (binaryfunc)array_inplace_right_shift, /*inplace_rshift*/\n (binaryfunc)array_inplace_bitwise_and, /*inplace_and*/\n (binaryfunc)array_inplace_bitwise_xor, /*inplace_xor*/\n (binaryfunc)array_inplace_bitwise_or, /*inplace_or*/\n\n (binaryfunc)array_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)array_TRUE_divide,\t /*nb_TRUE_divide*/\n (binaryfunc)array_inplace_floor_divide, /*nb_inplace_floor_divide*/\n (binaryfunc)array_inplace_TRUE_divide, /*nb_inplace_TRUE_divide*/\n\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Sequence Protocol **************************\n *************************************************************************/\n\n/* Some of this is repeated in the array_as_mapping protocol. But\n we fill it in here so that PySequence_XXXX calls work as expected \n*/\n\n\nstatic PyObject * \narray_slice(PyArrayObject *self, int ilow, int ihigh) \n{\n PyArrayObject *r;\n int l;\n char *data;\n\n if (self->nd == 0) {\n PyErr_SetString(PyExc_ValueError, \"can't slice a scalar\");\n return NULL;\n }\n \t\n l=self->dimensions[0];\n if (ihigh < 0) ihigh += l;\n if (ilow < 0) ilow += l;\n if (ilow < 0) ilow = 0;\n else if (ilow > l) ilow = l;\n if (ihigh < 0) ihigh = 0;\n else if (ihigh > l) ihigh = l;\n if (ihigh < ilow) ihigh = ilow;\n\n if (ihigh != ilow) {\n data = index2ptr(self, ilow);\n if (data == NULL) return NULL;\n } else {\n data = self->data;\n }\n\n self->dimensions[0] = ihigh-ilow;\n r = (PyArrayObject *)\\\n\t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n\t\t\t self->descr->type_num, self->strides, data,\n\t\t\t self->itemsize, self->flags, (PyObject *)self);\n\n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n Py_INCREF(self);\n\tPyArray_UpdateFlags(r, UPDATE_ALL_FLAGS); \n return (PyObject *)r;\n}\n\n\nstatic int \narray_ass_slice(PyArrayObject *self, int ilow, int ihigh, PyObject *v) {\n int ret;\n PyArrayObject *tmp;\n\t\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n if ((tmp = (PyArrayObject *)array_slice(self, ilow, ihigh)) \\\n == NULL) \n return -1; \n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\nstatic int\narray_contains(PyArrayObject *self, PyObject *el)\n{\n /* equivalent to any(self == el) */\n\n return PyObject_RichCompareBool((PyObject *)self, el, Py_EQ);\n}\n\n\nstatic PySequenceMethods array_as_sequence = {\n (inquiry)array_length,\t\t/*sq_length*/\n (binaryfunc)NULL, /* sq_concat is handled by nb_add*/\n (intargfunc)NULL, /* sq_repeat is handled nb_multiply*/\n (intargfunc)array_item_nice,\t\t/*sq_item*/\n (intintargfunc)array_slice,\t\t/*sq_slice*/\n (intobjargproc)array_ass_item,\t/*sq_ass_item*/\n (intintobjargproc)array_ass_slice,\t/*sq_ass_slice*/\n\t(objobjproc) array_contains, /* sq_contains */\n\t(binaryfunc) NULL, /* sg_inplace_concat */\n\t(intargfunc) NULL /* sg_inplace_repeat */\n};\n\n\n/****************** End of Sequence Protocol ****************************/\n\n\nstatic int \ndump_data(char **string, int *n, int *max_n, char *data, int nd, \n intp *dimensions, intp *strides, PyArrayObject* self) \n{\n PyArray_Descr *descr=self->descr;\n PyObject *op, *sp;\n char *ostring;\n int i, N;\n\t\n#define CHECK_MEMORY if (*n >= *max_n-16) { *max_n *= 2; \\\n\t\t*string = (char *)realloc(*string, *max_n); }\n\t\n if (nd == 0) {\n\t\t\n if ((op = descr->getitem(data, self)) == NULL) return -1;\n sp = PyObject_Repr(op);\n if (sp == NULL) {Py_DECREF(op); return -1;}\n ostring = PyString_AsString(sp);\n N = PyString_Size(sp)*sizeof(char);\n *n += N;\n CHECK_MEMORY\n memmove(*string+(*n-N), ostring, N);\n Py_DECREF(sp);\n Py_DECREF(op);\n return 0;\n } else {\n CHECK_MEMORY\n (*string)[*n] = '[';\n *n += 1;\n for(i=0; idata, \n\t\t self->nd, self->dimensions, \n self->strides, self) < 0) { \n\t\tfree(string); return NULL; \n\t}\n\t\n\tif (PyArray_ISFLEXIBLE(self)) {\n\t\tchar buf[100];\n\t\tsnprintf(buf, sizeof(buf), \"%d\", self->itemsize);\n\t\tsprintf(string+n, \", '%c%s')\", self->descr->type, buf);\n\t\tret = PyString_FromStringAndSize(string, n+6+strlen(buf));\n\t}\n\telse {\n\t\tsprintf(string+n, \", '%c')\", self->descr->type);\n\t\tret = PyString_FromStringAndSize(string, n+6);\n\t}\n\t\n\n free(string);\n return ret;\n}\n\nstatic PyObject *PyArray_StrFunction=NULL;\nstatic PyObject *PyArray_ReprFunction=NULL;\n\nstatic void \nPyArray_SetStringFunction(PyObject *op, int repr) \n{\n if (repr) {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_ReprFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_ReprFunction = op; \n } else {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_StrFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_StrFunction = op; \n }\n}\n\nstatic PyObject *\narray_repr(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_ReprFunction == NULL) {\n s = array_repr_builtin(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_ReprFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\nstatic PyObject *\narray_str(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_StrFunction == NULL) {\n s = array_repr(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_StrFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\n\nstatic PyObject *\narray_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) \n{\n PyObject *array_other, *result;\n\n switch (cmp_op) \n {\n case Py_LT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less);\n case Py_LE:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less_equal);\n case Py_EQ:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then return the integer\n\t\t\t object 0. This fixes code that used to\n\t\t\t allow equality comparisons between arrays\n\t\t\t and other objects which would give a result\n\t\t\t of 0\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.equal);\n /* If the comparison results in NULL, then the \n\t\t\t two array objects can not be compared together so \n\t\t\t return zero \n */\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n return result;\n case Py_NE:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then objects cannot be \n\t\t\t compared and cannot be equal, therefore, \n\t\t\t return True;\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.not_equal);\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n return result;\n case Py_GT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.greater);\n case Py_GE:\n return PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t other, \n\t\t\t\t\t \t n_ops.greater_equal);\n }\n return NULL;\n}\n\nstatic PyObject *\n_check_axis(PyArrayObject *arr, int *axis, int flags)\n{\n\tPyObject *temp;\n\tint n = arr->nd;\n\n\tif ((*axis >= MAX_DIMS) || (n==0)) {\n\t\ttemp = PyArray_Ravel(arr,0);\n\t\t*axis = 0;\n\t\treturn temp;\n\t}\n\telse {\n\t\tif (flags) {\n\t\t\ttemp = PyArray_FromAny((PyObject *)arr, NULL, \n\t\t\t\t\t 0, 0, flags);\n\t\t\tif (temp == NULL) return NULL;\n\t\t}\n\t\telse {\n\t\t\tPy_INCREF(arr);\n\t\t\ttemp = (PyObject *)arr;\n\t\t}\n\t}\n\tif (*axis < 0) *axis += n;\n\tif ((*axis < 0) || (*axis >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"axis(=%d) out of bounds\", *axis);\n\t\tPy_DECREF(temp);\n\t\treturn NULL;\n\t}\n\treturn temp;\n}\n\n#include \"arraymethods.c\"\n\n/* Lifted from numarray */\nstatic PyObject *\nPyArray_IntTupleFromIntp(int len, intp *vals)\n{\n\tint i;\n PyObject *intTuple = PyTuple_New(len);\n if (!intTuple) goto fail;\n for(i=0; ind == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i = ap->nd-1; i >= 0; --i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int \n_IsFortranContiguous(PyArrayObject *ap) \n{\n\tint sd;\n\tint i;\n\t\n\tif (ap->nd == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i=0; i< ap->nd; ++i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int\n_IsAligned(PyArrayObject *ap) \n{\n\tint i, alignment, aligned=1;\n\tintp ptr;\n\tint type = ap->descr->type_num;\n\n\tif ((type == PyArray_STRING) || (type == PyArray_VOID))\n\t\treturn 1;\n\n\talignment = ap->descr->alignment;\n\n\tptr = (intp) ap->data;\n aligned = (ptr % alignment) == 0;\n for (i=0; i nd; i++)\n aligned &= ((ap->strides[i] % alignment) == 0);\n return aligned != 0;\n}\n\nstatic Bool\n_IsWriteable(PyArrayObject *ap)\n{\n\tPyObject *base=ap->base;\n\tPyBufferProcs *pb;\n\n\t/* If we own our own data, then no-problem */\n\tif ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;\n\n\t/* Get to the final base object \n\t If it is a writeable array, then return TRUE\n\t If we can find an array object \n\t or a writeable buffer object as the final base object\n\t or a string object (for pickling support memory savings).\n\t - this last could be removed if a proper pickleable \n\t buffer was added to Python.\n\t*/\n\n\twhile(PyArray_Check(base)) {\n\t\tif (PyArray_CHKFLAGS(base, OWN_DATA)) \n\t\t\treturn (Bool) (PyArray_ISWRITEABLE(base));\n\t\tbase = PyArray_BASE(base);\n\t}\n\n\t/* here so pickle support works seamlessly \n\t and unpickled array can be set and reset writeable \n\t -- could be abused -- */\n\tif PyString_Check(base) return TRUE;\n\n\tpb = base->ob_type->tp_as_buffer;\n\tif (pb == NULL || pb->bf_getwritebuffer == NULL)\n\t\treturn FALSE;\n\t\n\treturn TRUE;\n}\n\n\nstatic void\nPyArray_UpdateFlags(PyArrayObject *ret, int flagmask)\n{\n\n\tif (flagmask & FORTRAN) {\n\t\tif (_IsFortranContiguous(ret)) {\n\t\t\tret->flags |= FORTRAN;\n\t\t\tif (ret->nd > 1) ret->flags &= ~CONTIGUOUS;\n\t\t}\n\t\telse ret->flags &= ~FORTRAN;\n\t}\n\tif (flagmask & CONTIGUOUS) {\n\t\tif (_IsContiguous(ret)) {\n\t\t\tret->flags |= CONTIGUOUS;\n\t\t\tif (ret->nd > 1) ret->flags &= ~FORTRAN;\n\t\t}\n\t\telse ret->flags &= ~CONTIGUOUS;\n\t}\n\tif (flagmask & ALIGNED) {\n\t\tif (_IsAligned(ret)) ret->flags |= ALIGNED;\n\t\telse ret->flags &= ~ALIGNED;\n\t}\n\treturn;\n}\n\n/* This routine checks to see if newstrides (of length nd) will not \n walk outside of the memory implied by either numbytes or\n a single segment array of the provided dimensions and element size if\n numbytes is 0 */\nstatic Bool\nPyArray_CheckStrides(int elsize, int nd, intp numbytes, \n\t\t intp *dims, intp *newstrides)\n{\n\tint i;\n\t\n\tif (numbytes == 0) \n\t\tnumbytes = PyArray_MultiplyList(dims, nd) * elsize;\n\t\n\tfor (i=0; i numbytes) {\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\treturn TRUE;\n\t\n}\n\n\n/* This is the main array creation routine. */\n\n/* Flags argument has multiple related meanings \n depending on data and strides: \n\n If data is given, then flags is flags associated with data. \n If strides is not given, then a contiguous strides array will be created\n and the CONTIGUOUS bit will be set. If the flags argument \n has the FORTRAN bit set, then a FORTRAN-style strides array will be\n created (and of course the FORTRAN flag bit will be set). \n\n If data is not given but created here, then flags will be DEFAULT_FLAGS\n and a non-zero flags argument can be used to indicate a FORTRAN style\n array is desired. \n*/\n\nstatic intp\n_array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize, \n\t\t int inflag, int *objflags) \n{\n\tint i;\n\t/* Only make Fortran strides if not contiguous as well */\n\tif ((inflag & FORTRAN) && !(inflag & CONTIGUOUS)) {\n\t\tfor (i=0; i 1) *objflags &= ~CONTIGUOUS;\n\t\telse *objflags |= CONTIGUOUS;\n\t}\n\telse {\n\t\tfor (i=nd-1;i>=0;i--) {\n\t\t\tstrides[i] = itemsize;\n\t\t\titemsize *= dims[i] ? dims[i] : 1;\n\t\t}\n\t\t*objflags |= CONTIGUOUS;\n\t\tif (nd > 1) *objflags &= ~FORTRAN;\n\t\telse *objflags |= FORTRAN;\n\t}\n\treturn itemsize;\n}\n\n\t\nstatic PyObject *\nPyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n\t PyObject *obj)\n{\n\tPyArrayObject *self;\n\tPyArray_Descr *descr;\n\tregister int i;\n\tintp sd, temp;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\tif (descr == NULL) return NULL;\n\n\tif (nd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"number of dimensions must be >=0\");\n\t\treturn NULL;\n\t}\n if (nd > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError,\n \"maximum number of dimensions is %d\", MAX_DIMS);\n return NULL;\n\t}\n\n\t/* Check dimensions */\n\tfor (i=nd-1;i>=0;i--) {\n\t\tif (dims[i] < 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"negative dimensions\"\t\\\n\t\t\t\t\t\" are not allowed.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tself = (PyArrayObject *) subtype->tp_alloc(subtype, 0);\n\tif (self == NULL) return NULL;\t\n\tself->descr = descr;\n\tself->dimensions = NULL;\n\tif (data == NULL) { /* strides is NULL too */\n\t\tself->flags = DEFAULT_FLAGS;\n\t\tif (flags) {\n\t\t\tself->flags |= FORTRAN; \n\t\t\tif (nd > 1) self->flags &= ~CONTIGUOUS;\n\t\t\tflags = FORTRAN;\n\t\t}\n\t}\n\telse self->flags = (flags & ~UPDATEIFCOPY);\n\t\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tif (itemsize < 1) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"Type must provide an itemsize.\");\n\t\t\tPyObject_Del(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tself->itemsize = itemsize;\n\t\t/* Guarantee that these kind of arrays are never byteswapped\n\t\t unknowingly. \n\t\t*/\n\t\tif (type_num != PyArray_UNICODE)\n\t\t\tself->flags |= NOTSWAPPED;\n\t}\n\telse self->itemsize = descr->elsize; \n\t\t\n\tsd = self->itemsize;\n\t\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dims, sizeof(intp)*nd);\n\t\tif (strides == NULL) { /* fill it in */\n\t\t\tsd = _array_fill_strides(self->strides, dims, nd, sd,\n\t\t\t\t\t\t flags, &(self->flags));\n\t\t}\n\t\telse {\n\t\t\tif (data == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"If strides is given in \" \\\n\t\t\t\t\t\t\"array creation, data must \" \\\n\t\t\t\t\t\t\"be given too.\");\n\t\t\t\tPyObject_Del(self);\n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\t\treturn NULL;\n\t\t\t}\t\t\t\t\t\n\t\t\tmemcpy(self->strides, strides, sizeof(intp)*nd);\n\t\t}\n\t}\n \t\n\t\t\n\tif (data == NULL) {\n\n\t\t/* Make sure we are aligned on void ptrs (without wasting\n\t\t space if we already are). But, also, allocate something \n\t\t even for zero-space arrays e.g. shape=(0,) -- otherwise\n buffer exposure (a.data) doesn't work as it should. */\n\n\t\tif (sd==0) sd = sizeof(intp);\n\t\telse if ((temp=sd%sizeof(intp))) sd += sizeof(intp) - temp;\n\n\t\tif ((data = PyDataMem_NEW(sd))==NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\tif (self->dimensions != NULL) \n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\n\t\t/* It is bad to have unitialized OBJECT pointers */\n\t\t/* We shouldn't need to check for the OBJECT Letter\n\t\t but perhaps it's best. */\n\t\tif (type_num == PyArray_OBJECT || \\\n\t\t type_num == PyArray_OBJECTLTR) {\n\t\t\tmemset(data, 0, sd);\n\t\t}\n\t}\n\telse {\n self->flags &= ~OWN_DATA; /* If data is passed in, \n\t\t\t\t\t this object won't own it \n\t\t\t\t\t by default.\n\t\t\t\t\t Caller must arrange for \n\t\t\t\t\t this to be reset if truly\n\t\t\t\t\t desired */\n }\n self->data = data;\n\tself->nd = nd;\n\tself->base = (PyObject *)NULL;\n self->weakreflist = (PyObject *)NULL;\n\n /* call the __array_finalize__\n\t method if a subtype and some object passed in */\n\tif ((obj != NULL) && (subtype != &PyArray_Type) && \n\t (subtype != &PyBigArray_Type)) {\n\t\tPyObject *res;\n\t\tres = PyObject_CallMethod((PyObject *)self, \n\t\t\t\t\t \"__array_finalize__\",\n\t\t\t\t\t \"O\", obj);\n\t\tif (res == NULL) PyErr_Clear();\n\t\telse Py_DECREF(res);\n\t}\n\n\treturn (PyObject *)self;\n}\n\n\n\nstatic PyObject * \nPyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape)\n{\n intp oldsize, newsize;\n int new_nd=newshape->len, k, n, elsize;\n int refcnt;\n intp* new_dimensions=newshape->ptr;\n intp new_strides[MAX_DIMS];\n intp sd;\n intp *dimptr;\n char *new_data;\n\t\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n \"resize only works on contiguous arrays\");\n return NULL;\n }\n\n\n newsize = PyArray_MultiplyList(new_dimensions, new_nd);\n\n if (newsize == 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Newsize is zero. Cannot delete an array \"\\\n \"in this way.\");\n return NULL;\n }\n oldsize = PyArray_SIZE(self);\n \n\tif (oldsize != newsize) {\n\t\tif (!(self->flags & OWN_DATA)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize this array: \"\t\\\n\t\t\t\t\t\"it does not own its data.\");\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\trefcnt = (((PyObject *)self)->ob_refcnt);\n\t\tif ((refcnt > 2) || (self->base != NULL) || \\\n\t\t (self->weakreflist != NULL)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize an array that has \"\\\n\t\t\t\t\t\"been referenced or is referencing\\n\"\\\n\t\t\t\t\t\"another array in this way. Use the \"\\\n\t\t\t\t\t\"resize function.\");\n\t\t\treturn NULL;\n\t\t} \n\t\t\n\t\t/* Reallocate space if needed */\n\t\tnew_data = PyDataMem_RENEW(self->data, \n\t\t\t\t\t newsize*(self->itemsize));\n\t\tif (new_data == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n\t\t\t\t\t\"can't allocate memory for array.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tself->data = new_data;\n\t}\n \n if ((newsize > oldsize) && PyArray_ISWRITEABLE(self)) { \n\t\t/* Fill new memory with zeros */\n elsize = self->itemsize;\n\t\tif ((PyArray_TYPE(self) == PyArray_OBJECT)) {\n\t\t\tPyObject *zero = PyInt_FromLong(0);\n PyObject **optr;\n\t\t\toptr = ((PyObject **)self->data) + oldsize;\n\t\t\tn = newsize - oldsize;\n\t\t\tfor (k=0; kdata+oldsize*elsize, 0, \n\t\t\t (newsize-oldsize)*elsize);\n\t\t}\n\t}\n \n if (self->nd != new_nd) { /* Different number of dimensions. */\n self->nd = new_nd;\n \n /* Need new dimensions and strides arrays */\n dimptr = PyDimMem_RENEW(self->dimensions, 2*new_nd);\n if (dimptr == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n \"can't allocate memory for array \" \\\n \"(array may be corrupted).\");\n return NULL;\n }\n self->dimensions = dimptr;\n\t\tself->strides = dimptr + new_nd;\n }\n\n /* make new_strides variable */\n sd = (intp) self->itemsize;\n sd = _array_fill_strides(new_strides, new_dimensions, new_nd, sd,\n 0, &(self->flags));\n\n \n memmove(self->dimensions, new_dimensions, new_nd*sizeof(intp));\n memmove(self->strides, new_strides, new_nd*sizeof(intp));\n\n Py_INCREF(Py_None);\t\n return Py_None;\n \n}\n\n\nstatic void\nPyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj)\n{\n PyObject **optr;\n intp i,n;\n optr = (PyObject **)(arr->data);\n n = PyArray_SIZE(arr);\n if (obj == NULL) {\n for (i=0; ibase = buffer.base;\n Py_INCREF(buffer.base); \n }\n\n PyDimMem_FREE(dims.ptr);\n if (strides.ptr) PyDimMem_FREE(strides.ptr);\n return PyArray_Return(ret);\n \n fail:\n if (dims.ptr) free(dims.ptr);\n if (strides.ptr) free(strides.ptr);\n return NULL;\n}\n\n\n\n/******************* array attribute get and set routines ******************/\n\nstatic PyObject *\narray_ndim_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong(self->nd);\n}\n\nstatic PyObject *\narray_flags_get(PyArrayObject *self)\n{\n static PyObject *module=NULL;\n\n if (module==NULL) {\n module = PyImport_ImportModule(\"scipy.base._internal\");\n if (module == NULL) return NULL;\n }\n return PyObject_CallMethod(module, \"flagsobj\", \"Oi\", \n self, self->flags);\n}\n\n/*\nstatic int\narray_flags_set(PyArrayObject *self, PyObject *obj) \n{\n\tint flagback = self->flags;\n\n if (PyDict_Check(obj)) {\n PyObject *new;\n\t\tnew = PyDict_GetItemString(obj, \"ALIGNED\");\n\t\tif (new) {\n\t\t\tif (PyObject_Not(new)) self->flags &= ~ALIGNED;\n\t\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\t\telse {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"cannot set aligned flag of \" \\\n\t\t\t\t\t\t\"mis-aligned array to True\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n new = PyDict_GetItemString(obj, \"UPDATEIFCOPY\");\n if (new) {\n if (PyObject_Not(new)) {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n else {\n\t\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return -1;\n }\n }\n new = PyDict_GetItemString(obj, \"WRITEABLE\");\n if (new) {\n\t\t\tif (PyObject_IsTrue(new)) {\n\t\t\t\tif (_IsWriteable(self)) {\n\t\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself->flags = flagback;\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\t\"cannot set \"\t\\\n\t\t\t\t\t\t\t\"WRITEABLE \"\t\\\n\t\t\t\t\t\t\t\"flag to True of \"\\\n\t\t\t\t\t\t\t\"this array \");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n new = PyDict_GetItemString(obj, \"NOTSWAPPED\");\n if (new) {\n if (PyObject_IsTrue(new))\n self->flags |= NOTSWAPPED;\n else {\n self->flags &= ~NOTSWAPPED;\n\t\t\t}\n\t\t}\n return 0;\n }\n PyErr_SetString(PyExc_ValueError, \n \"Object must be a dictionary\");\n return -1;\n}\n*/\n\n\nstatic PyObject *\narray_shape_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->dimensions);\n}\n\n\nstatic int\narray_shape_set(PyArrayObject *self, PyObject *val)\n{\n \tint nd;\n\tPyObject *ret;\n\n\tif (!PyTuple_Check(val)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"shape must be a tuple\");\n\t\treturn -1;\n\t}\n\tret = PyArray_Reshape(self, val);\n\tif (ret == NULL) return -1;\n\t\n\tif (self->nd > 0) { /* Free old dimensions and strides */\n\t\tPyDimMem_FREE(self->dimensions);\n\t}\n\tnd = PyArray_NDIM(ret);\n\tself->nd = nd;\n\tif (nd > 0) { /* create new dimensions and strides */\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\tPyErr_SetString(PyExc_MemoryError,\"\");\n\t\t\treturn -1;\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, PyArray_DIMS(ret), \n\t\t nd*sizeof(intp));\n\t\tmemcpy(self->strides, PyArray_STRIDES(ret), \n\t\t nd*sizeof(intp));\n\t}\n\telse self->dimensions=NULL;\n\tPy_DECREF(ret);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_strides_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic int\narray_strides_set(PyArrayObject *self, PyObject *obj)\n{\n\tPyArray_Dims newstrides = {NULL, 0};\n\tPyArrayObject *new;\n\tintp numbytes;\n\n\tif (!PyArray_IntpConverter(obj, &newstrides) || \\\n\t newstrides.ptr == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"invalid strides.\");\n\t\treturn -1;\n\t}\n\tif (newstrides.len != self->nd) {\n\t\tPyErr_Format(PyExc_ValueError, \"strides must be \"\t\\\n\t\t\t \" same length as shape (%d)\", self->nd);\n\t\treturn -1;\n\t}\n\tnew = self;\n\twhile(new->base != NULL) {\n\t\tif (PyArray_Check(new->base)) \n\t\t\tnew = (PyArrayObject *)new->base;\n\t}\n\tnumbytes = PyArray_MultiplyList(new->dimensions, \n\t\t\t\t\tnew->nd)*new->itemsize;\n\t\n\tif (!PyArray_CheckStrides(self->itemsize, self->nd, numbytes, \n\t\t\t\t self->dimensions, newstrides.ptr)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"strides is not \"\\\n\t\t\t\t\"compatible with available memory\");\n\t\treturn -1;\n\t}\n\tmemcpy(self->strides, newstrides.ptr, sizeof(intp)*newstrides.len);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_protocol_strides_get(PyArrayObject *self)\n{\n\tif PyArray_ISCONTIGUOUS(self) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic PyObject *\narray_priority_get(PyArrayObject *self)\n{\n\tif (PyArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_PRIORITY);\n\telse if (PyBigArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_BIG_PRIORITY);\n\telse\n\t\treturn PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY);\n}\n\n\nstatic PyObject *\narray_data_get(PyArrayObject *self)\n{\n\tintp nbytes;\n\tif (!(PyArray_ISONESEGMENT(self))) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot get single-\"\\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn NULL;\n\t}\t\t\n\tnbytes = PyArray_NBYTES(self);\n\tif PyArray_ISWRITEABLE(self) \n\t\treturn PyBuffer_FromReadWriteObject((PyObject *)self, 0, \n\t\t\t\t\t\t (int) nbytes);\n\telse\n\t\treturn PyBuffer_FromObject((PyObject *)self, 0, (int) nbytes);\n}\n\nstatic int\narray_data_set(PyArrayObject *self, PyObject *op)\n{\n\tvoid *buf;\n\tint buf_len;\n\tint writeable=1;\n\n\tif (PyObject_AsWriteBuffer(op, &buf, &buf_len) < 0) {\n\t\twriteable = 0;\n\t\tif (PyObject_AsReadBuffer(op, (const void **)&buf, \n\t\t\t\t\t &buf_len) < 0) {\n\t\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\t\"Object does not have single-segment\" \\\n\t\t\t\t\t\"buffer interface\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif (!PyArray_ISONESEGMENT(self)) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot set single-\" \\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn -1;\n\t}\n\tif (PyArray_NBYTES(self) > buf_len) {\n\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\"Not enough data for array.\");\n\t\treturn -1;\n\t}\n\tif (self->flags & OWN_DATA) {\n\t\tPyArray_XDECREF(self);\n\t\tPyDataMem_FREE(self->data);\n\t}\n\tif (self->base) {\n\t\tif (self->flags & UPDATEIFCOPY) {\n\t\t\t((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tself->flags &= ~UPDATEIFCOPY;\n\t\t}\n\t\tPy_DECREF(self->base);\n\t}\n\tPy_INCREF(op);\n\tself->base = op;\n\tself->data = buf;\n\tself->flags = CARRAY_FLAGS;\n\tif (!writeable)\n\t\tself->flags &= ~WRITEABLE;\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_itemsize_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->itemsize);\n}\n\nstatic PyObject *\narray_size_get(PyArrayObject *self)\n{\n\tlonglong size=PyArray_SIZE(self);\n\tif (size > MAX_INT || size < MIN_INT)\n\t\treturn PyLong_FromLongLong((longlong) size);\n\telse \n\t\treturn PyInt_FromLong((long) size);\n}\n\n\nstatic PyObject *\narray_typechar_get(PyArrayObject *self)\n{\n\tif PyArray_ISFLEXIBLE(self) \n\t\treturn PyString_FromFormat(\"%c%d\", (self->descr->type),\n\t\t\t\t\t self->itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(self->descr->type), 1);\n}\n\nstatic PyObject *\narray_typestr_get(PyArrayObject *self)\n{\n\tstatic char endians[] = \"<>\";\n\tchar endian;\n\tint which;\n\tunsigned long val = 1;\n\tchar *s;\n\tchar basic_=self->descr->kind;\n\n\ts = (char *)&val; /* s[0] == 0 implies big-endian */\n\twhich = (PyArray_ISNOTSWAPPED(self) ? 0 : 1);\n\tif (s[0] == 0) which = 1 - which;\n\tendian = endians[which]; \n\t\n\tif ((basic_==PyArray_VOIDLTR) || (basic_==PyArray_STRINGLTR) || \\\n\t (basic_==PyArray_OBJECTLTR) || (self->itemsize == 1))\n\t\treturn PyString_FromFormat(\"|%c%d\", basic_, self->itemsize);\n\telse\n\t\treturn PyString_FromFormat(\"%c%c%d\", endian, basic_,\n\t\t\t\t\t self->itemsize);\n}\n\nstatic PyObject *\narray_descr_get(PyArrayObject *self)\n{\n\tPyObject *res;\n\tPyObject *dobj;\n\n\t/* hand this off to the typeobject */\n\t/* or give default */\n\tif (PyArray_ISUSERDEF(self)) {\n\t\tres = PyObject_GetAttrString((PyObject *)self->descr->typeobj, \n\t\t\t\t\t \"__array_descr__\");\n\t\tif (res) return res;\n\t\tPyErr_Clear();\n\t}\n\t/* get default */\n\tdobj = PyTuple_New(2);\n\tif (dobj == NULL) return NULL;\n\tPyTuple_SET_ITEM(dobj, 0, PyString_FromString(\"\"));\n\tPyTuple_SET_ITEM(dobj, 1, array_typestr_get(self));\n\tres = PyList_New(1);\n\tif (res == NULL) {Py_DECREF(dobj); return NULL;}\n\tPyList_SET_ITEM(res, 0, dobj);\n\treturn res;\n}\n\nstatic PyObject *\narray_typenum_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->descr->type_num);\n}\n\n\nstatic PyObject *\narray_type_get(PyArrayObject *self)\n{\n\treturn PyArray_TypeObjectFromType(self->descr->type_num);\n}\n\n/* If the type is changed. \n Also needing change: strides, itemsize\n\n Either itemsize is exactly the same\n or the array is single-segment (contiguous or fortran) with\n compatibile dimensions\n\n*/\n\nstatic int\narray_type_set(PyArrayObject *self, PyObject *arg)\n{\n PyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n intp newdim;\n int index;\n char *msg = \"new type not compatible with array.\";\n\n if ((PyArray_TypecodeConverter(arg, &newtype) < 0) ||\n newtype.type_num == PyArray_NOTYPE) {\n PyErr_SetString(PyExc_TypeError, \"Invalid type for array\");\n return -1;\n }\n if (!(PyArray_ISONESEGMENT(self) ||\t\t\\\n\t (newtype.itemsize != self->itemsize))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1; \n }\n\n\tif (PyArray_ISCONTIGUOUS(self)) index = self->nd - 1;\n\telse index = 0;\n\n if (newtype.itemsize < self->itemsize) {\n /* if it is compatible increase the size of the dimension\n at end (or at the front for FORTRAN)\n */\n if (self->itemsize % newtype.itemsize != 0) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n newdim = self->itemsize / newtype.itemsize;\n\t\tself->dimensions[index] *= newdim;\n self->strides[index] = newtype.itemsize;\n\t}\n \n else if (newtype.itemsize > self->itemsize) {\n \n /* Determine if last (or first if FORTRAN) dimension\n is compatible */\n\n\t\tnewdim = self->dimensions[index] * self->itemsize;\n if ((newdim % newtype.itemsize) != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n\t\t\n self->dimensions[index] = newdim / newtype.itemsize;\n self->strides[index] = newtype.itemsize;\n\t\t\n }\n\t\n \n /* fall through -- adjust type*/\n\n self->descr = PyArray_DescrFromType(newtype.type_num);\n self->itemsize = newtype.itemsize;\n PyArray_UpdateFlags(self, ALIGNED);\n return 0;\n\n}\n\n\n\nstatic PyObject *\narray_base_get(PyArrayObject *self)\n{\n\tif (self->base == NULL) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\telse {\n\t\tPy_INCREF(self->base);\n\t\treturn self->base;\n\t}\n}\n\n\nstatic PyObject *\narray_real_get(PyArrayObject *self)\n{\n\tPyArrayObject *ret;\n\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *)ret;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n}\n\n\nstatic int\narray_real_set(PyArrayObject *self, PyObject *val)\n{\n\tPyArrayObject *ret;\n\tPyArrayObject *new;\n\tint rint;\n\n\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0);\n\tif (new == NULL) return -1;\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return -1;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\tret = self;\n\t}\t\n\trint = PyArray_CopyInto(ret, new);\n\tPy_DECREF(ret);\n\treturn rint;\n}\n\nstatic PyObject *\narray_imag_get(PyArrayObject *self)\n{\t\n\tPyArrayObject *ret;\n\tint itemsize;\n\tint typenum;\n PyArray_Typecode type;\n\t\n\ttype.type_num = self->descr->type_num;\n\ttype.itemsize = self->itemsize;\n\ttype.fortran = PyArray_ISFORTRAN(self);\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\titemsize = self->itemsize >> 1;\n\t\ttypenum = self->descr->type_num - PyArray_NUM_FLOATTYPE;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t typenum,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data + itemsize,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *) ret;\n\t}\n\telse {\n\t\tret = (PyArrayObject *)PyArray_Zeros(self->nd, \n\t\t\t\t\t\t self->dimensions, &type);\n\t\tret->flags &= ~WRITEABLE;\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic int\narray_imag_set(PyArrayObject *self, PyObject *val)\n{\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyArrayObject *ret;\n\t\tPyArrayObject *new;\n\t\tint rint;\n\n\t\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0); \n\t\tif (new == NULL) return -1;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides+ \\\n\t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) {\n\t\t\tPy_DECREF(new); \n\t\t\treturn -1;\n\t\t}\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\trint = PyArray_CopyInto(ret, new);\n\t\tPy_DECREF(ret);\t\t\n\t\tPy_DECREF(new);\n\t\treturn rint;\n\t}\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError, \"Does not have imaginary \" \\\n\t\t\t\t\"part to set.\");\n\t\treturn -1;\n\t}\n}\n\nstatic PyObject *\narray_flat_get(PyArrayObject *self)\n{\n return PyArray_IterNew((PyObject *)self);\n}\n\nstatic int \narray_flat_set(PyArrayObject *self, PyObject *val)\n{\n\tPyObject *arr=NULL;\n\tint retval = -1;\n\tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n\tPyArray_Typecode typecode;\n int swap;\n PyArray_CopySwapFunc *copyswap;\n\n\ttypecode.type_num = self->descr->type_num;\n\ttypecode.itemsize = self->itemsize;\n\ttypecode.fortran = PyArray_ISFORTRAN(self);\n\t\n\tarr = PyArray_FromAny(val, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\tarrit = (PyArrayIterObject *)PyArray_IterNew(arr);\n\tif (arrit == NULL) goto exit;\n\tselfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (selfit == NULL) goto exit;\n\n swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);\n copyswap = self->descr->copyswap;\n if (PyArray_ISOBJECT(self)) {\n while(selfit->index < selfit->size) {\n Py_XDECREF(*((PyObject **)selfit->dataptr));\n Py_INCREF(*((PyObject **)arrit->dataptr)); \n memmove(selfit->dataptr, arrit->dataptr, \n sizeof(PyObject *));\n copyswap(selfit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_ITER_NEXT(selfit);\n PyArray_ITER_NEXT(arrit);\n if (arrit->index == arrit->size) \n PyArray_ITER_RESET(arrit);\n }\n retval = 0; \n goto exit;\n }\n\n\twhile(selfit->index < selfit->size) {\n\t\tmemmove(selfit->dataptr, arrit->dataptr, self->itemsize);\n copyswap(selfit->dataptr, NULL, swap, self->itemsize);\n\t\tPyArray_ITER_NEXT(selfit);\n\t\tPyArray_ITER_NEXT(arrit);\n\t\tif (arrit->index == arrit->size) \n\t\t\tPyArray_ITER_RESET(arrit);\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(selfit);\n\tPy_XDECREF(arrit);\n\tPy_XDECREF(arr);\n\treturn retval;\n}\n\nstatic PyGetSetDef array_getsetlist[] = {\n {\"ndim\", \n\t (getter)array_ndim_get, \n\t NULL, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)array_flags_get, \n NULL,\n\t \"special dictionary of flags\"},\n {\"shape\", \n\t (getter)array_shape_get, \n\t (setter)array_shape_set, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)array_strides_get, \n\t (setter)array_strides_set,\n\t \"tuple of bytes steps in each dimension\"},\n {\"data\", \n\t (getter)array_data_get, \n\t (setter)array_data_set, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)array_itemsize_get, \n\t NULL,\n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)array_size_get,\n\t NULL,\n \"number of elements in the array\"},\n\t{\"base\",\n\t (getter)array_base_get,\n\t NULL,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)array_type_get, \n\t (setter)array_type_set,\n\t \"get array type class\"},\n\t{\"dtypechar\",\n\t (getter)array_typechar_get,\n\t NULL,\n\t \"get array type character code\"},\n\t{\"dtypenum\",\n\t (getter)array_typenum_get,\n\t NULL,\n\t \"get array type number code\"},\n\t{\"dtypestr\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)array_real_get, \n\t (setter)array_real_set, \n\t \"real part of array\"},\n {\"imag\", \n\t (getter)array_imag_get, \n\t (setter)array_imag_set, \n\t \"imaginary part of array\"},\n\t{\"flat\", \n\t (getter)array_flat_get, \n\t (setter)array_flat_set, \n\t \"a 1-d view of a contiguous array\"}, \n\t{\"__array_data__\", \n\t (getter)array_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)array_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)array_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)array_protocol_strides_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t{\"__array_priority__\",\n\t (getter)array_priority_get,\n\t NULL,\n\t \"Array priority\"},\n \t{NULL, NULL, NULL, NULL}, /* Sentinel */\n};\n\n/****************** end of attribute get and set routines *******************/\n\n\n\nstatic char Arraytype__doc__[] = \n \"A array object represents a multidimensional, homogeneous array of basic values. It has the folowing data members, m.shape (the size of each dimension in the array), m.itemsize (the size (in bytes) of each element of the array), and m.typecode (a character representing the type of the array elements). Arrays are sequence, mapping and numeric objects. Sequence indexing is similar to lists, with single indices returning a reference that points to the old array data, and slices returning by copy. A array is also allowed to be indexed by a sequence of items.\t Each member of the sequence indexes the corresponding dimension of the array.\";\n\nstatic PyTypeObject PyBigArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.bigndarray\",\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n /* methods */\n (destructor)array_dealloc,\t\t /*tp_dealloc */\n (printfunc)NULL,\t\t\t /*tp_print*/\n 0,\t\t\t\t\t /*tp_getattr*/\n 0,\t\t\t\t\t /*tp_setattr*/\n (cmpfunc)0, \t\t /*tp_compare*/\n (reprfunc)array_repr,\t\t /*tp_repr*/\n &array_as_number,\t\t\t /*tp_as_number*/\n NULL, \t\t\t /*tp_as_sequence*/\n &array_as_mapping,\t\t\t /*tp_as_mapping*/\n (hashfunc)0,\t\t\t /*tp_hash*/\n (ternaryfunc)0,\t\t\t /*tp_call*/\n (reprfunc)array_str, \t /*tp_str*/\n\t\t\n (getattrofunc)0,\t\t\t /*tp_getattro*/\n (setattrofunc)0,\t\t\t /*tp_setattro*/\n NULL, \t /*tp_as_buffer*/\n (Py_TPFLAGS_DEFAULT \n | Py_TPFLAGS_BASETYPE\n | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/\n /*Documentation string */\n Arraytype__doc__,\t\t\t /*tp_doc*/\n\n (traverseproc)0,\t\t\t /*tp_traverse */\n (inquiry)0,\t\t\t /*tp_clear */\n (richcmpfunc)array_richcompare,\t \n offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */\n\n /* Iterator support (use standard) */\n\n (getiterfunc)0, \t\t /* tp_iter */\n (iternextfunc)0,\t\t\t /* tp_iternext */\n\n /* Sub-classing (new-style object) support */\n\n array_methods,\t\t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n array_getsetlist,\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0,\t /* tp_alloc */ \n (newfunc)array_new,\t\t /* tp_new */\n 0,\t \t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n};\n\n/* A standard array will subclass from the Big Array and \n add the array_as_sequence table\n and the array_as_buffer table\n */\n\nstatic PyTypeObject PyArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.ndarray\",\t\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n};\n\n\n/* The rest of this code is to build the right kind of array from a python */\n/* object. */\n\nstatic int \ndiscover_depth(PyObject *s, int max, int stop_at_string) \n{\n int d=0;\n PyObject *e;\n\t\n if(max < 1) return -1;\n\n if(! PySequence_Check(s) || PyInstance_Check(s) || \\\n\t PySequence_Length(s) < 0) {\n PyErr_Clear(); return 0;\n }\n if (PyArray_Check(s))\n\t\treturn PyArray_NDIM(s);\n if(PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))\n\t\treturn stop_at_string ? 0:1;\n if (PySequence_Length(s) == 0) \n\t\treturn 1;\n\t\n if ((e=PySequence_GetItem(s,0)) == NULL) return -1;\n if(e!=s) {\n\t\td=discover_depth(e,max-1, stop_at_string);\n\t\tif(d >= 0) d++;\n\t}\n Py_DECREF(e);\n return d;\n}\n\nstatic int\ndiscover_itemsize(PyObject *s, int nd, int *itemsize) \n{\n\tint n, r, i;\n\tPyObject *e;\n\t\n\tn = PyObject_Length(s);\n\n\tif ((nd == 0) || PyString_Check(s) ||\t\t\\\n\t PyUnicode_Check(s) || PyBuffer_Check(s)) {\n\t\tif PyUnicode_Check(s) \n\t\t\t*itemsize = MAX(*itemsize, sizeof(Py_UNICODE)*n);\n\t\telse\n\t\t\t*itemsize = MAX(*itemsize, n);\n\t\treturn 0;\n\t}\n\tfor (i=0; i n_lower) n_lower = d[1];\n }\n d[1] = n_lower;\n\t\n return 0;\n}\n\nstatic void\n_array_small_type(int chktype, int mintype, int chksize, int minsize, \n\t\t PyArray_Typecode *outtype)\n{\n\touttype->type_num = MAX(chktype, mintype);\n\tif (PyTypeNum_ISFLEXIBLE(outtype->type_num) &&\t\\\n\t PyTypeNum_ISFLEXIBLE(mintype)) {\n\t\t/* Handle string->unicode case separately \n\t\t because string itemsize is twice as large */\n\t\tif (outtype->type_num == PyArray_UNICODE && \n\t\t mintype == PyArray_STRING) {\n\t\t\touttype->itemsize = MAX(chksize, 2*minsize);\n\t\t}\n\t\telse {\n\t\t\touttype->itemsize = MAX(chksize, minsize);\n\t\t}\n\t}\n\telse {\n\t\touttype->itemsize = chksize;\n\t}\n\treturn;\t\n}\n\nstatic void\n_array_find_type(PyObject *op, PyArray_Typecode *minitype, \n\t\t PyArray_Typecode *outtype, int max)\n{\n int l;\n PyObject *ip;\n\tint chktype=0;\n\tint chksize=0;\n\tint mintype, minsize;\n\n\tif (minitype == NULL) {\n\t\tmintype = PyArray_BOOL;\n\t\tminsize = sizeof(Bool);\n\t}\n\telse {\n\t\tmintype = minitype->type_num;\n\t\tminsize = minitype->itemsize;\n\t}\n\n \n if (max < 0 || mintype == -1) goto deflt;\n\t\n if (PyArray_Check(op)) {\n\t\tchktype = PyArray_TYPE(op);\n\t\tchksize = PyArray_ITEMSIZE(op);\n\t\tgoto finish;\n\t}\n\t\n\tif (PyArray_IsScalar(op, Generic)) {\n\t\tPyArray_TypecodeFromScalar(op, outtype);\n\t\tchktype = outtype->type_num;\n\t\tchksize = outtype->itemsize;\n\t\tgoto finish;\n\t}\n\t\n\n if (PyObject_HasAttrString(op, \"__array__\")) {\n ip = PyObject_CallMethod(op, \"__array__\", NULL);\n if(ip && PyArray_Check(ip)) {\n\t\t\tchktype = PyArray_TYPE(ip);\n\t\t\tchksize = PyArray_ITEMSIZE(ip);\n\t\t\tgoto finish;\n\t\t}\n } \n\t\n\tif (PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tint swap=0, res;\n\t\tip = PyObject_GetAttrString(op, \"__array_typestr__\");\n\t\tif (ip && PyString_Check(ip)) {\n\t\t\tres = _array_typecode_fromstr(PyString_AS_STRING(ip), \n\t\t\t\t\t\t &swap, outtype); \n\t\t\tif (res >= 0) {\n\t\t\t\tPy_DECREF(ip);\n\t\t\t\tchktype = outtype->type_num;\n\t\t\t\tchksize = outtype->itemsize;\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t}\n\t\tPy_XDECREF(ip);\n\t}\n\n if (PyString_Check(op)) {\n\t\tchktype = PyArray_STRING;\n\t\tchksize = PyString_GET_SIZE(op);\n\t\tgoto finish;\n }\n\n\tif (PyUnicode_Check(op)) {\n\t\tchktype = PyArray_UNICODE;\n\t\tchksize = PyUnicode_GET_DATA_SIZE(op);\n\t\tgoto finish;\n\t}\n\n\tif (PyBuffer_Check(op)) {\n\t\tchktype = PyArray_VOID;\n\t\tchksize = op->ob_type->tp_as_sequence->sq_length(op);\n\t\tPyErr_Clear();\n\t\tgoto finish;\n\t}\n\n\tif (PyInstance_Check(op)) goto deflt;\n\t\n if (PySequence_Check(op)) {\n\t\tPyArray_Typecode newtype;\n\t\tnewtype.type_num = mintype;\n\t\tnewtype.itemsize = minsize;\n\t\tnewtype.fortran = 0;\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n\t\t\tPyErr_Clear(); \n\t\t\tgoto deflt;\n\t\t}\n if (l == 0 && mintype == 0) {\n\t\t\tnewtype.type_num = PyArray_INTP;\n\t\t\tnewtype.itemsize = sizeof(intp);\n\t\t}\n while (--l >= 0) {\n ip = PySequence_GetItem(op, l);\n if (ip==NULL) {\n\t\t\t\tPyErr_Clear(); \n\t\t\t\tgoto deflt;\n\t\t\t}\n\t\t\t_array_find_type(ip, &newtype, outtype, max-1);\n\t\t\t_array_small_type(outtype->type_num,\n\t\t\t\t\t newtype.type_num, \n\t\t\t\t\t outtype->itemsize,\n\t\t\t\t\t newtype.itemsize,\n\t\t\t\t\t &newtype);\n Py_DECREF(ip);\n }\n\t\tchktype = newtype.type_num;\n\t\tchksize = newtype.itemsize;\n\t\tgoto finish;\n }\n\t\n\tif (PyBool_Check(op)) {\n\t\tchktype = PyArray_BOOL;\n\t\tchksize = sizeof(Bool);\n\t\tgoto finish;\t\t\n\t}\n else if (PyInt_Check(op)) {\n\t\tchktype = PyArray_LONG;\n\t\tchksize = sizeof(long);\n\t\tgoto finish;\n } else if (PyFloat_Check(op)) {\n\t\tchktype = PyArray_DOUBLE;\n\t\tchksize = sizeof(double);\n\t\tgoto finish;\n\t} else if (PyComplex_Check(op)) {\n\t\tchktype = PyArray_CDOUBLE;\n\t\tchksize = sizeof(cdouble);\n\t\tgoto finish;\n\t}\n\n deflt:\n\tchktype = PyArray_OBJECT;\n\tchksize = sizeof(void *);\n\n finish:\n\t_array_small_type(chktype, mintype, chksize, minsize, \n\t\t\t outtype);\n\treturn;\n}\n\nstatic int \nAssign_Array(PyArrayObject *self, PyObject *v) \n{\n PyObject *e;\n int l, r;\n\t\n if (!PySequence_Check(v)) {\n PyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"assignment from non-sequence\");\n return -1;\n }\n\t\n l=PyObject_Length(v);\n if(l < 0) return -1; \n\t\n while(--l >= 0)\n {\n e=PySequence_GetItem(v,l);\n if (e == NULL) return -1; \n\t\t\tr = PySequence_SetItem((PyObject*)self,l,e);\n Py_DECREF(e);\n if(r == -1) return -1;\n }\n return 0;\n}\n\n/* \"Array Scalars don't call this code\" */ \nstatic PyObject *\nArray_FromScalar(PyObject *op, PyArray_Typecode *typecode) \n{\n PyArrayObject *ret;\n\tint itemsize = 0;\n\tint type = typecode->type_num;\n\n\tif PyTypeNum_ISFLEXIBLE(type) {\n\t\titemsize = PyObject_Length(op);\n\t}\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,\n\t\t\t\t\t NULL, NULL, itemsize, 0, NULL);\n\n\tif (ret == NULL) return NULL;\n\n ret->descr->setitem(op, ret->data, ret);\n\t\n if (PyErr_Occurred()) {\n array_dealloc(ret);\n return NULL;\n } else {\n return (PyObject *)ret;\n }\n}\n\n\nstatic PyObject *\nArray_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth)\n{\n PyArrayObject *r;\n int nd;\n\tintp *d;\n\tint stop_at_string;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\t\n\t\n\tstop_at_string = ((type == PyArray_OBJECT) ||\t\\\n\t\t\t (type == PyArray_STRING) ||\t\\\n\t\t\t (type == PyArray_UNICODE) || \\\n\t\t\t (type == PyArray_VOID));\n\n if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string)) > 0)) {\n\t\tif (nd==0)\n\t\t\treturn Array_FromScalar(s, typecode);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid input sequence\");\n return NULL;\n }\n\t\n if ((max_depth && nd > max_depth) ||\t\\\n\t (min_depth && nd < min_depth)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of dimensions\");\n return NULL;\n }\n\t\n\tif ((d=PyDimMem_NEW(nd)) == NULL) {\n\t\treturn PyErr_NoMemory();\n }\n\tif(discover_dimensions(s,nd,d, !stop_at_string) == -1) {\n\t\tPyDimMem_FREE(d);\n\t\treturn NULL;\n\t}\n\tif (itemsize == 0 && PyTypeNum_ISFLEXIBLE(type)) {\n\t\tif (discover_itemsize(s, nd, &itemsize) == -1) {\n\t\t\tPyDimMem_FREE(d);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n r=(PyArrayObject*)PyArray_New(&PyArray_Type, nd, d, \n\t\t\t\t type, NULL, NULL,\n\t\t\t\t itemsize, \n\t\t\t\t typecode->fortran, NULL);\n\n PyDimMem_FREE(d);\n if(!r) return NULL;\n if(Assign_Array(r,s) == -1) {\n\t\tPy_DECREF(r);\n\t\treturn NULL;\n\t}\n return (PyObject*)r;\n}\n\n\nstatic int \nPyArray_ValidType(int type) \n{\n\tPyArray_Descr *descr;\n\t\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr==NULL) return 0;\n\treturn 1;\n}\n\n\n/* If the output is not a CARRAY, then it is buffered also */\n\nstatic int\n_bufferedcast(PyArrayObject *out, PyArrayObject *in)\n{\n\tchar *inbuffer, *bptr, *optr;\n\tchar *outbuffer=NULL;\n\tPyArrayIterObject *it_in=NULL, *it_out=NULL;\n\tregister intp i, index;\n\tintp ncopies = PyArray_SIZE(out) / PyArray_SIZE(in);\n\tint elsize=in->itemsize;\n\tint nels = PyArray_BUFSIZE;\n\tint el;\n\tint inswap, outswap=0;\n\tint obuf=!PyArray_ISCARRAY(out);\n\tint oelsize = out->itemsize;\n\tPyArray_VectorUnaryFunc *castfunc;\n PyArray_CopySwapFunc *in_csn;\n PyArray_CopySwapFunc *out_csn;\n\tint retval = -1;\n\n\tcastfunc = in->descr->cast[out->descr->type_num];\n in_csn = in->descr->copyswap;\n out_csn = out->descr->copyswap;\n\n\t/* If the input or output is STRING, UNICODE, or VOID */\n\t/* then getitem and setitem are used for the cast */\n\t/* and byteswapping is handled by those methods */\n\n\tinswap = !(PyArray_ISFLEXIBLE(in) || PyArray_ISNOTSWAPPED(in));\n\t\n\tinbuffer = PyDataMem_NEW(PyArray_BUFSIZE*elsize);\n\tif (inbuffer == NULL) return -1;\n\tit_in = (PyArrayIterObject *)PyArray_IterNew((PyObject *)in);\n\tif (it_in == NULL) goto exit;\n\n\tif (obuf) {\n\t\toutswap = !(PyArray_ISFLEXIBLE(out) || \\\n\t\t\t PyArray_ISNOTSWAPPED(out));\n\t\toutbuffer = PyDataMem_NEW(PyArray_BUFSIZE*oelsize);\n\t\tif (outbuffer == NULL) goto exit;\n\n\t\tit_out = (PyArrayIterObject *)PyArray_IterNew((PyObject *)out);\n\t\tif (it_out == NULL) goto exit;\n\n\t\tnels = MIN(nels, PyArray_BUFSIZE);\n\t}\n\t\n\toptr = (obuf) ? outbuffer: out->data;\n\tbptr = inbuffer;\n\tel = 0;\t\n\twhile(ncopies--) {\n\t\tindex = it_in->size;\n\t\tPyArray_ITER_RESET(it_in);\n\t\twhile(index--) {\n in_csn(bptr, it_in->dataptr, inswap, elsize);\n\t\t\tbptr += elsize;\n\t\t\tPyArray_ITER_NEXT(it_in);\n\t\t\tel += 1;\n\t\t\tif ((el == nels) || (index == 0)) {\n\t\t\t\t/* buffer filled, do cast */\n\t\t\t\t\n\t\t\t\tcastfunc(inbuffer, optr, el, in, out);\n\t\t\t\t\n\t\t\t\tif (obuf) {\n\t\t\t\t\t/* Copy from outbuffer to array */\n\t\t\t\t\tfor(i=0; idataptr,\n optr, outswap,\n oelsize);\n\t\t\t\t\t\toptr += oelsize;\n\t\t\t\t\t\tPyArray_ITER_NEXT(it_out);\n\t\t\t\t\t}\n\t\t\t\t\toptr = outbuffer;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toptr += out->itemsize * nels;\n\t\t\t\t}\n\t\t\t\tel = 0;\n\t\t\t\tbptr = inbuffer;\n\t\t\t}\n\t\t}\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(it_in);\n\tPyDataMem_FREE(inbuffer);\n\tPyDataMem_FREE(outbuffer);\t\n\tif (obuf) {\n\t\tPy_XDECREF(it_out);\n\t}\n\treturn retval;\n\n}\n\n\n/* For backward compatibility */\n\nstatic PyObject *\nPyArray_Cast(PyArrayObject *mp, int type_num) \n{\n\tPyArray_Typecode type;\n\tPyArray_Descr *descr;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\ttype.itemsize = descr->elsize;\n\ttype.type_num = descr->type_num;\n\ttype.fortran = 0;\n\t\n\treturn PyArray_CastToType(mp, &type);\n}\n\nstatic PyObject * \nPyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at) \n{\n\tPyObject *out;\n\tint ret;\n\n\tif ((mp->descr->type_num == at->type_num) && \\\n\t (at->itemsize==0 || mp->itemsize == at->itemsize) &&\n\t PyArray_ISBEHAVED_RO(mp)) {\n\t\tPy_INCREF(mp);\n\t\treturn (PyObject *)mp;\n\t}\n\t\t\n\tif (at->itemsize == 0) {\n\t\tif (mp->descr->type_num == PyArray_STRING &&\t\\\n\t\t at->type_num == PyArray_UNICODE)\n\t\t\tat->itemsize = mp->itemsize*sizeof(Py_UNICODE);\n\t\tif (mp->descr->type_num == PyArray_UNICODE &&\n\t\t at->type_num == PyArray_STRING) \n\t\t\tat->itemsize = mp->itemsize/sizeof(Py_UNICODE);\n\t\tif (at->type_num == PyArray_VOID)\n\t\t\tat->itemsize = mp->itemsize;\n\t}\n\n\tout = PyArray_New(mp->ob_type, mp->nd, \n\t\t\t mp->dimensions, \n\t\t\t at->type_num,\n\t\t\t NULL, NULL, at->itemsize, \n\t\t\t at->fortran, (PyObject *)mp);\n\tif (out == NULL) return NULL;\n\tret = PyArray_CastTo((PyArrayObject *)out, mp);\n\tif (ret != -1) return out;\n\n\tPy_DECREF(out);\n\treturn NULL;\n\t\n}\n\t \n/* The number of elements in out must be an integer multiple\n of the number of elements in mp. \n*/\n\nstatic int\nPyArray_CastTo(PyArrayObject *out, PyArrayObject *mp)\n{\n\n\tint simple;\n\tintp mpsize = PyArray_SIZE(mp);\n\tintp outsize = PyArray_SIZE(out);\n\n\tif (mpsize == 0) return 0;\n\tif (!PyArray_ISWRITEABLE(out)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array is not writeable.\");\n\t\treturn -1;\n\t}\n\tif (outsize % mpsize != 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array must have an integer-multiple\"\\\n\t\t\t\t\" of the number of elements in the input \"\\\n\t\t\t\t\"array\");\n\t\treturn -1; \n\t}\n\n\tsimple = ((PyArray_ISCARRAY(mp) && PyArray_ISCARRAY(out)) || \\\n (PyArray_ISFARRAY(mp) && PyArray_ISFARRAY(out)));\n\t\n\tif (simple) {\n\t\tchar *inptr;\n\t\tchar *optr = out->data;\n\t\tintp obytes = out->itemsize * outsize;\n\t\tintp ncopies = outsize / mpsize;\n\n\t\twhile(ncopies--) {\n\t\t\tinptr = mp->data;\n\t\t\tmp->descr->cast[out->descr->type_num](inptr, \n\t\t\t\t\t\t\t optr,\n\t\t\t\t\t\t\t mpsize,\n\t\t\t\t\t\t\t mp, out);\n\t\t\toptr += obytes;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t/* If not a well-behaved cast, then use buffers */\n\tif (_bufferedcast(out, mp) == -1) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nstatic PyObject *\narray_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags) \n{\n\t\n\tPyArrayObject *ret=NULL;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\tint copy = 0;\n\tint arrflags;\n\tPyArray_Typecode oldtype;\n\tchar *msg = \"Cannot copy-back to a read-only array.\";\n\n\toldtype.type_num = PyArray_TYPE(arr);\n\toldtype.itemsize = PyArray_ITEMSIZE(arr);\n\toldtype.fortran = 0;\n\n\tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n\tif (itemsize == 0) itemsize = arr->itemsize;\n\ttypecode->type_num = type;\n\ttypecode->itemsize = itemsize;\n\n\t/* Don't copy if sizes are compatible */\n\tif (PyArray_EquivalentTypes(&oldtype, typecode)) {\n\t\tarrflags = arr->flags;\n\n\t\tcopy = (flags & ENSURECOPY) || \\\n\t\t\t((flags & CONTIGUOUS) && (!(arrflags & CONTIGUOUS))) \\\n\t\t\t|| (PyArray_ITEMSIZE(arr) != itemsize) || \\\n\t\t\t((flags & ALIGNED) && (!(arrflags & ALIGNED))) || \\\n\t\t\t((flags & NOTSWAPPED) && (!(arrflags & NOTSWAPPED))) \\\n\t\t\t|| (arr->nd > 1 &&\t\t\t\t\\\n\t\t\t ((flags & FORTRAN) != (arrflags & FORTRAN))) || \\\n\t\t\t((flags & WRITEABLE) && (!(arrflags & WRITEABLE)));\n\t\t\n\t\tif (copy) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_New(arr->ob_type, \n\t\t\t\t\t arr->nd, \n\t\t\t\t\t arr->dimensions,\n\t\t\t\t\t arr->descr->type_num,\n\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t itemsize,\n\t\t\t\t\t flags & FORTRAN,\n\t\t\t\t\t (PyObject *)arr);\n\t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t} \n\t\t/* If no copy then just increase the reference\n\t\t count and return the input */\n\t\telse { \n\t\t\tPy_INCREF(arr);\n\t\t\tret = arr;\n\t\t}\n\t}\n\t\n\t/* The desired output type is different than the input\n\t array type */\n\telse {\n\t\t/* Cast to the desired type if we can do it safely\n\t\t Also cast if source is a ndim-0 array to mimic\n\t\t behavior with Python scalars */\n\t\tif (flags & FORCECAST || PyArray_NDIM(arr)==0 ||\n\t\t PyArray_CanCastSafely(PyArray_TYPE(arr), type)) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_CastToType(arr, typecode);\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Array can not be safely cast \"\\\n\t\t\t\t\t\"to required type\");\n\t\t\tret = NULL;\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic int\n_array_typecode_fromstr(char *str, int *swap, PyArray_Typecode *type)\n{\n int type_num;\n char typechar;\n int size;\n unsigned long number = 1;\n char *s;\n char msg[] = \"unsupported typestring\";\n \n s = (char *)&number; /* s[0] == 0 implies big-endian */\n\n *swap = 0;\n\n if (str[0] == '<' || str[0] == '>') {\n\tif ((str[0] == '<') && (s[0] == 0)) *swap = 1;\n\telse if ((str[0] == '>') && (s[0] != 0)) *swap = 1;\n }\n str += 1;\n \n#define _MY_FAIL {\t\t\t\t \\\n\t PyErr_SetString(PyExc_ValueError, msg); \\\n\t return -1;\t\t\t \\\n }\t\t\n\n typechar = str[0];\n size = atoi(str + 1);\n switch (typechar) {\n case 'b':\n\t if (size == sizeof(Bool))\n\t\t type_num = PyArray_BOOL;\t \n\t else _MY_FAIL \n\t break;\t\t \n case 'u':\n if (size == sizeof(uintp))\n type_num = PyArray_UINTP;\n\t else if (size == sizeof(char))\n\t\t type_num = PyArray_UBYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_USHORT;\n\t else if (size == sizeof(int)) \n\t\t type_num = PyArray_UINT;\n\t else if (size == sizeof(ulong)) \n\t\t type_num = PyArray_ULONG;\n\t else if (size == sizeof(ulonglong))\n\t\t type_num = PyArray_ULONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'i':\n if (size == sizeof(intp))\n type_num = PyArray_INTP;\n\t else if (size == sizeof(char)) \n\t\t type_num = PyArray_BYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_SHORT;\n\t else if (size == sizeof(int))\n\t\t type_num = PyArray_INT;\n\t else if (size == sizeof(long)) \n\t\t type_num = PyArray_LONG;\n\t else if (size == sizeof(longlong))\n\t\t type_num = PyArray_LONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'f':\n\t if (size == sizeof(float))\n\t\t type_num = PyArray_FLOAT;\n\t else if (size == sizeof(double))\n\t\t type_num = PyArray_DOUBLE;\n\t else if (size == sizeof(longdouble))\n\t\t type_num = PyArray_LONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'c':\n\t if (size == sizeof(float)*2)\n\t\t type_num = PyArray_CFLOAT;\n\t else if (size == sizeof(double)*2)\n\t\t type_num = PyArray_CDOUBLE;\n\t else if (size == sizeof(longdouble)*2)\n\t\t type_num = PyArray_CLONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'O':\n\t if (size == sizeof(PyObject *))\n\t\t type_num = PyArray_OBJECT;\n\t else _MY_FAIL\n\t break;\n case 'S':\n\t type_num = PyArray_STRING;\n\t break;\n case 'U':\n\t type_num = PyArray_UNICODE;\n\t size *= sizeof(Py_UNICODE);\n\t break;\t \n case 'V':\n\t type_num = PyArray_VOID;\n\t break;\n default:\n\t _MY_FAIL\n }\n\n#undef _MY_FAIL\n\n type->type_num = type_num;\n type->itemsize = size;\n type->fortran = 0;\n return 0;\n}\n\nstatic PyObject *\narray_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n{\n\tPyObject *attr=NULL, *item=NULL, *r;\n\tPyArrayObject *ret=NULL;\n\tPyArray_Typecode type;\n\tchar *data;\n\tint buffer_len;\n\tint res, i, n;\n\tintp dims[MAX_DIMS], strides[MAX_DIMS];\n\tint swap;\n\n\t/* Get the memory from __array_data__ and __array_offset__ */\n\t/* Get the shape */\n\t/* Get the typestring -- ignore array_descr */\n\t/* Get the strides */\n\t\n\tattr = PyObject_GetAttrString(input, \"__array_data__\");\n\tif (attr == NULL) {\n\t\tPy_INCREF(input);\n\t\tattr = input;\n\t}\n\t\n\tres = PyObject_AsWriteBuffer(attr, (void **)&data, &buffer_len);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n\n\tattr = PyObject_GetAttrString(input, \"__array_typestr__\");\n\tif (!PyString_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_typestr__ must be a string.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\t\n\t}\n\tres = _array_typecode_fromstr(PyString_AS_STRING(attr), &swap, &type);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n \n\tattr = PyObject_GetAttrString(input, \"__array_shape__\");\n\tif (!PyTuple_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_shape__ must be a tuple.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\n\t}\n\tn = PyTuple_GET_SIZE(attr);\n\tfor (i=0; ibase = input;\n \n\tattr = PyObject_GetAttrString(input, \"__array_strides__\");\n\tif (attr != NULL && attr != Py_None) {\n\t\tif (!PyTuple_Check(attr)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"__array_strides__ must be a tuple.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tif (n != PyTuple_GET_SIZE(attr)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"mismatch in length of \"\\\n\t\t\t\t\t\"__array_strides__ and \"\\\n\t\t\t\t\t\"__array_shape__.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tfor (i=0; istrides, strides, n*sizeof(intp));\n\t}\n\n\tif (swap) {\n\t\tPyObject *tmp;\n\t\ttmp = PyObject_CallMethod((PyObject *)ret, \"byteswap\", \"\");\n\t\tPy_DECREF(tmp);\n\t}\n\n\tPyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);\n\tr = array_fromarray(ret, intype, flags);\n\tPy_DECREF(ret);\n\treturn r;\n}\n\nstatic PyObject *\narray_fromattr(PyObject *op, PyArray_Typecode *typecode, int flags) \n{\n PyObject *new, *r;\n\t \n if (typecode->type_num == PyArray_NOTYPE) {\n new = PyObject_CallMethod(op, \"__array__\", NULL);\n } else {\n new = PyObject_CallMethod(op, \"__array__\", \"i\", \n typecode->type_num);\n }\n if (new == NULL) return NULL;\n if (!PyArray_Check(new)) {\n PyErr_SetString(PyExc_ValueError, \n \"object __array__ method not \" \\\n \"producing an array.\");\n Py_DECREF(new);\n return NULL;\n }\n r = array_fromarray((PyArrayObject *)new, typecode, flags);\n Py_DECREF(new);\n return r;\n} \n\n\nstatic PyObject *\narray_fromobject(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth, int flags) \n{\n /* This is the main code to make a NumPy array from a Python\n Object. It is called from lot's of different places which\n is why there are so many checks. The comments try to\n explain some of the checks. */\n\n\tint type = typecode->type_num;\n PyObject *r=NULL;\n\n\t/* Is input object already an array? */\n\t/* This is where the flags are used */\n if (PyArray_Check(op)) \n\t\tr = array_fromarray((PyArrayObject *)op, typecode, flags);\n\telse if (PyObject_HasAttrString(op, \"__array__\")) {\n\t\t/* Code that returns the object to convert for a non\n\t\t multiarray input object from the __array__ attribute of the\n\t\t object. */\n r = array_fromattr(op, typecode, flags);\n\t}\n\telse if (PyObject_HasAttrString(op, \"__array_shape__\") &&\n\t\t PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tr = array_frominterface(op, typecode, flags);\n\t}\n\telse {\n\t\tif (type == PyArray_NOTYPE) {\n\t\t\t_array_find_type(op, NULL, typecode, MAX_DIMS);\n\t\t}\n\t\tif (PySequence_Check(op))\n\t\t\tr = Array_FromSequence(op, typecode, \n\t\t\t\t\t min_depth, max_depth);\n\t\telse\n\t\t\tr = Array_FromScalar(op, typecode);\n\t}\n\n /* If we didn't succed return NULL */\n if (r == NULL) return NULL;\n\t\n\t/* Be sure we succeed here */\n\t\n if(!PyArray_Check(r)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Internal error array_fromobject \"\\\n\t\t\t\t\"not producing an array\");\n\t\tPy_DECREF(r);\n return NULL;\n }\n\n if (min_depth != 0 && ((PyArrayObject *)r)->nd < min_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object of too small depth for desired array\");\n return NULL;\n }\n if (max_depth != 0 && ((PyArrayObject *)r)->nd > max_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object too deep for desired array\");\n return NULL;\n }\n return r;\n}\n\nstatic void\nPyArray_ArrayType(PyObject *op, PyArray_Typecode *intype, \n\t\t PyArray_Typecode *outtype) \n{\n\t_array_find_type(op, intype, outtype, MAX_DIMS);\n\treturn;\n}\n\nstatic int \nPyArray_ObjectType(PyObject *op, int minimum_type) \n{\n\tPyArray_Typecode intype, outtype;\n\tintype.type_num = minimum_type;\n\t_array_find_type(op, &intype, &outtype, MAX_DIMS);\n\treturn outtype.type_num;\n}\n\n\n\n/* flags is any of \n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough\n to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, and WRITEABLE\n and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, the returned array will be a copy of the object, \n (C) contiguous in memory, aligned, notswapped, and writeable.\n \n So CONTIGUOUS | ENSURECOPY passed in means that the returned\n array does not have to be CONTIGUOUS or a COPY but should be\n ALIGNED, NOTSWAPPED and WRITEABLE. \n\n typecode->fortran can be set to request a\n fortran-contiguous array. Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n*/\n\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n{\n \tPyArray_Typecode mine = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode *type;\n\t\n\tif (typecode == NULL) type = &mine;\n\telse type = typecode;\n\t\t\n\tif (requires & ENSURECOPY) {\n\t\trequires |= DEFAULT_FLAGS;\n\t}\n\t/* Ensure that type->fortran and flags & FORTRAN are the\n\t same */\n\tif (requires & FORTRAN) typecode->fortran = 1;\n\tif (type->fortran == 1) {\n\t\trequires |= FARRAY_FLAGS;\n\t\tif (min_depth > 2) requires &= ~CONTIGUOUS;\n\t}\n\n\t/* make sure itemsize is not 0 unless warranted. */\n\tif ((type->itemsize == 0) && (type->type_num != PyArray_NOTYPE)) {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type->type_num);\n\t\tif (descr != NULL) type->itemsize = descr->elsize;\n\t\telse return NULL;\n\t}\n\t\n\treturn array_fromobject(op, type, min_depth, max_depth, \n\t\t\t\trequires);\t\n}\n\n/* This is a quick wrapper around PyArray_FromAny(op, NULL, 0, 0, 0) */\n/* that special cases Arrays and PyArray_Scalars up front */\n/* It steals a reference to the object */\n\n/* Because it decrefs op if any conversion needs to take place \n -- so it can be used like PyArray_EnsureArray(some_function(...)) */\n\nstatic PyObject *\nPyArray_EnsureArray(PyObject *op)\n{\n PyObject *new;\n\n if (op == NULL) return NULL;\n\n if (PyArray_Check(op)) return op;\n\n if (PyArray_IsScalar(op, Generic)) {\n new = PyArray_FromScalar(op, NULL);\n Py_DECREF(op);\n return new;\n }\n new = PyArray_FromAny(op, NULL, 0, 0, 0);\n Py_DECREF(op);\n return new;\n}\n\n/* These are all compressed into a single API */\n/* Deprecated calls -- Use PyArray_FromAny */\n\nstatic PyObject *\nPyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, BEHAVED_FLAGS);\n}\n\nstatic PyObject *\nPyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n\t\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, DEFAULT_FLAGS);\n}\n\nstatic PyObject *\nPyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n\t\t\t ENSURECOPY);\n}\n\n/* End of deprecated */\n\n\nstatic int \nPyArray_CanCastSafely(int fromtype, int totype) \n{\n\tPyArray_Descr *from, *to;\n\n if (fromtype == totype) return 1;\n if (fromtype == PyArray_BOOL) return 1;\n\tif (totype == PyArray_BOOL) return 0;\n if (totype == PyArray_OBJECT || totype == PyArray_VOID) return 1;\n\tif (fromtype == PyArray_OBJECT || fromtype == PyArray_VOID) return 0;\n\n\tfrom = PyArray_DescrFromType(fromtype);\n\tto = PyArray_DescrFromType(totype);\n \n switch(fromtype) {\n case PyArray_BYTE:\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISUNSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_UBYTE:\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_FLOAT:\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\tif (PyTypeNum_ISCOMPLEX(totype)) \n\t\t\treturn ((to->elsize >> 1) >= from->elsize);\n\t\telse\n\t\t\treturn (totype > fromtype);\n case PyArray_CFLOAT:\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn (totype > fromtype);\n\tcase PyArray_STRING:\n\tcase PyArray_UNICODE:\n\t\treturn (totype > fromtype);\n default:\n return 0;\n }\n}\n\nstatic Bool\nPyArray_CanCastTo(PyArray_Typecode *from, PyArray_Typecode *to)\n{\n\tint fromtype=from->type_num;\n\tint totype=to->type_num;\n\tBool ret;\n\n\tret = (Bool) PyArray_CanCastSafely(fromtype, totype);\n\tif (ret) { /* Check String and Unicode more closely */\n\t\tif (fromtype == PyArray_STRING) {\n\t\t\tif (totype == PyArray_STRING) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t\telse if (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize * sizeof(Py_UNICODE)\\\n\t\t\t\t <= to->itemsize);\n\t\t\t}\n\t\t}\n\t\telse if (fromtype == PyArray_UNICODE) {\n\t\t\tif (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}\n\n\n\n/*********************** Element-wise Array Iterator ***********************/\n/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/\n/* and Python's array iterator ***/\n \n\nstatic PyObject *\nPyArray_IterNew(PyObject *obj)\n{\n PyArrayIterObject *it;\n\tint i, nd; \n\tPyArrayObject *ao = (PyArrayObject *)obj;\n\n if (!PyArray_Check(ao)) {\n PyErr_BadInternalCall();\n return NULL;\n }\n\n it = PyObject_GC_New(PyArrayIterObject, &PyArrayIter_Type);\n if (it == NULL)\n return NULL;\n\n\tnd = ao->nd;\n\tPyArray_UpdateFlags(ao, CONTIGUOUS);\n\tit->contiguous = 0;\n\tif PyArray_ISCONTIGUOUS(ao) it->contiguous = 1;\n Py_INCREF(ao);\n it->ao = ao;\n\tit->size = PyArray_SIZE(ao);\n\tit->nd_m1 = nd - 1;\n\tit->factors[nd-1] = 1;\n\tfor (i=0; i < nd; i++) {\n\t\tit->dims_m1[i] = it->ao->dimensions[i] - 1;\n\t\tit->strides[i] = it->ao->strides[i];\n\t\tit->backstrides[i] = it->strides[i] *\t\\\n\t\t\tit->dims_m1[i];\n\t\tif (i > 0)\n\t\t\tit->factors[nd-i-1] = it->factors[nd-i] *\t\\\n\t\t\t\tit->ao->dimensions[nd-i];\n\t}\n\tPyArray_ITER_RESET(it);\n\t\n PyObject_GC_Track(it);\n return (PyObject *)it;\n}\n\n/* Returns an array scalar holding the element desired */\n\nstatic PyObject *\narrayiter_next(PyArrayIterObject *it)\n{\n\tPyObject *ret;\n\n\tif (it->index < it->size) {\n\t\tret = PyArray_ToScalar(it->dataptr, it->ao);\n\t\tPyArray_ITER_NEXT(it);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narrayiter_dealloc(PyArrayIterObject *it)\n{\n PyObject_GC_UnTrack(it);\n Py_XDECREF(it->ao);\n PyObject_GC_Del(it);\n }\n\nstatic int\narrayiter_traverse(PyArrayIterObject *it, visitproc visit, void *arg)\n{\n if (it->ao != NULL)\n return visit((PyObject *)(it->ao), arg);\n return 0;\n}\n\n\nstatic int\niter_length(PyArrayIterObject *self) \n{\n return (int) self->size;\n}\n\n\nstatic PyObject *\niter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tint index, strides, itemsize;\n\tintp count=0;\n\tchar *dptr, *optr;\n\tPyObject *r;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn NULL;\n\t}\n\tindex = (ind->dimensions[0]);\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\t/* Get size of return array */\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0)\n\t\t\tcount++;\n\t\tdptr += strides;\n\t}\n\titemsize = self->ao->itemsize;\n\tr = PyArray_New(self->ao->ob_type, 1, &count, \n\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\titemsize, 0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\t/* Set up loop */\n\toptr = PyArray_DATA(r);\n\tindex = ind->dimensions[0];\n\tdptr = ind->data;\n\n copyswap = self->ao->descr->copyswap;\n\t/* Loop over Boolean array */\n\tswap = !(PyArray_ISNOTSWAPPED(self->ao));\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\t\toptr += itemsize;\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\nstatic PyObject *\niter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tintp num;\n\tPyObject *r;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint swap;\n\tchar *optr;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = self->ao->itemsize;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t}\n\t\n\tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n\t\t\tself->ao->descr->type_num, NULL, \n\t\t\tNULL, self->ao->itemsize, \n\t\t\t0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\toptr = PyArray_DATA(r);\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) {Py_DECREF(r); return NULL;}\n\tindex = ind_it->size;\n copyswap = PyArray_DESCR(r)->copyswap;\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif (num < 0 || num >= self->size) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\tPy_DECREF(r);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\toptr += itemsize;\n\t\tPyArray_ITER_NEXT(ind_it);\n\t}\n\tPy_DECREF(ind_it);\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\n\nstatic PyObject *\niter_subscript(PyArrayIterObject *self, PyObject *ind)\n{\n\tint i;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *r;\n\tchar *dptr;\n\tint size;\n\tPyObject *obj = NULL;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\t\t\n\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\tobj = iter_subscript(self, ind);\n\t\tPy_DECREF(ind);\n\t\treturn obj;\n\t}\n\n\t/* Tuples not accepted --- i.e. no NewAxis */\n\t/* Could implement this with adjusted strides\n\t and dimensions in iterator */\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\tPyArray_ITER_RESET(self);\n\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n\t\t\treturn PyArray_ToScalar(self->dataptr, self->ao);\n\t\t}\n\t\telse { /* empty array */\n\t\t\tintp ii = 0;\n\t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n\t\t\t\t\tself->ao->descr->type_num, NULL, \n\t\t\t\t\tNULL, self->ao->itemsize, 0,\n\t\t\t\t\t(PyObject *)self->ao);\n\t\t\treturn r;\t\t\t\n\t\t}\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) \n\t\t\tgoto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start)\n\t\tif (n_steps == SingleIndex) { /* Integer */\n\t\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn r;\n\t\t}\n\t\tsize = self->ao->itemsize;\n\t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n\t\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\t\tsize, 0, (PyObject *)self->ao);\n\t\tif (r==NULL) goto fail; \n\t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n copyswap = PyArray_DESCR(r)->copyswap;\n\t\twhile(n_steps--) {\n copyswap(dptr, self->dataptr, swap, size);\n\t\t\tfor(i=0; i< step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tdptr += size;\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer) || PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tr = iter_subscript_Bool(self, (PyArrayObject *)obj);\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tobj = new;\n\t\t\tr = iter_subscript_int(self, (PyArrayObject *)obj);\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"unsupported iterator index\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPy_DECREF(obj);\n\t\treturn r;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\n fail:\n\tPy_XDECREF(obj);\n\treturn NULL;\n\n}\n\n\nstatic int\niter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tint index, strides, itemsize;\n\tchar *dptr;\n PyArray_CopySwapFunc *copyswap;\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn -1;\n\t}\n\titemsize = self->ao->itemsize;\n\tindex = ind->dimensions[0];\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\tPyArray_ITER_RESET(self);\n\t/* Loop over Boolean array */\n copyswap = self->ao->descr->copyswap;\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(self->dataptr, val->dataptr, swap,\n itemsize);\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index==val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn 0;\n}\n\nstatic int\niter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tPyArray_Typecode typecode;\n\tintp num;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = typecode.itemsize = self->ao->itemsize;\n\ttypecode.type_num = self->ao->descr->type_num;\n copyswap = self->ao->descr->copyswap;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\treturn 0;\n\t}\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) return -1;\n\tindex = ind_it->size;\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif ((num < 0) || (num >= self->size)) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\treturn -1;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\tPyArray_ITER_NEXT(ind_it);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index == val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPy_DECREF(ind_it);\n\treturn 0;\n}\n\n\nstatic int\niter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) \n{\n\tint i;\n\tPyObject *arrval=NULL;\n\tPyArrayIterObject *val_it=NULL;\n\tPyArray_Typecode type;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint swap;\n\tint itemsize;\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *obj;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\ti = iter_ass_subscript(self, ind, val);\n\t\tPy_DECREF(ind);\n\t\treturn i;\n\t}\n\t\n\ttype.type_num = self->ao->descr->type_num;\n\titemsize = type.itemsize = self->ao->itemsize;\n\t\n\tarrval = PyArray_FromAny(val, &type, 0, 0, 0);\n\tif (arrval==NULL) return -1;\n\tval_it = (PyArrayIterObject *)PyArray_IterNew(arrval);\n\tif (val_it==NULL) goto fail;\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\n copyswap = PyArray_DESCR(arrval)->copyswap;\n\tswap = (PyArray_ISNOTSWAPPED(self->ao)!=PyArray_ISNOTSWAPPED(arrval));\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n copyswap(self->dataptr, PyArray_DATA(arrval), \n swap, itemsize);\n\t\t}\n\t\tgoto succeed;\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) goto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start);\n\t\tif (n_steps == SingleIndex) { /* Integer */\n copyswap(self->dataptr, PyArray_DATA(arrval),\n swap, itemsize);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\tgoto succeed;\n\t\t}\n\t\twhile(n_steps--) {\n copyswap(self->dataptr, val_it->dataptr,\n swap, itemsize);\n\t\t\tfor(i=0; i < step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tPyArray_ITER_NEXT(val_it);\n\t\t\tif (val_it->index == val_it->size) \n\t\t\t\tPyArray_ITER_RESET(val_it);\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\tgoto succeed;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer))\n\t\tobj = PyArray_FromScalar(ind, &indtype);\n\telse if (PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tif (iter_ass_sub_Bool(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tPy_DECREF(obj);\n\t\t\tobj = new;\n\t\t\tif (iter_ass_sub_int(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t}\n\t\telse goto fail;\n\t\tPy_DECREF(obj);\n\t\tgoto succeed;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\tgoto fail;\n\n succeed:\n\tPy_DECREF(val_it);\n\tPy_DECREF(arrval);\n\treturn 0;\n\n fail:\n\tPy_XDECREF(val_it);\n\tPy_XDECREF(arrval);\n\treturn -1;\n\t\n}\n\n\nstatic PyMappingMethods iter_as_mapping = {\n (inquiry)iter_length,\t\t /*mp_length*/\n (binaryfunc)iter_subscript,\t /*mp_subscript*/\n (objobjargproc)iter_ass_subscript,\t/*mp_ass_subscript*/\n};\n\nstatic char doc_iter_array[] = \"__array__(type=None)\\n Get array \"\\\n \"from iterator\";\n\nstatic PyObject *\niter_array(PyArrayIterObject *it, PyObject *op) \n{\n \n PyObject *r;\n intp size;\n\n /* Any argument ignored */\n\n /* Two options: \n 1) underlying array is contiguous\n -- return 1-d wrapper around it \n 2) underlying array is not contiguous\n -- make new 1-d contiguous array with updateifcopy flag set\n to copy back to the old array\n */\n\n size = PyArray_SIZE(it->ao);\n if (PyArray_ISCONTIGUOUS(it->ao)) {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n\t\t\t\tit->ao->flags,\n (PyObject *)it->ao); \n\t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, NULL, it->ao->itemsize, 0, \n (PyObject *)it->ao);\n\t\tif (r==NULL) return NULL;\n\t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n\t\t\tPy_DECREF(r); \n\t\t\treturn NULL;\n\t\t}\n PyArray_FLAGS(r) |= UPDATEIFCOPY;\n it->ao->flags &= ~WRITEABLE;\n }\n Py_INCREF(it->ao);\n PyArray_BASE(r) = (PyObject *)it->ao;\n return r;\n \n}\n\nstatic char doc_iter_copy[] = \"copy()\\n Get a copy of 1-d array\";\n\nstatic PyObject *\niter_copy(PyArrayIterObject *it, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\t\n\treturn PyArray_Flatten(it->ao, 0);\n}\n\nstatic PyMethodDef iter_methods[] = {\n /* to get array */\n {\"__array__\", (PyCFunction)iter_array, 1, doc_iter_array},\n\t{\"copy\", (PyCFunction)iter_copy, 1, doc_iter_copy},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\nstatic PyTypeObject PyArrayIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.flatiter\",\t\t /* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arrayiter_dealloc,\t\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0, \t\t\t /* tp_as_sequence */\n &iter_as_mapping, \t /* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0,\t \t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arrayiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arrayiter_next,\t\t/* tp_iternext */\n iter_methods,\t\t\t\t/* tp_methods */\n};\n\n/** END of Array Iterator **/\n\n\n\n/*********************** Subscript Array Iterator *************************\n * *\n * This object handles subscript behavior for array objects. *\n * It is an iterator object with a next method *\n * It abstracts the n-dimensional mapping behavior to make the looping *\n * code more understandable (maybe) *\n * and so that indexing can be set up ahead of time *\n */ \n\n/* This checks the args for any fancy indexing objects */\n\n#define SOBJ_NOTFANCY 0 \n#define SOBJ_ISFANCY 1\n#define SOBJ_BADARRAY 2\n#define SOBJ_TOOMANY 3\n#define SOBJ_LISTTUP 4\n\nstatic int\nfancy_indexing_check(PyObject *args)\n{\n\tint i, n;\n\tPyObject *obj;\n\tint retval = SOBJ_NOTFANCY;\n\n\tif (PyTuple_Check(args)) {\n\t\tn = PyTuple_GET_SIZE(args);\n\t\tif (n >= MAX_DIMS) return SOBJ_TOOMANY;\n\t\tfor (i=0; i=MAX_DIMS) return SOBJ_ISFANCY;\n\t\tfor (i=0; i SOBJ_ISFANCY) return retval;\n\t\t}\n\t}\n\n\treturn retval;\n}\n\n/* convert an indexing object to an INTP indexing array iterator\n if possible -- otherwise, it is a Slice or Ellipsis object\n and has to be interpreted on bind to a particular \n array so leave it NULL for now.\n */\nstatic int\n_convert_obj(PyObject *obj, PyArrayIterObject **iter)\n{\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tPyObject *arr;\n\n\tif (PySlice_Check(obj) || (obj == Py_Ellipsis))\n\t\t*iter = NULL;\n\telse {\n\t\tarr = PyArray_FromAny(obj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) return -1;\n\t\t*iter = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (*iter == NULL) return -1;\n\t}\n\treturn 0;\n}\n\n/* Adjust dimensionality and strides for index object iterators \n --- i.e. broadcast\n */\nstatic int\nPyArray_Broadcast(PyArrayMultiIterObject *mit)\n{\n\tint i, nd, k, j;\n\tintp tmp;\n\tPyArrayIterObject *it;\n\t\n\t/* Discover the broadcast number of dimensions */\n\tfor (i=0, nd=0; inumiter; i++) \n\t\tnd = MAX(nd, mit->iters[i]->ao->nd);\n\tmit->nd = nd;\n\n\t/* Discover the broadcast shape in each dimension */\n\tfor (i=0; idimensions[i] = 1;\n\t\tfor (j=0; jnumiter; j++) {\n\t\t\tit = mit->iters[j];\n\t\t\t/* This prepends 1 to shapes not already \n\t\t\t equal to nd */\n\t\t\tk = i + it->ao->nd - nd;\n\t\t\tif (k>=0) {\n\t\t\t\ttmp = it->ao->dimensions[k];\n\t\t\t\tif (tmp == 1) continue;\n\t\t\t\tif (mit->dimensions[i] == 1) \n\t\t\t\t\tmit->dimensions[i] = tmp;\n\t\t\t\telse if (mit->dimensions[i] != tmp) {\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\t\"index objects are \" \\\n\t\t\t\t\t\t\t\"not broadcastable \" \\\n\t\t\t\t\t\t\t\"to a single shape.\");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Reset the iterator dimensions and strides of each iterator\n\t object -- using 0 valued strides for broadcasting */\n\n\ttmp = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tmit->size = tmp;\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tit->nd_m1 = mit->nd - 1;\n\t\tit->size = tmp;\n\t\tnd = it->ao->nd;\n\t\tit->factors[mit->nd-1] = 1;\n\t\tfor (j=0; j < mit->nd; j++) {\n\t\t\tit->dims_m1[j] = mit->dimensions[j] - 1;\n\t\t\tk = j + nd - mit->nd;\n\t\t\t/* If this dimension was added or shape\n\t\t\t of underlying array was 1 */\n\t\t\tif ((k < 0) || \\\n\t\t\t it->ao->dimensions[k] != mit->dimensions[j]) {\n\t\t\t\tit->contiguous = 0;\n\t\t\t\tit->strides[j] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tit->strides[j] = it->ao->strides[k];\n\t\t\t}\n\t\t\tit->backstrides[j] = it->strides[j] *\t\\\n\t\t\t\tit->dims_m1[j];\n\t\t\tif (j > 0)\n\t\t\t\tit->factors[mit->nd-j-1] =\t\t\\\n\t\t\t\t\tit->factors[mit->nd-j] *\t\\\n\t\t\t\t\tmit->dimensions[mit->nd-j];\n\t\t}\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn 0;\n}\n\n/* Reset the map iterator to the beginning */\nstatic void\nPyArray_MapIterReset(PyArrayMapIterObject *mit)\n{\n\tint i,j; intp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index = 0;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\n\tif (mit->subspace != NULL) {\n\t\tmemcpy(coord, mit->bscoord, sizeof(intp)*mit->ait->ao->nd);\n\t\tPyArray_ITER_RESET(mit->subspace);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tj = mit->iteraxes[i];\n\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* This function needs to update the state of the map iterator\n and point mit->dataptr to the memory-location of the next object\n*/\nstatic void\nPyArray_MapIterNext(PyArrayMapIterObject *mit)\n{\n\tint i, j;\n\tintp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index += 1;\n\tif (mit->index >= mit->size) return;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\t/* Sub-space iteration */\n\tif (mit->subspace != NULL) {\n\t\tPyArray_ITER_NEXT(mit->subspace);\n\t\tif (mit->subspace->index == mit->subspace->size) {\n\t\t\t/* reset coord to coordinates of \n\t\t\t beginning of the subspace */\n\t\t\tmemcpy(coord, mit->bscoord, \n\t\t\t sizeof(intp)*mit->ait->ao->nd);\n\t\t\tPyArray_ITER_RESET(mit->subspace);\n\t\t\tfor (i=0; inumiter; i++) {\n\t\t\t\tit = mit->iters[i];\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t\tj = mit->iteraxes[i];\n\t\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t\t sizeof(intp));\n\t\t\t}\n\t\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\t}\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* Bind a mapiteration to a particular array */\n\n/* Determine if subspace iteration is necessary. If so, \n 1) Fill in mit->iteraxes\n\t 2) Create subspace iterator\n\t 3) Update nd, dimensions, and size. \n\n Subspace iteration is necessary if: arr->nd > mit->numiter\n*/\n\n/* Need to check for index-errors somewhere. \n\n Let's do it at bind time and also convert all <0 values to >0 here\n as well. \n*/\nstatic void\nPyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n{\n\tint subnd;\n\tPyObject *sub=NULL, *obj=NULL;\n\tint i, j, n, curraxis, ellipexp, noellip;\n\tPyArrayIterObject *it;\n\tintp dimsize;\n\tintp *indptr;\n\n\t/* Remove old binding if any */\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\n\tPy_XDECREF(mit->subspace);\n\tmit->subspace = NULL;\n\t\n\tsubnd = arr->nd - mit->numiter;\n\tif (subnd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Too many indices for array.\");\n\t\treturn;\n\t}\n\n\tmit->ait = (PyArrayIterObject *)PyArray_IterNew((PyObject *)arr);\n\tif (mit->ait == NULL) return;\n\n\t/* If this is just a view, then do nothing more */\n\t/* views are handled by just adjusting the strides\n\t and dimensions of the object.\n\t*/\n\t \n\tif (mit->view) return;\n\n\t/* no subspace iteration needed. Return */\n\tif (subnd == 0) {\n\t\tn = arr->nd;\n\t\tfor (i=0; iiteraxes[i] = i;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\t/* all indexing arrays have been converted to 0 \n\t therefore we can extract the subspace with a simple\n\t getitem call which will use view semantics\n\t*/\n\t\n\tsub = PyObject_GetItem((PyObject *)arr, mit->indexobj);\n\tif (sub == NULL) goto fail;\n\tmit->subspace = (PyArrayIterObject *)PyArray_IterNew(sub);\n\tif (mit->subspace == NULL) goto fail;\n\tPy_DECREF(sub);\n\n\t/* Expand dimensions of result */\n\tn = mit->subspace->ao->nd;\n\tfor (i=0; idimensions[mit->nd+i] = mit->subspace->ao->dimensions[i];\n\tmit->nd += n;\n\n\t/* Now, we still need to interpret the ellipsis and slice objects \n\t to determine which axes the indexing arrays are referring to\n\t*/\n\tn = PyTuple_GET_SIZE(mit->indexobj);\n\n\t/* The number of dimensions an ellipsis takes up */\n\tellipexp = arr->nd - n + 1;\n\t/* Now fill in iteraxes -- remember indexing arrays have been \n converted to 0's in mit->indexobj */\n\tcurraxis = 0;\n\tj = 0;\n\tnoellip = 1; /* Only expand the first ellipsis */\n\tmemset(mit->bscoord, '\\0', sizeof(intp)*arr->nd);\n\tfor (i=0; iindexobj, i);\n\t\tif (PyInt_Check(obj) || PyLong_Check(obj)) \n\t\t\tmit->iteraxes[j++] = curraxis++;\n\t\telse if (noellip && obj == Py_Ellipsis) {\n\t\t\tcurraxis += ellipexp;\n\t\t\tnoellip = 0;\n\t\t}\n\t\telse {\n\t\t\tint start=0;\n\t\t\tint stop, step;\n\t\t\t/* Should be slice object or\n\t\t\t another Ellipsis */\n\t\t\tif (obj == Py_Ellipsis) {\n\t\t\t\tmit->bscoord[curraxis] = 0;\n\t\t\t}\n\t\t\telse if (!PySlice_Check(obj) || \\\n\t\t\t\t (slice_GetIndices((PySliceObject *)obj, \n\t\t\t\t\t\t arr->dimensions[curraxis],\n\t\t\t\t\t\t &start, &stop, &step,\n\t\t\t\t\t\t &dimsize) < 0)) {\n\t\t\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t\t\t \"unexpected object \"\t\\\n\t\t\t\t\t \"(%s) in selection position %d\",\n\t\t\t\t\t obj->ob_type->tp_name, i);\n\t\t\t goto fail;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmit->bscoord[curraxis] = start;\n\t\t\t}\n\t\t\tcurraxis += 1; \n\t\t}\n\t}\n finish:\n\t/* Here check the indexes (now that we have iteraxes) */\n\tmit->size = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tPyArray_ITER_RESET(it);\n\t\tdimsize = arr->dimensions[mit->iteraxes[i]];\n\t\twhile(it->index < it->size) {\n\t\t\tindptr = ((intp *)it->dataptr);\n\t\t\tif (*indptr < 0) *indptr += dimsize;\n\t\t\tif (*indptr < 0 || *indptr >= dimsize) {\n\t\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t\t \"index (%d) out of range \"\\\n\t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n\t\t\t\t\t *indptr, dimsize-1, \n\t\t\t\t\t mit->iteraxes[i]);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn;\n\n fail:\n\tPy_XDECREF(sub);\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\treturn;\n}\n\n/* This function takes a Boolean array and constructs index objects and\n iterators as if nonzero(Bool) had been called\n*/\nstatic int\n_nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)\n{\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\tPyArrayObject *ba =NULL, *new=NULL;\n\tint nd, j;\n\tintp size, i, count;\n\tBool *ptr;\n\tintp coords[MAX_DIMS], dims_m1[MAX_DIMS];\n\tintp *dptr[MAX_DIMS];\n\n\tba = (PyArrayObject *)PyArray_FromAny(myBool, &typecode, 0, 0, \n\t\t\t\t\t CARRAY_FLAGS);\n\tif (ba == NULL) return -1;\n\tnd = ba->nd;\n\tfor (j=0; jdata;\n\tcount = 0;\n\n\t/* pre-determine how many nonzero entries there are */\n\tfor (i=0; iao->data;\n\t\tcoords[j] = 0;\n\t\tdims_m1[j] = ba->dimensions[j]-1;\n\t}\n\n\tptr = (Bool *)ba->data;\n\n\tif (count == 0) return nd;\n\n\t/* Loop through the Boolean array and copy coordinates\n\t for non-zero entries */\n\tfor (i=0; i=0; j--) {\n\t\t\tif (coords[j] < dims_m1[j]) {\n\t\t\t\tcoords[j]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcoords[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn nd;\n\n fail:\n\tfor (j=0; jiters[i] = NULL;\n \tmit->view = 0;\n \tmit->index = 0;\n \tmit->ait = NULL;\n \tmit->subspace = NULL;\n\tmit->numiter = 0;\n\tmit->consec = 1;\n\tfancy = fancy_indexing_check(indexobj);\n\tPy_INCREF(indexobj);\n\tmit->indexobj = indexobj;\n\tif (fancy == SOBJ_NOTFANCY) { /* bail out */\n\t\tmit->view = 1;\n\t\tgoto ret;\n\t}\n\n\tif (fancy == SOBJ_BADARRAY) {\n\t\tPyErr_SetString(PyExc_TypeError,\t\t\t\\\n\t\t\t\t\"Arrays used as indexes must be of \" \\\n\t\t\t\t\"integer type\");\n\t\tgoto fail;\n\t}\n\tif (fancy == SOBJ_TOOMANY) {\n\t\tPyErr_SetString(PyExc_TypeError,\"Too many indicies\");\n\t\tgoto fail;\n\t}\n\n\tif (fancy == SOBJ_LISTTUP) {\n\t\tPyObject *newobj;\n\t\tnewobj = PySequence_Tuple(indexobj);\n\t\tif (newobj == NULL) goto fail;\n\t\tPy_DECREF(indexobj);\n\t\tindexobj = newobj;\n\t\tmit->indexobj = indexobj;\n\t}\n\n#undef SOBJ_NOTFANCY \n#undef SOBJ_ISFANCY \n#undef SOBJ_BADARRAY \n#undef SOBJ_TOOMANY \n#undef SOBJ_LISTTUP \n\n\n\t/* Must have some kind of fancy indexing if we are here */\n\t/* indexobj is either a list, an arrayobject, or a tuple \n\t (with at least 1 list or arrayobject or Bool object), */\n\t\n\t/* convert all inputs to iterators */\n\tif (PyArray_Check(indexobj) &&\t\t\t\\\n\t (PyArray_TYPE(indexobj) == PyArray_BOOL)) {\n\t\tmit->numiter = _nonzero_indices(indexobj, mit->iters);\n\t\tif (mit->numiter < 0) goto fail;\n\t\tmit->nd = 1;\n\t\tmit->dimensions[0] = mit->iters[0]->dims_m1[0]+1;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = PyTuple_New(mit->numiter);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tPyTuple_SET_ITEM(mit->indexobj, i, \n\t\t\t\t\t PyInt_FromLong(0));\n\t\t}\n\t}\n\n\telse if (PyList_Check(indexobj) || PyArray_Check(indexobj)) {\n\t\tmit->numiter = 1;\n\t\tarr = PyArray_FromAny(indexobj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) goto fail;\n\t\tmit->iters[0] = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (mit->iters[0] == NULL) goto fail;\n\t\tmit->nd = PyArray_NDIM(arr);\n\t\tmemcpy(mit->dimensions,PyArray_DIMS(arr),mit->nd*sizeof(intp));\n\t\tmit->size = PyArray_SIZE(arr);\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = Py_BuildValue(\"(N)\", PyInt_FromLong(0));\n\t}\n\telse { /* must be a tuple */\n\t\tPyObject *obj;\n\t\tPyArrayIterObject *iter;\n\t\tPyObject *new;\n\t\t/* Make a copy of the tuple -- we will be replacing \n\t\t index objects with 0's */\n\t\tn = PyTuple_GET_SIZE(indexobj);\n\t\tnew = PyTuple_New(n);\n\t\tif (new == NULL) goto fail;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = new;\n\t\tstarted = 0;\n\t\tnonindex = 0;\n\t\tfor (i=0; iconsec = 0;\n\t\t\t\tmit->iters[(mit->numiter)++] = iter;\n\t\t\t\tPyTuple_SET_ITEM(new,i,\n\t\t\t\t\t\t PyInt_FromLong(0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (started) nonindex = 1;\n\t\t\t\tPy_INCREF(obj);\n\t\t\t\tPyTuple_SET_ITEM(new,i,obj);\n\t\t\t}\n\t\t}\n\t\t/* Store the number of iterators actually converted */\n\t\t/* These will be mapped to actual axes at bind time */\n\t\tif (PyArray_Broadcast((PyArrayMultiIterObject *)mit) < 0)\n\t\t\tgoto fail;\n\t}\n\n ret:\n PyObject_GC_Track(mit);\n return (PyObject *)mit;\n \n fail:\n\tPy_XDECREF(arr);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n\treturn NULL;\n}\n\n\n/* return unbound mapiter object */\n\nstatic PyObject *\narraymapiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) \n{\n\tPyObject *newtup, *res;\n\tint n;\n\n\tif (!PyTuple_Check(args)) {\n\t\tPyErr_BadInternalCall();\n\t\treturn NULL;\n\t}\n\n\tn = PyTuple_GET_SIZE(args);\n\t\n\tif (n < 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"must be initialized with >= 1 argument\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n > 1) {\n\t\tnewtup = PyTuple_GetSlice(args, 0, n);\n\t\tif (newtup == NULL) return NULL;\n\t\tres = PyArray_MapIterNew(newtup);\n\t\tPy_DECREF(newtup);\n\t}\n\telse { /* n == 1 */\n\t\tnewtup = PyTuple_GET_ITEM(args, 0);\n\t\tres = PyArray_MapIterNew(newtup);\n\t}\n\n\treturn res; \t\n}\n\n\n/* Returns a 0-dim array holding the element desired */\n\nstatic PyObject *\narraymapiter_next(PyArrayMapIterObject *mit)\n{\n\tPyObject *ret;\n\tif (mit->ait == NULL) return NULL;\n\tif (mit->view) return NULL;\n\tif (mit->index < mit->size) {\n\t\tret = PyArray_ToScalar(mit->dataptr, mit->ait->ao);\n\t\tPyArray_MapIterNext(mit);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narraymapiter_dealloc(PyArrayMapIterObject *mit)\n{\n\tint i;\n PyObject_GC_UnTrack(mit);\n Py_XDECREF(mit->ait);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n}\n\nstatic int\narraymapiter_traverse(PyArrayMapIterObject *mit, visitproc visit, void *arg)\n{\n\tint ret, i;\n if (mit->ait != NULL)\n if ((ret = visit((PyObject *)(mit->ait), arg)) != 0) \n\t\t\treturn ret;\t\n\n\tif (mit->iters != NULL) \n\t\tfor (i=0; inumiter; i++) \n\t\t\tif (mit->iters[i] != NULL) \n\t\t\t\tif ((ret=visit((PyObject *)mit->iters[i], \n\t\t\t\t\t arg)) != 0)\n\t\t\t\t\treturn ret;\n\n\tif (mit->indexobj != NULL)\n\t\tif ((ret = visit(mit->indexobj, arg)) != 0) return ret;\n\t\n return 0;\n}\n\n/* \nstatic char doc_mapiter_bind[] = \"obj.bind(a)\\n Bind an array to the \"\\\n\t\"mapiter object\";\n\nstatic PyObject *\nmapiter_bind(PyArrayMapIterObject *mit, PyObject *args)\n{\n\tPyObject *r;\n intp size, strides;\n int nd;\n\tPyArrayObject *arr;\n\n if (!PyArg_ParseTuple(args, \"O!\", &PyArray_Type, &arr)) return NULL;\n\n\tPyArray_MapIterBind(mit, arr);\n\n\tif (mit->ait == NULL) return NULL;\n\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyMethodDef mapiter_methods[] = {\n\t{\"bind\", (PyCFunction)mapiter_bind, 1, doc_mapiter_bind},\n {NULL,\t\tNULL}\t\t\n};\n*/\n\n\nstatic PyTypeObject PyArrayMapIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.mapiter\",\t\t \t/* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arraymapiter_dealloc,\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0,\t\t\t\t\t/* tp_as_sequence */\n 0,\t\t\t\t\t/* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0, \t\t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arraymapiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arraymapiter_next,\t/* tp_iternext */\n 0,\t \t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n 0,\t\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0, \t /* tp_alloc */\n (newfunc)arraymapiter_new,\t /* tp_new */\n 0,\t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n\n};\n\n/** END of Subscript Iterator **/\n\n\n\n", "source_code_before": " /*\n Provide multidimensional arrays as a basic object type in python. \n\nBased on Original Numeric implementation\nCopyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\nwith contributions from many Numeric Python developers 1995-2004 *\n\nHeavily modified in 2005 with inspiration from Numarray \n\nby\n\nTravis Oliphant\nAssistant Professor at\nBrigham Young University \n\nmaintainer email: oliphant.travis@ieee.org\n\nNumarray design (which provided guidance) by \nSpace Science Telescope Institute \n (J. Todd Miller, Perry Greenfield, Rick White)\n\n*/\n\n/* $Id: arrayobject.c,v 1.59 2005/09/14 00:14:00 teoliphant Exp $ */\n\n/*\n#include \"Python.h\"\n#include \"structmember.h\"\n\n#define _MULTIARRAYMODULE\n#include \"Numeric3/arrayobject.h\"\n*/\n\n/* Helper functions */\n\n#define error_converting(x) (((x) == -1) && PyErr_Occurred())\n\nstatic intp\nPyArray_PyIntAsIntp(PyObject *o)\n{\n\tlonglong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INTP, 0, 0};\n\tintp ret;\n\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((intp *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (longlong) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (longlong) PyLong_AsLongLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\t\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONGLONG != SIZEOF_PY_INTPTR_T)\n\tif ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C intp\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (intp) long_value;\n}\n\n\nstatic PyObject *array_int(PyArrayObject *v);\n\nstatic int\nPyArray_PyIntAsInt(PyObject *o)\n{\n\tlong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INT, 0, 0};\n\tint ret;\n\t\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((int *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (long) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (long) PyLong_AsLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONG != SIZEOF_INT)\n\tif ((long_value < INT_MIN) || (long_value > INT_MAX)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C int\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (int) long_value;\n}\n\n\nstatic double\nPyArray_GetPriority(PyObject *obj, double default_) \n{\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n\n\tif (PyArray_CheckExact(obj))\n\t\treturn priority;\n if (PyBigArray_CheckExact(obj)) \n return PyArray_BIG_PRIORITY;\n\n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n if (PyErr_Occurred()) {\n PyErr_Clear(); \n priority = default_;\n }\n Py_XDECREF(ret);\n return priority; \n}\n\n/* Backward compatibility only */\n/* In both Zero and One\n\n ***You must free the memory once you are done with it\n using PyDataMem_FREE(ptr) or you create a memory leak***\n\n If arr is an Object array you are getting a \n BORROWED reference to Zero or One.\n Do not DECREF.\n Please INCREF if you will be hanging on to it.\n\n The memory for the ptr still must be freed in any case;\n*/\n\nstatic char *\nPyArray_Zero(PyArrayObject *arr)\n{\n char *zeroval;\n char *buf;\n int buf_len;\n PyObject *obj, *ret;\n\n zeroval = PyDataMem_NEW(arr->itemsize);\n if (zeroval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n if (PyArray_ISOBJECT(arr)) {\n obj=PyInt_FromLong((long) 0);\n memcpy(zeroval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return zeroval;\n }\n ret = PyObject_GetAttrString((PyObject *)arr, \"_zero\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_zero not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n return NULL;\n }\n memcpy(zeroval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n memset(zeroval, 0, arr->itemsize);\n return zeroval;\n}\n\nstatic char *\nPyArray_One(PyArrayObject *arr)\n{\n char *oneval;\n char *buf;\n int buf_len, ret2;\n PyObject *obj, *ret;\n\n oneval = PyDataMem_NEW(arr->itemsize);\n if (oneval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n obj = PyInt_FromLong((long) 1);\n if (PyArray_ISOBJECT(arr)) {\n memcpy(oneval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return oneval;\n }\n \n ret = PyObject_GetAttrString((PyObject *)arr, \"_one\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_one not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n PyDataMem_FREE(oneval);\n return NULL;\n }\n memcpy(oneval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n\n ret2 = arr->descr->setitem(obj, oneval, arr);\n Py_DECREF(obj);\n if (ret < 0) {\n PyDataMem_FREE(oneval);\n return NULL;\n }\n return oneval;\n}\n\n/* End deprecated */\n\n\nstatic int \ndo_sliced_copy(char *dest, intp *dest_strides, intp *dest_dimensions,\n\t int dest_nd, char *src, intp *src_strides, \n\t intp *src_dimensions, int src_nd, int elsize, \n\t int copies) {\n intp i, j;\n\t\n if (src_nd == 0 && dest_nd == 0) {\n for(j=0; j src_nd) {\n for(i=0; i<*dest_dimensions; i++, dest += *dest_strides) {\n if (do_sliced_copy(dest, dest_strides+1, \n dest_dimensions+1, dest_nd-1,\n src, src_strides, \n src_dimensions, src_nd, \n elsize, copies) == -1) \n return -1;\n }\n return 0;\n }\n\t\n if (dest_nd == 1) {\n if (*dest_dimensions != *src_dimensions) {\n PyErr_SetString(PyExc_ValueError, \n \"matrices are not aligned for copy\");\n return -1;\n }\n for(i=0; i<*dest_dimensions; i++, src += *src_strides) {\n for(j=0; j 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize) && \n ((*src_strides)[*src_nd-1] == *elsize)) {\n if ((*dest_dimensions)[*dest_nd-1] != \n (*src_dimensions)[*src_nd-1]) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"matrices are not aligned\");\n return -1;\n }\n *elsize *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1; *src_nd-=1;\n } else {\n break;\n }\n }\n if (*src_nd == 0) {\n while (*dest_nd > 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize)) {\n *copies *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1;\n } else {\n break;\n }\n }\n }\n return 0;\n}\n\nstatic char *\ncontiguous_data(PyArrayObject *src) \n{\n intp dest_strides[MAX_DIMS], *dest_strides_ptr;\n intp *dest_dimensions=src->dimensions;\n int dest_nd=src->nd;\n intp *src_strides = src->strides;\n intp *src_dimensions=src->dimensions;\n int src_nd=src->nd;\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n intp stride=elsize;\n char *new_data;\n\t\n for(i=dest_nd-1; i>=0; i--) {\n dest_strides[i] = stride;\n stride *= dest_dimensions[i];\n }\n\t\n dest_strides_ptr = dest_strides;\n\t\n if (optimize_slices(&dest_strides_ptr, &dest_dimensions, &dest_nd,\n &src_strides, &src_dimensions, &src_nd,\n &elsize, &copies) == -1) \n return NULL;\n\t\n new_data = (char *)malloc(stride);\n\t\n ret = do_sliced_copy(new_data, dest_strides_ptr, dest_dimensions, \n dest_nd, src->data, src_strides, \n src_dimensions, src_nd, elsize, copies);\n\t\n if (ret != -1) { return new_data; }\n else { free(new_data); return NULL; }\n}\n\n/* end Helper functions */\n\n\nstatic PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n int, intp *, char *, int, int, PyObject *);\n\n/* C-API functions */\n\n/* Used for arrays of python objects to increment the reference count of */\n/* every python object in the array. */\nstatic int \nPyArray_INCREF(PyArrayObject *mp) \n{\n\tintp i, n;\n\n PyObject **data, **data2;\n\t\n if (mp->descr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data;\n for(i=0; idescr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data; \n for(i=0; i 0; n--, a += 1) {\n b = a + 1;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 4:\n for (a = (char*)p ; n > 0; n--, a += 2) {\n b = a + 3;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 8:\n for (a = (char*)p ; n > 0; n--, a += 4) {\n b = a + 7;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n default:\n m = size / 2;\n for (a = (char *)p ; n > 0; n--, a += m) {\n b = a + (size-1);\n for (j=0; j 1, then dst must be contiguous */\nstatic void\ncopy_and_swap(void *dst, void *src, int itemsize, intp numitems,\n intp srcstrides, int swap) \n{\n int i;\n char *s1 = (char *)src;\n char *d1 = (char *)dst;\n \n\n if ((numitems == 1) || (itemsize == srcstrides)) \n memcpy(d1, s1, itemsize*numitems);\n else { \n for (i = 0; i < numitems; i++) {\n memcpy(d1, s1, itemsize);\n d1 += itemsize;\n s1 += srcstrides;\n } \n }\n\n if (swap)\n byte_swap_vector(d1, numitems, itemsize);\n}\n\n\n/* Computer-generated arraytype and scalartype code */\n#include \"scalartypes.inc\"\n#include \"arraytypes.inc\"\n\nstatic char *\nindex2ptr(PyArrayObject *mp, int i) \n{\n\tif (i==0 && (mp->nd == 0 || mp->dimensions[0] > 0)) \n\t\treturn mp->data;\n\t\n if (mp->nd>0 && i>0 && i < mp->dimensions[0]) {\n return mp->data+i*mp->strides[0];\n }\n PyErr_SetString(PyExc_IndexError,\"index out of bounds\");\n return NULL;\n}\n\nstatic intp \nPyArray_Size(PyObject *op) \n{\n if (PyArray_Check(op)) {\n return PyArray_SIZE((PyArrayObject *)op);\n } \n\telse {\n return 0;\n }\n}\n\n/* If destination is not the right type, then src \n will be cast to destination. \n*/\n\n/* Does a flat iterator-based copy. \n\n The arrays are assumed to have the same number of elements\n They can be different sizes and have different types however. \n*/\n\nstatic int\nPyArray_CopyInto(PyArrayObject *dest, PyArrayObject *src)\n{\n intp dsize, ssize, sbytes;\n\tint ncopies, elsize, index;\n PyArrayIterObject *dit=NULL;\n PyArrayIterObject *sit=NULL;\n\tchar *dptr;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n PyArray_CopySwapNFunc *copyswapn;\n \n if (!PyArray_ISWRITEABLE(dest)) {\n PyErr_SetString(PyExc_RuntimeError, \n \"Cannot write to array.\");\n return -1;\n }\n\n if (!PyArray_EquivArrTypes(dest, src)) {\n return PyArray_CastTo(dest, src);\n }\n\n dsize = PyArray_SIZE(dest);\n ssize = PyArray_SIZE(src);\n\tif (ssize == 0) return 0;\n if (dsize % ssize != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Destination number of elements must be\"\\\n \"an integer multiple of the source number of\"\\\n \"elements.\");\n return -1;\n }\n ncopies = dsize / ssize;\n\n\tswap = PyArray_ISNOTSWAPPED(dest) != PyArray_ISNOTSWAPPED(src);\n\tcopyswap = dest->descr->copyswap;\n\tcopyswapn = dest->descr->copyswapn;\n\n elsize = dest->itemsize;\n\n if ((PyArray_ISCONTIGUOUS(dest) && PyArray_ISCONTIGUOUS(src)) \\\n\t || (PyArray_ISFORTRAN(dest) && PyArray_ISFORTRAN(src))) {\n \n PyArray_XDECREF(dest);\n dptr = dest->data;\n sbytes = ssize * src->itemsize;\n while(ncopies--) {\n memmove(dptr, src->data, sbytes);\n dptr += sbytes;\n }\n\t\tif (swap)\n\t\t\tcopyswapn(dest->data, NULL, dsize, 1, elsize);\n PyArray_INCREF(dest);\n return 0;\n }\n\n dit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)dest);\n sit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)src);\n\n if ((dit == NULL) || (sit == NULL)) {\n Py_XDECREF(dit);\n Py_XDECREF(sit);\n return -1;\n }\n\n PyArray_XDECREF(dest);\n while(ncopies--) {\n index = ssize;\n while(index--) {\n memmove(dit->dataptr, sit->dataptr, elsize);\n\t\t\tif (swap)\n\t\t\t\tcopyswap(dit->dataptr, NULL, 1, elsize);\n PyArray_ITER_NEXT(dit);\n PyArray_ITER_NEXT(sit);\n }\n PyArray_ITER_RESET(sit);\n } \n PyArray_INCREF(dest);\n Py_DECREF(dit);\n Py_DECREF(sit);\n\treturn 0;\n}\n\n\nstatic int \nPyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) \n{\n PyArrayObject *src;\n int ret;\n\tPyArray_Typecode typecode;\n\n\n\ttypecode.type_num = dest->descr->type_num;\n\ttypecode.itemsize = dest->itemsize;\n\ttypecode.fortran = PyArray_ISFORTRAN(dest);\n\t\t\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n\t\t\t\t\t &typecode, 0,\n\t\t\t\t\t dest->nd, 0);\n if (src == NULL) return -1;\n\n ret = PyArray_CopyInto(dest, src);\n Py_DECREF(src);\n return ret;\n}\n\n\n/* These are also old calls (should use PyArray_New) */\n\n/* They all zero-out the memory as previously done */\n\nstatic PyObject *\nPyArray_FromDimsAndDataAndDescr(int nd, int *d, \n PyArray_Descr *descr,\n char *data) {\n\tPyObject *ret;\n\n#if SIZEOF_INTP != SIZEOF_INT\n\tint i;\n\tintp newd[MAX_DIMS];\n\t\n\tfor (i=0; itype_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#else\n\tret = PyArray_New(&PyArray_Type, nd, (intp *)d, \n descr->type_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#endif\n\tif (descr->type_num != PyArray_OBJECT)\n\t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_FromDimsAndData(int nd, int *d, int type, char *data) \n{\n\tPyObject *ret;\n#if SIZEOF_INTP != SIZEOF_INT\n\tintp newd[MAX_DIMS];\n\tint i;\t\n\tfor (i=0; iob_type, m1->nd, \n\t\t\t\t\t m1->dimensions,\n\t\t\t\t\t m1->descr->type_num,\n\t\t\t\t\t NULL, NULL, m1->itemsize,\n\t\t\t\t\t 0, (PyObject *)m1);\n\t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n\t\n return (PyObject *)ret;\n}\n\n\nstatic PyObject *array_item(PyArrayObject *, int);\n\nstatic PyObject *\nPyArray_Scalar(char *data, int type_num, int itemsize, int swap)\n{\n PyArray_Descr *descr;\n\tPyTypeObject *type;\n\tPyObject *obj;\t\n\tchar *destptr;\n PyArray_CopySwapFunc *copyswap;\n\n descr = PyArray_DescrFromType(type_num);\n if (descr == NULL) return NULL;\n type = descr->typeobj;\n copyswap = descr->copyswap;\n\tif (type_num == PyArray_STRING) \n\t\tobj = type->tp_alloc(type, itemsize);\n\telse\n\t\tobj = type->tp_alloc(type, 0);\n\tif (obj == NULL) return NULL;\n\tif PyTypeNum_ISFLEXIBLE(type_num) { \n\t\tif (type_num == PyArray_STRING) {\n\t\t\tdestptr = PyString_AS_STRING(obj);\n\t\t\t((PyStringObject *)obj)->ob_shash = -1;\n\t\t\t((PyStringObject *)obj)->ob_sstate =\t\\\n\t\t\t\tSSTATE_NOT_INTERNED; \n\t\t}\n\t\telse {\n\t\t\tdestptr = PyDataMem_NEW(itemsize);\n\t\t\tif (destptr == NULL) {\n\t\t\t\tPyObject_Del(obj);\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tif (type_num == PyArray_UNICODE) {\n\t\t\t\tPyUnicode_AS_UNICODE(obj) = \\\n\t\t\t\t\t(Py_UNICODE *)destptr;\n\t\t\t\t((PyUnicodeObject*)obj)->length = itemsize / \\\n\t\t\t\t\tsizeof(Py_UNICODE);\n\t\t\t\t((PyUnicodeObject*)obj)->hash = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t((PyVoidScalarObject *)obj)->obval = destptr;\n\t\t\t\t((PyVoidScalarObject *)obj)->ob_size = itemsize;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tdestptr = &(((PyScalarObject*)obj)->obval);\n\t}\n\t/* copyswap for OBJECT increments the reference count */\n copyswap(destptr, data, swap, itemsize);\n\treturn obj;\n}\n\n/* returns an Array-Scalar Object of the type of arr\n from the given pointer to memory -- main Scalar creation function\n default new method calls this. \n*/\nstatic PyObject *\nPyArray_ToScalar(char *data, PyArrayObject *arr)\n{\n\tint type_num = arr->descr->type_num;\n\tint itemsize = arr->itemsize;\n int swap = !(PyArray_ISNOTSWAPPED(arr));\n\n\treturn PyArray_Scalar(data, type_num, itemsize, swap);\n}\n\n\n/* Return Python scalar if 0-d array object is encountered */\n\nstatic PyObject *\nPyArray_Return(PyArrayObject *mp) \n{\n \n\tif (mp == NULL) return NULL;\n\n if (PyErr_Occurred()) {\n Py_XDECREF(mp);\n return NULL;\n }\n\n\tif (PyArray_Check((PyObject *)mp) && mp->nd == 0) {\n\t\tPyObject *ret;\n\t\tret = PyArray_ToScalar(mp->data, mp);\n\t\tPy_DECREF(mp);\n\t\treturn ret;\n\t}\n\telse {\n\t\treturn (PyObject *)mp;\n\t}\n}\n\n/*\n returns typenum to associate with this type >=PyArray_USERDEF.\n Also creates a copy of the VOID_DESCR table inserting it's typeobject in\n and it's typenum in the appropriate place.\n \n needs the userdecrs table and PyArray_NUMUSER variables\n defined in arratypes.inc\n*/\nstatic int \nPyArray_RegisterDataType(PyTypeObject *type)\n{\n\tPyArray_Descr *descr;\n\tint typenum;\n\tint i;\n\t\n\tif ((type == &PyVoidArrType_Type) ||\t\t\t\\\n\t !PyType_IsSubtype(type, &PyVoidArrType_Type)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can only register void subtypes.\");\n\t\treturn -1;\n\t}\n\t/* See if this type is already registered */\n\tfor (i=0; itypeobj == type)\n\t\t\treturn descr->type_num;\n\t}\n\tdescr = malloc(sizeof(PyArray_Descr));\n\tmemcpy(descr, PyArray_DescrFromType(PyArray_VOID), \n\t sizeof(PyArray_Descr));\n\ttypenum = PyArray_USERDEF + PyArray_NUMUSERTYPES;\n\tdescr->type_num = typenum;\n\tdescr->typeobj = type;\n\tuserdescrs = realloc(userdescrs, \n\t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n if (userdescrs == NULL) {\n PyErr_SetString(PyExc_MemoryError, \"RegisterDataType\");\n return -1;\n }\n\tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n\treturn typenum;\n}\n\n\n/* \n copyies over from the old descr table for anything\n NULL or zero in what is given. \n frees the copy of the Descr_table already there.\n places a pointer to the new one into the slot.\n*/\nstatic int\nPyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n{\n\tPyArray_Descr *old;\n\tint i;\n\n\tif (!PyArray_ISUSERDEF(typenum)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Data type not registered.\");\n\t\treturn -1;\n\t}\n\told = userdescrs[typenum-PyArray_USERDEF];\n\tdescr->typeobj = old->typeobj;\n\tdescr->type_num = typenum;\n\n#define _NULL_CHECK(member) \\\n\tif (descr->member == NULL) descr->member = old->member\n\n\tfor (i=0; imember == 0) descr->member = old->member\n\n\t_ZERO_CHECK(kind);\n\t_ZERO_CHECK(type);\n\t_ZERO_CHECK(elsize);\n\t_ZERO_CHECK(alignment);\n#undef _ZERO_CHECK\n\n\tfree(old);\n\tuserdescrs[typenum-PyArray_USERDEF] = descr;\n\treturn 0;\n}\n\n\nstatic int\nPyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) \n{\n intp size;\n intp n, n2;\n int n3, n4;\n PyArrayIterObject *it;\n PyObject *obj, *strobj, *tupobj;\n\n n3 = strlen((const char *)sep);\n if (n3 == 0) { /* binary data */\n if (PyArray_ISOBJECT(self)) {\n PyErr_SetString(PyExc_ValueError, \"Cannot write \"\\\n\t\t\t\t\t\"object arrays to a file in \"\\\n\t\t\t\t\t\"binary mode.\");\n return -1;\n }\n\n if (PyArray_ISCONTIGUOUS(self)) {\n size = PyArray_SIZE(self);\n if ((n=fwrite((const void *)self->data, \n (size_t) self->itemsize,\n (size_t) size, fp)) < size) {\n PyErr_Format(PyExc_ValueError, \n \"%ld requested and %ld written\",\n (long) size, (long) n);\n return -1;\n }\n }\n else {\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n while(it->index < it->size) {\n if (fwrite((const void *)it->dataptr, \n (size_t) self->itemsize,\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n \" %d to file\", it->index);\n Py_DECREF(it);\n return -1;\n }\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n } \n }\n else { /* text data */\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n\t\tn4 = strlen((const char *)format);\n while(it->index < it->size) {\n obj = self->descr->getitem(it->dataptr, self);\n if (obj == NULL) {Py_DECREF(it); return -1;}\n\t\t\tif (n4 == 0) { /* standard writing */\n\t\t\t\tstrobj = PyObject_Str(obj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n\t\t\telse { /* use format string */\n\t\t\t\ttupobj = PyTuple_New(1);\n\t\t\t\tif (tupobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t\tPyTuple_SET_ITEM(tupobj,0,obj);\n\t\t\t\tobj = PyString_FromString((const char *)format);\n\t\t\t\tif (obj == NULL) {Py_DECREF(tupobj); \n\t\t\t\t\tPy_DECREF(it); return -1;}\n\t\t\t\tstrobj = PyString_Format(obj, tupobj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tPy_DECREF(tupobj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n if ((n=fwrite(PyString_AS_STRING(strobj), \n 1, n2=PyString_GET_SIZE(strobj),\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n \" to file\", it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n }\n /* write separator for all but last one */\n if (it->index != it->size-1) \n fwrite(sep, 1, n3, fp);\n Py_DECREF(strobj);\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n return 0;\n}\n\nstatic PyObject *\nPyArray_ToList(PyArrayObject *self) \n{\n PyObject *lp;\n PyArrayObject *v;\n intp sz, i;\n\t\n if (!PyArray_Check(self)) return (PyObject *)self;\n\n if (self->nd == 0) \n\t\treturn self->descr->getitem(self->data,self);\n\t\n sz = self->dimensions[0];\n lp = PyList_New(sz);\n\t\n for (i=0; ind >= self->nd) {\n\t\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\t\"array_item not returning smaller\" \\\n\t\t\t\t\t\" dimensional array\");\n\t\t\tPy_DECREF(lp);\n\t\t\treturn NULL;\n\t\t}\n PyList_SetItem(lp, i, PyArray_ToList(v));\n\t\tPy_DECREF(v);\n }\n\t\n return lp;\n}\n\nstatic PyObject *\nPyArray_ToString(PyArrayObject *self)\n{\n intp numbytes;\n intp index;\n char *dptr;\n int elsize;\n PyObject *ret;\n PyArrayIterObject *it;\n \n if (PyArray_TYPE(self) == PyArray_OBJECT) {\n PyErr_SetString(PyExc_ValueError, \"a string for the data\"\\\n\t\t\t\t\"in an object array is not appropriate.\");\n return NULL;\n }\n\n numbytes = PyArray_NBYTES(self);\n if (PyArray_ISONESEGMENT(self)) {\n ret = PyString_FromStringAndSize(self->data, (int) numbytes);\n }\n else {\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it==NULL) return NULL;\n ret = PyString_FromStringAndSize(NULL, (int) numbytes);\n if (ret == NULL) {Py_DECREF(it); return NULL;}\n dptr = PyString_AS_STRING(ret);\n index = it->size;\n elsize = self->itemsize;\n while(index--) {\n memcpy(dptr, it->dataptr, elsize);\n dptr += elsize;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n\treturn ret;\n}\n\n\n/*********************** end C-API functions **********************/\n\n\n/* array object functions */\n\nstatic void \narray_dealloc(PyArrayObject *self) {\n\n if (self->weakreflist != NULL)\n PyObject_ClearWeakRefs((PyObject *)self);\n\n if(self->base) {\n\t\t/* UPDATEIFCOPY means that base points to an \n\t\t array that should be updated with the contents\n\t\t of this array upon destruction.\n self->base->flags must have been WRITEABLE \n (checked previously) and it was locked here\n thus, unlock it.\n\t\t*/\n\t\tif (self->flags & UPDATEIFCOPY) {\n ((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tPy_INCREF(self); /* hold on to self in next call */\n PyArray_CopyInto((PyArrayObject *)self->base, self);\n\t\t\t/* Don't need to DECREF -- because we are deleting\n\t\t\t self already... */\n\t\t}\n\t\t/* In any case base is pointing to something that we need\n\t\t to DECREF -- either a view or a buffer object */\n Py_DECREF(self->base);\n }\n \n if ((self->flags & OWN_DATA) && (self->data != NULL)) {\n\t\t/* Free internal references if an Object array */\n\t\tPyArray_XDECREF(self);\n\n PyDataMem_FREE(self->data);\n }\n\t\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t}\n\t\n self->ob_type->tp_free((PyObject *)self);\n}\n\n/*************************************************************************\n **************** Implement Mapping Protocol ***************************\n *************************************************************************/\n\nstatic int \narray_length(PyArrayObject *self) \n{\n if (self->nd != 0) {\n return self->dimensions[0];\n } else {\n\t\tPyErr_SetString(PyExc_TypeError, \"len() of unsized object.\");\n\t\treturn -1;\n }\n}\n\n\nstatic PyObject *\narray_item(PyArrayObject *self, int i) \n{\n char *item;\n PyArrayObject *r;\n\n\n\tif(self->nd == 0) {\n\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\"0-d arrays can't be indexed.\");\n\t\treturn NULL;\n\t}\n if ((item = index2ptr(self, i)) == NULL) return NULL;\n\n\tr = (PyArrayObject *)PyArray_New(self->ob_type, \n\t\t\t\t\t self->nd-1, self->dimensions+1, \n\t\t\t\t\t self->descr->type_num, \n\t\t\t\t\t self->strides+1, item, \n\t\t\t\t\t self->itemsize, self->flags,\n\t\t\t\t\t (PyObject *)self);\n\tif (r == NULL) return NULL;\n\tPy_INCREF(self);\n\tr->base = (PyObject *)self;\n PyArray_UpdateFlags(r, CONTIGUOUS | FORTRAN);\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_item_nice(PyArrayObject *self, int i) \n{\n\treturn PyArray_Return((PyArrayObject *)array_item(self, i));\n}\n\n\nstatic int \narray_ass_item(PyArrayObject *self, int i, PyObject *v) \n{\n PyArrayObject *tmp;\n char *item;\n int ret;\n\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n if (i < 0) i = i+self->dimensions[0];\n\n if (self->nd > 1) {\n if((tmp = (PyArrayObject *)array_item(self, i)) == NULL)\n return -1;\n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n return ret; \n }\n\t\n if ((item = index2ptr(self, i)) == NULL) return -1;\n if (self->descr->setitem(v, item, self) == -1) return -1;\n return 0;\n}\n\n/* -------------------------------------------------------------- */\nstatic int\nslice_coerce_index(PyObject *o, int *v)\n{\n\t*v = PyArray_PyIntAsInt(o);\n\tif (error_converting(*v)) {\n\t\tPyErr_Clear();\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\n/* This is basically PySlice_GetIndicesEx, but with our coercion\n * of indices to integers (plus, that function is new in Python 2.3) */\nstatic int\nslice_GetIndices(PySliceObject *r, int length,\n int *start, int *stop, int *step,\n intp *slicelength)\n{\n\tint defstart, defstop;\n\t\n\tif (r->step == Py_None) {\n\t\t*step = 1;\n\t} else {\n\t\tif (!slice_coerce_index(r->step, step)) return -1;\n\t\tif (*step == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"slice step can not be zero\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tdefstart = *step < 0 ? length - 1 : 0;\n\tdefstop = *step < 0 ? -1 : length;\n\t\n\tif (r->start == Py_None) {\n\t\t*start = *step < 0 ? length-1 : 0;\n\t} else {\n\t\tif (!slice_coerce_index(r->start, start)) return -1;\n\t\tif (*start < 0) *start += length;\n\t\tif (*start < 0) *start = (*step < 0) ? -1 : 0;\n\t\tif (*start >= length) {\n\t\t\t*start = (*step < 0) ? length - 1 : length;\n\t\t}\n\t}\n\t\n\tif (r->stop == Py_None) {\n\t\t*stop = defstop;\n\t} else {\n\t\tif (!slice_coerce_index(r->stop, stop)) return -1;\n\t\tif (*stop < 0) *stop += length;\n if (*stop < 0) *stop = -1;\n if (*stop > length) *stop = length;\n\t}\n\t\n\tif ((*step < 0 && *stop >= *start) || \\\n\t (*step > 0 && *start >= *stop)) {\n\t\t*slicelength = 0;\n\t} else if (*step < 0) {\n\t\t*slicelength = (*stop - *start + 1) / (*step) + 1;\n\t} else {\n\t\t*slicelength = (*stop - *start - 1) / (*step) + 1;\n\t}\n\t\n\treturn 0;\n}\n\n#define PseudoIndex -1\n#define RubberIndex -2\n#define SingleIndex -3\n\nstatic int\nparse_subindex(PyObject *op, int *step_size, intp *n_steps, int max)\n{\n\tint index;\n\t\n\tif (op == Py_None) {\n\t\t*n_steps = PseudoIndex;\n\t\tindex = 0;\n\t} else if (op == Py_Ellipsis) {\n\t\t*n_steps = RubberIndex;\n\t\tindex = 0;\n\t} else if (PySlice_Check(op)) {\n\t\tint stop;\n\t\tif (slice_GetIndices((PySliceObject *)op, max,\n\t\t\t\t &index, &stop, step_size, n_steps) < 0) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"invalid slice\");\n\t\t\t}\n\t\t\tgoto fail;\n\t\t}\n\t\tif (*n_steps <= 0) {\n\t\t\t*n_steps = 0;\n\t\t\t*step_size = 1;\n\t\t\tindex = 0;\n\t\t}\n\t} else {\n\t\tindex = PyArray_PyIntAsInt(op);\n\t\tif (error_converting(index)) {\n\t\t\tPyErr_SetString(PyExc_IndexError,\n\t\t\t\t\t\"each subindex must be either a \"\\\n\t\t\t\t\t\"slice, an integer, Ellipsis, or \"\\\n\t\t\t\t\t\"newaxis\");\n\t\t\tgoto fail;\n\t\t}\n\t\t*n_steps = SingleIndex;\n\t\t*step_size = 0;\n\t\tif (index < 0) index += max;\n\t\tif (index >= max || index < 0) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \"invalid index\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn index;\n fail:\n\treturn -1;\n}\n\n\nstatic int \nparse_index(PyArrayObject *self, PyObject *op, \n intp *dimensions, intp *strides, intp *offset_ptr)\n{\n int i, j, n;\n int nd_old, nd_new, start, offset, n_add, n_pseudo;\n int step_size;\n\tintp n_steps;\n PyObject *op1=NULL;\n int is_slice;\n\n\n if (PySlice_Check(op) || op == Py_Ellipsis || op == Py_None) {\n n = 1;\n op1 = op;\n Py_INCREF(op);\t\n /* this relies on the fact that n==1 for loop below */\n is_slice = 1;\n }\n else {\n if (!PySequence_Check(op)) {\n PyErr_SetString(PyExc_IndexError, \n \"index must be either an int \"\\\n \"or a sequence\");\n return -1;\n }\n n = PySequence_Length(op);\n is_slice = 0;\n }\n\t\n nd_old = nd_new = 0;\n\t\n offset = 0;\n for(i=0; ind ? \\\n self->dimensions[nd_old] : 0);\n Py_DECREF(op1);\n if (start == -1) break;\n\t\t\n if (n_steps == PseudoIndex) {\n dimensions[nd_new] = 1; strides[nd_new] = 0; nd_new++;\n } else {\n if (n_steps == RubberIndex) {\n for(j=i+1, n_pseudo=0; jnd-(n-i-n_pseudo-1+nd_old);\n if (n_add < 0) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = \\\n self->strides[nd_old];\n nd_new++; nd_old++;\n }\n } else {\n if (nd_old >= self->nd) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n offset += self->strides[nd_old]*start;\n nd_old++;\n if (n_steps != SingleIndex) {\n dimensions[nd_new] = n_steps;\n strides[nd_new] = step_size * \\\n self->strides[nd_old-1];\n nd_new++;\n }\n }\n }\n }\n if (i < n) return -1;\n n_add = self->nd-nd_old;\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = self->strides[nd_old];\n nd_new++; nd_old++;\n }\t \n *offset_ptr = offset;\n return nd_new;\n}\n\nstatic void\n_swap_axes(PyArrayMapIterObject *mit, PyArrayObject **ret)\n{\n\tPyObject *new, *tup;\n\tint n1, n2, n3, val;\n\tint i;\n\n\ttup = PyTuple_New(mit->nd);\n\t/* tuple for transpose is \n\t (n1,..,n1+n2-1,0,..,n1-1,n1+n2,...,n3-1)\n\t n1 is the number of dimensions of \n\t the broadcasted index array \n\t n2 is the number of dimensions skipped at the\n\t start\n\t n3 is the number of dimensions of the \n\t result \n\t*/\n\tn1 = mit->iters[0]->nd_m1 + 1;\n\tn2 = mit->iteraxes[0];\n\tn3 = mit->nd;\n\tval = n1;\n\ti = 0;\n\twhile(val < n1+n2) \n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = 0;\n\twhile(val < n1)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = n1+n2;\n\twhile(val < n3)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\n\tnew = PyArray_Transpose(*ret, tup);\n\tPy_DECREF(tup);\n\tPy_DECREF(*ret);\n\t*ret = (PyArrayObject *)new;\n}\n\n\n\nstatic PyObject *\nPyArray_GetMap(PyArrayMapIterObject *mit)\n{\n\n\tPyArrayObject *ret, *temp;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\t/* Unbound map iterator --- Bind should have been called */\n\tif (mit->ait == NULL) return NULL;\n\n\t/* This relies on the map iterator object telling us the shape\n\t of the new array in nd and dimensions.\n\t*/\n\ttemp = mit->ait->ao;\n\tret = (PyArrayObject *)\\\n\t\tPyArray_New(temp->ob_type, mit->nd, mit->dimensions, \n\t\t\t temp->descr->type_num, NULL, NULL, \n\t\t\t temp->itemsize, \n\t\t\t PyArray_ISFORTRAN(temp),\n\t\t\t (PyObject *)temp);\n\tif (ret == NULL) return NULL;\n\n\t/* Now just iterate through the new array filling it in\n\t with the next object from the original array as\n\t defined by the mapping iterator */\n\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ret)) \n\t == NULL) \n\t\treturn NULL;\n\tindex = it->size;\n\tswap = ((temp->flags & NOTSWAPPED) != (ret->flags & NOTSWAPPED));\n copyswap = ret->descr->copyswap;\n\tPyArray_MapIterReset(mit);\n\twhile (index--) {\n copyswap(it->dataptr, mit->dataptr, swap, ret->itemsize);\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\t\n\t/* check for consecutive axes */\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, &ret);\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\nstatic int\nPyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)\n{\n\tPyObject *arr=NULL;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n\tPyArray_Typecode typecode = {0, 0, 0};\n PyArray_CopySwapFunc *copyswap;\n\n\t/* Unbound Map Iterator */\n\tif (mit->ait == NULL) return -1;\n\n\ttypecode.type_num = mit->ait->ao->descr->type_num;\n\ttypecode.itemsize = mit->ait->ao->itemsize;\n\n\tarr = PyArray_FromAny(op, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, (PyArrayObject **)&arr);\n\t\t}\n\t}\n\t\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) \n\t\treturn -1;\n\n\tindex = mit->size;\n\tswap = ((mit->ait->ao->flags & NOTSWAPPED) != \\\n\t\t(PyArray_FLAGS(arr) & NOTSWAPPED));\n\n copyswap = PyArray_DESCR(arr)->copyswap;\n\tPyArray_MapIterReset(mit);\n /* Need to decref OBJECT arrays */\n if (PyTypeNum_ISOBJECT(typecode.type_num)) {\n while (index--) {\n Py_XDECREF(*((PyObject **)mit->dataptr));\n Py_INCREF(*((PyObject **)it->dataptr));\n memmove(mit->dataptr, it->dataptr, sizeof(PyObject *));\n copyswap(mit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_MapIterNext(mit);\n PyArray_ITER_NEXT(it);\n if (it->index == it->size)\n PyArray_ITER_RESET(it);\n }\n return 0;\n }\n\n\twhile(index--) {\n\t\tmemmove(mit->dataptr, it->dataptr, PyArray_ITEMSIZE(arr));\n copyswap(mit->dataptr, NULL, swap, PyArray_ITEMSIZE(arr));\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t\tif (it->index == it->size)\n\t\t\tPyArray_ITER_RESET(it);\n\t}\t\t\n\treturn 0;\n}\n\n/* Called when treating array object like a mapping -- called first from \n Python when using a[object] unless object is a standard slice object\n (not an extended one). \n\n*/\n\n/* There are two situations: \n\n 1 - the subscript is a standard view and a reference to the \n array can be returned\n\n 2 - the subscript uses Boolean masks or integer indexing and\n therefore a new array is created and returned. \n\n*/\n\n/* Always returns 0-dimensional arrays */\n\nstatic PyObject *\narray_subscript(PyArrayObject *self, PyObject *op) \n{\n intp dimensions[MAX_DIMS], strides[MAX_DIMS];\n\tintp offset;\n int nd, i;\n PyArrayObject *other;\n\tPyArrayMapIterObject *mit;\n\n if (PyArray_IsScalar(op, Integer) || PyInt_Check(op) || \\\n PyLong_Check(op)) {\n intp value;\n value = PyArray_PyIntAsIntp(op);\n if (PyErr_Occurred())\n PyErr_Clear();\n else if (value >= 0) {\n if (value <= MAX_INT)\n return array_item(self, (int) value);\n }\n else if (value < 0) {\n if (value >= -MAX_INT) {\n if (self->nd > 0) value += self->dimensions[0];\n return array_item(self, (int) value);\n }\n }\n }\n\n\tif (PyArrayMapIter_Check(op)) {\n\t\tmit = (PyArrayMapIterObject *)op;\n\t\t/* bind to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\n\t\t/* If the mapiterator was created with standard indexing\n\t\t behavior, fall through to view-based code */\n\t\tif (!mit->view) return PyArray_GetMap(mit);\n\t\top = mit->indexobj;\n\t}\n\telse { /* wrap arguments into a mapiter object */\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(op);\n\t\tif (mit == NULL) return NULL;\n\t\tif (!mit->view) { /* fancy indexing */\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tother = (PyArrayObject *)PyArray_GetMap(mit);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn (PyObject *)other;\n\t\t}\n\t\tPy_DECREF(mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(op);\n\tif (!error_converting(i)) {\n\t\tif (i < 0 && self->nd > 0) i = i+self->dimensions[0];\n\t\treturn array_item(self, i);\n\t}\n\tPyErr_Clear();\n\n\t/* Standard (view-based) Indexing */\n if ((nd = parse_index(self, op, dimensions, strides, &offset)) \n == -1) \n return NULL;\n\n\t/* This will only work if new array will be a view */\n\tif ((other = (PyArrayObject *)\t\t\t\t\t\\\n\t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n\t\t\t strides, self->data+offset, \n\t\t\t self->itemsize, self->flags,\n\t\t\t (PyObject *)self)) == NULL) \n\t\treturn NULL;\n\n\n\tother->base = (PyObject *)self;\n\tPy_INCREF(self);\n\t\n\tPyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);\n\t\n\treturn (PyObject *)other;\n}\n\n\n/* Another assignment hacked by using CopyObject. */\n\n/* This only works if subscript returns a standard view. */\n\n/* Again there are two cases. In the first case, PyArray_CopyObject\n can be used. In the second case, a new indexing function has to be \n used.\n*/\n\nstatic int \narray_ass_sub(PyArrayObject *self, PyObject *index, PyObject *op) \n{\n int ret, i;\n PyArrayObject *tmp;\n\tPyArrayMapIterObject *mit;\n\t\n if (op == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n\tif (PyArrayMapIter_Check(index)) {\n\t\tmit = (PyArrayMapIterObject *)index;\n\t\t/* bind behavior to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\t\n\t\t/* fall through if standard view-based map iterator */\n\t\tif (!mit->view) return PyArray_SetMap(mit, op);\n\t\tindex = mit->indexobj;\n\t}\n\telse {\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(index);\n\t\tif (mit == NULL) return -1;\n\t\tif (!mit->view) {\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tret = PyArray_SetMap(mit, op);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn ret;\n\t\t}\n\t\tPy_DECREF((PyObject*)mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(index);\n\tif (!error_converting(i)) {\n\t\treturn array_ass_item(self, i, op);\n\t}\n\tPyErr_Clear();\n\t\n\t/* Rest of standard (view-based) indexing */\n\n if ((tmp = (PyArrayObject *)array_subscript(self, index)) == NULL)\n return -1; \n ret = PyArray_CopyObject(tmp, op);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\n/* There are places that require that array_subscript return a PyArrayObject\n and not possibly a scalar. Thus, this is the function exposed to \n Python so that 0-dim arrays are passed as scalars\n*/\n\nstatic PyObject *\narray_subscript_nice(PyArrayObject *self, PyObject *op) \n{\n\treturn PyArray_Return((PyArrayObject *)array_subscript(self, op));\n}\n\n\nstatic PyMappingMethods array_as_mapping = {\n (inquiry)array_length,\t\t /*mp_length*/\n (binaryfunc)array_subscript_nice,\t/*mp_subscript*/\n (objobjargproc)array_ass_sub,\t /*mp_ass_subscript*/\n};\n\n/****************** End of Mapping Protocol ******************************/\n\n\n/*************************************************************************\n **************** Implement Buffer Protocol ****************************\n *************************************************************************/\n\n/* removed multiple segment interface */\n\nstatic int \narray_getsegcount(PyArrayObject *self, int *lenp) \n{\n if (lenp)\n *lenp = PyArray_NBYTES(self);\n\n if (PyArray_ISONESEGMENT(self)) {\n return 1;\n }\n\n if (lenp)\n *lenp = 0;\n return 0;\n}\n\nstatic int \narray_getreadbuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (segment != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Accessing non-existing array segment\");\n return -1;\n }\n \n if (PyArray_ISONESEGMENT(self)) {\n *ptrptr = self->data;\n return PyArray_NBYTES(self);\n }\n PyErr_SetString(PyExc_ValueError, \"Array is not a single segment\");\n *ptrptr = NULL;\n return -1;\n}\n\n\nstatic int \narray_getwritebuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (PyArray_CHKFLAGS(self, WRITEABLE)) \n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_ValueError, \"Array cannot be \"\\\n \"accessed as a writeable buffer.\");\n return -1;\n }\n}\n\nstatic int \narray_getcharbuf(PyArrayObject *self, int segment, const char **ptrptr) \n{\n if (self->descr->type_num == PyArray_STRING || \\\n\t self->descr->type_num == PyArray_UNICODE)\n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_TypeError, \n \"Non-character array cannot be interpreted \"\\\n \"as character buffer.\");\n return -1;\n }\n}\n\nstatic PyBufferProcs array_as_buffer = {\n (getreadbufferproc)array_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)array_getwritebuf, /*bf_getwritebuffer*/\n (getsegcountproc)array_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)array_getcharbuf, /*bf_getcharbuffer*/\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Number Protocol ****************************\n *************************************************************************/\n\n\ntypedef struct {\n PyObject *add,\n *subtract,\n *multiply,\n *divide,\n *remainder,\n *power,\n\t\t*sqrt,\n *negative,\n *absolute,\n *invert,\n *left_shift,\n *right_shift,\n *bitwise_and,\n *bitwise_xor,\n *bitwise_or,\n *less,\n *less_equal,\n *equal,\n *not_equal,\n *greater,\n *greater_equal,\n *floor_divide,\n *TRUE_divide,\n\t\t*logical_or,\n\t\t*logical_and,\n\t\t*floor,\n\t\t*ceil,\n\t\t*maximum,\n\t\t*minimum;\t\n\t\n} NumericOps;\n\nstatic NumericOps n_ops = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL};\n\n/* Dictionary can contain any of the numeric operations, by name. \n Those not present will not be changed\n */\n\n#define SET(op) temp=PyDict_GetItemString(dict, #op);\t\\\n\tif (temp != NULL) {\t\t\t\t\\\n\t\tif (!(PyCallable_Check(temp))) return -1; \\\n Py_XDECREF(n_ops.op); \\\n\t\tn_ops.op = temp; \\\n\t}\n\n \nint \nPyArray_SetNumericOps(PyObject *dict) \n{\n PyObject *temp = NULL;\n SET(add);\n SET(subtract);\n SET(multiply);\n SET(divide);\n SET(remainder);\n SET(power);\n\tSET(sqrt);\n SET(negative);\n SET(absolute);\n SET(invert);\n SET(left_shift);\n SET(right_shift);\n SET(bitwise_and);\n SET(bitwise_or);\n SET(bitwise_xor);\n SET(less);\t \n SET(less_equal);\n SET(equal);\n SET(not_equal);\n SET(greater);\n SET(greater_equal);\n SET(floor_divide);\t\n SET(TRUE_divide);\t\n\tSET(logical_or);\n\tSET(logical_and);\n\tSET(floor);\n\tSET(ceil);\n\tSET(maximum);\n\tSET(minimum);\n return 0;\n}\n\n#define GET(op) if (PyDict_SetItemString(dict, #op, n_ops.op)==-1) \\\n\t\tgoto fail;\n\nstatic PyObject *\nPyArray_GetNumericOps(void) \n{\n\tPyObject *dict;\n\tif ((dict = PyDict_New())==NULL) \n\t\treturn NULL;\t\n\tGET(add);\n GET(subtract);\n GET(multiply);\n GET(divide);\n GET(remainder);\n GET(power);\n\tGET(sqrt);\n GET(negative);\n GET(absolute);\n GET(invert);\n GET(left_shift);\n GET(right_shift);\n GET(bitwise_and);\n GET(bitwise_or);\n GET(bitwise_xor);\n GET(less);\t \n GET(less_equal);\n GET(equal);\n GET(not_equal);\n GET(greater);\n GET(greater_equal);\n GET(floor_divide); \n GET(TRUE_divide); \n\tGET(logical_or);\n\tGET(logical_and);\n\tGET(floor);\n\tGET(ceil);\n\tGET(maximum);\n\tGET(minimum);\n\treturn dict;\t\n\n fail:\n\tPy_DECREF(dict);\n\treturn NULL;\t\t\n}\n\nstatic PyObject *\nPyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"reduce\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"accumulate\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OO)\", m1, m2);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(O)\", m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericInplaceBinaryFunction(PyArrayObject *m1, \n\t\t\t\t PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OOO)\", m1, m2, m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\narray_add(PyArrayObject *m1, PyObject *m2) \n{ \n return PyArray_GenericBinaryFunction(m1, m2, n_ops.add); \n}\n\nstatic PyObject *\narray_subtract(PyArrayObject *m1, PyObject *m2) \n{\n\treturn PyArray_GenericBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_negative(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.negative);\n}\n\nstatic PyObject *\narray_absolute(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.absolute);\n}\n\nstatic PyObject *\narray_invert(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.invert);\n}\n\nstatic PyObject *\narray_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_inplace_add(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.add);\n}\n\nstatic PyObject *\narray_inplace_subtract(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_inplace_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_inplace_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_inplace_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_inplace_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_inplace_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_inplace_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_inplace_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_inplace_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_inplace_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.TRUE_divide);\n}\n\nstatic PyObject *\narray_inplace_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_inplace_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.TRUE_divide);\n}\n\n/* Array evaluates as \"TRUE\" if any of the elements are non-zero */\nstatic int \narray_all_nonzero(PyArrayObject *mp) \n{\n\tintp index;\n\tPyArrayIterObject *it;\n\tBool anyTRUE = 0;\n\t\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)mp);\n\tif (it==NULL) return anyTRUE;\n\tindex = it->size;\n\twhile(index--) {\n\t\tif (mp->descr->nonzero(it->dataptr, mp)) {\n\t\t\tanyTRUE = 1;\n\t\t\tbreak;\n\t\t}\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\treturn anyTRUE;\n}\n\nstatic PyObject *\narray_divmod(PyArrayObject *op1, PyObject *op2) \n{\n PyObject *divp, *modp, *result;\n\n divp = array_divide(op1, op2);\n if (divp == NULL) return NULL;\n modp = array_remainder(op1, op2);\n if (modp == NULL) {\n Py_DECREF(divp);\n return NULL;\n }\n result = Py_BuildValue(\"OO\", divp, modp);\n Py_DECREF(divp);\n Py_DECREF(modp);\n return result;\n}\n\n\nstatic PyObject *\narray_int(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can be\"\\\n\t\t\t\t\" converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_int == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to int\");\n Py_DECREF(pv);\n return NULL;\n }\n\n pv2 = pv->ob_type->tp_as_number->nb_int(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_float(PyArrayObject *v) \n{\n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an \"\\\n\t\t\t\t\"int, scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_float == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to float\");\n Py_DECREF(pv);\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_float(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_long(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_long == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to long\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_long(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_oct(PyArrayObject *v) \n{\t \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_oct == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to oct\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_oct(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_hex(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_hex == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to hex\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_hex(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\n_array_copy_nice(PyArrayObject *self)\n{\n\treturn PyArray_Return((PyArrayObject *)\t\t\\\n\t\t\t PyArray_Copy(self));\n}\n\nstatic PyNumberMethods array_as_number = {\n (binaryfunc)array_add,\t\t /*nb_add*/\n (binaryfunc)array_subtract,\t\t /*nb_subtract*/\n (binaryfunc)array_multiply,\t\t /*nb_multiply*/\n (binaryfunc)array_divide,\t\t /*nb_divide*/\n (binaryfunc)array_remainder,\t /*nb_remainder*/\n (binaryfunc)array_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)array_power,\t\t /*nb_power*/\n (unaryfunc)array_negative, /*nb_neg*/\t\n (unaryfunc)_array_copy_nice,\t\t /*nb_pos*/ \n (unaryfunc)array_absolute,\t\t /*(unaryfunc)array_abs,*/\n (inquiry)array_all_nonzero,\t\t /*nb_nonzero*/\n (unaryfunc)array_invert,\t\t /*nb_invert*/\n (binaryfunc)array_left_shift,\t /*nb_lshift*/\n (binaryfunc)array_right_shift,\t /*nb_rshift*/\n (binaryfunc)array_bitwise_and,\t /*nb_and*/\n (binaryfunc)array_bitwise_xor,\t /*nb_xor*/\n (binaryfunc)array_bitwise_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)array_int,\t\t /*nb_int*/\n (unaryfunc)array_long,\t\t /*nb_long*/\n (unaryfunc)array_float,\t\t /*nb_float*/\n (unaryfunc)array_oct,\t\t /*nb_oct*/\n (unaryfunc)array_hex,\t\t /*nb_hex*/\n\n /*This code adds augmented assignment functionality*/\n /*that was made available in Python 2.0*/\n (binaryfunc)array_inplace_add,\t /*inplace_add*/\n (binaryfunc)array_inplace_subtract,\t /*inplace_subtract*/\n (binaryfunc)array_inplace_multiply,\t /*inplace_multiply*/\n (binaryfunc)array_inplace_divide,\t /*inplace_divide*/\n (binaryfunc)array_inplace_remainder, /*inplace_remainder*/\n (ternaryfunc)array_inplace_power,\t /*inplace_power*/\n (binaryfunc)array_inplace_left_shift, /*inplace_lshift*/\n (binaryfunc)array_inplace_right_shift, /*inplace_rshift*/\n (binaryfunc)array_inplace_bitwise_and, /*inplace_and*/\n (binaryfunc)array_inplace_bitwise_xor, /*inplace_xor*/\n (binaryfunc)array_inplace_bitwise_or, /*inplace_or*/\n\n (binaryfunc)array_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)array_TRUE_divide,\t /*nb_TRUE_divide*/\n (binaryfunc)array_inplace_floor_divide, /*nb_inplace_floor_divide*/\n (binaryfunc)array_inplace_TRUE_divide, /*nb_inplace_TRUE_divide*/\n\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Sequence Protocol **************************\n *************************************************************************/\n\n/* Some of this is repeated in the array_as_mapping protocol. But\n we fill it in here so that PySequence_XXXX calls work as expected \n*/\n\n\nstatic PyObject * \narray_slice(PyArrayObject *self, int ilow, int ihigh) \n{\n PyArrayObject *r;\n int l;\n char *data;\n\n if (self->nd == 0) {\n PyErr_SetString(PyExc_ValueError, \"can't slice a scalar\");\n return NULL;\n }\n \t\n l=self->dimensions[0];\n if (ihigh < 0) ihigh += l;\n if (ilow < 0) ilow += l;\n if (ilow < 0) ilow = 0;\n else if (ilow > l) ilow = l;\n if (ihigh < 0) ihigh = 0;\n else if (ihigh > l) ihigh = l;\n if (ihigh < ilow) ihigh = ilow;\n\n if (ihigh != ilow) {\n data = index2ptr(self, ilow);\n if (data == NULL) return NULL;\n } else {\n data = self->data;\n }\n\n self->dimensions[0] = ihigh-ilow;\n r = (PyArrayObject *)\\\n\t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n\t\t\t self->descr->type_num, self->strides, data,\n\t\t\t self->itemsize, self->flags, (PyObject *)self);\n\n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n Py_INCREF(self);\n\tPyArray_UpdateFlags(r, UPDATE_ALL_FLAGS); \n return (PyObject *)r;\n}\n\n\nstatic int \narray_ass_slice(PyArrayObject *self, int ilow, int ihigh, PyObject *v) {\n int ret;\n PyArrayObject *tmp;\n\t\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n if ((tmp = (PyArrayObject *)array_slice(self, ilow, ihigh)) \\\n == NULL) \n return -1; \n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\nstatic int\narray_contains(PyArrayObject *self, PyObject *el)\n{\n /* equivalent to any(self == el) */\n\n return PyObject_RichCompareBool((PyObject *)self, el, Py_EQ);\n}\n\n\nstatic PySequenceMethods array_as_sequence = {\n (inquiry)array_length,\t\t/*sq_length*/\n (binaryfunc)NULL, /* sq_concat is handled by nb_add*/\n (intargfunc)NULL, /* sq_repeat is handled nb_multiply*/\n (intargfunc)array_item_nice,\t\t/*sq_item*/\n (intintargfunc)array_slice,\t\t/*sq_slice*/\n (intobjargproc)array_ass_item,\t/*sq_ass_item*/\n (intintobjargproc)array_ass_slice,\t/*sq_ass_slice*/\n\t(objobjproc) array_contains, /* sq_contains */\n\t(binaryfunc) NULL, /* sg_inplace_concat */\n\t(intargfunc) NULL /* sg_inplace_repeat */\n};\n\n\n/****************** End of Sequence Protocol ****************************/\n\n\nstatic int \ndump_data(char **string, int *n, int *max_n, char *data, int nd, \n intp *dimensions, intp *strides, PyArrayObject* self) \n{\n PyArray_Descr *descr=self->descr;\n PyObject *op, *sp;\n char *ostring;\n int i, N;\n\t\n#define CHECK_MEMORY if (*n >= *max_n-16) { *max_n *= 2; \\\n\t\t*string = (char *)realloc(*string, *max_n); }\n\t\n if (nd == 0) {\n\t\t\n if ((op = descr->getitem(data, self)) == NULL) return -1;\n sp = PyObject_Repr(op);\n if (sp == NULL) {Py_DECREF(op); return -1;}\n ostring = PyString_AsString(sp);\n N = PyString_Size(sp)*sizeof(char);\n *n += N;\n CHECK_MEMORY\n memmove(*string+(*n-N), ostring, N);\n Py_DECREF(sp);\n Py_DECREF(op);\n return 0;\n } else {\n CHECK_MEMORY\n (*string)[*n] = '[';\n *n += 1;\n for(i=0; idata, \n\t\t self->nd, self->dimensions, \n self->strides, self) < 0) { \n\t\tfree(string); return NULL; \n\t}\n\t\n\tif (PyArray_ISFLEXIBLE(self)) {\n\t\tchar buf[100];\n\t\tsnprintf(buf, sizeof(buf), \"%d\", self->itemsize);\n\t\tsprintf(string+n, \", '%c%s')\", self->descr->type, buf);\n\t\tret = PyString_FromStringAndSize(string, n+6+strlen(buf));\n\t}\n\telse {\n\t\tsprintf(string+n, \", '%c')\", self->descr->type);\n\t\tret = PyString_FromStringAndSize(string, n+6);\n\t}\n\t\n\n free(string);\n return ret;\n}\n\nstatic PyObject *PyArray_StrFunction=NULL;\nstatic PyObject *PyArray_ReprFunction=NULL;\n\nstatic void \nPyArray_SetStringFunction(PyObject *op, int repr) \n{\n if (repr) {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_ReprFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_ReprFunction = op; \n } else {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_StrFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_StrFunction = op; \n }\n}\n\nstatic PyObject *\narray_repr(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_ReprFunction == NULL) {\n s = array_repr_builtin(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_ReprFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\nstatic PyObject *\narray_str(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_StrFunction == NULL) {\n s = array_repr(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_StrFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\n\nstatic PyObject *\narray_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) \n{\n PyObject *array_other, *result;\n\n switch (cmp_op) \n {\n case Py_LT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less);\n case Py_LE:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less_equal);\n case Py_EQ:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then return the integer\n\t\t\t object 0. This fixes code that used to\n\t\t\t allow equality comparisons between arrays\n\t\t\t and other objects which would give a result\n\t\t\t of 0\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.equal);\n /* If the comparison results in NULL, then the \n\t\t\t two array objects can not be compared together so \n\t\t\t return zero \n */\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n return result;\n case Py_NE:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then objects cannot be \n\t\t\t compared and cannot be equal, therefore, \n\t\t\t return True;\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.not_equal);\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n return result;\n case Py_GT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.greater);\n case Py_GE:\n return PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t other, \n\t\t\t\t\t \t n_ops.greater_equal);\n }\n return NULL;\n}\n\nstatic PyObject *\n_check_axis(PyArrayObject *arr, int *axis, int flags)\n{\n\tPyObject *temp;\n\tint n = arr->nd;\n\n\tif ((*axis >= MAX_DIMS) || (n==0)) {\n\t\ttemp = PyArray_Ravel(arr,0);\n\t\t*axis = 0;\n\t\treturn temp;\n\t}\n\telse {\n\t\tif (flags) {\n\t\t\ttemp = PyArray_FromAny((PyObject *)arr, NULL, \n\t\t\t\t\t 0, 0, flags);\n\t\t\tif (temp == NULL) return NULL;\n\t\t}\n\t\telse {\n\t\t\tPy_INCREF(arr);\n\t\t\ttemp = (PyObject *)arr;\n\t\t}\n\t}\n\tif (*axis < 0) *axis += n;\n\tif ((*axis < 0) || (*axis >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"axis(=%d) out of bounds\", *axis);\n\t\tPy_DECREF(temp);\n\t\treturn NULL;\n\t}\n\treturn temp;\n}\n\n#include \"arraymethods.c\"\n\n/* Lifted from numarray */\nstatic PyObject *\nPyArray_IntTupleFromIntp(int len, intp *vals)\n{\n\tint i;\n PyObject *intTuple = PyTuple_New(len);\n if (!intTuple) goto fail;\n for(i=0; ind == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i = ap->nd-1; i >= 0; --i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int \n_IsFortranContiguous(PyArrayObject *ap) \n{\n\tint sd;\n\tint i;\n\t\n\tif (ap->nd == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i=0; i< ap->nd; ++i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int\n_IsAligned(PyArrayObject *ap) \n{\n\tint i, alignment, aligned=1;\n\tintp ptr;\n\tint type = ap->descr->type_num;\n\n\tif ((type == PyArray_STRING) || (type == PyArray_VOID))\n\t\treturn 1;\n\n\talignment = ap->descr->alignment;\n\n\tptr = (intp) ap->data;\n aligned = (ptr % alignment) == 0;\n for (i=0; i nd; i++)\n aligned &= ((ap->strides[i] % alignment) == 0);\n return aligned != 0;\n}\n\nstatic Bool\n_IsWriteable(PyArrayObject *ap)\n{\n\tPyObject *base=ap->base;\n\tPyBufferProcs *pb;\n\n\t/* If we own our own data, then no-problem */\n\tif ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;\n\n\t/* Get to the final base object \n\t If it is a writeable array, then return TRUE\n\t If we can find an array object \n\t or a writeable buffer object as the final base object\n\t or a string object (for pickling support memory savings).\n\t - this last could be removed if a proper pickleable \n\t buffer was added to Python.\n\t*/\n\n\twhile(PyArray_Check(base)) {\n\t\tif (PyArray_CHKFLAGS(base, OWN_DATA)) \n\t\t\treturn (Bool) (PyArray_ISWRITEABLE(base));\n\t\tbase = PyArray_BASE(base);\n\t}\n\n\t/* here so pickle support works seamlessly \n\t and unpickled array can be set and reset writeable \n\t -- could be abused -- */\n\tif PyString_Check(base) return TRUE;\n\n\tpb = base->ob_type->tp_as_buffer;\n\tif (pb == NULL || pb->bf_getwritebuffer == NULL)\n\t\treturn FALSE;\n\t\n\treturn TRUE;\n}\n\n\nstatic void\nPyArray_UpdateFlags(PyArrayObject *ret, int flagmask)\n{\n\n\tif (flagmask & FORTRAN) {\n\t\tif (_IsFortranContiguous(ret)) {\n\t\t\tret->flags |= FORTRAN;\n\t\t\tif (ret->nd > 1) ret->flags &= ~CONTIGUOUS;\n\t\t}\n\t\telse ret->flags &= ~FORTRAN;\n\t}\n\tif (flagmask & CONTIGUOUS) {\n\t\tif (_IsContiguous(ret)) {\n\t\t\tret->flags |= CONTIGUOUS;\n\t\t\tif (ret->nd > 1) ret->flags &= ~FORTRAN;\n\t\t}\n\t\telse ret->flags &= ~CONTIGUOUS;\n\t}\n\tif (flagmask & ALIGNED) {\n\t\tif (_IsAligned(ret)) ret->flags |= ALIGNED;\n\t\telse ret->flags &= ~ALIGNED;\n\t}\n\treturn;\n}\n\n/* This routine checks to see if newstrides (of length nd) will not \n walk outside of the memory implied by either numbytes or\n a single segment array of the provided dimensions and element size if\n numbytes is 0 */\nstatic Bool\nPyArray_CheckStrides(int elsize, int nd, intp numbytes, \n\t\t intp *dims, intp *newstrides)\n{\n\tint i;\n\t\n\tif (numbytes == 0) \n\t\tnumbytes = PyArray_MultiplyList(dims, nd) * elsize;\n\t\n\tfor (i=0; i numbytes) {\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\treturn TRUE;\n\t\n}\n\n\n/* This is the main array creation routine. */\n\n/* Flags argument has multiple related meanings \n depending on data and strides: \n\n If data is given, then flags is flags associated with data. \n If strides is not given, then a contiguous strides array will be created\n and the CONTIGUOUS bit will be set. If the flags argument \n has the FORTRAN bit set, then a FORTRAN-style strides array will be\n created (and of course the FORTRAN flag bit will be set). \n\n If data is not given but created here, then flags will be DEFAULT_FLAGS\n and a non-zero flags argument can be used to indicate a FORTRAN style\n array is desired. \n*/\n\nstatic intp\n_array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize, \n\t\t int inflag, int *objflags) \n{\n\tint i;\n\t/* Only make Fortran strides if not contiguous as well */\n\tif ((inflag & FORTRAN) && !(inflag & CONTIGUOUS)) {\n\t\tfor (i=0; i 1) *objflags &= ~CONTIGUOUS;\n\t\telse *objflags |= CONTIGUOUS;\n\t}\n\telse {\n\t\tfor (i=nd-1;i>=0;i--) {\n\t\t\tstrides[i] = itemsize;\n\t\t\titemsize *= dims[i] ? dims[i] : 1;\n\t\t}\n\t\t*objflags |= CONTIGUOUS;\n\t\tif (nd > 1) *objflags &= ~FORTRAN;\n\t\telse *objflags |= FORTRAN;\n\t}\n\treturn itemsize;\n}\n\n\t\nstatic PyObject *\nPyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n\t PyObject *obj)\n{\n\tPyArrayObject *self;\n\tPyArray_Descr *descr;\n\tregister int i;\n\tintp sd, temp;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\tif (descr == NULL) return NULL;\n\n\tif (nd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"number of dimensions must be >=0\");\n\t\treturn NULL;\n\t}\n if (nd > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError,\n \"maximum number of dimensions is %d\", MAX_DIMS);\n return NULL;\n\t}\n\n\t/* Check dimensions */\n\tfor (i=nd-1;i>=0;i--) {\n\t\tif (dims[i] < 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"negative dimensions\"\t\\\n\t\t\t\t\t\" are not allowed.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tself = (PyArrayObject *) subtype->tp_alloc(subtype, 0);\n\tif (self == NULL) return NULL;\t\n\tself->descr = descr;\n\tself->dimensions = NULL;\n\tif (data == NULL) { /* strides is NULL too */\n\t\tself->flags = DEFAULT_FLAGS;\n\t\tif (flags) {\n\t\t\tself->flags |= FORTRAN; \n\t\t\tif (nd > 1) self->flags &= ~CONTIGUOUS;\n\t\t\tflags = FORTRAN;\n\t\t}\n\t}\n\telse self->flags = (flags & ~UPDATEIFCOPY);\n\t\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tif (itemsize < 1) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"Type must provide an itemsize.\");\n\t\t\tPyObject_Del(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tself->itemsize = itemsize;\n\t\t/* Guarantee that these kind of arrays are never byteswapped\n\t\t unknowingly. \n\t\t*/\n\t\tif (type_num != PyArray_UNICODE)\n\t\t\tself->flags |= NOTSWAPPED;\n\t}\n\telse self->itemsize = descr->elsize; \n\t\t\n\tsd = self->itemsize;\n\t\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dims, sizeof(intp)*nd);\n\t\tif (strides == NULL) { /* fill it in */\n\t\t\tsd = _array_fill_strides(self->strides, dims, nd, sd,\n\t\t\t\t\t\t flags, &(self->flags));\n\t\t}\n\t\telse {\n\t\t\tif (data == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"If strides is given in \" \\\n\t\t\t\t\t\t\"array creation, data must \" \\\n\t\t\t\t\t\t\"be given too.\");\n\t\t\t\tPyObject_Del(self);\n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\t\treturn NULL;\n\t\t\t}\t\t\t\t\t\n\t\t\tmemcpy(self->strides, strides, sizeof(intp)*nd);\n\t\t}\n\t}\n \t\n\t\t\n\tif (data == NULL) {\n\n\t\t/* Make sure we are aligned on void ptrs (without wasting\n\t\t space if we already are). But, also, allocate something \n\t\t even for zero-space arrays e.g. shape=(0,) -- otherwise\n buffer exposure (a.data) doesn't work as it should. */\n\n\t\tif (sd==0) sd = sizeof(intp);\n\t\telse if ((temp=sd%sizeof(intp))) sd += sizeof(intp) - temp;\n\n\t\tif ((data = PyDataMem_NEW(sd))==NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\tif (self->dimensions != NULL) \n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\n\t\t/* It is bad to have unitialized OBJECT pointers */\n\t\t/* We shouldn't need to check for the OBJECT Letter\n\t\t but perhaps it's best. */\n\t\tif (type_num == PyArray_OBJECT || \\\n\t\t type_num == PyArray_OBJECTLTR) {\n\t\t\tmemset(data, 0, sd);\n\t\t}\n\t}\n\telse {\n self->flags &= ~OWN_DATA; /* If data is passed in, \n\t\t\t\t\t this object won't own it \n\t\t\t\t\t by default.\n\t\t\t\t\t Caller must arrange for \n\t\t\t\t\t this to be reset if truly\n\t\t\t\t\t desired */\n }\n self->data = data;\n\tself->nd = nd;\n\tself->base = (PyObject *)NULL;\n self->weakreflist = (PyObject *)NULL;\n\n /* call the __array_finalize__\n\t method if a subtype and some object passed in */\n\tif ((obj != NULL) && (subtype != &PyArray_Type) && \n\t (subtype != &PyBigArray_Type)) {\n\t\tPyObject *res;\n\t\tres = PyObject_CallMethod((PyObject *)self, \n\t\t\t\t\t \"__array_finalize__\",\n\t\t\t\t\t \"O\", obj);\n\t\tif (res == NULL) PyErr_Clear();\n\t\telse Py_DECREF(res);\n\t}\n\n\treturn (PyObject *)self;\n}\n\n\n\nstatic PyObject * \nPyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape)\n{\n intp oldsize, newsize;\n int new_nd=newshape->len, k, n, elsize;\n int refcnt;\n intp* new_dimensions=newshape->ptr;\n intp new_strides[MAX_DIMS];\n intp sd;\n intp *dimptr;\n char *new_data;\n\t\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n \"resize only works on contiguous arrays\");\n return NULL;\n }\n\n\n newsize = PyArray_MultiplyList(new_dimensions, new_nd);\n\n if (newsize == 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Newsize is zero. Cannot delete an array \"\\\n \"in this way.\");\n return NULL;\n }\n oldsize = PyArray_SIZE(self);\n \n\tif (oldsize != newsize) {\n\t\tif (!(self->flags & OWN_DATA)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize this array: \"\t\\\n\t\t\t\t\t\"it does not own its data.\");\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\trefcnt = (((PyObject *)self)->ob_refcnt);\n\t\tif ((refcnt > 2) || (self->base != NULL) || \\\n\t\t (self->weakreflist != NULL)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize an array that has \"\\\n\t\t\t\t\t\"been referenced or is referencing\\n\"\\\n\t\t\t\t\t\"another array in this way. Use the \"\\\n\t\t\t\t\t\"resize function.\");\n\t\t\treturn NULL;\n\t\t} \n\t\t\n\t\t/* Reallocate space if needed */\n\t\tnew_data = PyDataMem_RENEW(self->data, \n\t\t\t\t\t newsize*(self->itemsize));\n\t\tif (new_data == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n\t\t\t\t\t\"can't allocate memory for array.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tself->data = new_data;\n\t}\n \n if ((newsize > oldsize) && PyArray_ISWRITEABLE(self)) { \n\t\t/* Fill new memory with zeros */\n elsize = self->itemsize;\n\t\tif ((PyArray_TYPE(self) == PyArray_OBJECT)) {\n\t\t\tPyObject *zero = PyInt_FromLong(0);\n PyObject **optr;\n\t\t\toptr = ((PyObject **)self->data) + oldsize;\n\t\t\tn = newsize - oldsize;\n\t\t\tfor (k=0; kdata+oldsize*elsize, 0, \n\t\t\t (newsize-oldsize)*elsize);\n\t\t}\n\t}\n \n if (self->nd != new_nd) { /* Different number of dimensions. */\n self->nd = new_nd;\n \n /* Need new dimensions and strides arrays */\n dimptr = PyDimMem_RENEW(self->dimensions, 2*new_nd);\n if (dimptr == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n \"can't allocate memory for array \" \\\n \"(array may be corrupted).\");\n return NULL;\n }\n self->dimensions = dimptr;\n\t\tself->strides = dimptr + new_nd;\n }\n\n /* make new_strides variable */\n sd = (intp) self->itemsize;\n sd = _array_fill_strides(new_strides, new_dimensions, new_nd, sd,\n 0, &(self->flags));\n\n \n memmove(self->dimensions, new_dimensions, new_nd*sizeof(intp));\n memmove(self->strides, new_strides, new_nd*sizeof(intp));\n\n Py_INCREF(Py_None);\t\n return Py_None;\n \n}\n\n\nstatic void\nPyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj)\n{\n PyObject **optr;\n intp i,n;\n optr = (PyObject **)(arr->data);\n n = PyArray_SIZE(arr);\n if (obj == NULL) {\n for (i=0; ibase = buffer.base;\n Py_INCREF(buffer.base); \n }\n\n PyDimMem_FREE(dims.ptr);\n if (strides.ptr) PyDimMem_FREE(strides.ptr);\n return PyArray_Return(ret);\n \n fail:\n if (dims.ptr) free(dims.ptr);\n if (strides.ptr) free(strides.ptr);\n return NULL;\n}\n\n\n\n/******************* array attribute get and set routines ******************/\n\nstatic PyObject *\narray_ndim_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong(self->nd);\n}\n\nstatic PyObject *\narray_flags_get(PyArrayObject *self)\n{\n static PyObject *module=NULL;\n\n if (module==NULL) {\n module = PyImport_ImportModule(\"scipy.base._internal\");\n if (module == NULL) return NULL;\n }\n return PyObject_CallMethod(module, \"flagsobj\", \"Oi\", \n self, self->flags);\n}\n\n/*\nstatic int\narray_flags_set(PyArrayObject *self, PyObject *obj) \n{\n\tint flagback = self->flags;\n\n if (PyDict_Check(obj)) {\n PyObject *new;\n\t\tnew = PyDict_GetItemString(obj, \"ALIGNED\");\n\t\tif (new) {\n\t\t\tif (PyObject_Not(new)) self->flags &= ~ALIGNED;\n\t\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\t\telse {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"cannot set aligned flag of \" \\\n\t\t\t\t\t\t\"mis-aligned array to True\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n new = PyDict_GetItemString(obj, \"UPDATEIFCOPY\");\n if (new) {\n if (PyObject_Not(new)) {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n else {\n\t\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return -1;\n }\n }\n new = PyDict_GetItemString(obj, \"WRITEABLE\");\n if (new) {\n\t\t\tif (PyObject_IsTrue(new)) {\n\t\t\t\tif (_IsWriteable(self)) {\n\t\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself->flags = flagback;\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\t\"cannot set \"\t\\\n\t\t\t\t\t\t\t\"WRITEABLE \"\t\\\n\t\t\t\t\t\t\t\"flag to True of \"\\\n\t\t\t\t\t\t\t\"this array \");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n new = PyDict_GetItemString(obj, \"NOTSWAPPED\");\n if (new) {\n if (PyObject_IsTrue(new))\n self->flags |= NOTSWAPPED;\n else {\n self->flags &= ~NOTSWAPPED;\n\t\t\t}\n\t\t}\n return 0;\n }\n PyErr_SetString(PyExc_ValueError, \n \"Object must be a dictionary\");\n return -1;\n}\n*/\n\n\nstatic PyObject *\narray_shape_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->dimensions);\n}\n\n\nstatic int\narray_shape_set(PyArrayObject *self, PyObject *val)\n{\n \tint nd;\n\tPyObject *ret;\n\n\tif (!PyTuple_Check(val)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"shape must be a tuple\");\n\t\treturn -1;\n\t}\n\tret = PyArray_Reshape(self, val);\n\tif (ret == NULL) return -1;\n\t\n\tif (self->nd > 0) { /* Free old dimensions and strides */\n\t\tPyDimMem_FREE(self->dimensions);\n\t}\n\tnd = PyArray_NDIM(ret);\n\tself->nd = nd;\n\tif (nd > 0) { /* create new dimensions and strides */\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\tPyErr_SetString(PyExc_MemoryError,\"\");\n\t\t\treturn -1;\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, PyArray_DIMS(ret), \n\t\t nd*sizeof(intp));\n\t\tmemcpy(self->strides, PyArray_STRIDES(ret), \n\t\t nd*sizeof(intp));\n\t}\n\telse self->dimensions=NULL;\n\tPy_DECREF(ret);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_strides_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic int\narray_strides_set(PyArrayObject *self, PyObject *obj)\n{\n\tPyArray_Dims newstrides = {NULL, 0};\n\tPyArrayObject *new;\n\tintp numbytes;\n\n\tif (!PyArray_IntpConverter(obj, &newstrides) || \\\n\t newstrides.ptr == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"invalid strides.\");\n\t\treturn -1;\n\t}\n\tif (newstrides.len != self->nd) {\n\t\tPyErr_Format(PyExc_ValueError, \"strides must be \"\t\\\n\t\t\t \" same length as shape (%d)\", self->nd);\n\t\treturn -1;\n\t}\n\tnew = self;\n\twhile(new->base != NULL) {\n\t\tif (PyArray_Check(new->base)) \n\t\t\tnew = (PyArrayObject *)new->base;\n\t}\n\tnumbytes = PyArray_MultiplyList(new->dimensions, \n\t\t\t\t\tnew->nd)*new->itemsize;\n\t\n\tif (!PyArray_CheckStrides(self->itemsize, self->nd, numbytes, \n\t\t\t\t self->dimensions, newstrides.ptr)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"strides is not \"\\\n\t\t\t\t\"compatible with available memory\");\n\t\treturn -1;\n\t}\n\tmemcpy(self->strides, newstrides.ptr, sizeof(intp)*newstrides.len);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_protocol_strides_get(PyArrayObject *self)\n{\n\tif PyArray_ISCONTIGUOUS(self) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic PyObject *\narray_priority_get(PyArrayObject *self)\n{\n\tif (PyArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_PRIORITY);\n\telse if (PyBigArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_BIG_PRIORITY);\n\telse\n\t\treturn PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY);\n}\n\n\nstatic PyObject *\narray_data_get(PyArrayObject *self)\n{\n\tintp nbytes;\n\tif (!(PyArray_ISONESEGMENT(self))) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot get single-\"\\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn NULL;\n\t}\t\t\n\tnbytes = PyArray_NBYTES(self);\n\tif PyArray_ISWRITEABLE(self) \n\t\treturn PyBuffer_FromReadWriteObject((PyObject *)self, 0, \n\t\t\t\t\t\t (int) nbytes);\n\telse\n\t\treturn PyBuffer_FromObject((PyObject *)self, 0, (int) nbytes);\n}\n\nstatic int\narray_data_set(PyArrayObject *self, PyObject *op)\n{\n\tvoid *buf;\n\tint buf_len;\n\tint writeable=1;\n\n\tif (PyObject_AsWriteBuffer(op, &buf, &buf_len) < 0) {\n\t\twriteable = 0;\n\t\tif (PyObject_AsReadBuffer(op, (const void **)&buf, \n\t\t\t\t\t &buf_len) < 0) {\n\t\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\t\"Object does not have single-segment\" \\\n\t\t\t\t\t\"buffer interface\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif (!PyArray_ISONESEGMENT(self)) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot set single-\" \\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn -1;\n\t}\n\tif (PyArray_NBYTES(self) > buf_len) {\n\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\"Not enough data for array.\");\n\t\treturn -1;\n\t}\n\tif (self->flags & OWN_DATA) {\n\t\tPyArray_XDECREF(self);\n\t\tPyDataMem_FREE(self->data);\n\t}\n\tif (self->base) {\n\t\tif (self->flags & UPDATEIFCOPY) {\n\t\t\t((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tself->flags &= ~UPDATEIFCOPY;\n\t\t}\n\t\tPy_DECREF(self->base);\n\t}\n\tPy_INCREF(op);\n\tself->base = op;\n\tself->data = buf;\n\tself->flags = CARRAY_FLAGS;\n\tif (!writeable)\n\t\tself->flags &= ~WRITEABLE;\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_itemsize_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->itemsize);\n}\n\nstatic PyObject *\narray_size_get(PyArrayObject *self)\n{\n\tlonglong size=PyArray_SIZE(self);\n\tif (size > MAX_INT || size < MIN_INT)\n\t\treturn PyLong_FromLongLong((longlong) size);\n\telse \n\t\treturn PyInt_FromLong((long) size);\n}\n\n\nstatic PyObject *\narray_typechar_get(PyArrayObject *self)\n{\n\tif PyArray_ISFLEXIBLE(self) \n\t\treturn PyString_FromFormat(\"%c%d\", (self->descr->type),\n\t\t\t\t\t self->itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(self->descr->type), 1);\n}\n\nstatic PyObject *\narray_typestr_get(PyArrayObject *self)\n{\n\tstatic char endians[] = \"<>\";\n\tchar endian;\n\tint which;\n\tunsigned long val = 1;\n\tchar *s;\n\tchar basic_=self->descr->kind;\n\n\ts = (char *)&val; /* s[0] == 0 implies big-endian */\n\twhich = (PyArray_ISNOTSWAPPED(self) ? 0 : 1);\n\tif (s[0] == 0) which = 1 - which;\n\tendian = endians[which]; \n\t\n\tif ((basic_==PyArray_VOIDLTR) || (basic_==PyArray_STRINGLTR) || \\\n\t (basic_==PyArray_OBJECTLTR) || (self->itemsize == 1))\n\t\treturn PyString_FromFormat(\"|%c%d\", basic_, self->itemsize);\n\telse\n\t\treturn PyString_FromFormat(\"%c%c%d\", endian, basic_,\n\t\t\t\t\t self->itemsize);\n}\n\nstatic PyObject *\narray_descr_get(PyArrayObject *self)\n{\n\tPyObject *res;\n\tPyObject *dobj;\n\n\t/* hand this off to the typeobject */\n\t/* or give default */\n\tif (PyArray_ISUSERDEF(self)) {\n\t\tres = PyObject_GetAttrString((PyObject *)self->descr->typeobj, \n\t\t\t\t\t \"__array_descr__\");\n\t\tif (res) return res;\n\t\tPyErr_Clear();\n\t}\n\t/* get default */\n\tdobj = PyTuple_New(2);\n\tif (dobj == NULL) return NULL;\n\tPyTuple_SET_ITEM(dobj, 0, PyString_FromString(\"\"));\n\tPyTuple_SET_ITEM(dobj, 1, array_typestr_get(self));\n\tres = PyList_New(1);\n\tif (res == NULL) {Py_DECREF(dobj); return NULL;}\n\tPyList_SET_ITEM(res, 0, dobj);\n\treturn res;\n}\n\nstatic PyObject *\narray_typenum_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->descr->type_num);\n}\n\n\nstatic PyObject *\narray_type_get(PyArrayObject *self)\n{\n\treturn PyArray_TypeObjectFromType(self->descr->type_num);\n}\n\n/* If the type is changed. \n Also needing change: strides, itemsize\n\n Either itemsize is exactly the same\n or the array is single-segment (contiguous or fortran) with\n compatibile dimensions\n\n*/\n\nstatic int\narray_type_set(PyArrayObject *self, PyObject *arg)\n{\n PyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n intp newdim;\n int index;\n char *msg = \"new type not compatible with array.\";\n\n if ((PyArray_TypecodeConverter(arg, &newtype) < 0) ||\n newtype.type_num == PyArray_NOTYPE) {\n PyErr_SetString(PyExc_TypeError, \"Invalid type for array\");\n return -1;\n }\n if (!(PyArray_ISONESEGMENT(self) ||\t\t\\\n\t (newtype.itemsize != self->itemsize))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1; \n }\n\n\tif (PyArray_ISCONTIGUOUS(self)) index = self->nd - 1;\n\telse index = 0;\n\n if (newtype.itemsize < self->itemsize) {\n /* if it is compatible increase the size of the dimension\n at end (or at the front for FORTRAN)\n */\n if (self->itemsize % newtype.itemsize != 0) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n newdim = self->itemsize / newtype.itemsize;\n\t\tself->dimensions[index] *= newdim;\n self->strides[index] = newtype.itemsize;\n\t}\n \n else if (newtype.itemsize > self->itemsize) {\n \n /* Determine if last (or first if FORTRAN) dimension\n is compatible */\n\n\t\tnewdim = self->dimensions[index] * self->itemsize;\n if ((newdim % newtype.itemsize) != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n\t\t\n self->dimensions[index] = newdim / newtype.itemsize;\n self->strides[index] = newtype.itemsize;\n\t\t\n }\n\t\n \n /* fall through -- adjust type*/\n\n self->descr = PyArray_DescrFromType(newtype.type_num);\n self->itemsize = newtype.itemsize;\n PyArray_UpdateFlags(self, ALIGNED);\n return 0;\n\n}\n\n\n\nstatic PyObject *\narray_base_get(PyArrayObject *self)\n{\n\tif (self->base == NULL) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\telse {\n\t\tPy_INCREF(self->base);\n\t\treturn self->base;\n\t}\n}\n\n\nstatic PyObject *\narray_real_get(PyArrayObject *self)\n{\n\tPyArrayObject *ret;\n\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *)ret;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n}\n\n\nstatic int\narray_real_set(PyArrayObject *self, PyObject *val)\n{\n\tPyArrayObject *ret;\n\tPyArrayObject *new;\n\tint rint;\n\n\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0);\n\tif (new == NULL) return -1;\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return -1;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\tret = self;\n\t}\t\n\trint = PyArray_CopyInto(ret, new);\n\tPy_DECREF(ret);\n\treturn rint;\n}\n\nstatic PyObject *\narray_imag_get(PyArrayObject *self)\n{\t\n\tPyArrayObject *ret;\n\tint itemsize;\n\tint typenum;\n PyArray_Typecode type;\n\t\n\ttype.type_num = self->descr->type_num;\n\ttype.itemsize = self->itemsize;\n\ttype.fortran = PyArray_ISFORTRAN(self);\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\titemsize = self->itemsize >> 1;\n\t\ttypenum = self->descr->type_num - PyArray_NUM_FLOATTYPE;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t typenum,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data + itemsize,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *) ret;\n\t}\n\telse {\n\t\tret = (PyArrayObject *)PyArray_Zeros(self->nd, \n\t\t\t\t\t\t self->dimensions, &type);\n\t\tret->flags &= ~WRITEABLE;\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic int\narray_imag_set(PyArrayObject *self, PyObject *val)\n{\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyArrayObject *ret;\n\t\tPyArrayObject *new;\n\t\tint rint;\n\n\t\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0); \n\t\tif (new == NULL) return -1;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides+ \\\n\t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) {\n\t\t\tPy_DECREF(new); \n\t\t\treturn -1;\n\t\t}\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\trint = PyArray_CopyInto(ret, new);\n\t\tPy_DECREF(ret);\t\t\n\t\tPy_DECREF(new);\n\t\treturn rint;\n\t}\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError, \"Does not have imaginary \" \\\n\t\t\t\t\"part to set.\");\n\t\treturn -1;\n\t}\n}\n\nstatic PyObject *\narray_flat_get(PyArrayObject *self)\n{\n return PyArray_IterNew((PyObject *)self);\n}\n\nstatic int \narray_flat_set(PyArrayObject *self, PyObject *val)\n{\n\tPyObject *arr=NULL;\n\tint retval = -1;\n\tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n\tPyArray_Typecode typecode;\n int swap;\n PyArray_CopySwapFunc *copyswap;\n\n\ttypecode.type_num = self->descr->type_num;\n\ttypecode.itemsize = self->itemsize;\n\ttypecode.fortran = PyArray_ISFORTRAN(self);\n\t\n\tarr = PyArray_FromAny(val, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\tarrit = (PyArrayIterObject *)PyArray_IterNew(arr);\n\tif (arrit == NULL) goto exit;\n\tselfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (selfit == NULL) goto exit;\n\n swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);\n copyswap = self->descr->copyswap;\n if (PyArray_ISOBJECT(self)) {\n while(selfit->index < selfit->size) {\n Py_XDECREF(*((PyObject **)selfit->dataptr));\n Py_INCREF(*((PyObject **)arrit->dataptr)); \n memmove(selfit->dataptr, arrit->dataptr, \n sizeof(PyObject *));\n copyswap(selfit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_ITER_NEXT(selfit);\n PyArray_ITER_NEXT(arrit);\n if (arrit->index == arrit->size) \n PyArray_ITER_RESET(arrit);\n }\n retval = 0; \n goto exit;\n }\n\n\twhile(selfit->index < selfit->size) {\n\t\tmemmove(selfit->dataptr, arrit->dataptr, self->itemsize);\n copyswap(selfit->dataptr, NULL, swap, self->itemsize);\n\t\tPyArray_ITER_NEXT(selfit);\n\t\tPyArray_ITER_NEXT(arrit);\n\t\tif (arrit->index == arrit->size) \n\t\t\tPyArray_ITER_RESET(arrit);\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(selfit);\n\tPy_XDECREF(arrit);\n\tPy_XDECREF(arr);\n\treturn retval;\n}\n\nstatic PyGetSetDef array_getsetlist[] = {\n {\"ndim\", \n\t (getter)array_ndim_get, \n\t NULL, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)array_flags_get, \n NULL,\n\t \"special dictionary of flags\"},\n {\"shape\", \n\t (getter)array_shape_get, \n\t (setter)array_shape_set, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)array_strides_get, \n\t (setter)array_strides_set,\n\t \"tuple of bytes steps in each dimension\"},\n {\"data\", \n\t (getter)array_data_get, \n\t (setter)array_data_set, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)array_itemsize_get, \n\t NULL,\n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)array_size_get,\n\t NULL,\n \"number of elements in the array\"},\n\t{\"base\",\n\t (getter)array_base_get,\n\t NULL,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)array_type_get, \n\t (setter)array_type_set,\n\t \"get array type class\"},\n\t{\"dtypechar\",\n\t (getter)array_typechar_get,\n\t NULL,\n\t \"get array type character code\"},\n\t{\"dtypenum\",\n\t (getter)array_typenum_get,\n\t NULL,\n\t \"get array type number code\"},\n\t{\"dtypestr\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)array_real_get, \n\t (setter)array_real_set, \n\t \"real part of array\"},\n {\"imag\", \n\t (getter)array_imag_get, \n\t (setter)array_imag_set, \n\t \"imaginary part of array\"},\n\t{\"flat\", \n\t (getter)array_flat_get, \n\t (setter)array_flat_set, \n\t \"a 1-d view of a contiguous array\"}, \n\t{\"__array_data__\", \n\t (getter)array_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)array_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)array_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)array_protocol_strides_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t{\"__array_priority__\",\n\t (getter)array_priority_get,\n\t NULL,\n\t \"Array priority\"},\n \t{NULL, NULL, NULL, NULL}, /* Sentinel */\n};\n\n/****************** end of attribute get and set routines *******************/\n\n\n\nstatic char Arraytype__doc__[] = \n \"A array object represents a multidimensional, homogeneous array of basic values. It has the folowing data members, m.shape (the size of each dimension in the array), m.itemsize (the size (in bytes) of each element of the array), and m.typecode (a character representing the type of the array elements). Arrays are sequence, mapping and numeric objects. Sequence indexing is similar to lists, with single indices returning a reference that points to the old array data, and slices returning by copy. A array is also allowed to be indexed by a sequence of items.\t Each member of the sequence indexes the corresponding dimension of the array.\";\n\nstatic PyTypeObject PyBigArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.bigndarray\",\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n /* methods */\n (destructor)array_dealloc,\t\t /*tp_dealloc */\n (printfunc)NULL,\t\t\t /*tp_print*/\n 0,\t\t\t\t\t /*tp_getattr*/\n 0,\t\t\t\t\t /*tp_setattr*/\n (cmpfunc)0, \t\t /*tp_compare*/\n (reprfunc)array_repr,\t\t /*tp_repr*/\n &array_as_number,\t\t\t /*tp_as_number*/\n NULL, \t\t\t /*tp_as_sequence*/\n &array_as_mapping,\t\t\t /*tp_as_mapping*/\n (hashfunc)0,\t\t\t /*tp_hash*/\n (ternaryfunc)0,\t\t\t /*tp_call*/\n (reprfunc)array_str, \t /*tp_str*/\n\t\t\n (getattrofunc)0,\t\t\t /*tp_getattro*/\n (setattrofunc)0,\t\t\t /*tp_setattro*/\n NULL, \t /*tp_as_buffer*/\n (Py_TPFLAGS_DEFAULT \n | Py_TPFLAGS_BASETYPE\n | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/\n /*Documentation string */\n Arraytype__doc__,\t\t\t /*tp_doc*/\n\n (traverseproc)0,\t\t\t /*tp_traverse */\n (inquiry)0,\t\t\t /*tp_clear */\n (richcmpfunc)array_richcompare,\t \n offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */\n\n /* Iterator support (use standard) */\n\n (getiterfunc)0, \t\t /* tp_iter */\n (iternextfunc)0,\t\t\t /* tp_iternext */\n\n /* Sub-classing (new-style object) support */\n\n array_methods,\t\t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n array_getsetlist,\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0,\t /* tp_alloc */ \n (newfunc)array_new,\t\t /* tp_new */\n 0,\t \t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n};\n\n/* A standard array will subclass from the Big Array and \n add the array_as_sequence table\n and the array_as_buffer table\n */\n\nstatic PyTypeObject PyArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.ndarray\",\t\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n};\n\n\n/* The rest of this code is to build the right kind of array from a python */\n/* object. */\n\nstatic int \ndiscover_depth(PyObject *s, int max, int stop_at_string) \n{\n int d=0;\n PyObject *e;\n\t\n if(max < 1) return -1;\n\n if(! PySequence_Check(s) || PyInstance_Check(s) || \\\n\t PySequence_Length(s) < 0) {\n PyErr_Clear(); return 0;\n }\n if (PyArray_Check(s))\n\t\treturn PyArray_NDIM(s);\n if(PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))\n\t\treturn stop_at_string ? 0:1;\n if (PySequence_Length(s) == 0) \n\t\treturn 1;\n\t\n if ((e=PySequence_GetItem(s,0)) == NULL) return -1;\n if(e!=s) {\n\t\td=discover_depth(e,max-1, stop_at_string);\n\t\tif(d >= 0) d++;\n\t}\n Py_DECREF(e);\n return d;\n}\n\nstatic int\ndiscover_itemsize(PyObject *s, int nd, int *itemsize) \n{\n\tint n, r, i;\n\tPyObject *e;\n\t\n\tn = PyObject_Length(s);\n\n\tif ((nd == 0) || PyString_Check(s) ||\t\t\\\n\t PyUnicode_Check(s) || PyBuffer_Check(s)) {\n\t\tif PyUnicode_Check(s) \n\t\t\t*itemsize = MAX(*itemsize, sizeof(Py_UNICODE)*n);\n\t\telse\n\t\t\t*itemsize = MAX(*itemsize, n);\n\t\treturn 0;\n\t}\n\tfor (i=0; i n_lower) n_lower = d[1];\n }\n d[1] = n_lower;\n\t\n return 0;\n}\n\nstatic void\n_array_small_type(int chktype, int mintype, int chksize, int minsize, \n\t\t PyArray_Typecode *outtype)\n{\n\touttype->type_num = MAX(chktype, mintype);\n\tif (PyTypeNum_ISFLEXIBLE(outtype->type_num) &&\t\\\n\t PyTypeNum_ISFLEXIBLE(mintype)) {\n\t\t/* Handle string->unicode case separately \n\t\t because string itemsize is twice as large */\n\t\tif (outtype->type_num == PyArray_UNICODE && \n\t\t mintype == PyArray_STRING) {\n\t\t\touttype->itemsize = MAX(chksize, 2*minsize);\n\t\t}\n\t\telse {\n\t\t\touttype->itemsize = MAX(chksize, minsize);\n\t\t}\n\t}\n\telse {\n\t\touttype->itemsize = chksize;\n\t}\n\treturn;\t\n}\n\nstatic void\n_array_find_type(PyObject *op, PyArray_Typecode *minitype, \n\t\t PyArray_Typecode *outtype, int max)\n{\n int l;\n PyObject *ip;\n\tint chktype=0;\n\tint chksize=0;\n\tint mintype, minsize;\n\n\tif (minitype == NULL) {\n\t\tmintype = PyArray_BOOL;\n\t\tminsize = sizeof(Bool);\n\t}\n\telse {\n\t\tmintype = minitype->type_num;\n\t\tminsize = minitype->itemsize;\n\t}\n\n \n if (max < 0 || mintype == -1) goto deflt;\n\t\n if (PyArray_Check(op)) {\n\t\tchktype = PyArray_TYPE(op);\n\t\tchksize = PyArray_ITEMSIZE(op);\n\t\tgoto finish;\n\t}\n\t\n\tif (PyArray_IsScalar(op, Generic)) {\n\t\tPyArray_TypecodeFromScalar(op, outtype);\n\t\tchktype = outtype->type_num;\n\t\tchksize = outtype->itemsize;\n\t\tgoto finish;\n\t}\n\t\n\n if (PyObject_HasAttrString(op, \"__array__\")) {\n ip = PyObject_CallMethod(op, \"__array__\", NULL);\n if(ip && PyArray_Check(ip)) {\n\t\t\tchktype = PyArray_TYPE(ip);\n\t\t\tchksize = PyArray_ITEMSIZE(ip);\n\t\t\tgoto finish;\n\t\t}\n } \n\t\n\tif (PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tint swap=0, res;\n\t\tip = PyObject_GetAttrString(op, \"__array_typestr__\");\n\t\tif (ip && PyString_Check(ip)) {\n\t\t\tres = _array_typecode_fromstr(PyString_AS_STRING(ip), \n\t\t\t\t\t\t &swap, outtype); \n\t\t\tif (res >= 0) {\n\t\t\t\tPy_DECREF(ip);\n\t\t\t\tchktype = outtype->type_num;\n\t\t\t\tchksize = outtype->itemsize;\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t}\n\t\tPy_XDECREF(ip);\n\t}\n\n if (PyString_Check(op)) {\n\t\tchktype = PyArray_STRING;\n\t\tchksize = PyString_GET_SIZE(op);\n\t\tgoto finish;\n }\n\n\tif (PyUnicode_Check(op)) {\n\t\tchktype = PyArray_UNICODE;\n\t\tchksize = PyUnicode_GET_DATA_SIZE(op);\n\t\tgoto finish;\n\t}\n\n\tif (PyBuffer_Check(op)) {\n\t\tchktype = PyArray_VOID;\n\t\tchksize = op->ob_type->tp_as_sequence->sq_length(op);\n\t\tPyErr_Clear();\n\t\tgoto finish;\n\t}\n\n\tif (PyInstance_Check(op)) goto deflt;\n\t\n if (PySequence_Check(op)) {\n\t\tPyArray_Typecode newtype;\n\t\tnewtype.type_num = mintype;\n\t\tnewtype.itemsize = minsize;\n\t\tnewtype.fortran = 0;\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n\t\t\tPyErr_Clear(); \n\t\t\tgoto deflt;\n\t\t}\n if (l == 0 && mintype == 0) {\n\t\t\tnewtype.type_num = PyArray_INTP;\n\t\t\tnewtype.itemsize = sizeof(intp);\n\t\t}\n while (--l >= 0) {\n ip = PySequence_GetItem(op, l);\n if (ip==NULL) {\n\t\t\t\tPyErr_Clear(); \n\t\t\t\tgoto deflt;\n\t\t\t}\n\t\t\t_array_find_type(ip, &newtype, outtype, max-1);\n\t\t\t_array_small_type(outtype->type_num,\n\t\t\t\t\t newtype.type_num, \n\t\t\t\t\t outtype->itemsize,\n\t\t\t\t\t newtype.itemsize,\n\t\t\t\t\t &newtype);\n Py_DECREF(ip);\n }\n\t\tchktype = newtype.type_num;\n\t\tchksize = newtype.itemsize;\n\t\tgoto finish;\n }\n\t\n\tif (PyBool_Check(op)) {\n\t\tchktype = PyArray_BOOL;\n\t\tchksize = sizeof(Bool);\n\t\tgoto finish;\t\t\n\t}\n else if (PyInt_Check(op)) {\n\t\tchktype = PyArray_LONG;\n\t\tchksize = sizeof(long);\n\t\tgoto finish;\n } else if (PyFloat_Check(op)) {\n\t\tchktype = PyArray_DOUBLE;\n\t\tchksize = sizeof(double);\n\t\tgoto finish;\n\t} else if (PyComplex_Check(op)) {\n\t\tchktype = PyArray_CDOUBLE;\n\t\tchksize = sizeof(cdouble);\n\t\tgoto finish;\n\t}\n\n deflt:\n\tchktype = PyArray_OBJECT;\n\tchksize = sizeof(void *);\n\n finish:\n\t_array_small_type(chktype, mintype, chksize, minsize, \n\t\t\t outtype);\n\treturn;\n}\n\nstatic int \nAssign_Array(PyArrayObject *self, PyObject *v) \n{\n PyObject *e;\n int l, r;\n\t\n if (!PySequence_Check(v)) {\n PyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"assignment from non-sequence\");\n return -1;\n }\n\t\n l=PyObject_Length(v);\n if(l < 0) return -1; \n\t\n while(--l >= 0)\n {\n e=PySequence_GetItem(v,l);\n if (e == NULL) return -1; \n\t\t\tr = PySequence_SetItem((PyObject*)self,l,e);\n Py_DECREF(e);\n if(r == -1) return -1;\n }\n return 0;\n}\n\n/* \"Array Scalars don't call this code\" */ \nstatic PyObject *\nArray_FromScalar(PyObject *op, PyArray_Typecode *typecode) \n{\n PyArrayObject *ret;\n\tint itemsize = 0;\n\tint type = typecode->type_num;\n\n\tif PyTypeNum_ISFLEXIBLE(type) {\n\t\titemsize = PyObject_Length(op);\n\t}\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,\n\t\t\t\t\t NULL, NULL, itemsize, 0, NULL);\n\n\tif (ret == NULL) return NULL;\n\n ret->descr->setitem(op, ret->data, ret);\n\t\n if (PyErr_Occurred()) {\n array_dealloc(ret);\n return NULL;\n } else {\n return (PyObject *)ret;\n }\n}\n\n\nstatic PyObject *\nArray_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth)\n{\n PyArrayObject *r;\n int nd;\n\tintp *d;\n\tint stop_at_string;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\t\n\t\n\tstop_at_string = ((type == PyArray_OBJECT) ||\t\\\n\t\t\t (type == PyArray_STRING) ||\t\\\n\t\t\t (type == PyArray_UNICODE) || \\\n\t\t\t (type == PyArray_VOID));\n\n if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string)) > 0)) {\n\t\tif (nd==0)\n\t\t\treturn Array_FromScalar(s, typecode);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid input sequence\");\n return NULL;\n }\n\t\n if ((max_depth && nd > max_depth) ||\t\\\n\t (min_depth && nd < min_depth)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of dimensions\");\n return NULL;\n }\n\t\n\tif ((d=PyDimMem_NEW(nd)) == NULL) {\n\t\treturn PyErr_NoMemory();\n }\n\tif(discover_dimensions(s,nd,d, !stop_at_string) == -1) {\n\t\tPyDimMem_FREE(d);\n\t\treturn NULL;\n\t}\n\tif (itemsize == 0 && PyTypeNum_ISFLEXIBLE(type)) {\n\t\tif (discover_itemsize(s, nd, &itemsize) == -1) {\n\t\t\tPyDimMem_FREE(d);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n r=(PyArrayObject*)PyArray_New(&PyArray_Type, nd, d, \n\t\t\t\t type, NULL, NULL,\n\t\t\t\t itemsize, \n\t\t\t\t typecode->fortran, NULL);\n\n PyDimMem_FREE(d);\n if(!r) return NULL;\n if(Assign_Array(r,s) == -1) {\n\t\tPy_DECREF(r);\n\t\treturn NULL;\n\t}\n return (PyObject*)r;\n}\n\n\nstatic int \nPyArray_ValidType(int type) \n{\n\tPyArray_Descr *descr;\n\t\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr==NULL) return 0;\n\treturn 1;\n}\n\n\n/* If the output is not a CARRAY, then it is buffered also */\n\nstatic int\n_bufferedcast(PyArrayObject *out, PyArrayObject *in)\n{\n\tchar *inbuffer, *bptr, *optr;\n\tchar *outbuffer=NULL;\n\tPyArrayIterObject *it_in=NULL, *it_out=NULL;\n\tregister intp i, index;\n\tintp ncopies = PyArray_SIZE(out) / PyArray_SIZE(in);\n\tint elsize=in->itemsize;\n\tint nels = PyArray_BUFSIZE;\n\tint el;\n\tint inswap, outswap=0;\n\tint obuf=!PyArray_ISCARRAY(out);\n\tint oelsize = out->itemsize;\n\tPyArray_VectorUnaryFunc *castfunc;\n PyArray_CopySwapFunc *in_csn;\n PyArray_CopySwapFunc *out_csn;\n\tint retval = -1;\n\n\tcastfunc = in->descr->cast[out->descr->type_num];\n in_csn = in->descr->copyswap;\n out_csn = out->descr->copyswap;\n\n\t/* If the input or output is STRING, UNICODE, or VOID */\n\t/* then getitem and setitem are used for the cast */\n\t/* and byteswapping is handled by those methods */\n\n\tinswap = !(PyArray_ISFLEXIBLE(in) || PyArray_ISNOTSWAPPED(in));\n\t\n\tinbuffer = PyDataMem_NEW(PyArray_BUFSIZE*elsize);\n\tif (inbuffer == NULL) return -1;\n\tit_in = (PyArrayIterObject *)PyArray_IterNew((PyObject *)in);\n\tif (it_in == NULL) goto exit;\n\n\tif (obuf) {\n\t\toutswap = !(PyArray_ISFLEXIBLE(out) || \\\n\t\t\t PyArray_ISNOTSWAPPED(out));\n\t\toutbuffer = PyDataMem_NEW(PyArray_BUFSIZE*oelsize);\n\t\tif (outbuffer == NULL) goto exit;\n\n\t\tit_out = (PyArrayIterObject *)PyArray_IterNew((PyObject *)out);\n\t\tif (it_out == NULL) goto exit;\n\n\t\tnels = MIN(nels, PyArray_BUFSIZE);\n\t}\n\t\n\toptr = (obuf) ? outbuffer: out->data;\n\tbptr = inbuffer;\n\tel = 0;\t\n\twhile(ncopies--) {\n\t\tindex = it_in->size;\n\t\tPyArray_ITER_RESET(it_in);\n\t\twhile(index--) {\n in_csn(bptr, it_in->dataptr, inswap, elsize);\n\t\t\tbptr += elsize;\n\t\t\tPyArray_ITER_NEXT(it_in);\n\t\t\tel += 1;\n\t\t\tif ((el == nels) || (index == 0)) {\n\t\t\t\t/* buffer filled, do cast */\n\t\t\t\t\n\t\t\t\tcastfunc(inbuffer, optr, el, in, out);\n\t\t\t\t\n\t\t\t\tif (obuf) {\n\t\t\t\t\t/* Copy from outbuffer to array */\n\t\t\t\t\tfor(i=0; idataptr,\n optr, outswap,\n oelsize);\n\t\t\t\t\t\toptr += oelsize;\n\t\t\t\t\t\tPyArray_ITER_NEXT(it_out);\n\t\t\t\t\t}\n\t\t\t\t\toptr = outbuffer;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toptr += out->itemsize * nels;\n\t\t\t\t}\n\t\t\t\tel = 0;\n\t\t\t\tbptr = inbuffer;\n\t\t\t}\n\t\t}\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(it_in);\n\tPyDataMem_FREE(inbuffer);\n\tPyDataMem_FREE(outbuffer);\t\n\tif (obuf) {\n\t\tPy_XDECREF(it_out);\n\t}\n\treturn retval;\n\n}\n\n\n/* For backward compatibility */\n\nstatic PyObject *\nPyArray_Cast(PyArrayObject *mp, int type_num) \n{\n\tPyArray_Typecode type;\n\tPyArray_Descr *descr;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\ttype.itemsize = descr->elsize;\n\ttype.type_num = descr->type_num;\n\ttype.fortran = 0;\n\t\n\treturn PyArray_CastToType(mp, &type);\n}\n\nstatic PyObject * \nPyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at) \n{\n\tPyObject *out;\n\tint ret;\n\n\tif ((mp->descr->type_num == at->type_num) && \\\n\t (at->itemsize==0 || mp->itemsize == at->itemsize) &&\n\t PyArray_ISBEHAVED_RO(mp)) {\n\t\tPy_INCREF(mp);\n\t\treturn (PyObject *)mp;\n\t}\n\t\t\n\tif (at->itemsize == 0) {\n\t\tif (mp->descr->type_num == PyArray_STRING &&\t\\\n\t\t at->type_num == PyArray_UNICODE)\n\t\t\tat->itemsize = mp->itemsize*sizeof(Py_UNICODE);\n\t\tif (mp->descr->type_num == PyArray_UNICODE &&\n\t\t at->type_num == PyArray_STRING) \n\t\t\tat->itemsize = mp->itemsize/sizeof(Py_UNICODE);\n\t\tif (at->type_num == PyArray_VOID)\n\t\t\tat->itemsize = mp->itemsize;\n\t}\n\n\tout = PyArray_New(mp->ob_type, mp->nd, \n\t\t\t mp->dimensions, \n\t\t\t at->type_num,\n\t\t\t NULL, NULL, at->itemsize, \n\t\t\t at->fortran, (PyObject *)mp);\n\tif (out == NULL) return NULL;\n\tret = PyArray_CastTo((PyArrayObject *)out, mp);\n\tif (ret != -1) return out;\n\n\tPy_DECREF(out);\n\treturn NULL;\n\t\n}\n\t \n/* The number of elements in out must be an integer multiple\n of the number of elements in mp. \n*/\n\nstatic int\nPyArray_CastTo(PyArrayObject *out, PyArrayObject *mp)\n{\n\n\tint simple;\n\tintp mpsize = PyArray_SIZE(mp);\n\tintp outsize = PyArray_SIZE(out);\n\n\tif (mpsize == 0) return 0;\n\tif (!PyArray_ISWRITEABLE(out)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array is not writeable.\");\n\t\treturn -1;\n\t}\n\tif (outsize % mpsize != 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array must have an integer-multiple\"\\\n\t\t\t\t\" of the number of elements in the input \"\\\n\t\t\t\t\"array\");\n\t\treturn -1; \n\t}\n\n\tsimple = ((PyArray_ISCARRAY(mp) && PyArray_ISCARRAY(out)) || \\\n (PyArray_ISFARRAY(mp) && PyArray_ISFARRAY(out)));\n\t\n\tif (simple) {\n\t\tchar *inptr;\n\t\tchar *optr = out->data;\n\t\tintp obytes = out->itemsize * outsize;\n\t\tintp ncopies = outsize / mpsize;\n\n\t\twhile(ncopies--) {\n\t\t\tinptr = mp->data;\n\t\t\tmp->descr->cast[out->descr->type_num](inptr, \n\t\t\t\t\t\t\t optr,\n\t\t\t\t\t\t\t mpsize,\n\t\t\t\t\t\t\t mp, out);\n\t\t\toptr += obytes;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t/* If not a well-behaved cast, then use buffers */\n\tif (_bufferedcast(out, mp) == -1) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nstatic PyObject *\narray_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags) \n{\n\t\n\tPyArrayObject *ret=NULL;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\tint copy = 0;\n\tint arrflags;\n\tPyArray_Typecode oldtype;\n\tchar *msg = \"Cannot copy-back to a read-only array.\";\n\n\toldtype.type_num = PyArray_TYPE(arr);\n\toldtype.itemsize = PyArray_ITEMSIZE(arr);\n\toldtype.fortran = 0;\n\n\tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n\tif (itemsize == 0) itemsize = arr->itemsize;\n\ttypecode->type_num = type;\n\ttypecode->itemsize = itemsize;\n\n\t/* Don't copy if sizes are compatible */\n\tif (PyArray_EquivalentTypes(&oldtype, typecode)) {\n\t\tarrflags = arr->flags;\n\n\t\tcopy = (flags & ENSURECOPY) || \\\n\t\t\t((flags & CONTIGUOUS) && (!(arrflags & CONTIGUOUS))) \\\n\t\t\t|| (PyArray_ITEMSIZE(arr) != itemsize) || \\\n\t\t\t((flags & ALIGNED) && (!(arrflags & ALIGNED))) || \\\n\t\t\t((flags & NOTSWAPPED) && (!(arrflags & NOTSWAPPED))) \\\n\t\t\t|| (arr->nd > 1 &&\t\t\t\t\\\n\t\t\t ((flags & FORTRAN) != (arrflags & FORTRAN))) || \\\n\t\t\t((flags & WRITEABLE) && (!(arrflags & WRITEABLE)));\n\t\t\n\t\tif (copy) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_New(arr->ob_type, \n\t\t\t\t\t arr->nd, \n\t\t\t\t\t arr->dimensions,\n\t\t\t\t\t arr->descr->type_num,\n\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t itemsize,\n\t\t\t\t\t flags & FORTRAN,\n\t\t\t\t\t (PyObject *)arr);\n\t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t} \n\t\t/* If no copy then just increase the reference\n\t\t count and return the input */\n\t\telse { \n\t\t\tPy_INCREF(arr);\n\t\t\tret = arr;\n\t\t}\n\t}\n\t\n\t/* The desired output type is different than the input\n\t array type */\n\telse {\n\t\t/* Cast to the desired type if we can do it safely\n\t\t Also cast if source is a ndim-0 array to mimic\n\t\t behavior with Python scalars */\n\t\tif (flags & FORCECAST || PyArray_NDIM(arr)==0 ||\n\t\t PyArray_CanCastSafely(PyArray_TYPE(arr), type)) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_CastToType(arr, typecode);\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Array can not be safely cast \"\\\n\t\t\t\t\t\"to required type\");\n\t\t\tret = NULL;\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic int\n_array_typecode_fromstr(char *str, int *swap, PyArray_Typecode *type)\n{\n int type_num;\n char typechar;\n int size;\n unsigned long number = 1;\n char *s;\n char msg[] = \"unsupported typestring\";\n \n s = (char *)&number; /* s[0] == 0 implies big-endian */\n\n *swap = 0;\n\n if (str[0] == '<' || str[0] == '>') {\n\tif ((str[0] == '<') && (s[0] == 0)) *swap = 1;\n\telse if ((str[0] == '>') && (s[0] != 0)) *swap = 1;\n }\n str += 1;\n \n#define _MY_FAIL {\t\t\t\t \\\n\t PyErr_SetString(PyExc_ValueError, msg); \\\n\t return -1;\t\t\t \\\n }\t\t\n\n typechar = str[0];\n size = atoi(str + 1);\n switch (typechar) {\n case 'b':\n\t if (size == sizeof(Bool))\n\t\t type_num = PyArray_BOOL;\t \n\t else _MY_FAIL \n\t break;\t\t \n case 'u':\n if (size == sizeof(uintp))\n type_num = PyArray_UINTP;\n\t else if (size == sizeof(char))\n\t\t type_num = PyArray_UBYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_USHORT;\n\t else if (size == sizeof(int)) \n\t\t type_num = PyArray_UINT;\n\t else if (size == sizeof(ulong)) \n\t\t type_num = PyArray_ULONG;\n\t else if (size == sizeof(ulonglong))\n\t\t type_num = PyArray_ULONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'i':\n if (size == sizeof(intp))\n type_num = PyArray_INTP;\n\t else if (size == sizeof(char)) \n\t\t type_num = PyArray_BYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_SHORT;\n\t else if (size == sizeof(int))\n\t\t type_num = PyArray_INT;\n\t else if (size == sizeof(long)) \n\t\t type_num = PyArray_LONG;\n\t else if (size == sizeof(longlong))\n\t\t type_num = PyArray_LONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'f':\n\t if (size == sizeof(float))\n\t\t type_num = PyArray_FLOAT;\n\t else if (size == sizeof(double))\n\t\t type_num = PyArray_DOUBLE;\n\t else if (size == sizeof(longdouble))\n\t\t type_num = PyArray_LONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'c':\n\t if (size == sizeof(float)*2)\n\t\t type_num = PyArray_CFLOAT;\n\t else if (size == sizeof(double)*2)\n\t\t type_num = PyArray_CDOUBLE;\n\t else if (size == sizeof(longdouble)*2)\n\t\t type_num = PyArray_CLONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'O':\n\t if (size == sizeof(PyObject *))\n\t\t type_num = PyArray_OBJECT;\n\t else _MY_FAIL\n\t break;\n case 'S':\n\t type_num = PyArray_STRING;\n\t break;\n case 'U':\n\t type_num = PyArray_UNICODE;\n\t size *= sizeof(Py_UNICODE);\n\t break;\t \n case 'V':\n\t type_num = PyArray_VOID;\n\t break;\n default:\n\t _MY_FAIL\n }\n\n#undef _MY_FAIL\n\n type->type_num = type_num;\n type->itemsize = size;\n type->fortran = 0;\n return 0;\n}\n\nstatic PyObject *\narray_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n{\n\tPyObject *attr=NULL, *item=NULL, *r;\n\tPyArrayObject *ret=NULL;\n\tPyArray_Typecode type;\n\tchar *data;\n\tint buffer_len;\n\tint res, i, n;\n\tintp dims[MAX_DIMS], strides[MAX_DIMS];\n\tint swap;\n\n\t/* Get the memory from __array_data__ and __array_offset__ */\n\t/* Get the shape */\n\t/* Get the typestring -- ignore array_descr */\n\t/* Get the strides */\n\t\n\tattr = PyObject_GetAttrString(input, \"__array_data__\");\n\tif (attr == NULL) {\n\t\tPy_INCREF(input);\n\t\tattr = input;\n\t}\n\t\n\tres = PyObject_AsWriteBuffer(attr, (void **)&data, &buffer_len);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n\n\tattr = PyObject_GetAttrString(input, \"__array_typestr__\");\n\tif (!PyString_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_typestr__ must be a string.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\t\n\t}\n\tres = _array_typecode_fromstr(PyString_AS_STRING(attr), &swap, &type);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n \n\tattr = PyObject_GetAttrString(input, \"__array_shape__\");\n\tif (!PyTuple_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_shape__ must be a tuple.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\n\t}\n\tn = PyTuple_GET_SIZE(attr);\n\tfor (i=0; ibase = input;\n \n\tattr = PyObject_GetAttrString(input, \"__array_strides__\");\n\tif (attr != NULL && attr != Py_None) {\n\t\tif (!PyTuple_Check(attr)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"__array_strides__ must be a tuple.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tif (n != PyTuple_GET_SIZE(attr)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"mismatch in length of \"\\\n\t\t\t\t\t\"__array_strides__ and \"\\\n\t\t\t\t\t\"__array_shape__.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tfor (i=0; istrides, strides, n*sizeof(intp));\n\t}\n\n\tif (swap) {\n\t\tPyObject *tmp;\n\t\ttmp = PyObject_CallMethod((PyObject *)ret, \"byteswap\", \"\");\n\t\tPy_DECREF(tmp);\n\t}\n\n\tPyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);\n\tr = array_fromarray(ret, intype, flags);\n\tPy_DECREF(ret);\n\treturn r;\n}\n\nstatic PyObject *\narray_fromattr(PyObject *op, PyArray_Typecode *typecode, int flags) \n{\n PyObject *new, *r;\n\t \n if (typecode->type_num == PyArray_NOTYPE) {\n new = PyObject_CallMethod(op, \"__array__\", NULL);\n } else {\n new = PyObject_CallMethod(op, \"__array__\", \"i\", \n typecode->type_num);\n }\n if (new == NULL) return NULL;\n if (!PyArray_Check(new)) {\n PyErr_SetString(PyExc_ValueError, \n \"object __array__ method not \" \\\n \"producing an array.\");\n Py_DECREF(new);\n return NULL;\n }\n r = array_fromarray((PyArrayObject *)new, typecode, flags);\n Py_DECREF(new);\n return r;\n} \n\n\nstatic PyObject *\narray_fromobject(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth, int flags) \n{\n /* This is the main code to make a NumPy array from a Python\n Object. It is called from lot's of different places which\n is why there are so many checks. The comments try to\n explain some of the checks. */\n\n\tint type = typecode->type_num;\n PyObject *r=NULL;\n\n\t/* Is input object already an array? */\n\t/* This is where the flags are used */\n if (PyArray_Check(op)) \n\t\tr = array_fromarray((PyArrayObject *)op, typecode, flags);\n\telse if (PyObject_HasAttrString(op, \"__array__\")) {\n\t\t/* Code that returns the object to convert for a non\n\t\t multiarray input object from the __array__ attribute of the\n\t\t object. */\n r = array_fromattr(op, typecode, flags);\n\t}\n\telse if (PyObject_HasAttrString(op, \"__array_shape__\") &&\n\t\t PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tr = array_frominterface(op, typecode, flags);\n\t}\n\telse {\n\t\tif (type == PyArray_NOTYPE) {\n\t\t\t_array_find_type(op, NULL, typecode, MAX_DIMS);\n\t\t}\n\t\tif (PySequence_Check(op))\n\t\t\tr = Array_FromSequence(op, typecode, \n\t\t\t\t\t min_depth, max_depth);\n\t\telse\n\t\t\tr = Array_FromScalar(op, typecode);\n\t}\n\n /* If we didn't succed return NULL */\n if (r == NULL) return NULL;\n\t\n\t/* Be sure we succeed here */\n\t\n if(!PyArray_Check(r)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Internal error array_fromobject \"\\\n\t\t\t\t\"not producing an array\");\n\t\tPy_DECREF(r);\n return NULL;\n }\n\n if (min_depth != 0 && ((PyArrayObject *)r)->nd < min_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object of too small depth for desired array\");\n return NULL;\n }\n if (max_depth != 0 && ((PyArrayObject *)r)->nd > max_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object too deep for desired array\");\n return NULL;\n }\n return r;\n}\n\nstatic void\nPyArray_ArrayType(PyObject *op, PyArray_Typecode *intype, \n\t\t PyArray_Typecode *outtype) \n{\n\t_array_find_type(op, intype, outtype, MAX_DIMS);\n\treturn;\n}\n\nstatic int \nPyArray_ObjectType(PyObject *op, int minimum_type) \n{\n\tPyArray_Typecode intype, outtype;\n\tintype.type_num = minimum_type;\n\t_array_find_type(op, &intype, &outtype, MAX_DIMS);\n\treturn outtype.type_num;\n}\n\n\n\n/* flags is any of \n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough\n to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, and WRITEABLE\n and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, the returned array will be a copy of the object, \n (C) contiguous in memory, aligned, notswapped, and writeable.\n \n So CONTIGUOUS | ENSURECOPY passed in means that the returned\n array does not have to be CONTIGUOUS or a COPY but should be\n ALIGNED, NOTSWAPPED and WRITEABLE. \n\n typecode->fortran can be set to request a\n fortran-contiguous array. Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n*/\n\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n{\n \tPyArray_Typecode mine = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode *type;\n\t\n\tif (typecode == NULL) type = &mine;\n\telse type = typecode;\n\t\t\n\tif (requires & ENSURECOPY) {\n\t\trequires |= DEFAULT_FLAGS;\n\t}\n\t/* Ensure that type->fortran and flags & FORTRAN are the\n\t same */\n\tif (requires & FORTRAN) typecode->fortran = 1;\n\tif (type->fortran == 1) {\n\t\trequires |= FARRAY_FLAGS;\n\t\tif (min_depth > 2) requires &= ~CONTIGUOUS;\n\t}\n\n\t/* make sure itemsize is not 0 unless warranted. */\n\tif ((type->itemsize == 0) && (type->type_num != PyArray_NOTYPE)) {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type->type_num);\n\t\tif (descr != NULL) type->itemsize = descr->elsize;\n\t\telse return NULL;\n\t}\n\t\n\treturn array_fromobject(op, type, min_depth, max_depth, \n\t\t\t\trequires);\t\n}\n\n/* This is a quick wrapper around PyArray_FromAny(op, NULL, 0, 0, 0) */\n/* that special cases Arrays and PyArray_Scalars up front */\n/* It steals a reference to the object */\n\n/* Because it decrefs op if any conversion needs to take place \n -- so it can be used like PyArray_EnsureArray(some_function(...)) */\n\nstatic PyObject *\nPyArray_EnsureArray(PyObject *op)\n{\n PyObject *new;\n\n if (op == NULL) return NULL;\n\n if (PyArray_Check(op)) return op;\n\n if (PyArray_IsScalar(op, Generic)) {\n new = PyArray_FromScalar(op, NULL);\n Py_DECREF(op);\n return new;\n }\n new = PyArray_FromAny(op, NULL, 0, 0, 0);\n Py_DECREF(op);\n return new;\n}\n\n/* These are all compressed into a single API */\n/* Deprecated calls -- Use PyArray_FromAny */\n\nstatic PyObject *\nPyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, BEHAVED_FLAGS);\n}\n\nstatic PyObject *\nPyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n\t\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, DEFAULT_FLAGS);\n}\n\nstatic PyObject *\nPyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n\t\t\t ENSURECOPY);\n}\n\n/* End of deprecated */\n\n\nstatic int \nPyArray_CanCastSafely(int fromtype, int totype) \n{\n\tPyArray_Descr *from, *to;\n\n if (fromtype == totype) return 1;\n if (fromtype == PyArray_BOOL) return 1;\n\tif (totype == PyArray_BOOL) return 0;\n if (totype == PyArray_OBJECT || totype == PyArray_VOID) return 1;\n\tif (fromtype == PyArray_OBJECT || fromtype == PyArray_VOID) return 0;\n\n\tfrom = PyArray_DescrFromType(fromtype);\n\tto = PyArray_DescrFromType(totype);\n \n switch(fromtype) {\n case PyArray_BYTE:\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISUNSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_UBYTE:\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_FLOAT:\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\tif (PyTypeNum_ISCOMPLEX(totype)) \n\t\t\treturn ((to->elsize >> 1) >= from->elsize);\n\t\telse\n\t\t\treturn (totype > fromtype);\n case PyArray_CFLOAT:\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn (totype > fromtype);\n\tcase PyArray_STRING:\n\tcase PyArray_UNICODE:\n\t\treturn (totype > fromtype);\n default:\n return 0;\n }\n}\n\nstatic Bool\nPyArray_CanCastTo(PyArray_Typecode *from, PyArray_Typecode *to)\n{\n\tint fromtype=from->type_num;\n\tint totype=to->type_num;\n\tBool ret;\n\n\tret = (Bool) PyArray_CanCastSafely(fromtype, totype);\n\tif (ret) { /* Check String and Unicode more closely */\n\t\tif (fromtype == PyArray_STRING) {\n\t\t\tif (totype == PyArray_STRING) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t\telse if (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize * sizeof(Py_UNICODE)\\\n\t\t\t\t <= to->itemsize);\n\t\t\t}\n\t\t}\n\t\telse if (fromtype == PyArray_UNICODE) {\n\t\t\tif (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}\n\n\n\n/*********************** Element-wise Array Iterator ***********************/\n/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/\n/* and Python's array iterator ***/\n \n\nstatic PyObject *\nPyArray_IterNew(PyObject *obj)\n{\n PyArrayIterObject *it;\n\tint i, nd; \n\tPyArrayObject *ao = (PyArrayObject *)obj;\n\n if (!PyArray_Check(ao)) {\n PyErr_BadInternalCall();\n return NULL;\n }\n\n it = PyObject_GC_New(PyArrayIterObject, &PyArrayIter_Type);\n if (it == NULL)\n return NULL;\n\n\tnd = ao->nd;\n\tPyArray_UpdateFlags(ao, CONTIGUOUS);\n\tit->contiguous = 0;\n\tif PyArray_ISCONTIGUOUS(ao) it->contiguous = 1;\n Py_INCREF(ao);\n it->ao = ao;\n\tit->size = PyArray_SIZE(ao);\n\tit->nd_m1 = nd - 1;\n\tit->factors[nd-1] = 1;\n\tfor (i=0; i < nd; i++) {\n\t\tit->dims_m1[i] = it->ao->dimensions[i] - 1;\n\t\tit->strides[i] = it->ao->strides[i];\n\t\tit->backstrides[i] = it->strides[i] *\t\\\n\t\t\tit->dims_m1[i];\n\t\tif (i > 0)\n\t\t\tit->factors[nd-i-1] = it->factors[nd-i] *\t\\\n\t\t\t\tit->ao->dimensions[nd-i];\n\t}\n\tPyArray_ITER_RESET(it);\n\t\n PyObject_GC_Track(it);\n return (PyObject *)it;\n}\n\n/* Returns an array scalar holding the element desired */\n\nstatic PyObject *\narrayiter_next(PyArrayIterObject *it)\n{\n\tPyObject *ret;\n\n\tif (it->index < it->size) {\n\t\tret = PyArray_ToScalar(it->dataptr, it->ao);\n\t\tPyArray_ITER_NEXT(it);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narrayiter_dealloc(PyArrayIterObject *it)\n{\n PyObject_GC_UnTrack(it);\n Py_XDECREF(it->ao);\n PyObject_GC_Del(it);\n }\n\nstatic int\narrayiter_traverse(PyArrayIterObject *it, visitproc visit, void *arg)\n{\n if (it->ao != NULL)\n return visit((PyObject *)(it->ao), arg);\n return 0;\n}\n\n\nstatic int\niter_length(PyArrayIterObject *self) \n{\n return (int) self->size;\n}\n\n\nstatic PyObject *\niter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tint index, strides, itemsize;\n\tintp count=0;\n\tchar *dptr, *optr;\n\tPyObject *r;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn NULL;\n\t}\n\tindex = (ind->dimensions[0]);\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\t/* Get size of return array */\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0)\n\t\t\tcount++;\n\t\tdptr += strides;\n\t}\n\titemsize = self->ao->itemsize;\n\tr = PyArray_New(self->ao->ob_type, 1, &count, \n\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\titemsize, 0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\t/* Set up loop */\n\toptr = PyArray_DATA(r);\n\tindex = ind->dimensions[0];\n\tdptr = ind->data;\n\n copyswap = self->ao->descr->copyswap;\n\t/* Loop over Boolean array */\n\tswap = !(PyArray_ISNOTSWAPPED(self->ao));\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\t\toptr += itemsize;\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\nstatic PyObject *\niter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tintp num;\n\tPyObject *r;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint swap;\n\tchar *optr;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = self->ao->itemsize;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t}\n\t\n\tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n\t\t\tself->ao->descr->type_num, NULL, \n\t\t\tNULL, self->ao->itemsize, \n\t\t\t0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\toptr = PyArray_DATA(r);\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) {Py_DECREF(r); return NULL;}\n\tindex = ind_it->size;\n copyswap = PyArray_DESCR(r)->copyswap;\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif (num < 0 || num >= self->size) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\tPy_DECREF(r);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\toptr += itemsize;\n\t\tPyArray_ITER_NEXT(ind_it);\n\t}\n\tPy_DECREF(ind_it);\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\n\nstatic PyObject *\niter_subscript(PyArrayIterObject *self, PyObject *ind)\n{\n\tint i;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *r;\n\tchar *dptr;\n\tint size;\n\tPyObject *obj = NULL;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\t\t\n\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\tobj = iter_subscript(self, ind);\n\t\tPy_DECREF(ind);\n\t\treturn obj;\n\t}\n\n\t/* Tuples not accepted --- i.e. no NewAxis */\n\t/* Could implement this with adjusted strides\n\t and dimensions in iterator */\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\tPyArray_ITER_RESET(self);\n\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n\t\t\treturn PyArray_ToScalar(self->dataptr, self->ao);\n\t\t}\n\t\telse { /* empty array */\n\t\t\tintp ii = 0;\n\t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n\t\t\t\t\tself->ao->descr->type_num, NULL, \n\t\t\t\t\tNULL, self->ao->itemsize, 0,\n\t\t\t\t\t(PyObject *)self->ao);\n\t\t\treturn r;\t\t\t\n\t\t}\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) \n\t\t\tgoto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start)\n\t\tif (n_steps == SingleIndex) { /* Integer */\n\t\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn r;\n\t\t}\n\t\tsize = self->ao->itemsize;\n\t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n\t\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\t\tsize, 0, (PyObject *)self->ao);\n\t\tif (r==NULL) goto fail; \n\t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n copyswap = PyArray_DESCR(r)->copyswap;\n\t\twhile(n_steps--) {\n copyswap(dptr, self->dataptr, swap, size);\n\t\t\tfor(i=0; i< step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tdptr += size;\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer) || PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tr = iter_subscript_Bool(self, (PyArrayObject *)obj);\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tobj = new;\n\t\t\tr = iter_subscript_int(self, (PyArrayObject *)obj);\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"unsupported iterator index\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPy_DECREF(obj);\n\t\treturn r;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\n fail:\n\tPy_XDECREF(obj);\n\treturn NULL;\n\n}\n\n\nstatic int\niter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tint index, strides, itemsize;\n\tchar *dptr;\n PyArray_CopySwapFunc *copyswap;\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn -1;\n\t}\n\titemsize = self->ao->itemsize;\n\tindex = ind->dimensions[0];\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\tPyArray_ITER_RESET(self);\n\t/* Loop over Boolean array */\n copyswap = self->ao->descr->copyswap;\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(self->dataptr, val->dataptr, swap,\n itemsize);\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index==val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn 0;\n}\n\nstatic int\niter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tPyArray_Typecode typecode;\n\tintp num;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = typecode.itemsize = self->ao->itemsize;\n\ttypecode.type_num = self->ao->descr->type_num;\n copyswap = self->ao->descr->copyswap;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\treturn 0;\n\t}\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) return -1;\n\tindex = ind_it->size;\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif ((num < 0) || (num >= self->size)) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\treturn -1;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\tPyArray_ITER_NEXT(ind_it);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index == val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPy_DECREF(ind_it);\n\treturn 0;\n}\n\n\nstatic int\niter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) \n{\n\tint i;\n\tPyObject *arrval=NULL;\n\tPyArrayIterObject *val_it=NULL;\n\tPyArray_Typecode type;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint swap;\n\tint itemsize;\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *obj;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\ti = iter_ass_subscript(self, ind, val);\n\t\tPy_DECREF(ind);\n\t\treturn i;\n\t}\n\t\n\ttype.type_num = self->ao->descr->type_num;\n\titemsize = type.itemsize = self->ao->itemsize;\n\t\n\tarrval = PyArray_FromAny(val, &type, 0, 0, 0);\n\tif (arrval==NULL) return -1;\n\tval_it = (PyArrayIterObject *)PyArray_IterNew(arrval);\n\tif (val_it==NULL) goto fail;\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\n copyswap = PyArray_DESCR(arrval)->copyswap;\n\tswap = (PyArray_ISNOTSWAPPED(self->ao)!=PyArray_ISNOTSWAPPED(arrval));\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n copyswap(self->dataptr, PyArray_DATA(arrval), \n swap, itemsize);\n\t\t}\n\t\tgoto succeed;\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) goto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start);\n\t\tif (n_steps == SingleIndex) { /* Integer */\n copyswap(self->dataptr, PyArray_DATA(arrval),\n swap, itemsize);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\tgoto succeed;\n\t\t}\n\t\twhile(n_steps--) {\n copyswap(self->dataptr, val_it->dataptr,\n swap, itemsize);\n\t\t\tfor(i=0; i < step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tPyArray_ITER_NEXT(val_it);\n\t\t\tif (val_it->index == val_it->size) \n\t\t\t\tPyArray_ITER_RESET(val_it);\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\tgoto succeed;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer))\n\t\tobj = PyArray_FromScalar(ind, &indtype);\n\telse if (PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tif (iter_ass_sub_Bool(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tPy_DECREF(obj);\n\t\t\tobj = new;\n\t\t\tif (iter_ass_sub_int(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t}\n\t\telse goto fail;\n\t\tPy_DECREF(obj);\n\t\tgoto succeed;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\tgoto fail;\n\n succeed:\n\tPy_DECREF(val_it);\n\tPy_DECREF(arrval);\n\treturn 0;\n\n fail:\n\tPy_XDECREF(val_it);\n\tPy_XDECREF(arrval);\n\treturn -1;\n\t\n}\n\n\nstatic PyMappingMethods iter_as_mapping = {\n (inquiry)iter_length,\t\t /*mp_length*/\n (binaryfunc)iter_subscript,\t /*mp_subscript*/\n (objobjargproc)iter_ass_subscript,\t/*mp_ass_subscript*/\n};\n\nstatic char doc_iter_array[] = \"__array__(type=None)\\n Get array \"\\\n \"from iterator\";\n\nstatic PyObject *\niter_array(PyArrayIterObject *it, PyObject *op) \n{\n \n PyObject *r;\n intp size;\n\n /* Any argument ignored */\n\n /* Two options: \n 1) underlying array is contiguous\n -- return 1-d wrapper around it \n 2) underlying array is not contiguous\n -- make new 1-d contiguous array with updateifcopy flag set\n to copy back to the old array\n */\n\n size = PyArray_SIZE(it->ao);\n if (PyArray_ISCONTIGUOUS(it->ao)) {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n\t\t\t\tit->ao->flags,\n (PyObject *)it->ao); \n\t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, NULL, it->ao->itemsize, 0, \n (PyObject *)it->ao);\n\t\tif (r==NULL) return NULL;\n\t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n\t\t\tPy_DECREF(r); \n\t\t\treturn NULL;\n\t\t}\n PyArray_FLAGS(r) |= UPDATEIFCOPY;\n it->ao->flags &= ~WRITEABLE;\n }\n Py_INCREF(it->ao);\n PyArray_BASE(r) = (PyObject *)it->ao;\n return r;\n \n}\n\nstatic char doc_iter_copy[] = \"copy()\\n Get a copy of 1-d array\";\n\nstatic PyObject *\niter_copy(PyArrayIterObject *it, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\t\n\treturn PyArray_Flatten(it->ao, 0);\n}\n\nstatic PyMethodDef iter_methods[] = {\n /* to get array */\n {\"__array__\", (PyCFunction)iter_array, 1, doc_iter_array},\n\t{\"copy\", (PyCFunction)iter_copy, 1, doc_iter_copy},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\nstatic PyTypeObject PyArrayIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.flatiter\",\t\t /* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arrayiter_dealloc,\t\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0, \t\t\t /* tp_as_sequence */\n &iter_as_mapping, \t /* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0,\t \t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arrayiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arrayiter_next,\t\t/* tp_iternext */\n iter_methods,\t\t\t\t/* tp_methods */\n};\n\n/** END of Array Iterator **/\n\n\n\n/*********************** Subscript Array Iterator *************************\n * *\n * This object handles subscript behavior for array objects. *\n * It is an iterator object with a next method *\n * It abstracts the n-dimensional mapping behavior to make the looping *\n * code more understandable (maybe) *\n * and so that indexing can be set up ahead of time *\n */ \n\n/* This checks the args for any fancy indexing objects */\n\n#define SOBJ_NOTFANCY 0 \n#define SOBJ_ISFANCY 1\n#define SOBJ_BADARRAY 2\n#define SOBJ_TOOMANY 3\n#define SOBJ_LISTTUP 4\n\nstatic int\nfancy_indexing_check(PyObject *args)\n{\n\tint i, n;\n\tPyObject *obj;\n\tint retval = SOBJ_NOTFANCY;\n\n\tif (PyTuple_Check(args)) {\n\t\tn = PyTuple_GET_SIZE(args);\n\t\tif (n >= MAX_DIMS) return SOBJ_TOOMANY;\n\t\tfor (i=0; i=MAX_DIMS) return SOBJ_ISFANCY;\n\t\tfor (i=0; i SOBJ_ISFANCY) return retval;\n\t\t}\n\t}\n\n\treturn retval;\n}\n\n/* convert an indexing object to an INTP indexing array iterator\n if possible -- otherwise, it is a Slice or Ellipsis object\n and has to be interpreted on bind to a particular \n array so leave it NULL for now.\n */\nstatic int\n_convert_obj(PyObject *obj, PyArrayIterObject **iter)\n{\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tPyObject *arr;\n\n\tif (PySlice_Check(obj) || (obj == Py_Ellipsis))\n\t\t*iter = NULL;\n\telse {\n\t\tarr = PyArray_FromAny(obj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) return -1;\n\t\t*iter = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (*iter == NULL) return -1;\n\t}\n\treturn 0;\n}\n\n/* Adjust dimensionality and strides for index object iterators \n --- i.e. broadcast\n */\nstatic int\nPyArray_Broadcast(PyArrayMultiIterObject *mit)\n{\n\tint i, nd, k, j;\n\tintp tmp;\n\tPyArrayIterObject *it;\n\t\n\t/* Discover the broadcast number of dimensions */\n\tfor (i=0, nd=0; inumiter; i++) \n\t\tnd = MAX(nd, mit->iters[i]->ao->nd);\n\tmit->nd = nd;\n\n\t/* Discover the broadcast shape in each dimension */\n\tfor (i=0; idimensions[i] = 1;\n\t\tfor (j=0; jnumiter; j++) {\n\t\t\tit = mit->iters[j];\n\t\t\t/* This prepends 1 to shapes not already \n\t\t\t equal to nd */\n\t\t\tk = i + it->ao->nd - nd;\n\t\t\tif (k>=0) {\n\t\t\t\ttmp = it->ao->dimensions[k];\n\t\t\t\tif (tmp == 1) continue;\n\t\t\t\tif (mit->dimensions[i] == 1) \n\t\t\t\t\tmit->dimensions[i] = tmp;\n\t\t\t\telse if (mit->dimensions[i] != tmp) {\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\t\"index objects are \" \\\n\t\t\t\t\t\t\t\"not broadcastable \" \\\n\t\t\t\t\t\t\t\"to a single shape.\");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Reset the iterator dimensions and strides of each iterator\n\t object -- using 0 valued strides for broadcasting */\n\n\ttmp = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tmit->size = tmp;\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tit->nd_m1 = mit->nd - 1;\n\t\tit->size = tmp;\n\t\tnd = it->ao->nd;\n\t\tit->factors[mit->nd-1] = 1;\n\t\tfor (j=0; j < mit->nd; j++) {\n\t\t\tit->dims_m1[j] = mit->dimensions[j] - 1;\n\t\t\tk = j + nd - mit->nd;\n\t\t\t/* If this dimension was added or shape\n\t\t\t of underlying array was 1 */\n\t\t\tif ((k < 0) || \\\n\t\t\t it->ao->dimensions[k] != mit->dimensions[j]) {\n\t\t\t\tit->contiguous = 0;\n\t\t\t\tit->strides[j] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tit->strides[j] = it->ao->strides[k];\n\t\t\t}\n\t\t\tit->backstrides[j] = it->strides[j] *\t\\\n\t\t\t\tit->dims_m1[j];\n\t\t\tif (j > 0)\n\t\t\t\tit->factors[mit->nd-j-1] =\t\t\\\n\t\t\t\t\tit->factors[mit->nd-j] *\t\\\n\t\t\t\t\tmit->dimensions[mit->nd-j];\n\t\t}\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn 0;\n}\n\n/* Reset the map iterator to the beginning */\nstatic void\nPyArray_MapIterReset(PyArrayMapIterObject *mit)\n{\n\tint i,j; intp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index = 0;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\n\tif (mit->subspace != NULL) {\n\t\tmemcpy(coord, mit->bscoord, sizeof(intp)*mit->ait->ao->nd);\n\t\tPyArray_ITER_RESET(mit->subspace);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tj = mit->iteraxes[i];\n\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* This function needs to update the state of the map iterator\n and point mit->dataptr to the memory-location of the next object\n*/\nstatic void\nPyArray_MapIterNext(PyArrayMapIterObject *mit)\n{\n\tint i, j;\n\tintp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index += 1;\n\tif (mit->index >= mit->size) return;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\t/* Sub-space iteration */\n\tif (mit->subspace != NULL) {\n\t\tPyArray_ITER_NEXT(mit->subspace);\n\t\tif (mit->subspace->index == mit->subspace->size) {\n\t\t\t/* reset coord to coordinates of \n\t\t\t beginning of the subspace */\n\t\t\tmemcpy(coord, mit->bscoord, \n\t\t\t sizeof(intp)*mit->ait->ao->nd);\n\t\t\tPyArray_ITER_RESET(mit->subspace);\n\t\t\tfor (i=0; inumiter; i++) {\n\t\t\t\tit = mit->iters[i];\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t\tj = mit->iteraxes[i];\n\t\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t\t sizeof(intp));\n\t\t\t}\n\t\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\t}\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* Bind a mapiteration to a particular array */\n\n/* Determine if subspace iteration is necessary. If so, \n 1) Fill in mit->iteraxes\n\t 2) Create subspace iterator\n\t 3) Update nd, dimensions, and size. \n\n Subspace iteration is necessary if: arr->nd > mit->numiter\n*/\n\n/* Need to check for index-errors somewhere. \n\n Let's do it at bind time and also convert all <0 values to >0 here\n as well. \n*/\nstatic void\nPyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n{\n\tint subnd;\n\tPyObject *sub=NULL, *obj=NULL;\n\tint i, j, n, curraxis, ellipexp, noellip;\n\tPyArrayIterObject *it;\n\tintp dimsize;\n\tintp *indptr;\n\n\t/* Remove old binding if any */\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\n\tPy_XDECREF(mit->subspace);\n\tmit->subspace = NULL;\n\t\n\tsubnd = arr->nd - mit->numiter;\n\tif (subnd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Too many indices for array.\");\n\t\treturn;\n\t}\n\n\tmit->ait = (PyArrayIterObject *)PyArray_IterNew((PyObject *)arr);\n\tif (mit->ait == NULL) return;\n\n\t/* If this is just a view, then do nothing more */\n\t/* views are handled by just adjusting the strides\n\t and dimensions of the object.\n\t*/\n\t \n\tif (mit->view) return;\n\n\t/* no subspace iteration needed. Return */\n\tif (subnd == 0) {\n\t\tn = arr->nd;\n\t\tfor (i=0; iiteraxes[i] = i;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\t/* all indexing arrays have been converted to 0 \n\t therefore we can extract the subspace with a simple\n\t getitem call which will use view semantics\n\t*/\n\t\n\tsub = PyObject_GetItem((PyObject *)arr, mit->indexobj);\n\tif (sub == NULL) goto fail;\n\tmit->subspace = (PyArrayIterObject *)PyArray_IterNew(sub);\n\tif (mit->subspace == NULL) goto fail;\n\tPy_DECREF(sub);\n\n\t/* Expand dimensions of result */\n\tn = mit->subspace->ao->nd;\n\tfor (i=0; idimensions[mit->nd+i] = mit->subspace->ao->dimensions[i];\n\tmit->nd += n;\n\n\t/* Now, we still need to interpret the ellipsis and slice objects \n\t to determine which axes the indexing arrays are referring to\n\t*/\n\tn = PyTuple_GET_SIZE(mit->indexobj);\n\n\t/* The number of dimensions an ellipsis takes up */\n\tellipexp = arr->nd - n + 1;\n\t/* Now fill in iteraxes -- remember indexing arrays have been \n converted to 0's in mit->indexobj */\n\tcurraxis = 0;\n\tj = 0;\n\tnoellip = 1; /* Only expand the first ellipsis */\n\tmemset(mit->bscoord, '\\0', sizeof(intp)*arr->nd);\n\tfor (i=0; iindexobj, i);\n\t\tif (PyInt_Check(obj) || PyLong_Check(obj)) \n\t\t\tmit->iteraxes[j++] = curraxis++;\n\t\telse if (noellip && obj == Py_Ellipsis) {\n\t\t\tcurraxis += ellipexp;\n\t\t\tnoellip = 0;\n\t\t}\n\t\telse {\n\t\t\tint start=0;\n\t\t\tint stop, step;\n\t\t\t/* Should be slice object or\n\t\t\t another Ellipsis */\n\t\t\tif (obj == Py_Ellipsis) {\n\t\t\t\tmit->bscoord[curraxis] = 0;\n\t\t\t}\n\t\t\telse if (!PySlice_Check(obj) || \\\n\t\t\t\t (slice_GetIndices((PySliceObject *)obj, \n\t\t\t\t\t\t arr->dimensions[curraxis],\n\t\t\t\t\t\t &start, &stop, &step,\n\t\t\t\t\t\t &dimsize) < 0)) {\n\t\t\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t\t\t \"unexpected object \"\t\\\n\t\t\t\t\t \"(%s) in selection position %d\",\n\t\t\t\t\t obj->ob_type->tp_name, i);\n\t\t\t goto fail;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmit->bscoord[curraxis] = start;\n\t\t\t}\n\t\t\tcurraxis += 1; \n\t\t}\n\t}\n finish:\n\t/* Here check the indexes (now that we have iteraxes) */\n\tmit->size = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tPyArray_ITER_RESET(it);\n\t\tdimsize = arr->dimensions[mit->iteraxes[i]];\n\t\twhile(it->index < it->size) {\n\t\t\tindptr = ((intp *)it->dataptr);\n\t\t\tif (*indptr < 0) *indptr += dimsize;\n\t\t\tif (*indptr < 0 || *indptr >= dimsize) {\n\t\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t\t \"index (%d) out of range \"\\\n\t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n\t\t\t\t\t *indptr, dimsize-1, \n\t\t\t\t\t mit->iteraxes[i]);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn;\n\n fail:\n\tPy_XDECREF(sub);\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\treturn;\n}\n\n/* This function takes a Boolean array and constructs index objects and\n iterators as if nonzero(Bool) had been called\n*/\nstatic int\n_nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)\n{\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\tPyArrayObject *ba =NULL, *new=NULL;\n\tint nd, j;\n\tintp size, i, count;\n\tBool *ptr;\n\tintp coords[MAX_DIMS], dims_m1[MAX_DIMS];\n\tintp *dptr[MAX_DIMS];\n\n\tba = (PyArrayObject *)PyArray_FromAny(myBool, &typecode, 0, 0, \n\t\t\t\t\t CARRAY_FLAGS);\n\tif (ba == NULL) return -1;\n\tnd = ba->nd;\n\tfor (j=0; jdata;\n\tcount = 0;\n\n\t/* pre-determine how many nonzero entries there are */\n\tfor (i=0; iao->data;\n\t\tcoords[j] = 0;\n\t\tdims_m1[j] = ba->dimensions[j]-1;\n\t}\n\n\tptr = (Bool *)ba->data;\n\n\tif (count == 0) return nd;\n\n\t/* Loop through the Boolean array and copy coordinates\n\t for non-zero entries */\n\tfor (i=0; i=0; j--) {\n\t\t\tif (coords[j] < dims_m1[j]) {\n\t\t\t\tcoords[j]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcoords[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn nd;\n\n fail:\n\tfor (j=0; jiters[i] = NULL;\n \tmit->view = 0;\n \tmit->index = 0;\n \tmit->ait = NULL;\n \tmit->subspace = NULL;\n\tmit->numiter = 0;\n\tmit->consec = 1;\n\tfancy = fancy_indexing_check(indexobj);\n\tPy_INCREF(indexobj);\n\tmit->indexobj = indexobj;\n\tif (fancy == SOBJ_NOTFANCY) { /* bail out */\n\t\tmit->view = 1;\n\t\tgoto ret;\n\t}\n\n\tif (fancy == SOBJ_BADARRAY) {\n\t\tPyErr_SetString(PyExc_TypeError,\t\t\t\\\n\t\t\t\t\"Arrays used as indexes must be of \" \\\n\t\t\t\t\"integer type\");\n\t\tgoto fail;\n\t}\n\tif (fancy == SOBJ_TOOMANY) {\n\t\tPyErr_SetString(PyExc_TypeError,\"Too many indicies\");\n\t\tgoto fail;\n\t}\n\n\tif (fancy == SOBJ_LISTTUP) {\n\t\tPyObject *newobj;\n\t\tnewobj = PySequence_Tuple(indexobj);\n\t\tif (newobj == NULL) goto fail;\n\t\tPy_DECREF(indexobj);\n\t\tindexobj = newobj;\n\t\tmit->indexobj = indexobj;\n\t}\n\n#undef SOBJ_NOTFANCY \n#undef SOBJ_ISFANCY \n#undef SOBJ_BADARRAY \n#undef SOBJ_TOOMANY \n#undef SOBJ_LISTTUP \n\n\n\t/* Must have some kind of fancy indexing if we are here */\n\t/* indexobj is either a list, an arrayobject, or a tuple \n\t (with at least 1 list or arrayobject or Bool object), */\n\t\n\t/* convert all inputs to iterators */\n\tif (PyArray_Check(indexobj) &&\t\t\t\\\n\t (PyArray_TYPE(indexobj) == PyArray_BOOL)) {\n\t\tmit->numiter = _nonzero_indices(indexobj, mit->iters);\n\t\tif (mit->numiter < 0) goto fail;\n\t\tmit->nd = 1;\n\t\tmit->dimensions[0] = mit->iters[0]->dims_m1[0]+1;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = PyTuple_New(mit->numiter);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tPyTuple_SET_ITEM(mit->indexobj, i, \n\t\t\t\t\t PyInt_FromLong(0));\n\t\t}\n\t}\n\n\telse if (PyList_Check(indexobj) || PyArray_Check(indexobj)) {\n\t\tmit->numiter = 1;\n\t\tarr = PyArray_FromAny(indexobj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) goto fail;\n\t\tmit->iters[0] = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (mit->iters[0] == NULL) goto fail;\n\t\tmit->nd = PyArray_NDIM(arr);\n\t\tmemcpy(mit->dimensions,PyArray_DIMS(arr),mit->nd*sizeof(intp));\n\t\tmit->size = PyArray_SIZE(arr);\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = Py_BuildValue(\"(N)\", PyInt_FromLong(0));\n\t}\n\telse { /* must be a tuple */\n\t\tPyObject *obj;\n\t\tPyArrayIterObject *iter;\n\t\tPyObject *new;\n\t\t/* Make a copy of the tuple -- we will be replacing \n\t\t index objects with 0's */\n\t\tn = PyTuple_GET_SIZE(indexobj);\n\t\tnew = PyTuple_New(n);\n\t\tif (new == NULL) goto fail;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = new;\n\t\tstarted = 0;\n\t\tnonindex = 0;\n\t\tfor (i=0; iconsec = 0;\n\t\t\t\tmit->iters[(mit->numiter)++] = iter;\n\t\t\t\tPyTuple_SET_ITEM(new,i,\n\t\t\t\t\t\t PyInt_FromLong(0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (started) nonindex = 1;\n\t\t\t\tPy_INCREF(obj);\n\t\t\t\tPyTuple_SET_ITEM(new,i,obj);\n\t\t\t}\n\t\t}\n\t\t/* Store the number of iterators actually converted */\n\t\t/* These will be mapped to actual axes at bind time */\n\t\tif (PyArray_Broadcast((PyArrayMultiIterObject *)mit) < 0)\n\t\t\tgoto fail;\n\t}\n\n ret:\n PyObject_GC_Track(mit);\n return (PyObject *)mit;\n \n fail:\n\tPy_XDECREF(arr);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n\treturn NULL;\n}\n\n\n/* return unbound mapiter object */\n\nstatic PyObject *\narraymapiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) \n{\n\tPyObject *newtup, *res;\n\tint n;\n\n\tif (!PyTuple_Check(args)) {\n\t\tPyErr_BadInternalCall();\n\t\treturn NULL;\n\t}\n\n\tn = PyTuple_GET_SIZE(args);\n\t\n\tif (n < 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"must be initialized with >= 1 argument\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n > 1) {\n\t\tnewtup = PyTuple_GetSlice(args, 0, n);\n\t\tif (newtup == NULL) return NULL;\n\t\tres = PyArray_MapIterNew(newtup);\n\t\tPy_DECREF(newtup);\n\t}\n\telse { /* n == 1 */\n\t\tnewtup = PyTuple_GET_ITEM(args, 0);\n\t\tres = PyArray_MapIterNew(newtup);\n\t}\n\n\treturn res; \t\n}\n\n\n/* Returns a 0-dim array holding the element desired */\n\nstatic PyObject *\narraymapiter_next(PyArrayMapIterObject *mit)\n{\n\tPyObject *ret;\n\tif (mit->ait == NULL) return NULL;\n\tif (mit->view) return NULL;\n\tif (mit->index < mit->size) {\n\t\tret = PyArray_ToScalar(mit->dataptr, mit->ait->ao);\n\t\tPyArray_MapIterNext(mit);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narraymapiter_dealloc(PyArrayMapIterObject *mit)\n{\n\tint i;\n PyObject_GC_UnTrack(mit);\n Py_XDECREF(mit->ait);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n}\n\nstatic int\narraymapiter_traverse(PyArrayMapIterObject *mit, visitproc visit, void *arg)\n{\n\tint ret, i;\n if (mit->ait != NULL)\n if ((ret = visit((PyObject *)(mit->ait), arg)) != 0) \n\t\t\treturn ret;\t\n\n\tif (mit->iters != NULL) \n\t\tfor (i=0; inumiter; i++) \n\t\t\tif (mit->iters[i] != NULL) \n\t\t\t\tif ((ret=visit((PyObject *)mit->iters[i], \n\t\t\t\t\t arg)) != 0)\n\t\t\t\t\treturn ret;\n\n\tif (mit->indexobj != NULL)\n\t\tif ((ret = visit(mit->indexobj, arg)) != 0) return ret;\n\t\n return 0;\n}\n\n/* \nstatic char doc_mapiter_bind[] = \"obj.bind(a)\\n Bind an array to the \"\\\n\t\"mapiter object\";\n\nstatic PyObject *\nmapiter_bind(PyArrayMapIterObject *mit, PyObject *args)\n{\n\tPyObject *r;\n intp size, strides;\n int nd;\n\tPyArrayObject *arr;\n\n if (!PyArg_ParseTuple(args, \"O!\", &PyArray_Type, &arr)) return NULL;\n\n\tPyArray_MapIterBind(mit, arr);\n\n\tif (mit->ait == NULL) return NULL;\n\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyMethodDef mapiter_methods[] = {\n\t{\"bind\", (PyCFunction)mapiter_bind, 1, doc_mapiter_bind},\n {NULL,\t\tNULL}\t\t\n};\n*/\n\n\nstatic PyTypeObject PyArrayMapIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.mapiter\",\t\t \t/* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arraymapiter_dealloc,\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0,\t\t\t\t\t/* tp_as_sequence */\n 0,\t\t\t\t\t/* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0, \t\t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arraymapiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arraymapiter_next,\t/* tp_iternext */\n 0,\t \t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n 0,\t\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0, \t /* tp_alloc */\n (newfunc)arraymapiter_new,\t /* tp_new */\n 0,\t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n\n};\n\n/** END of Subscript Iterator **/\n\n\n\n", "methods": [ { "name": "PyArray_PyIntAsIntp", "long_name": "PyArray_PyIntAsIntp( PyObject * o)", "filename": "arrayobject.c", "nloc": 59, "complexity": 19, "token_count": 385, "parameters": [ "o" ], "start_line": 40, "end_line": 103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "PyArray_PyIntAsInt", "long_name": "PyArray_PyIntAsInt( PyObject * o)", "filename": "arrayobject.c", "nloc": 57, "complexity": 19, "token_count": 389, "parameters": [ "o" ], "start_line": 109, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 86, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 191, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "PyArray_Zero", "long_name": "PyArray_Zero( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 190, "parameters": [ "arr" ], "start_line": 208, "end_line": 243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_One", "long_name": "PyArray_One( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 40, "complexity": 7, "token_count": 222, "parameters": [ "arr" ], "start_line": 246, "end_line": 289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "do_sliced_copy", "long_name": "do_sliced_copy( char * dest , intp * dest_strides , intp * dest_dimensions , int dest_nd , char * src , intp * src_strides , intp * src_dimensions , int src_nd , int elsize , int copies)", "filename": "arrayobject.c", "nloc": 48, "complexity": 13, "token_count": 313, "parameters": [ "dest", "dest_strides", "dest_dimensions", "dest_nd", "src", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 295, "end_line": 345, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "optimize_slices", "long_name": "optimize_slices( intp ** dest_strides , intp ** dest_dimensions , int * dest_nd , intp ** src_strides , intp ** src_dimensions , int * src_nd , int * elsize , int * copies)", "filename": "arrayobject.c", "nloc": 32, "complexity": 8, "token_count": 214, "parameters": [ "dest_strides", "dest_dimensions", "dest_nd", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 368, "end_line": 399, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 402, "end_line": 436, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_INCREF", "long_name": "PyArray_INCREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 449, "end_line": 471, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_XDECREF", "long_name": "PyArray_XDECREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 474, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "byte_swap_vector", "long_name": "byte_swap_vector( * p , int n , int size)", "filename": "arrayobject.c", "nloc": 38, "complexity": 10, "token_count": 340, "parameters": [ "p", "n", "size" ], "start_line": 499, "end_line": 537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "copy_and_swap", "long_name": "copy_and_swap( * dst , * src , int itemsize , intp numitems , intp srcstrides , int swap)", "filename": "arrayobject.c", "nloc": 18, "complexity": 5, "token_count": 120, "parameters": [ "dst", "src", "itemsize", "numitems", "srcstrides", "swap" ], "start_line": 542, "end_line": 562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "index2ptr", "long_name": "index2ptr( PyArrayObject * mp , int i)", "filename": "arrayobject.c", "nloc": 10, "complexity": 7, "token_count": 86, "parameters": [ "mp", "i" ], "start_line": 570, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Size", "long_name": "PyArray_Size( PyObject * op)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 33, "parameters": [ "op" ], "start_line": 583, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_CopyInto", "long_name": "PyArray_CopyInto( PyArrayObject * dest , PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 71, "complexity": 16, "token_count": 425, "parameters": [ "dest", "src" ], "start_line": 604, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 16, "complexity": 2, "token_count": 98, "parameters": [ "dest", "src_object" ], "start_line": 688, "end_line": 707, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndDataAndDescr", "long_name": "PyArray_FromDimsAndDataAndDescr( int nd , int * d , PyArray_Descr * descr , char * data)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 144, "parameters": [ "nd", "d", "descr", "data" ], "start_line": 715, "end_line": 736, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 5, "token_count": 137, "parameters": [ "nd", "d", "type", "data" ], "start_line": 740, "end_line": 760, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 5, "token_count": 133, "parameters": [ "nd", "d", "type" ], "start_line": 764, "end_line": 781, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 77, "parameters": [ "m1" ], "start_line": 787, "end_line": 799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_Scalar", "long_name": "PyArray_Scalar( char * data , int type_num , int itemsize , int swap)", "filename": "arrayobject.c", "nloc": 48, "complexity": 8, "token_count": 289, "parameters": [ "data", "type_num", "itemsize", "swap" ], "start_line": 805, "end_line": 854, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyArray_ToScalar", "long_name": "PyArray_ToScalar( char * data , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 51, "parameters": [ "data", "arr" ], "start_line": 861, "end_line": 868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_Return", "long_name": "PyArray_Return( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 85, "parameters": [ "mp" ], "start_line": 874, "end_line": 893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 31, "complexity": 6, "token_count": 177, "parameters": [ "type" ], "start_line": 904, "end_line": 936, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 946, "end_line": 989, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 87, "complexity": 16, "token_count": 571, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 993, "end_line": 1082, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "PyArray_ToList", "long_name": "PyArray_ToList( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 24, "complexity": 5, "token_count": 151, "parameters": [ "self" ], "start_line": 1085, "end_line": 1113, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_ToString", "long_name": "PyArray_ToString( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 191, "parameters": [ "self" ], "start_line": 1116, "end_line": 1151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_dealloc", "long_name": "array_dealloc( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 20, "complexity": 7, "token_count": 144, "parameters": [ "self" ], "start_line": 1160, "end_line": 1197, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_length", "long_name": "array_length( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 1204, "end_line": 1212, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 150, "parameters": [ "self", "i" ], "start_line": 1216, "end_line": 1240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_item_nice", "long_name": "array_item_nice( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "i" ], "start_line": 1243, "end_line": 1246, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_ass_item", "long_name": "array_ass_item( PyArrayObject * self , int i , PyObject * v)", "filename": "arrayobject.c", "nloc": 27, "complexity": 8, "token_count": 177, "parameters": [ "self", "i", "v" ], "start_line": 1250, "end_line": 1280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "slice_coerce_index", "long_name": "slice_coerce_index( PyObject * o , int * v)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "o", "v" ], "start_line": 1284, "end_line": 1292, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "slice_GetIndices", "long_name": "slice_GetIndices( PySliceObject * r , int length , int * start , int * stop , int * step , intp * slicelength)", "filename": "arrayobject.c", "nloc": 45, "complexity": 24, "token_count": 376, "parameters": [ "r", "length", "start", "stop", "step", "slicelength" ], "start_line": 1298, "end_line": 1348, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "parse_subindex", "long_name": "parse_subindex( PyObject * op , int * step_size , intp * n_steps , int max)", "filename": "arrayobject.c", "nloc": 45, "complexity": 11, "token_count": 223, "parameters": [ "op", "step_size", "n_steps", "max" ], "start_line": 1355, "end_line": 1400, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "parse_index", "long_name": "parse_index( PyArrayObject * self , PyObject * op , intp * dimensions , intp * strides , intp * offset_ptr)", "filename": "arrayobject.c", "nloc": 89, "complexity": 20, "token_count": 540, "parameters": [ "self", "op", "dimensions", "strides", "offset_ptr" ], "start_line": 1404, "end_line": 1499, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "_swap_axes", "long_name": "_swap_axes( PyArrayMapIterObject * mit , PyArrayObject ** ret)", "filename": "arrayobject.c", "nloc": 24, "complexity": 4, "token_count": 187, "parameters": [ "mit", "ret" ], "start_line": 1502, "end_line": 1536, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 252, "parameters": [ "mit" ], "start_line": 1541, "end_line": 1591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "PyArray_SetMap", "long_name": "PyArray_SetMap( PyArrayMapIterObject * mit , PyObject * op)", "filename": "arrayobject.c", "nloc": 50, "complexity": 12, "token_count": 392, "parameters": [ "mit", "op" ], "start_line": 1594, "end_line": 1653, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 425, "parameters": [ "self", "op" ], "start_line": 1674, "end_line": 1749, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "array_ass_sub", "long_name": "array_ass_sub( PyArrayObject * self , PyObject * index , PyObject * op)", "filename": "arrayobject.c", "nloc": 43, "complexity": 9, "token_count": 251, "parameters": [ "self", "index", "op" ], "start_line": 1762, "end_line": 1814, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "array_subscript_nice", "long_name": "array_subscript_nice( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "self", "op" ], "start_line": 1822, "end_line": 1825, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_getsegcount", "long_name": "array_getsegcount( PyArrayObject * self , int * lenp)", "filename": "arrayobject.c", "nloc": 11, "complexity": 4, "token_count": 48, "parameters": [ "self", "lenp" ], "start_line": 1844, "end_line": 1856, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_getreadbuf", "long_name": "array_getreadbuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 72, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1859, "end_line": 1874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_getwritebuf", "long_name": "array_getwritebuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1878, "end_line": 1887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_getcharbuf", "long_name": "array_getcharbuf( PyArrayObject * self , int segment , const char ** ptrptr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 3, "token_count": 65, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1890, "end_line": 1901, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_SetNumericOps", "long_name": "PyArray_SetNumericOps( PyObject * dict)", "filename": "arrayobject.c", "nloc": 34, "complexity": 1, "token_count": 162, "parameters": [ "dict" ], "start_line": 1969, "end_line": 2002, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_GetNumericOps", "long_name": "PyArray_GetNumericOps()", "filename": "arrayobject.c", "nloc": 39, "complexity": 2, "token_count": 183, "parameters": [], "start_line": 2008, "end_line": 2047, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_GenericReduceFunction", "long_name": "PyArray_GenericReduceFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2050, "end_line": 2069, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericAccumulateFunction", "long_name": "PyArray_GenericAccumulateFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2073, "end_line": 2092, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericBinaryFunction", "long_name": "PyArray_GenericBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 69, "parameters": [ "m1", "m2", "op" ], "start_line": 2096, "end_line": 2107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericUnaryFunction", "long_name": "PyArray_GenericUnaryFunction( PyArrayObject * m1 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 63, "parameters": [ "m1", "op" ], "start_line": 2110, "end_line": 2121, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericInplaceBinaryFunction", "long_name": "PyArray_GenericInplaceBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 13, "complexity": 2, "token_count": 71, "parameters": [ "m1", "m2", "op" ], "start_line": 2124, "end_line": 2136, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_add", "long_name": "array_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2139, "end_line": 2142, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_subtract", "long_name": "array_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2145, "end_line": 2148, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_multiply", "long_name": "array_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2151, "end_line": 2154, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_divide", "long_name": "array_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2157, "end_line": 2160, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_remainder", "long_name": "array_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2163, "end_line": 2166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_power", "long_name": "array_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2169, "end_line": 2172, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_negative", "long_name": "array_negative( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2175, "end_line": 2178, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_absolute", "long_name": "array_absolute( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2181, "end_line": 2184, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_invert", "long_name": "array_invert( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2187, "end_line": 2190, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_left_shift", "long_name": "array_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2193, "end_line": 2196, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_right_shift", "long_name": "array_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2199, "end_line": 2202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_and", "long_name": "array_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2205, "end_line": 2208, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_or", "long_name": "array_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2211, "end_line": 2214, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_xor", "long_name": "array_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2217, "end_line": 2220, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_add", "long_name": "array_inplace_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2223, "end_line": 2226, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_subtract", "long_name": "array_inplace_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2229, "end_line": 2232, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_multiply", "long_name": "array_inplace_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2235, "end_line": 2238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_divide", "long_name": "array_inplace_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2241, "end_line": 2244, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_remainder", "long_name": "array_inplace_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2247, "end_line": 2250, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_power", "long_name": "array_inplace_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2253, "end_line": 2256, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_left_shift", "long_name": "array_inplace_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2259, "end_line": 2262, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_right_shift", "long_name": "array_inplace_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2265, "end_line": 2268, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_and", "long_name": "array_inplace_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2271, "end_line": 2274, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_or", "long_name": "array_inplace_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2277, "end_line": 2280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_xor", "long_name": "array_inplace_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2283, "end_line": 2286, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_floor_divide", "long_name": "array_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2289, "end_line": 2292, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_TRUE_divide", "long_name": "array_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2295, "end_line": 2298, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_floor_divide", "long_name": "array_inplace_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2301, "end_line": 2305, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_inplace_TRUE_divide", "long_name": "array_inplace_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2308, "end_line": 2312, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_all_nonzero", "long_name": "array_all_nonzero( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 93, "parameters": [ "mp" ], "start_line": 2316, "end_line": 2334, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_divmod", "long_name": "array_divmod( PyArrayObject * op1 , PyObject * op2)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 89, "parameters": [ "op1", "op2" ], "start_line": 2337, "end_line": 2352, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_int", "long_name": "array_int( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2356, "end_line": 2382, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_float", "long_name": "array_float( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2385, "end_line": 2410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_long", "long_name": "array_long( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2413, "end_line": 2435, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_oct", "long_name": "array_oct( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2438, "end_line": 2460, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_hex", "long_name": "array_hex( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2463, "end_line": 2485, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "_array_copy_nice", "long_name": "_array_copy_nice( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 22, "parameters": [ "self" ], "start_line": 2488, "end_line": 2492, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 258, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2553, "end_line": 2591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_ass_slice", "long_name": "array_ass_slice( PyArrayObject * self , int ilow , int ihigh , PyObject * v)", "filename": "arrayobject.c", "nloc": 20, "complexity": 4, "token_count": 108, "parameters": [ "self", "ilow", "ihigh", "v" ], "start_line": 2595, "end_line": 2616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_contains", "long_name": "array_contains( PyArrayObject * self , PyObject * el)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "el" ], "start_line": 2619, "end_line": 2624, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "dump_data", "long_name": "dump_data( char ** string , int * n , int * max_n , char * data , int nd , intp * dimensions , intp * strides , PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 41, "complexity": 7, "token_count": 308, "parameters": [ "string", "n", "max_n", "data", "nd", "dimensions", "strides", "self" ], "start_line": 2645, "end_line": 2692, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "array_repr_builtin", "long_name": "array_repr_builtin( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 30, "complexity": 4, "token_count": 222, "parameters": [ "self" ], "start_line": 2695, "end_line": 2731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_SetStringFunction", "long_name": "PyArray_SetStringFunction( PyObject * op , int repr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 48, "parameters": [ "op", "repr" ], "start_line": 2737, "end_line": 2754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2757, "end_line": 2769, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2772, "end_line": 2784, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_richcompare", "long_name": "array_richcompare( PyArrayObject * self , PyObject * other , int cmp_op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 13, "token_count": 273, "parameters": [ "self", "other", "cmp_op" ], "start_line": 2788, "end_line": 2865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 78, "top_nesting_level": 0 }, { "name": "_check_axis", "long_name": "_check_axis( PyArrayObject * arr , int * axis , int flags)", "filename": "arrayobject.c", "nloc": 29, "complexity": 8, "token_count": 164, "parameters": [ "arr", "axis", "flags" ], "start_line": 2868, "end_line": 2897, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyArray_IntTupleFromIntp", "long_name": "PyArray_IntTupleFromIntp( int len , intp * vals)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 91, "parameters": [ "len", "vals" ], "start_line": 2903, "end_line": 2919, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_IntpFromSequence", "long_name": "PyArray_IntpFromSequence( PyObject * seq , intp * vals , int maxvals)", "filename": "arrayobject.c", "nloc": 21, "complexity": 7, "token_count": 161, "parameters": [ "seq", "vals", "maxvals" ], "start_line": 2924, "end_line": 2947, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "_IsContiguous", "long_name": "_IsContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 109, "parameters": [ "ap" ], "start_line": 2953, "end_line": 2969, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsFortranContiguous", "long_name": "_IsFortranContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 107, "parameters": [ "ap" ], "start_line": 2973, "end_line": 2989, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsAligned", "long_name": "_IsAligned( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 110, "parameters": [ "ap" ], "start_line": 2993, "end_line": 3009, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsWriteable", "long_name": "_IsWriteable( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 16, "complexity": 8, "token_count": 109, "parameters": [ "ap" ], "start_line": 3012, "end_line": 3045, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_UpdateFlags", "long_name": "PyArray_UpdateFlags( PyArrayObject * ret , int flagmask)", "filename": "arrayobject.c", "nloc": 22, "complexity": 9, "token_count": 129, "parameters": [ "ret", "flagmask" ], "start_line": 3049, "end_line": 3071, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_CheckStrides", "long_name": "PyArray_CheckStrides( int elsize , int nd , intp numbytes , intp * dims , intp * newstrides)", "filename": "arrayobject.c", "nloc": 13, "complexity": 4, "token_count": 84, "parameters": [ "elsize", "nd", "numbytes", "dims", "newstrides" ], "start_line": 3078, "end_line": 3093, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "_array_fill_strides", "long_name": "_array_fill_strides( intp * strides , intp * dims , int nd , intp itemsize , int inflag , int * objflags)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 171, "parameters": [ "strides", "dims", "nd", "itemsize", "inflag", "objflags" ], "start_line": 3113, "end_line": 3137, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 672, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3141, "end_line": 3285, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "PyArray_Resize", "long_name": "PyArray_Resize( PyArrayObject * self , PyArray_Dims * newshape)", "filename": "arrayobject.c", "nloc": 87, "complexity": 15, "token_count": 501, "parameters": [ "self", "newshape" ], "start_line": 3290, "end_line": 3395, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_FillObjectArray", "long_name": "PyArray_FillObjectArray( PyArrayObject * arr , PyObject * obj)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 98, "parameters": [ "arr", "obj" ], "start_line": 3399, "end_line": 3416, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_new", "long_name": "array_new( PyTypeObject * subtype , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 100, "complexity": 20, "token_count": 593, "parameters": [ "subtype", "args", "kwds" ], "start_line": 3420, "end_line": 3535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 116, "top_nesting_level": 0 }, { "name": "array_ndim_get", "long_name": "array_ndim_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 3542, "end_line": 3545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flags_get", "long_name": "array_flags_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 10, "complexity": 3, "token_count": 55, "parameters": [ "self" ], "start_line": 3548, "end_line": 3558, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_shape_get", "long_name": "array_shape_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3631, "end_line": 3634, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_shape_set", "long_name": "array_shape_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 33, "complexity": 6, "token_count": 206, "parameters": [ "self", "val" ], "start_line": 3638, "end_line": 3672, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_strides_get", "long_name": "array_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3676, "end_line": 3679, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_strides_set", "long_name": "array_strides_set( PyArrayObject * self , PyObject * obj)", "filename": "arrayobject.c", "nloc": 32, "complexity": 7, "token_count": 209, "parameters": [ "self", "obj" ], "start_line": 3682, "end_line": 3715, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_protocol_strides_get", "long_name": "array_protocol_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 35, "parameters": [ "self" ], "start_line": 3719, "end_line": 3726, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_priority_get", "long_name": "array_priority_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 3, "token_count": 42, "parameters": [ "self" ], "start_line": 3729, "end_line": 3737, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_data_get", "long_name": "array_data_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 82, "parameters": [ "self" ], "start_line": 3741, "end_line": 3755, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_data_set", "long_name": "array_data_set( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 44, "complexity": 9, "token_count": 229, "parameters": [ "self", "op" ], "start_line": 3758, "end_line": 3802, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "array_itemsize_get", "long_name": "array_itemsize_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 3806, "end_line": 3809, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_size_get", "long_name": "array_size_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "self" ], "start_line": 3812, "end_line": 3819, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typechar_get", "long_name": "array_typechar_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 47, "parameters": [ "self" ], "start_line": 3823, "end_line": 3830, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typestr_get", "long_name": "array_typestr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 7, "token_count": 141, "parameters": [ "self" ], "start_line": 3833, "end_line": 3853, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_descr_get", "long_name": "array_descr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 128, "parameters": [ "self" ], "start_line": 3856, "end_line": 3878, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_typenum_get", "long_name": "array_typenum_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 3881, "end_line": 3884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_get", "long_name": "array_type_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 3888, "end_line": 3891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_set", "long_name": "array_type_set( PyArrayObject * self , PyObject * arg)", "filename": "arrayobject.c", "nloc": 41, "complexity": 10, "token_count": 294, "parameters": [ "self", "arg" ], "start_line": 3903, "end_line": 3961, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "array_base_get", "long_name": "array_base_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 41, "parameters": [ "self" ], "start_line": 3966, "end_line": 3976, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 129, "parameters": [ "self" ], "start_line": 3980, "end_line": 4005, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 177, "parameters": [ "self", "val" ], "start_line": 4009, "end_line": 4041, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 3, "token_count": 200, "parameters": [ "self" ], "start_line": 4044, "end_line": 4079, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 203, "parameters": [ "self", "val" ], "start_line": 4082, "end_line": 4119, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_flat_get", "long_name": "array_flat_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 4122, "end_line": 4125, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 51, "complexity": 9, "token_count": 368, "parameters": [ "self", "val" ], "start_line": 4128, "end_line": 4182, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "discover_depth", "long_name": "discover_depth( PyObject * s , int max , int stop_at_string)", "filename": "arrayobject.c", "nloc": 23, "complexity": 14, "token_count": 169, "parameters": [ "s", "max", "stop_at_string" ], "start_line": 4358, "end_line": 4383, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "discover_itemsize", "long_name": "discover_itemsize( PyObject * s , int nd , int * itemsize)", "filename": "arrayobject.c", "nloc": 21, "complexity": 9, "token_count": 161, "parameters": [ "s", "nd", "itemsize" ], "start_line": 4386, "end_line": 4408, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "discover_dimensions", "long_name": "discover_dimensions( PyObject * s , int nd , intp * d , int check_it)", "filename": "arrayobject.c", "nloc": 24, "complexity": 10, "token_count": 188, "parameters": [ "s", "nd", "d", "check_it" ], "start_line": 4415, "end_line": 4441, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_array_small_type", "long_name": "_array_small_type( int chktype , int mintype , int chksize , int minsize , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 100, "parameters": [ "chktype", "mintype", "chksize", "minsize", "outtype" ], "start_line": 4444, "end_line": 4464, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 126, "complexity": 28, "token_count": 671, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4467, "end_line": 4608, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 142, "top_nesting_level": 0 }, { "name": "Assign_Array", "long_name": "Assign_Array( PyArrayObject * self , PyObject * v)", "filename": "arrayobject.c", "nloc": 21, "complexity": 6, "token_count": 121, "parameters": [ "self", "v" ], "start_line": 4611, "end_line": 4634, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromScalar", "long_name": "Array_FromScalar( PyObject * op , PyArray_Typecode * typecode)", "filename": "arrayobject.c", "nloc": 19, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode" ], "start_line": 4638, "end_line": 4661, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromSequence", "long_name": "Array_FromSequence( PyObject * s , PyArray_Typecode * typecode , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 51, "complexity": 17, "token_count": 313, "parameters": [ "s", "typecode", "min_depth", "max_depth" ], "start_line": 4665, "end_line": 4722, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_ValidType", "long_name": "PyArray_ValidType( int type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 2, "token_count": 30, "parameters": [ "type" ], "start_line": 4726, "end_line": 4733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "_bufferedcast", "long_name": "_bufferedcast( PyArrayObject * out , PyArrayObject * in)", "filename": "arrayobject.c", "nloc": 75, "complexity": 16, "token_count": 477, "parameters": [ "out", "in" ], "start_line": 4739, "end_line": 4829, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "PyArray_Cast", "long_name": "PyArray_Cast( PyArrayObject * mp , int type_num)", "filename": "arrayobject.c", "nloc": 10, "complexity": 1, "token_count": 56, "parameters": [ "mp", "type_num" ], "start_line": 4835, "end_line": 4846, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 233, "parameters": [ "mp", "at" ], "start_line": 4849, "end_line": 4884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_CastTo", "long_name": "PyArray_CastTo( PyArrayObject * out , PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 40, "complexity": 10, "token_count": 214, "parameters": [ "out", "mp" ], "start_line": 4891, "end_line": 4937, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 80, "complexity": 26, "token_count": 522, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4940, "end_line": 5034, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "_array_typecode_fromstr", "long_name": "_array_typecode_fromstr( char * str , int * swap , PyArray_Typecode * type)", "filename": "arrayobject.c", "nloc": 94, "complexity": 36, "token_count": 533, "parameters": [ "str", "swap", "type" ], "start_line": 5038, "end_line": 5143, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5146, "end_line": 5240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_fromattr", "long_name": "array_fromattr( PyObject * op , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 21, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode", "flags" ], "start_line": 5243, "end_line": 5264, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_fromobject", "long_name": "array_fromobject( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int flags)", "filename": "arrayobject.c", "nloc": 46, "complexity": 13, "token_count": 270, "parameters": [ "op", "typecode", "min_depth", "max_depth", "flags" ], "start_line": 5268, "end_line": 5330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_ArrayType", "long_name": "PyArray_ArrayType( PyObject * op , PyArray_Typecode * intype , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 29, "parameters": [ "op", "intype", "outtype" ], "start_line": 5333, "end_line": 5338, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ObjectType", "long_name": "PyArray_ObjectType( PyObject * op , int minimum_type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 40, "parameters": [ "op", "minimum_type" ], "start_line": 5341, "end_line": 5347, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_FromAny", "long_name": "PyArray_FromAny( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int requires)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 165, "parameters": [ "op", "typecode", "min_depth", "max_depth", "requires" ], "start_line": 5401, "end_line": 5431, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "PyArray_EnsureArray", "long_name": "PyArray_EnsureArray( PyObject * op)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 82, "parameters": [ "op" ], "start_line": 5441, "end_line": 5457, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5463, "end_line": 5469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5472, "end_line": 5479, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5482, "end_line": 5489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CanCastSafely", "long_name": "PyArray_CanCastSafely( int fromtype , int totype)", "filename": "arrayobject.c", "nloc": 69, "complexity": 35, "token_count": 386, "parameters": [ "fromtype", "totype" ], "start_line": 5495, "end_line": 5566, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_CanCastTo", "long_name": "PyArray_CanCastTo( PyArray_Typecode * from , PyArray_Typecode * to)", "filename": "arrayobject.c", "nloc": 24, "complexity": 7, "token_count": 134, "parameters": [ "from", "to" ], "start_line": 5569, "end_line": 5593, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_IterNew", "long_name": "PyArray_IterNew( PyObject * obj)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 258, "parameters": [ "obj" ], "start_line": 5603, "end_line": 5640, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "arrayiter_next", "long_name": "arrayiter_next( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "it" ], "start_line": 5645, "end_line": 5655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "arrayiter_dealloc", "long_name": "arrayiter_dealloc( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 25, "parameters": [ "it" ], "start_line": 5658, "end_line": 5663, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "arrayiter_traverse", "long_name": "arrayiter_traverse( PyArrayIterObject * it , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 6, "complexity": 2, "token_count": 42, "parameters": [ "it", "visit", "arg" ], "start_line": 5666, "end_line": 5671, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "iter_length", "long_name": "iter_length( PyArrayIterObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 5675, "end_line": 5678, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 272, "parameters": [ "self", "ind" ], "start_line": 5682, "end_line": 5730, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 50, "complexity": 8, "token_count": 341, "parameters": [ "self", "ind" ], "start_line": 5733, "end_line": 5785, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 593, "parameters": [ "self", "ind" ], "start_line": 5789, "end_line": 5908, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "iter_ass_sub_Bool", "long_name": "iter_ass_sub_Bool( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 31, "complexity": 5, "token_count": 176, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5912, "end_line": 5944, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 41, "complexity": 8, "token_count": 283, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5947, "end_line": 5988, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_ass_subscript", "long_name": "iter_ass_subscript( PyArrayIterObject * self , PyObject * ind , PyObject * val)", "filename": "arrayobject.c", "nloc": 103, "complexity": 24, "token_count": 636, "parameters": [ "self", "ind", "val" ], "start_line": 5992, "end_line": 6114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 30, "complexity": 5, "token_count": 221, "parameters": [ "it", "op" ], "start_line": 6127, "end_line": 6169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "iter_copy", "long_name": "iter_copy( PyArrayIterObject * it , PyObject * args)", "filename": "arrayobject.c", "nloc": 5, "complexity": 2, "token_count": 35, "parameters": [ "it", "args" ], "start_line": 6174, "end_line": 6178, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "fancy_indexing_check", "long_name": "fancy_indexing_check( PyObject * args)", "filename": "arrayobject.c", "nloc": 55, "complexity": 22, "token_count": 293, "parameters": [ "args" ], "start_line": 6243, "end_line": 6304, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 62, "top_nesting_level": 0 }, { "name": "_convert_obj", "long_name": "_convert_obj( PyObject * obj , PyArrayIterObject ** iter)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 105, "parameters": [ "obj", "iter" ], "start_line": 6312, "end_line": 6327, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyArray_Broadcast", "long_name": "PyArray_Broadcast( PyArrayMultiIterObject * mit)", "filename": "arrayobject.c", "nloc": 58, "complexity": 13, "token_count": 464, "parameters": [ "mit" ], "start_line": 6333, "end_line": 6402, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterReset", "long_name": "PyArray_MapIterReset( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 35, "complexity": 4, "token_count": 261, "parameters": [ "mit" ], "start_line": 6406, "end_line": 6442, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNext", "long_name": "PyArray_MapIterNext( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 41, "complexity": 6, "token_count": 296, "parameters": [ "mit" ], "start_line": 6448, "end_line": 6492, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 682, "parameters": [ "mit", "arr" ], "start_line": 6510, "end_line": 6646, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "_nonzero_indices", "long_name": "_nonzero_indices( PyObject * myBool , PyArrayIterObject ** iters)", "filename": "arrayobject.c", "nloc": 57, "complexity": 15, "token_count": 454, "parameters": [ "myBool", "iters" ], "start_line": 6652, "end_line": 6721, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNew", "long_name": "PyArray_MapIterNew( PyObject * indexobj)", "filename": "arrayobject.c", "nloc": 111, "complexity": 24, "token_count": 745, "parameters": [ "indexobj" ], "start_line": 6724, "end_line": 6857, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 134, "top_nesting_level": 0 }, { "name": "arraymapiter_new", "long_name": "arraymapiter_new( PyTypeObject * type , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 130, "parameters": [ "type", "args", "kwds" ], "start_line": 6863, "end_line": 6893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "arraymapiter_next", "long_name": "arraymapiter_next( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 12, "complexity": 4, "token_count": 70, "parameters": [ "mit" ], "start_line": 6899, "end_line": 6910, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "arraymapiter_dealloc", "long_name": "arraymapiter_dealloc( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 60, "parameters": [ "mit" ], "start_line": 6913, "end_line": 6922, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "arraymapiter_traverse", "long_name": "arraymapiter_traverse( PyArrayMapIterObject * mit , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 16, "complexity": 9, "token_count": 146, "parameters": [ "mit", "visit", "arg" ], "start_line": 6925, "end_line": 6943, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyArray_PyIntAsIntp", "long_name": "PyArray_PyIntAsIntp( PyObject * o)", "filename": "arrayobject.c", "nloc": 59, "complexity": 19, "token_count": 385, "parameters": [ "o" ], "start_line": 40, "end_line": 103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "PyArray_PyIntAsInt", "long_name": "PyArray_PyIntAsInt( PyObject * o)", "filename": "arrayobject.c", "nloc": 57, "complexity": 19, "token_count": 389, "parameters": [ "o" ], "start_line": 109, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 86, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 191, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "PyArray_Zero", "long_name": "PyArray_Zero( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 190, "parameters": [ "arr" ], "start_line": 208, "end_line": 243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_One", "long_name": "PyArray_One( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 40, "complexity": 7, "token_count": 222, "parameters": [ "arr" ], "start_line": 246, "end_line": 289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "do_sliced_copy", "long_name": "do_sliced_copy( char * dest , intp * dest_strides , intp * dest_dimensions , int dest_nd , char * src , intp * src_strides , intp * src_dimensions , int src_nd , int elsize , int copies)", "filename": "arrayobject.c", "nloc": 48, "complexity": 13, "token_count": 313, "parameters": [ "dest", "dest_strides", "dest_dimensions", "dest_nd", "src", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 295, "end_line": 345, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "optimize_slices", "long_name": "optimize_slices( intp ** dest_strides , intp ** dest_dimensions , int * dest_nd , intp ** src_strides , intp ** src_dimensions , int * src_nd , int * elsize , int * copies)", "filename": "arrayobject.c", "nloc": 32, "complexity": 8, "token_count": 214, "parameters": [ "dest_strides", "dest_dimensions", "dest_nd", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 368, "end_line": 399, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 402, "end_line": 436, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_INCREF", "long_name": "PyArray_INCREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 449, "end_line": 471, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_XDECREF", "long_name": "PyArray_XDECREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 474, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "byte_swap_vector", "long_name": "byte_swap_vector( * p , int n , int size)", "filename": "arrayobject.c", "nloc": 38, "complexity": 10, "token_count": 340, "parameters": [ "p", "n", "size" ], "start_line": 499, "end_line": 537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "copy_and_swap", "long_name": "copy_and_swap( * dst , * src , int itemsize , intp numitems , intp srcstrides , int swap)", "filename": "arrayobject.c", "nloc": 18, "complexity": 5, "token_count": 120, "parameters": [ "dst", "src", "itemsize", "numitems", "srcstrides", "swap" ], "start_line": 542, "end_line": 562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "index2ptr", "long_name": "index2ptr( PyArrayObject * mp , int i)", "filename": "arrayobject.c", "nloc": 10, "complexity": 7, "token_count": 86, "parameters": [ "mp", "i" ], "start_line": 570, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Size", "long_name": "PyArray_Size( PyObject * op)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 33, "parameters": [ "op" ], "start_line": 583, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_CopyInto", "long_name": "PyArray_CopyInto( PyArrayObject * dest , PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 71, "complexity": 16, "token_count": 425, "parameters": [ "dest", "src" ], "start_line": 604, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 16, "complexity": 2, "token_count": 98, "parameters": [ "dest", "src_object" ], "start_line": 688, "end_line": 707, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndDataAndDescr", "long_name": "PyArray_FromDimsAndDataAndDescr( int nd , int * d , PyArray_Descr * descr , char * data)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 144, "parameters": [ "nd", "d", "descr", "data" ], "start_line": 715, "end_line": 736, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 5, "token_count": 137, "parameters": [ "nd", "d", "type", "data" ], "start_line": 740, "end_line": 760, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 5, "token_count": 133, "parameters": [ "nd", "d", "type" ], "start_line": 764, "end_line": 781, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 77, "parameters": [ "m1" ], "start_line": 787, "end_line": 799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_Scalar", "long_name": "PyArray_Scalar( char * data , int type_num , int itemsize , int swap)", "filename": "arrayobject.c", "nloc": 48, "complexity": 8, "token_count": 289, "parameters": [ "data", "type_num", "itemsize", "swap" ], "start_line": 805, "end_line": 854, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyArray_ToScalar", "long_name": "PyArray_ToScalar( char * data , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 51, "parameters": [ "data", "arr" ], "start_line": 861, "end_line": 868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_Return", "long_name": "PyArray_Return( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 85, "parameters": [ "mp" ], "start_line": 874, "end_line": 893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 31, "complexity": 6, "token_count": 177, "parameters": [ "type" ], "start_line": 904, "end_line": 936, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 946, "end_line": 989, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 87, "complexity": 16, "token_count": 571, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 993, "end_line": 1082, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "PyArray_ToList", "long_name": "PyArray_ToList( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 24, "complexity": 5, "token_count": 151, "parameters": [ "self" ], "start_line": 1085, "end_line": 1113, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_ToString", "long_name": "PyArray_ToString( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 191, "parameters": [ "self" ], "start_line": 1116, "end_line": 1151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_dealloc", "long_name": "array_dealloc( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 20, "complexity": 7, "token_count": 144, "parameters": [ "self" ], "start_line": 1160, "end_line": 1197, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_length", "long_name": "array_length( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 1204, "end_line": 1212, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 150, "parameters": [ "self", "i" ], "start_line": 1216, "end_line": 1240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_item_nice", "long_name": "array_item_nice( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "i" ], "start_line": 1243, "end_line": 1246, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_ass_item", "long_name": "array_ass_item( PyArrayObject * self , int i , PyObject * v)", "filename": "arrayobject.c", "nloc": 27, "complexity": 8, "token_count": 177, "parameters": [ "self", "i", "v" ], "start_line": 1250, "end_line": 1280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "slice_coerce_index", "long_name": "slice_coerce_index( PyObject * o , int * v)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "o", "v" ], "start_line": 1284, "end_line": 1292, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "slice_GetIndices", "long_name": "slice_GetIndices( PySliceObject * r , int length , int * start , int * stop , int * step , intp * slicelength)", "filename": "arrayobject.c", "nloc": 45, "complexity": 24, "token_count": 376, "parameters": [ "r", "length", "start", "stop", "step", "slicelength" ], "start_line": 1298, "end_line": 1348, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "parse_subindex", "long_name": "parse_subindex( PyObject * op , int * step_size , intp * n_steps , int max)", "filename": "arrayobject.c", "nloc": 45, "complexity": 11, "token_count": 223, "parameters": [ "op", "step_size", "n_steps", "max" ], "start_line": 1355, "end_line": 1400, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "parse_index", "long_name": "parse_index( PyArrayObject * self , PyObject * op , intp * dimensions , intp * strides , intp * offset_ptr)", "filename": "arrayobject.c", "nloc": 89, "complexity": 20, "token_count": 540, "parameters": [ "self", "op", "dimensions", "strides", "offset_ptr" ], "start_line": 1404, "end_line": 1499, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "_swap_axes", "long_name": "_swap_axes( PyArrayMapIterObject * mit , PyArrayObject ** ret)", "filename": "arrayobject.c", "nloc": 24, "complexity": 4, "token_count": 187, "parameters": [ "mit", "ret" ], "start_line": 1502, "end_line": 1536, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 252, "parameters": [ "mit" ], "start_line": 1541, "end_line": 1591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "PyArray_SetMap", "long_name": "PyArray_SetMap( PyArrayMapIterObject * mit , PyObject * op)", "filename": "arrayobject.c", "nloc": 50, "complexity": 12, "token_count": 392, "parameters": [ "mit", "op" ], "start_line": 1594, "end_line": 1653, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 425, "parameters": [ "self", "op" ], "start_line": 1674, "end_line": 1749, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "array_ass_sub", "long_name": "array_ass_sub( PyArrayObject * self , PyObject * index , PyObject * op)", "filename": "arrayobject.c", "nloc": 43, "complexity": 9, "token_count": 251, "parameters": [ "self", "index", "op" ], "start_line": 1762, "end_line": 1814, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "array_subscript_nice", "long_name": "array_subscript_nice( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "self", "op" ], "start_line": 1822, "end_line": 1825, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_getsegcount", "long_name": "array_getsegcount( PyArrayObject * self , int * lenp)", "filename": "arrayobject.c", "nloc": 11, "complexity": 4, "token_count": 48, "parameters": [ "self", "lenp" ], "start_line": 1844, "end_line": 1856, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_getreadbuf", "long_name": "array_getreadbuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 72, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1859, "end_line": 1874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_getwritebuf", "long_name": "array_getwritebuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1878, "end_line": 1887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_getcharbuf", "long_name": "array_getcharbuf( PyArrayObject * self , int segment , const char ** ptrptr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 3, "token_count": 65, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1890, "end_line": 1901, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_SetNumericOps", "long_name": "PyArray_SetNumericOps( PyObject * dict)", "filename": "arrayobject.c", "nloc": 34, "complexity": 1, "token_count": 162, "parameters": [ "dict" ], "start_line": 1969, "end_line": 2002, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_GetNumericOps", "long_name": "PyArray_GetNumericOps()", "filename": "arrayobject.c", "nloc": 39, "complexity": 2, "token_count": 183, "parameters": [], "start_line": 2008, "end_line": 2047, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_GenericReduceFunction", "long_name": "PyArray_GenericReduceFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2050, "end_line": 2069, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericAccumulateFunction", "long_name": "PyArray_GenericAccumulateFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2073, "end_line": 2092, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericBinaryFunction", "long_name": "PyArray_GenericBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 69, "parameters": [ "m1", "m2", "op" ], "start_line": 2096, "end_line": 2107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericUnaryFunction", "long_name": "PyArray_GenericUnaryFunction( PyArrayObject * m1 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 63, "parameters": [ "m1", "op" ], "start_line": 2110, "end_line": 2121, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericInplaceBinaryFunction", "long_name": "PyArray_GenericInplaceBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 13, "complexity": 2, "token_count": 71, "parameters": [ "m1", "m2", "op" ], "start_line": 2124, "end_line": 2136, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_add", "long_name": "array_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2139, "end_line": 2142, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_subtract", "long_name": "array_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2145, "end_line": 2148, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_multiply", "long_name": "array_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2151, "end_line": 2154, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_divide", "long_name": "array_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2157, "end_line": 2160, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_remainder", "long_name": "array_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2163, "end_line": 2166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_power", "long_name": "array_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2169, "end_line": 2172, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_negative", "long_name": "array_negative( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2175, "end_line": 2178, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_absolute", "long_name": "array_absolute( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2181, "end_line": 2184, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_invert", "long_name": "array_invert( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2187, "end_line": 2190, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_left_shift", "long_name": "array_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2193, "end_line": 2196, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_right_shift", "long_name": "array_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2199, "end_line": 2202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_and", "long_name": "array_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2205, "end_line": 2208, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_or", "long_name": "array_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2211, "end_line": 2214, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_xor", "long_name": "array_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2217, "end_line": 2220, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_add", "long_name": "array_inplace_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2223, "end_line": 2226, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_subtract", "long_name": "array_inplace_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2229, "end_line": 2232, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_multiply", "long_name": "array_inplace_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2235, "end_line": 2238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_divide", "long_name": "array_inplace_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2241, "end_line": 2244, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_remainder", "long_name": "array_inplace_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2247, "end_line": 2250, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_power", "long_name": "array_inplace_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2253, "end_line": 2256, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_left_shift", "long_name": "array_inplace_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2259, "end_line": 2262, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_right_shift", "long_name": "array_inplace_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2265, "end_line": 2268, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_and", "long_name": "array_inplace_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2271, "end_line": 2274, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_or", "long_name": "array_inplace_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2277, "end_line": 2280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_xor", "long_name": "array_inplace_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2283, "end_line": 2286, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_floor_divide", "long_name": "array_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2289, "end_line": 2292, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_TRUE_divide", "long_name": "array_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2295, "end_line": 2298, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_floor_divide", "long_name": "array_inplace_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2301, "end_line": 2305, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_inplace_TRUE_divide", "long_name": "array_inplace_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2308, "end_line": 2312, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_all_nonzero", "long_name": "array_all_nonzero( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 93, "parameters": [ "mp" ], "start_line": 2316, "end_line": 2334, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_divmod", "long_name": "array_divmod( PyArrayObject * op1 , PyObject * op2)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 89, "parameters": [ "op1", "op2" ], "start_line": 2337, "end_line": 2352, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_int", "long_name": "array_int( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2356, "end_line": 2382, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_float", "long_name": "array_float( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2385, "end_line": 2410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_long", "long_name": "array_long( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2413, "end_line": 2435, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_oct", "long_name": "array_oct( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2438, "end_line": 2460, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_hex", "long_name": "array_hex( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2463, "end_line": 2485, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "_array_copy_nice", "long_name": "_array_copy_nice( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 22, "parameters": [ "self" ], "start_line": 2488, "end_line": 2492, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 258, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2553, "end_line": 2591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_ass_slice", "long_name": "array_ass_slice( PyArrayObject * self , int ilow , int ihigh , PyObject * v)", "filename": "arrayobject.c", "nloc": 20, "complexity": 4, "token_count": 108, "parameters": [ "self", "ilow", "ihigh", "v" ], "start_line": 2595, "end_line": 2616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_contains", "long_name": "array_contains( PyArrayObject * self , PyObject * el)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "el" ], "start_line": 2619, "end_line": 2624, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "dump_data", "long_name": "dump_data( char ** string , int * n , int * max_n , char * data , int nd , intp * dimensions , intp * strides , PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 41, "complexity": 7, "token_count": 308, "parameters": [ "string", "n", "max_n", "data", "nd", "dimensions", "strides", "self" ], "start_line": 2645, "end_line": 2692, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "array_repr_builtin", "long_name": "array_repr_builtin( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 30, "complexity": 4, "token_count": 222, "parameters": [ "self" ], "start_line": 2695, "end_line": 2731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_SetStringFunction", "long_name": "PyArray_SetStringFunction( PyObject * op , int repr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 48, "parameters": [ "op", "repr" ], "start_line": 2737, "end_line": 2754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2757, "end_line": 2769, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2772, "end_line": 2784, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_richcompare", "long_name": "array_richcompare( PyArrayObject * self , PyObject * other , int cmp_op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 13, "token_count": 273, "parameters": [ "self", "other", "cmp_op" ], "start_line": 2788, "end_line": 2865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 78, "top_nesting_level": 0 }, { "name": "_check_axis", "long_name": "_check_axis( PyArrayObject * arr , int * axis , int flags)", "filename": "arrayobject.c", "nloc": 29, "complexity": 8, "token_count": 164, "parameters": [ "arr", "axis", "flags" ], "start_line": 2868, "end_line": 2897, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyArray_IntTupleFromIntp", "long_name": "PyArray_IntTupleFromIntp( int len , intp * vals)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 91, "parameters": [ "len", "vals" ], "start_line": 2903, "end_line": 2919, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_IntpFromSequence", "long_name": "PyArray_IntpFromSequence( PyObject * seq , intp * vals , int maxvals)", "filename": "arrayobject.c", "nloc": 21, "complexity": 7, "token_count": 161, "parameters": [ "seq", "vals", "maxvals" ], "start_line": 2924, "end_line": 2947, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "_IsContiguous", "long_name": "_IsContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 109, "parameters": [ "ap" ], "start_line": 2953, "end_line": 2969, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsFortranContiguous", "long_name": "_IsFortranContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 107, "parameters": [ "ap" ], "start_line": 2973, "end_line": 2989, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsAligned", "long_name": "_IsAligned( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 110, "parameters": [ "ap" ], "start_line": 2993, "end_line": 3009, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsWriteable", "long_name": "_IsWriteable( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 16, "complexity": 8, "token_count": 109, "parameters": [ "ap" ], "start_line": 3012, "end_line": 3045, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_UpdateFlags", "long_name": "PyArray_UpdateFlags( PyArrayObject * ret , int flagmask)", "filename": "arrayobject.c", "nloc": 22, "complexity": 9, "token_count": 129, "parameters": [ "ret", "flagmask" ], "start_line": 3049, "end_line": 3071, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_CheckStrides", "long_name": "PyArray_CheckStrides( int elsize , int nd , intp numbytes , intp * dims , intp * newstrides)", "filename": "arrayobject.c", "nloc": 13, "complexity": 4, "token_count": 84, "parameters": [ "elsize", "nd", "numbytes", "dims", "newstrides" ], "start_line": 3078, "end_line": 3093, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "_array_fill_strides", "long_name": "_array_fill_strides( intp * strides , intp * dims , int nd , intp itemsize , int inflag , int * objflags)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 171, "parameters": [ "strides", "dims", "nd", "itemsize", "inflag", "objflags" ], "start_line": 3113, "end_line": 3137, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 672, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3141, "end_line": 3285, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "PyArray_Resize", "long_name": "PyArray_Resize( PyArrayObject * self , PyArray_Dims * newshape)", "filename": "arrayobject.c", "nloc": 87, "complexity": 15, "token_count": 501, "parameters": [ "self", "newshape" ], "start_line": 3290, "end_line": 3395, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_FillObjectArray", "long_name": "PyArray_FillObjectArray( PyArrayObject * arr , PyObject * obj)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 98, "parameters": [ "arr", "obj" ], "start_line": 3399, "end_line": 3416, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_new", "long_name": "array_new( PyTypeObject * subtype , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 100, "complexity": 20, "token_count": 593, "parameters": [ "subtype", "args", "kwds" ], "start_line": 3420, "end_line": 3535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 116, "top_nesting_level": 0 }, { "name": "array_ndim_get", "long_name": "array_ndim_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 3542, "end_line": 3545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flags_get", "long_name": "array_flags_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 10, "complexity": 3, "token_count": 55, "parameters": [ "self" ], "start_line": 3548, "end_line": 3558, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_shape_get", "long_name": "array_shape_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3631, "end_line": 3634, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_shape_set", "long_name": "array_shape_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 33, "complexity": 6, "token_count": 206, "parameters": [ "self", "val" ], "start_line": 3638, "end_line": 3672, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_strides_get", "long_name": "array_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3676, "end_line": 3679, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_strides_set", "long_name": "array_strides_set( PyArrayObject * self , PyObject * obj)", "filename": "arrayobject.c", "nloc": 32, "complexity": 7, "token_count": 209, "parameters": [ "self", "obj" ], "start_line": 3682, "end_line": 3715, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_protocol_strides_get", "long_name": "array_protocol_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 35, "parameters": [ "self" ], "start_line": 3719, "end_line": 3726, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_priority_get", "long_name": "array_priority_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 3, "token_count": 42, "parameters": [ "self" ], "start_line": 3729, "end_line": 3737, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_data_get", "long_name": "array_data_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 82, "parameters": [ "self" ], "start_line": 3741, "end_line": 3755, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_data_set", "long_name": "array_data_set( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 44, "complexity": 9, "token_count": 229, "parameters": [ "self", "op" ], "start_line": 3758, "end_line": 3802, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "array_itemsize_get", "long_name": "array_itemsize_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 3806, "end_line": 3809, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_size_get", "long_name": "array_size_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "self" ], "start_line": 3812, "end_line": 3819, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typechar_get", "long_name": "array_typechar_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 47, "parameters": [ "self" ], "start_line": 3823, "end_line": 3830, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typestr_get", "long_name": "array_typestr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 7, "token_count": 141, "parameters": [ "self" ], "start_line": 3833, "end_line": 3853, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_descr_get", "long_name": "array_descr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 128, "parameters": [ "self" ], "start_line": 3856, "end_line": 3878, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_typenum_get", "long_name": "array_typenum_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 3881, "end_line": 3884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_get", "long_name": "array_type_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 3888, "end_line": 3891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_set", "long_name": "array_type_set( PyArrayObject * self , PyObject * arg)", "filename": "arrayobject.c", "nloc": 41, "complexity": 10, "token_count": 294, "parameters": [ "self", "arg" ], "start_line": 3903, "end_line": 3961, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "array_base_get", "long_name": "array_base_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 41, "parameters": [ "self" ], "start_line": 3966, "end_line": 3976, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 129, "parameters": [ "self" ], "start_line": 3980, "end_line": 4005, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 177, "parameters": [ "self", "val" ], "start_line": 4009, "end_line": 4041, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 3, "token_count": 200, "parameters": [ "self" ], "start_line": 4044, "end_line": 4079, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 203, "parameters": [ "self", "val" ], "start_line": 4082, "end_line": 4119, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_flat_get", "long_name": "array_flat_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 4122, "end_line": 4125, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 51, "complexity": 9, "token_count": 368, "parameters": [ "self", "val" ], "start_line": 4128, "end_line": 4182, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "discover_depth", "long_name": "discover_depth( PyObject * s , int max , int stop_at_string)", "filename": "arrayobject.c", "nloc": 23, "complexity": 14, "token_count": 169, "parameters": [ "s", "max", "stop_at_string" ], "start_line": 4358, "end_line": 4383, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "discover_itemsize", "long_name": "discover_itemsize( PyObject * s , int nd , int * itemsize)", "filename": "arrayobject.c", "nloc": 21, "complexity": 9, "token_count": 161, "parameters": [ "s", "nd", "itemsize" ], "start_line": 4386, "end_line": 4408, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "discover_dimensions", "long_name": "discover_dimensions( PyObject * s , int nd , intp * d , int check_it)", "filename": "arrayobject.c", "nloc": 24, "complexity": 10, "token_count": 188, "parameters": [ "s", "nd", "d", "check_it" ], "start_line": 4415, "end_line": 4441, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_array_small_type", "long_name": "_array_small_type( int chktype , int mintype , int chksize , int minsize , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 100, "parameters": [ "chktype", "mintype", "chksize", "minsize", "outtype" ], "start_line": 4444, "end_line": 4464, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 126, "complexity": 28, "token_count": 671, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4467, "end_line": 4608, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 142, "top_nesting_level": 0 }, { "name": "Assign_Array", "long_name": "Assign_Array( PyArrayObject * self , PyObject * v)", "filename": "arrayobject.c", "nloc": 21, "complexity": 6, "token_count": 121, "parameters": [ "self", "v" ], "start_line": 4611, "end_line": 4634, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromScalar", "long_name": "Array_FromScalar( PyObject * op , PyArray_Typecode * typecode)", "filename": "arrayobject.c", "nloc": 19, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode" ], "start_line": 4638, "end_line": 4661, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromSequence", "long_name": "Array_FromSequence( PyObject * s , PyArray_Typecode * typecode , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 51, "complexity": 17, "token_count": 313, "parameters": [ "s", "typecode", "min_depth", "max_depth" ], "start_line": 4665, "end_line": 4722, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_ValidType", "long_name": "PyArray_ValidType( int type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 2, "token_count": 30, "parameters": [ "type" ], "start_line": 4726, "end_line": 4733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "_bufferedcast", "long_name": "_bufferedcast( PyArrayObject * out , PyArrayObject * in)", "filename": "arrayobject.c", "nloc": 75, "complexity": 16, "token_count": 477, "parameters": [ "out", "in" ], "start_line": 4739, "end_line": 4829, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "PyArray_Cast", "long_name": "PyArray_Cast( PyArrayObject * mp , int type_num)", "filename": "arrayobject.c", "nloc": 10, "complexity": 1, "token_count": 56, "parameters": [ "mp", "type_num" ], "start_line": 4835, "end_line": 4846, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 233, "parameters": [ "mp", "at" ], "start_line": 4849, "end_line": 4884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_CastTo", "long_name": "PyArray_CastTo( PyArrayObject * out , PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 40, "complexity": 10, "token_count": 214, "parameters": [ "out", "mp" ], "start_line": 4891, "end_line": 4937, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 80, "complexity": 26, "token_count": 522, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4940, "end_line": 5034, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "_array_typecode_fromstr", "long_name": "_array_typecode_fromstr( char * str , int * swap , PyArray_Typecode * type)", "filename": "arrayobject.c", "nloc": 94, "complexity": 36, "token_count": 533, "parameters": [ "str", "swap", "type" ], "start_line": 5038, "end_line": 5143, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5146, "end_line": 5240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_fromattr", "long_name": "array_fromattr( PyObject * op , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 21, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode", "flags" ], "start_line": 5243, "end_line": 5264, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_fromobject", "long_name": "array_fromobject( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int flags)", "filename": "arrayobject.c", "nloc": 46, "complexity": 13, "token_count": 270, "parameters": [ "op", "typecode", "min_depth", "max_depth", "flags" ], "start_line": 5268, "end_line": 5330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_ArrayType", "long_name": "PyArray_ArrayType( PyObject * op , PyArray_Typecode * intype , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 29, "parameters": [ "op", "intype", "outtype" ], "start_line": 5333, "end_line": 5338, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ObjectType", "long_name": "PyArray_ObjectType( PyObject * op , int minimum_type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 40, "parameters": [ "op", "minimum_type" ], "start_line": 5341, "end_line": 5347, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_FromAny", "long_name": "PyArray_FromAny( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int requires)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 165, "parameters": [ "op", "typecode", "min_depth", "max_depth", "requires" ], "start_line": 5401, "end_line": 5431, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "PyArray_EnsureArray", "long_name": "PyArray_EnsureArray( PyObject * op)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 82, "parameters": [ "op" ], "start_line": 5441, "end_line": 5457, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5463, "end_line": 5469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5472, "end_line": 5479, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5482, "end_line": 5489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CanCastSafely", "long_name": "PyArray_CanCastSafely( int fromtype , int totype)", "filename": "arrayobject.c", "nloc": 69, "complexity": 35, "token_count": 386, "parameters": [ "fromtype", "totype" ], "start_line": 5495, "end_line": 5566, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_CanCastTo", "long_name": "PyArray_CanCastTo( PyArray_Typecode * from , PyArray_Typecode * to)", "filename": "arrayobject.c", "nloc": 24, "complexity": 7, "token_count": 134, "parameters": [ "from", "to" ], "start_line": 5569, "end_line": 5593, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_IterNew", "long_name": "PyArray_IterNew( PyObject * obj)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 258, "parameters": [ "obj" ], "start_line": 5603, "end_line": 5640, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "arrayiter_next", "long_name": "arrayiter_next( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "it" ], "start_line": 5645, "end_line": 5655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "arrayiter_dealloc", "long_name": "arrayiter_dealloc( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 25, "parameters": [ "it" ], "start_line": 5658, "end_line": 5663, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "arrayiter_traverse", "long_name": "arrayiter_traverse( PyArrayIterObject * it , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 6, "complexity": 2, "token_count": 42, "parameters": [ "it", "visit", "arg" ], "start_line": 5666, "end_line": 5671, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "iter_length", "long_name": "iter_length( PyArrayIterObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 5675, "end_line": 5678, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 272, "parameters": [ "self", "ind" ], "start_line": 5682, "end_line": 5730, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 50, "complexity": 8, "token_count": 341, "parameters": [ "self", "ind" ], "start_line": 5733, "end_line": 5785, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 593, "parameters": [ "self", "ind" ], "start_line": 5789, "end_line": 5908, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "iter_ass_sub_Bool", "long_name": "iter_ass_sub_Bool( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 31, "complexity": 5, "token_count": 176, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5912, "end_line": 5944, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 41, "complexity": 8, "token_count": 283, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5947, "end_line": 5988, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_ass_subscript", "long_name": "iter_ass_subscript( PyArrayIterObject * self , PyObject * ind , PyObject * val)", "filename": "arrayobject.c", "nloc": 103, "complexity": 24, "token_count": 636, "parameters": [ "self", "ind", "val" ], "start_line": 5992, "end_line": 6114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 30, "complexity": 5, "token_count": 221, "parameters": [ "it", "op" ], "start_line": 6127, "end_line": 6169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "iter_copy", "long_name": "iter_copy( PyArrayIterObject * it , PyObject * args)", "filename": "arrayobject.c", "nloc": 5, "complexity": 2, "token_count": 35, "parameters": [ "it", "args" ], "start_line": 6174, "end_line": 6178, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "fancy_indexing_check", "long_name": "fancy_indexing_check( PyObject * args)", "filename": "arrayobject.c", "nloc": 55, "complexity": 22, "token_count": 293, "parameters": [ "args" ], "start_line": 6243, "end_line": 6304, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 62, "top_nesting_level": 0 }, { "name": "_convert_obj", "long_name": "_convert_obj( PyObject * obj , PyArrayIterObject ** iter)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 105, "parameters": [ "obj", "iter" ], "start_line": 6312, "end_line": 6327, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyArray_Broadcast", "long_name": "PyArray_Broadcast( PyArrayMultiIterObject * mit)", "filename": "arrayobject.c", "nloc": 58, "complexity": 13, "token_count": 464, "parameters": [ "mit" ], "start_line": 6333, "end_line": 6402, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterReset", "long_name": "PyArray_MapIterReset( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 35, "complexity": 4, "token_count": 261, "parameters": [ "mit" ], "start_line": 6406, "end_line": 6442, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNext", "long_name": "PyArray_MapIterNext( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 41, "complexity": 6, "token_count": 296, "parameters": [ "mit" ], "start_line": 6448, "end_line": 6492, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 682, "parameters": [ "mit", "arr" ], "start_line": 6510, "end_line": 6646, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "_nonzero_indices", "long_name": "_nonzero_indices( PyObject * myBool , PyArrayIterObject ** iters)", "filename": "arrayobject.c", "nloc": 57, "complexity": 15, "token_count": 454, "parameters": [ "myBool", "iters" ], "start_line": 6652, "end_line": 6721, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNew", "long_name": "PyArray_MapIterNew( PyObject * indexobj)", "filename": "arrayobject.c", "nloc": 111, "complexity": 24, "token_count": 745, "parameters": [ "indexobj" ], "start_line": 6724, "end_line": 6857, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 134, "top_nesting_level": 0 }, { "name": "arraymapiter_new", "long_name": "arraymapiter_new( PyTypeObject * type , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 130, "parameters": [ "type", "args", "kwds" ], "start_line": 6863, "end_line": 6893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "arraymapiter_next", "long_name": "arraymapiter_next( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 12, "complexity": 4, "token_count": 70, "parameters": [ "mit" ], "start_line": 6899, "end_line": 6910, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "arraymapiter_dealloc", "long_name": "arraymapiter_dealloc( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 60, "parameters": [ "mit" ], "start_line": 6913, "end_line": 6922, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "arraymapiter_traverse", "long_name": "arraymapiter_traverse( PyArrayMapIterObject * mit , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 16, "complexity": 9, "token_count": 146, "parameters": [ "mit", "visit", "arg" ], "start_line": 6925, "end_line": 6943, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 946, "end_line": 989, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 } ], "nloc": 5493, "complexity": 1207, "token_count": 32870, "diff_parsed": { "added": [ "\tif (!PyTypeNum_ISUSERDEF(typenum)) {" ], "deleted": [ "\tif (!PyArray_ISUSERDEF(typenum)) {" ] } }, { "old_path": "scipy/base/src/scalartypes.inc.src", "new_path": "scipy/base/src/scalartypes.inc.src", "filename": "scalartypes.inc.src", "extension": "src", "change_type": "MODIFY", "diff": "@@ -1502,8 +1502,8 @@ ComplexFloating, Flexible, Character#\n \tPyVoidArrType_Type.tp_flags = BASEFLAGS;\n \n /**begin repeat\n-#name=bool, byte, short, longlong, ubyte, ushort, uint, ulong, ulonglong, float, longdouble, cfloat, clongdouble, void, object#\n-#NAME=Bool, Byte, Short, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, LongDouble, CFloat, CLongDouble, Void, Object#\n+#name=bool, byte, short, ubyte, ushort, uint, ulong, ulonglong, float, longdouble, cfloat, clongdouble, void, object#\n+#NAME=Bool, Byte, Short, UByte, UShort, UInt, ULong, ULongLong, Float, LongDouble, CFloat, CLongDouble, Void, Object#\n */\n Py@NAME@ArrType_Type.tp_hash = @name@_arrtype_hash;\n /**end repeat**/\n", "added_lines": 2, "deleted_lines": 2, "source_code": "/* -*- c -*- */\n\n/**begin repeat\n\n#name=Bool, Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, Object,#\n#type=Bool, signed char, short, int, long, longlong, unsigned char, unsigned short, unsigned int, unsigned long, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, PyObject *,char#\n*/\ntypedef struct {\n\tPyObject_HEAD;\n\t@type@ obval;\n} Py@name@ScalarObject;\n\n/**end repeat**/\n\n/* Inheritance established later when tp_bases is set (or tp_base for \n single inheritance) */\n\n/**begin repeat\n\n#name=numeric, integer, signedinteger, unsignedinteger, inexact, floating, complexfloating, flexible, \ncharacter#\n#NAME=Numeric, Integer, SignedInteger, UnsignedInteger, Inexact, Floating, ComplexFloating, Flexible, Character#\n*/\n\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@_arrtype\",\t\t /*tp_name*/\n sizeof(PyObject),\t\t /*tp_basicsize*/\n};\n/**end repeat**/\n\n\n#define PyStringScalarObject PyStringObject\n#define PyUnicodeScalarObject PyUnicodeObject\n\ntypedef struct {\n\tPyObject_VAR_HEAD;\n\tchar *obval;\n} PyVoidScalarObject;\n\n/* 0-dim array from array-scalar object */\n\nstatic PyObject *\nPyArray_FromScalar(PyObject *scalar, PyArray_Typecode *outcode)\n{\n\tPyArray_Typecode typecode;\n\tPyObject *r;\n\tchar *memptr;\n\tPyObject *ret;\n\n\t/* convert to 0-dim array of scalar typecode */\n\tPyArray_TypecodeFromScalar(scalar, &typecode);\n\tr = PyArray_New(&PyArray_Type, 0, NULL, typecode.type_num,\n\t\t\tNULL, NULL, typecode.itemsize, 0, NULL);\n\tif (r==NULL) return NULL;\n\n\tswitch(typecode.type_num) {\n\tcase PyArray_STRING:\n\t\tmemptr = PyString_AS_STRING(scalar);\n\t\tbreak;\n\tcase PyArray_UNICODE:\n\t\tmemptr = (char *)PyUnicode_AS_DATA(scalar);\n\t\tbreak;\n\tcase PyArray_VOID:\n\t\tmemptr = (((PyVoidScalarObject *)scalar)->obval);\n\t\tbreak;\n\tdefault:\n\t\tmemptr = &(((PyScalarObject *)scalar)->obval);\n\t\tbreak;\n\t}\n\n\tmemcpy(PyArray_DATA(r), memptr, PyArray_ITEMSIZE(r));\n\tif (PyArray_ISOBJECT(r)) {\n\t\tPy_INCREF(*((PyObject **)memptr));\n\t}\n\t\n\tif (outcode == NULL || \\\n\t outcode->type_num == PyArray_NOTYPE ||\t\\\n\t outcode->type_num == PyArray_TYPE(r))\n\t\treturn r;\n\n\t/* cast if necessary to desired output typecode */\n\tret = PyArray_CastToType((PyArrayObject *)r, outcode);\n\tPy_DECREF(r);\n\treturn ret;\n}\n\n\nstatic void\ngentype_dealloc(PyObject *v) \n{\n\tv->ob_type->tp_free(v);\n}\n\n\nstatic PyObject *\ngentype_power(PyObject *m1, PyObject *m2, PyObject *m3)\n{\n\tPyObject *arr, *ret, *arg2;\n\tchar *msg=\"unsupported operand type(s) for ** or pow()\";\n\t\n\tif (!PyArray_IsScalar(m1,Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_power(m1,m2, \n\t\t\t\t\t\t\t\t Py_None);\n\t\t}\n\t\telse {\n\t\t\tif (!PyArray_IsScalar(m2,Generic)) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_power(m1, arr,\n\t\t\t\t\t\t\t\t Py_None);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_power(m1,m2, \n\t\t\t\t\t\t\t\t Py_None);\n\t\t}\n\t\telse {\n\t\t\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_power(arr, m2,\n\t\t\t\t\t\t\t\t Py_None);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tarr=arg2=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\targ2 = PyArray_FromScalar(m2, NULL);\t\n\tif (arr == NULL || arg2 == NULL) {\n\t\tPy_XDECREF(arr); Py_XDECREF(arg2); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_power(arr, arg2, Py_None);\n\tPy_DECREF(arr);\n\tPy_DECREF(arg2);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_generic_method(PyObject *self, PyObject *args, PyObject *kwds, \n\t\t char *str)\n{\n\tPyObject *arr, *meth, *ret;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tmeth = PyObject_GetAttrString(arr, str);\n\tif (kwds == NULL) \n\t\tret = PyObject_CallObject(meth, args);\n\telse\n\t\tret = PyObject_Call(meth, args, kwds);\n\tPy_DECREF(meth);\n\tPy_DECREF(arr);\n\treturn PyArray_Return((PyArrayObject *)ret);\n}\n\n/**begin repeat\n\n#name=add, subtract, divide, remainder, divmod, lshift, rshift, and, xor, or, floor_divide, true_divide#\n#PYNAME=Add, Subtract, Divide, Remainder, Divmod, Lshift, Rshift, And, Xor, Or, FloorDivide, TrueDivide#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *m1, PyObject *m2)\n{\n\tPyObject *arr, *ret, *tup;\n\n\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_@name@(m1,m2);\n\t\t}\n else if ((m1->ob_type->tp_as_number == NULL) ||\n\t\t\t (m1->ob_type->tp_as_number->nb_@name@ == NULL)) {\n\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_@name@(m1, arr);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\telse {\n\t\t\t/* Convert m2 to a Python object and then try */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m2, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_@PYNAME@(m1, arr);\n\t\t\tif (ret==NULL) {\n\t\t\t\tPyObject *newarr;\n\t\t\t\tPyErr_Clear();\n\t\t\t\t/* Convert object to Array scalar and try again */\n\t\t\t\tnewarr = PyArray_FromAny(m1, NULL, 0, 0, 0);\n\t\t\t\tif (newarr!=NULL) {\n\t\t\t\t\tret = newarr->ob_type->tp_as_number->nb_@name@(m1, newarr);\n\t\t\t\t\tPy_DECREF(newarr);\n\t\t\t\t}\n\t\t\t}\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_@name@(m1,m2);\n\t\t}\n\t\telse if ((m2->ob_type->tp_as_number == NULL) ||\n\t\t\t (m2->ob_type->tp_as_number->nb_@name@ == NULL)) {\n\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_@name@(arr, m2);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\telse {\n\t\t\t/* Convert m1 to a Python object and then try */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m1, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tret = PyNumber_@PYNAME@(arr,m2);\n\t\t\tif (ret==NULL) {\n\t\t\t\tPyObject *newarr;\n\t\t\t\tPyErr_Clear();\n\t\t\t\t/* Convert object to Array and try again */\n\t\t\t\tnewarr = PyArray_FromAny(m1, NULL, 0, 0, 0);\n\t\t\t\tif (newarr!=NULL) {\n\t\t\t\t\tret = newarr->ob_type->tp_as_number->nb_@name@(newarr, m2);\n\t\t\t\t\tPy_DECREF(newarr);\n\t\t\t\t}\n\t\t\t}\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tarr=tup=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\ttup = PyArray_FromScalar(m2, NULL);\n\tif (arr == NULL || tup == NULL) {\n\t\tPy_XDECREF(tup); Py_XDECREF(arr); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_@name@(arr, tup);\n\tPy_DECREF(arr);\n\tPy_DECREF(tup);\n\treturn ret;\n}\n/**end repeat**/\n\n\nstatic PyObject *\ngentype_multiply(PyObject *m1, PyObject *m2)\n{\n\tPyObject *arr, *ret, *tup;\n\tlong repeat;\n\n\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_multiply(m1,m2);\n\t\t}\n\t\telse if ((m1->ob_type->tp_as_number == NULL) ||\n\t\t\t (m1->ob_type->tp_as_number->nb_multiply == NULL)) {\n\t\t\t/* Convert m2 to an int and assume sequence\n\t\t\t repeat */\n\t\t\trepeat = PyInt_AsLong(m2);\n\t\t\tif (repeat == -1 && PyErr_Occurred()) return NULL;\n\t\t\tret = PySequence_Repeat(m1, (int) repeat);\n\t\t\tif (ret == NULL) {\n\t\t\t\tPyErr_Clear();\n\t\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\t\tif (arr == NULL) return NULL;\n\t\t\t\tret = arr->ob_type->tp_as_number->\\\n\t\t\t\t\tnb_multiply(m1, arr);\n\t\t\t\tPy_DECREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t/* Convert m2 to a Python object */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m2, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_Multiply(m1, arr);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_multiply(m1,m2);\n\t\t}\n\t\telse if ((m2->ob_type->tp_as_number == NULL) ||\n\t\t\t (m2->ob_type->tp_as_number->nb_multiply == NULL)) {\n\t\t\t/* Convert m1 to an int and assume sequence\n\t\t\t repeat */\n\t\t\trepeat = PyInt_AsLong(m1);\n\t\t\tif (repeat == -1 && PyErr_Occurred()) return NULL;\n\t\t\tret = PySequence_Repeat(m2, (int) repeat);\n\t\t\tif (ret == NULL) {\n\t\t\t\tPyErr_Clear();\n\t\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\t\tif (arr == NULL) return NULL;\n\t\t\t\tret = arr->ob_type->tp_as_number->\t\\\n\t\t\t\t\tnb_multiply(arr, m2);\n\t\t\t\tPy_DECREF(arr);\n\t\t\t}\t\t\t\n\t\t}\n\t\telse {\n\t\t\t/* Convert m1 to a Python object */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m1, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_Multiply(arr, m2);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\t/* Both are array scalar objects */\n\tarr=tup=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\ttup = PyArray_FromScalar(m2, NULL);\n\tif (arr == NULL || tup == NULL) {\n\t\tPy_XDECREF(tup); Py_XDECREF(arr); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_multiply(arr, tup);\n\tPy_DECREF(arr);\n\tPy_DECREF(tup);\n\treturn ret;\n\n}\n\n\n\n/**begin repeat\n\n#name=negative, absolute, invert, int, long, float, oct, hex#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *m1)\n{\n\tPyObject *arr, *ret;\n\n\tarr = PyArray_FromScalar(m1, NULL);\n\tif (arr == NULL) return NULL;\n\tret = arr->ob_type->tp_as_number->nb_@name@(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n/**end repeat**/\n\nstatic int\ngentype_nonzero_number(PyObject *m1)\n{\n\tPyObject *arr;\n\tint ret;\n\n\tarr = PyArray_FromScalar(m1, NULL);\n\tif (arr == NULL) return -1;\n\tret = arr->ob_type->tp_as_number->nb_nonzero(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_str(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tif (arr==NULL) return NULL;\n\tret = PyObject_Str(arr->descr->getitem(arr->data, arr));\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_repr(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tif (arr==NULL) return NULL;\n\tret = PyObject_Repr(arr->descr->getitem(arr->data, arr));\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic void\nformat_longdouble(char *buf, size_t buflen, longdouble val, int precision)\n{\n register char *cp;\n\n PyOS_snprintf(buf, buflen, \"%.*\" LONGDOUBLE_FMT, precision, val);\n cp = buf;\n if (*cp == '-')\n cp++;\n for (; *cp != '\\0'; cp++) {\n if (!isdigit(Py_CHARMASK(*cp)))\n break;\n }\n if (*cp == '\\0') {\n *cp++ = '.';\n *cp++ = '0';\n *cp++ = '\\0';\n }\n}\n\n#if SIZEOF_LONGDOUBLE == SIZEOF_DOUBLE\n#define PREC_REPR 15\n#define PREC_STR 15\n#else\n#define PREC_REPR 21\n#define PREC_STR 21\n#endif\n\nstatic PyObject *\nlongdoubletype_repr(PyObject *self)\n{\n static char buf[100];\n format_longdouble(buf, sizeof(buf), ((PyLongDoubleScalarObject *)self)->obval, PREC_REPR);\n return PyString_FromString(buf);\n}\n\nstatic PyObject *\nclongdoubletype_repr(PyObject *self)\n{\n static char buf1[100];\n static char buf2[100];\n\tstatic char buf3[202];\n clongdouble x;\n x = ((PyCLongDoubleScalarObject *)self)->obval;\n format_longdouble(buf1, sizeof(buf1), x.real, PREC_REPR);\n format_longdouble(buf2, sizeof(buf2), x.imag, PREC_REPR);\n\n\tsnprintf(buf3, sizeof(buf3), \"(%s+%sj)\", buf1, buf2);\n\treturn PyString_FromString(buf3);\n}\n\n#define longdoubletype_str longdoubletype_repr\n#define clongdoubletype_str clongdoubletype_repr\n\n/** Could improve this with a PyLong_FromLongDouble(longdouble ldval)\n but this would need some more work...\n**/\n\n/**begin repeat\n\n#name=(int, long, hex, oct, float)*2#\n#KIND=(Long*4, Float)*2#\n#char=,,,,,c*5#\n#CHAR=,,,,,C*5#\n#POST=,,,,,.real*5#\n*/\nstatic PyObject *\n@char@longdoubletype_@name@(PyObject *self)\n{\n\tdouble dval;\n\tPyObject *obj, *ret;\n\t\n\tdval = (double)(((Py@CHAR@LongDoubleScalarObject *)self)->obval)@POST@;\n\tobj = Py@KIND@_FromDouble(dval);\n\tret = obj->ob_type->tp_as_number->nb_@name@(obj);\n\tPy_DECREF(obj);\n\treturn ret;\n}\n/**end repeat**/\n\n\nstatic PyObject *gentype_copy(PyObject *, PyObject *);\n\nstatic PyNumberMethods gentype_as_number = {\n (binaryfunc)gentype_add,\t\t /*nb_add*/\n (binaryfunc)gentype_subtract,\t\t /*nb_subtract*/\n (binaryfunc)gentype_multiply,\t\t /*nb_multiply*/\n (binaryfunc)gentype_divide,\t\t /*nb_divide*/\n (binaryfunc)gentype_remainder,\t /*nb_remainder*/\n (binaryfunc)gentype_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)gentype_power,\t\t /*nb_power*/\n (unaryfunc)gentype_negative,\t \n (unaryfunc)gentype_copy,\t\t /*nb_pos*/ \n (unaryfunc)gentype_absolute,\t\t /*(unaryfunc)gentype_abs,*/\n (inquiry)gentype_nonzero_number,\t\t /*nb_nonzero*/\n (unaryfunc)gentype_invert,\t\t /*nb_invert*/\n (binaryfunc)gentype_lshift,\t /*nb_lshift*/\n (binaryfunc)gentype_rshift,\t /*nb_rshift*/\n (binaryfunc)gentype_and,\t /*nb_and*/\n (binaryfunc)gentype_xor,\t /*nb_xor*/\n (binaryfunc)gentype_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)gentype_int,\t\t /*nb_int*/\n (unaryfunc)gentype_long,\t\t /*nb_long*/\n (unaryfunc)gentype_float,\t\t /*nb_float*/\n (unaryfunc)gentype_oct,\t\t /*nb_oct*/\n (unaryfunc)gentype_hex,\t\t /*nb_hex*/\n 0, /*inplace_add*/\n 0, /*inplace_subtract*/\n 0, /*inplace_multiply*/\n 0, /*inplace_divide*/\n 0, /*inplace_remainder*/\n 0, /*inplace_power*/\n 0, /*inplace_lshift*/\n 0, /*inplace_rshift*/\n 0, /*inplace_and*/\n 0, /*inplace_xor*/\n 0, /*inplace_or*/\n (binaryfunc)gentype_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)gentype_true_divide,\t /*nb_true_divide*/\n 0, /*nb_inplace_floor_divide*/\n 0, /*nb_inplace_true_divide*/\n\n};\n\nstatic PyObject *\ngentype_richcompare(PyObject *self, PyObject *other, int cmp_op) \n{\n\n\tPyObject *arr, *ret;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tret = arr->ob_type->tp_richcompare(arr, other, cmp_op);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_ndim_get(PyObject *self)\n{\n\treturn PyInt_FromLong(0);\n}\n\nstatic PyObject *\ngentype_flags_get(PyObject *self)\n{\n\tPyObject *dict;\n\tdict = PyDict_New();\t\n\n#define ADDFLAG(flag, val) PyDict_SetItemString(dict, #flag, Py_##val);\n\n ADDFLAG(CONTIGUOUS, True);\n ADDFLAG(OWN_DATA, True);\n ADDFLAG(FORTRAN, True);\n ADDFLAG(ALIGNED, True);\n ADDFLAG(NOTSWAPPED, True);\n ADDFLAG(WRITEABLE, False);\n ADDFLAG(UPDATEIFCOPY, False);\n\treturn dict;\n#undef ADDFLAG\n}\n\nstatic PyObject *\ngentype_shape_get(PyObject *self)\n{\n\treturn PyTuple_New(0);\n}\n\n/*\nstatic int\ngentype_shape_set(PyObject *self, PyObject *val)\n{\n\tif (!PyTuple_Check(val) || PyTuple_GET_SIZE(val) > 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \\\n\t\t\t\t\"invalid shape for scalar\");\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n*/\n\n\nstatic PyObject *\ngentype_data_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\n\treturn PyBuffer_FromObject(self, 0, typecode.itemsize);\n}\n\n\nstatic PyObject *\ngentype_itemsize_get(PyObject *self)\n{\t\n\tPyArray_Typecode typecode;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\treturn PyInt_FromLong((long) typecode.itemsize);\n}\n\nstatic PyObject *\ngentype_size_get(PyObject *self)\n{\n\treturn PyInt_FromLong(1);\n}\n\n\nstatic PyObject *\ngentype_typechar_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\tPyArray_Descr *descr;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\tdescr = PyArray_DescrFromType(typecode.type_num);\n\tif (PyArray_IsScalar(self, Flexible)) \n\t\treturn PyString_FromFormat(\"%c%d\", (int)(descr->type),\n\t\t\t\t\t typecode.itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(descr->type), 1);\n}\n\nstatic PyObject *\ngentype_typestr_get(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tret = PyObject_GetAttrString((PyObject *)arr, \"dtypestr\");\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_descr_get(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tret = PyObject_GetAttrString((PyObject *)arr, \"__array_descr__\");\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\n\nstatic PyObject *\ngentype_typenum_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\treturn PyInt_FromLong((long) typecode.type_num);\n}\n\nstatic PyObject *\ngentype_type_get(PyObject *self)\n{\n\treturn (PyObject *)self->ob_type;\n}\n\n\nstatic PyObject *\ngentype_base_get(PyObject *self)\n{\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\n\nstatic PyObject *\ngentype_real_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\n\tif (PyArray_IsScalar(self, ComplexFloating)) {\n\t\tPyArray_TypecodeFromScalar(self, &typecode);\n\t\treturn PyArray_Scalar(&(((PyScalarObject *)self)->obval),\n\t\t\t\t typecode.type_num-PyArray_NUM_FLOATTYPE,\n\t\t\t\t typecode.itemsize >> 1, 0);\n\t}\n\telse if PyArray_IsScalar(self, Object) {\n\t\tPyObject *obj = ((PyObjectScalarObject *)self)->obval;\n\t\tPyObject *ret;\n\t\tret = PyObject_GetAttrString(obj, \"real\");\n\t\tif (ret != NULL) return ret;\n\t}\n\tPy_INCREF(self);\n\treturn (PyObject *)self;\n}\n\nstatic PyObject *\ngentype_imag_get(PyObject *self)\n{\t\n\tPyArray_Typecode typecode;\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\tif (PyArray_IsScalar(self, ComplexFloating)) {\n\t\ttypecode.itemsize >>= 1;\n\t\treturn PyArray_Scalar(&(((PyScalarObject *)self)->obval)\n\t\t\t\t + typecode.itemsize, \n\t\t\t\t typecode.type_num-PyArray_NUM_FLOATTYPE,\n\t\t\t\t typecode.itemsize, 0);\n\t}\n\telse if PyArray_IsScalar(self, Object) {\n\t\tPyObject *obj = ((PyObjectScalarObject *)self)->obval;\n\t\tPyObject *ret;\n\t\tret = PyObject_GetAttrString(obj, \"imag\");\n\t\tif (ret == NULL) {\n\t\t\tPyErr_Clear();\n\t\t\tobj = PyInt_FromLong(0);\n\t\t\tret = PyArray_Scalar((char *)&obj, PyArray_OBJECT, \n\t\t\t\t\t sizeof(void *), 0);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t\treturn ret;\n\t}\n\telse {\n\t\tPyObject *ret;\n\t\tchar *temp;\n\t\ttemp = PyDataMem_NEW(typecode.itemsize);\n\t\tmemset(temp, '\\0', typecode.itemsize);\n\t\tret = PyArray_Scalar(temp, typecode.type_num,\n\t\t\t\t typecode.itemsize, 0);\n\t\tPyDataMem_FREE(temp);\n\t\treturn ret;\n\t}\n}\n\nstatic PyObject *\ngentype_flat_get(PyObject *self)\n{\n\tPyObject *ret, *arr;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tret = PyArray_IterNew(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyGetSetDef gentype_getsets[] = {\n {\"ndim\", \n\t (getter)gentype_ndim_get, \n\t (setter) 0, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)gentype_flags_get, \n\t (setter)0, \n\t \"integer value of flags\"},\n {\"shape\", \n\t (getter)gentype_shape_get, \n\t (setter)0, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)gentype_shape_get, \n\t (setter) 0, \n\t \"tuple of bytes steps in each dimension\"},\n {\"data\",\n\t (getter)gentype_data_get, \n\t (setter) 0, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)gentype_itemsize_get, \n\t (setter)0, \n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)gentype_size_get,\n (setter)0,\n \"number of elements in the gentype\"},\n\t{\"base\",\n\t (getter)gentype_base_get,\n\t (setter)0,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)gentype_type_get, \n\t (setter)0, \n\t \"get gentype type class\"},\n\t{\"dtypechar\",\n\t (getter)gentype_typechar_get,\n\t (setter)0,\n\t \"get gentype type character code\"},\n\t{\"dtypenum\",\n\t (getter)gentype_typenum_get,\n\t (setter)0,\n\t \"get gentype type number code\"},\n\t{\"dtypestr\",\n\t (getter)gentype_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)gentype_real_get, \n\t (setter)0,\n\t \"real part of scalar\"},\n {\"imag\", \n\t (getter)gentype_imag_get, \n\t (setter)0, \n\t \"imaginary part of scalar\"},\n\t{\"flat\", \n\t (getter)gentype_flat_get, \n\t (setter)0, \n\t \"a 1-d view of scalar\"}, \n\t{\"__array_data__\", \n\t (getter)gentype_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)gentype_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)gentype_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)gentype_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)gentype_shape_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t/* Does not have __array_priority__ because it is not a subtype.\n\t */\n \t{NULL, NULL, NULL, NULL} /* Sentinel */\n};\n\n/* 0-dim array from scalar object */\n\nstatic char doc_getarray[] = \"sc.__array__(|type) return 0-dim array\";\n\nstatic PyObject *\ngentype_getarray(PyObject *scalar, PyObject *args) \n{\n\tPyArray_Typecode outcode = {PyArray_NOTYPE, 0, 0};\n\n\tif (!PyArg_ParseTuple(args, \"|O&\", &PyArray_TypecodeConverter,\n\t\t\t &outcode)) return NULL;\n\treturn PyArray_FromScalar(scalar, &outcode);\n}\n\nstatic char doc_sc_wraparray[] = \"sc.__array_wrap__(obj) return scalar from array\";\n\nstatic PyObject *\ngentype_wraparray(PyObject *scalar, PyObject *args)\n{\n\tPyObject *arr;\n\n\tif (PyTuple_Size(args) < 1) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"only accepts 1 argument.\");\n\t\treturn NULL;\n\t}\n\tarr = PyTuple_GET_ITEM(args, 0);\n\tif (!PyArray_Check(arr)) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"can only be called with ndarray object\");\n\t\treturn NULL;\n\t}\n\n\treturn PyArray_Scalar(PyArray_DATA(arr), PyArray_TYPE(arr),\n\t\t\t PyArray_ITEMSIZE(arr), !PyArray_ISNOTSWAPPED(arr));\n}\n\n\n/**begin repeat\n\n#name=tolist, toscalar, tostring, astype, copy, resize, __deepcopy__, choose, sort, argsort, searchsorted, argmax, argmin, reshape, view, swapaxes, max, min, ptp, conj, conjugate, nonzero, all, any, flatten, ravel#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *self, PyObject *args)\n{\n\treturn gentype_generic_method(self, args, NULL, \"@name@\");\n}\n/**end repeat**/\n\nstatic PyObject *\ngentype_squeeze(PyObject *self, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n\tPy_INCREF(self);\n\treturn self;\n}\n\nstatic int\ngentype_getreadbuf(PyObject *, int, void **);\n\nstatic PyObject *\ngentype_byteswap(PyObject *self, PyObject *args)\n{\n\tBool inplace=FALSE;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_BoolConverter, &inplace))\n\t\treturn NULL;\n\t\n\tif (inplace) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"cannot byteswap a scalar in-place\");\n\t\treturn NULL;\n\t}\n\telse {\n\t\t/* get the data, copyswap it and pass it to a new Array scalar\n\t\t */\n\t\tchar *data;\n\t\tint numbytes;\n\t\tPyArray_Typecode type;\n\t\tPyArray_Descr *descr;\n\t\tPyObject *new;\n\t\tchar *newmem;\n\n\t\tnumbytes = gentype_getreadbuf(self, 0, (void **)&data);\n\t\tPyArray_TypecodeFromScalar(self, &type);\n\t\tnewmem = malloc(type.itemsize);\n\t\tif (newmem == NULL) return PyErr_NoMemory();\n\t\telse memcpy(newmem, data, type.itemsize);\n\t\tdescr = PyArray_DescrFromType(type.type_num);\n\t\tdescr->copyswap(newmem, NULL, 1, type.itemsize);\t\t\n\t\tnew = PyArray_Scalar(newmem, type.type_num, type.itemsize, 0);\n\t\tfree(newmem);\n\t\treturn new;\n\t}\n}\n\n/**begin repeat\n\n#name=transpose, getfield, take, put, putmask, repeat, tofile, mean, trace, diagonal, clip, std, sum, cumsum, prod, cumprod, compress#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *self, PyObject *args, PyObject *kwds)\n{\n\treturn gentype_generic_method(self, args, kwds, \"@name@\");\n}\n/**end repeat**/\n\n\nstatic PyObject *\ngentype_reduce(PyObject *self, PyObject *args)\n{\n\tPyObject *ret=NULL, *obj=NULL, *mod=NULL;\n\tconst char *buffer; \n\tint buflen;\n\n\t/* Return a tuple of (callable object, arguments) */\n\n\tret = PyTuple_New(2);\n\tif (ret == NULL) return NULL;\t\n\tif (PyObject_AsReadBuffer(self, (const void **)&buffer, &buflen)<0) {\n\t\tPy_DECREF(ret); return NULL;\n\t}\n\tmod = PyImport_ImportModule(\"scipy.base.multiarray\");\n\tif (mod == NULL) return NULL;\n\tobj = PyObject_GetAttrString(mod, \"scalar\");\n\tPy_DECREF(mod);\n\tif (obj == NULL) return NULL;\n\tPyTuple_SET_ITEM(ret, 0, obj);\n\tobj = PyObject_GetAttrString((PyObject *)self, \"dtypestr\");\n\tif PyArray_IsScalar(self, Object) {\n\t\tmod = ((PyObjectScalarObject *)self)->obval;\n\t\tPyTuple_SET_ITEM(ret, 1,\n\t\t\t\t Py_BuildValue(\"NO\", obj, mod));\n\t}\n\telse {\n\t\tmod = PyString_FromStringAndSize(buffer, buflen);\n\t\tPyTuple_SET_ITEM(ret, 1, \n\t\t\t\t Py_BuildValue(\"NN\", obj, mod));\n\t}\n\treturn ret;\n}\n\n/* ignores everything */\nstatic PyObject *\ngentype_setstate(PyObject *self, PyObject *args)\n{\n\tPy_INCREF(Py_None);\n\treturn (Py_None);\n}\n\nstatic PyObject *\ngentype_dump(PyObject *self, PyObject *args)\n{\n\tPyObject *file=NULL;\n\tint ret;\n\n\tif (!PyArg_ParseTuple(args, \"O\", &file))\n\t\treturn NULL;\n\tret = PyArray_Dump(self, file, 2);\n\tif (ret < 0) return NULL;\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyObject *\ngentype_dumps(PyObject *self, PyObject *args)\n{\n\tif (!PyArg_ParseTuple(args, \"\"))\n\t\treturn NULL;\n\treturn PyArray_Dumps(self, 2);\n}\n\n\n/* setting flags cannot be done for scalars */\nstatic PyObject *\ngentype_setflags(PyObject *self, PyObject *args, PyObject *kwds)\n{\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic int _array_typecode_fromstr(char *, int *, PyArray_Typecode *);\n\n/* need to fill in doc-strings for these methods on import -- copy from \n array docstrings \n*/\nstatic PyMethodDef gentype_methods[] = {\n {\"tolist\",\t (PyCFunction)gentype_tolist,\t1, NULL},\n {\"toscalar\", (PyCFunction)gentype_toscalar, METH_VARARGS, NULL},\n\t{\"tofile\", (PyCFunction)gentype_tofile, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"tostring\", (PyCFunction)gentype_tostring, METH_VARARGS, NULL},\n {\"byteswap\", (PyCFunction)gentype_byteswap,1, NULL},\n {\"astype\", (PyCFunction)gentype_astype, 1, NULL},\n\t{\"getfield\", (PyCFunction)gentype_getfield, \n\t METH_VARARGS | METH_KEYWORDS, NULL},\n {\"copy\", (PyCFunction)gentype_copy, 1, NULL}, \n {\"resize\", (PyCFunction)gentype_resize, 1, NULL}, \n\n\t{\"__array__\", (PyCFunction)gentype_getarray, 1, doc_getarray},\n\t{\"__array_wrap__\", (PyCFunction)gentype_wraparray, 1, doc_sc_wraparray},\n\n /* for the copy module */\n {\"__copy__\", (PyCFunction)gentype_copy, 1, NULL},\n {\"__deepcopy__\", (PyCFunction)gentype___deepcopy__, 1, NULL},\n\n\n {\"__reduce__\", (PyCFunction) gentype_reduce, 1, NULL},\t\n\t/* For consistency does nothing */\n\t{\"__setstate__\", (PyCFunction) gentype_setstate, 1, NULL},\n\n\t{\"dumps\", (PyCFunction) gentype_dumps, 1, NULL},\n\t{\"dump\", (PyCFunction) gentype_dump, 1, NULL},\n\n\t/* Methods for array */\n\t{\"transpose\",\t(PyCFunction)gentype_transpose, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"take\",\t(PyCFunction)gentype_take, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"put\",\t(PyCFunction)gentype_put, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"putmask\",\t(PyCFunction)gentype_putmask, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"repeat\",\t(PyCFunction)gentype_repeat, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"choose\",\t(PyCFunction)gentype_choose, \n\t METH_VARARGS, NULL},\t\n\t{\"sort\",\t(PyCFunction)gentype_sort, \n\t METH_VARARGS, NULL},\n\t{\"argsort\",\t(PyCFunction)gentype_argsort, \n\t METH_VARARGS, NULL},\n\t{\"searchsorted\", (PyCFunction)gentype_searchsorted, \n\t METH_VARARGS, NULL},\t\n\t{\"argmax\",\t(PyCFunction)gentype_argmax, \n\t METH_VARARGS, NULL},\n\t{\"argmin\", (PyCFunction)gentype_argmin,\n\t METH_VARARGS, NULL},\n\t{\"reshape\",\t(PyCFunction)gentype_reshape, \n\t METH_VARARGS, NULL},\n\t{\"squeeze\",\t(PyCFunction)gentype_squeeze, \n\t METH_VARARGS, NULL},\n\t{\"view\", (PyCFunction)gentype_view, \n\t METH_VARARGS, NULL},\n\t{\"swapaxes\", (PyCFunction)gentype_swapaxes,\n\t METH_VARARGS, NULL},\n\t{\"max\", (PyCFunction)gentype_max,\n\t METH_VARARGS, NULL},\n\t{\"min\", (PyCFunction)gentype_min,\n\t METH_VARARGS, NULL},\n\t{\"ptp\", (PyCFunction)gentype_ptp,\n\t METH_VARARGS, NULL},\n\t{\"mean\", (PyCFunction)gentype_mean,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"trace\", (PyCFunction)gentype_trace,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"diagonal\", (PyCFunction)gentype_diagonal,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"clip\", (PyCFunction)gentype_clip,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"conj\", (PyCFunction)gentype_conj,\n\t METH_VARARGS, NULL},\n\t{\"conjugate\", (PyCFunction)gentype_conjugate,\n\t METH_VARARGS, NULL},\n\t{\"nonzero\", (PyCFunction)gentype_nonzero,\n\t METH_VARARGS, NULL},\n\t{\"std\", (PyCFunction)gentype_std,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"sum\", (PyCFunction)gentype_sum,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"cumsum\", (PyCFunction)gentype_cumsum,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"prod\", (PyCFunction)gentype_prod,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"cumprod\", (PyCFunction)gentype_cumprod,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"all\", (PyCFunction)gentype_all,\n\t METH_VARARGS, NULL},\n\t{\"any\", (PyCFunction)gentype_any,\n\t METH_VARARGS, NULL},\n\t{\"compress\", (PyCFunction)gentype_compress,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"flatten\", (PyCFunction)gentype_flatten,\n\t METH_VARARGS, NULL},\n\t{\"ravel\", (PyCFunction)gentype_ravel,\n\t METH_VARARGS, NULL},\n\t{\"setflags\", (PyCFunction)gentype_setflags,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t/* add other methods!!! */\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\nstatic int\ngentype_getreadbuf(PyObject *self, int segment, void **ptrptr)\n{\n\tint numbytes;\n\tPyArray_Typecode outcode;\n\t\n\tif (segment != 0) {\n\t\tPyErr_SetString(PyExc_SystemError, \n\t\t\t\t\"Accessing non-existent array segment\");\n\t\treturn -1;\n\t}\n\n\tPyArray_TypecodeFromScalar(self, &outcode);\n\tnumbytes = outcode.itemsize;\n\tif PyArray_IsScalar(self, Flexible) {\n\t\tif PyArray_IsScalar(self, String)\n\t\t\t*ptrptr = PyString_AS_STRING(self);\n\t\telse if PyArray_IsScalar(self, Unicode)\n\t\t\t*ptrptr = (char *)PyUnicode_AS_DATA(self);\n\t\telse if PyArray_IsScalar(self, Void)\n\t\t\t*ptrptr = ((PyVoidScalarObject *)self)->obval;\n\t}\n\telse \n\t\t*ptrptr = (void *)&(((PyScalarObject *)self)->obval);\n\n\treturn numbytes;\n}\n\nstatic int\ngentype_getsegcount(PyObject *self, int *lenp)\n{\n\tPyArray_Typecode outcode;\n\n\tPyArray_TypecodeFromScalar(self, &outcode);\n\tif (lenp)\n\t\t*lenp = outcode.itemsize;\n\treturn 1;\n}\n\nstatic int\ngentype_getcharbuf(PyObject *self, int segment, const char **ptrptr)\n{\n\tif (PyArray_IsScalar(self, String) ||\t\\\n\t PyArray_IsScalar(self, Unicode))\n\t\treturn gentype_getreadbuf(self, segment, (void **)ptrptr);\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"Non-character array cannot be interpreted \"\\\n\t\t\t\t\"as character buffer.\");\n\t\treturn -1;\n\t}\n}\n\n\nstatic PyBufferProcs gentype_as_buffer = {\n (getreadbufferproc)gentype_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)0, /*bf_getwritebuffer*/\n (getsegcountproc)gentype_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)gentype_getcharbuf, /*bf_getcharbuffer*/\n};\n\n\n#define BASEFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES\n#define LEAFFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES\n\nstatic PyTypeObject PyGenericArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"generic_arrtype\",\t /*tp_name*/\n sizeof(PyObject),\t\t /*tp_basicsize*/\n};\n\n/* works for VOID and UNICODE */\n\nstatic void\nflexible_dealloc(PyObject *v) \n{\n\tPyDataMem_FREE(((PyVoidScalarObject *)v)->obval);\n\tv->ob_type->tp_free(v);\n}\n\nstatic void\nstring_arrtype_dealloc(PyObject *v)\n{\n\tv->ob_type->tp_free(v);\n}\n\nstatic void\nobject_arrtype_dealloc(PyObject *v)\n{\n\tPy_DECREF(((PyObjectScalarObject *)v)->obval);\n\tv->ob_type->tp_free(v);\n}\n\n/* string and unicode inherit from Python Type first and so GET_ITEM is different to\n get to the Python Type.\n */\n\n/**begin repeat \n#name=byte, short, int, long, longlong, ubyte, ushort, uint, ulong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, string, unicode, object#\n#TYPE=BYTE, SHORT, INT, LONG, LONGLONG, UBYTE, USHORT, UINT, ULONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, OBJECT#\n#num=1*16,0,0,1#\n*/\nstatic PyObject *\n@name@_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj=NULL;\n\tPyObject *arr;\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n\n\tif (type->tp_bases && (PyTuple_GET_SIZE(type->tp_bases)==2)) {\n\t\tPyTypeObject *sup;\n\t\tPyObject *ret;\n\t\t/* We are inheriting from a Python type as well so\n\t\t give it first dibs on conversion */\n\t\tsup = (PyTypeObject *)PyTuple_GET_ITEM(type->tp_bases, @num@);\n\t\tret = sup->tp_new(type, args, kwds);\n\t\tif (ret) return ret;\n\t\tPyErr_Clear();\n\t\t/* now do default conversion */\n\t}\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\n\ttypecode.type_num = PyArray_@TYPE@;\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n/**end repeat**/\n\n/* bool->tp_new only returns Py_True or Py_False */\nstatic PyObject *\nbool_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj=NULL;\n\tPyObject *arr;\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n\nstatic PyObject *\nvoid_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj, *arr;\n\tulonglong memu=1;\n\tPyObject *new=NULL;\n\tPyArray_Typecode typecode = {PyArray_VOID, 0, 0};\n\tchar *destptr;\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\t/* For a VOID scalar first see if obj is an integer or long \n\t and create new memory of that size (filled with 0) for the scalar\n\t*/\n\n\tif (PyLong_Check(obj) || PyInt_Check(obj) || \\\n\t PyArray_IsScalar(obj, Integer) ||\n\t (PyArray_Check(obj) && PyArray_NDIM(obj)==0 &&\t\\\n\t PyArray_ISINTEGER(obj))) {\n\t\tnew = obj->ob_type->tp_as_number->nb_long(obj);\n\t}\n\tif (new && PyLong_Check(new)) {\n\t\tPyObject *ret;\n\t\tmemu = PyLong_AsUnsignedLongLong(new);\n\t\tPy_DECREF(new);\n\t\tif (PyErr_Occurred() || (memu > MAX_INT)) {\n\t\t\tPyErr_Clear();\n\t\t\tPyErr_Format(PyExc_OverflowError, \n\t\t\t\t \"size must be smaller than %d\",\n\t\t\t\t (int) MAX_INT);\n\t\t\treturn NULL;\n\t\t}\n\t\tdestptr = PyDataMem_NEW((int) memu);\n\t\tif (destptr == NULL) return PyErr_NoMemory();\n\t\tret = type->tp_alloc(type, 0);\n\t\tif (ret == NULL) {\n\t\t\tPyDataMem_FREE(destptr);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\t((PyVoidScalarObject *)ret)->obval = destptr;\n\t\t((PyVoidScalarObject *)ret)->ob_size = (int) memu;\n\t\tmemset(destptr, '\\0', (size_t) memu);\n\t\treturn ret;\n\t}\n\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n\n\n/**************** Define Hash functions ********************/\n\n/**begin repeat\n#lname=bool,ubyte,ushort#\n#name=Bool,UByte, UShort#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n return (long)(((Py@name@ScalarObject *)obj)->obval);\n}\n/**end repeat**/\n\n/**begin repeat\n#lname=byte,short,uint,ulong#\n#name=Byte,Short,UInt,ULong#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((Py@name@ScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n/**end repeat**/\n\n#if SIZEOF_INT != SIZEOF_LONG\nstatic long\nint_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((PyIntScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n#endif\n\n/**begin repeat\n#char=,u#\n#Char=,U#\n#ext=&& (x >= LONG_MIN),#\n*/\n#if SIZEOF_LONG != SIZEOF_LONGLONG\n/* we assume SIZEOF_LONGLONG=2*SIZEOF_LONG */\nstatic long\n@char@longlong_arrtype_hash(PyObject *obj)\n{\n long y;\n @char@longlong x = (((Py@Char@LongLongScalarObject *)obj)->obval);\n\n if ((x <= LONG_MAX)@ext@) {\n y = (long) x;\n }\n else {\n union Mask {\n long hashvals[2];\n @char@longlong v;\n } both;\n\n both.v = x;\n y = both.hashvals[0] + (1000003)*both.hashvals[1];\n }\n if (y == -1) y = -2;\n return y;\n}\n#endif\n/**end repeat**/\n\n#if SIZEOF_LONG==SIZEOF_LONGLONG\nstatic long\nulonglong_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((PyULongLongScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n#endif\n\n\n\n/* Wrong thing to do for longdouble, but....*/\n/**begin repeat\n#lname=float, longdouble#\n#name=Float, LongDouble#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n return _Py_HashDouble((double) ((Py@name@ScalarObject *)obj)->obval);\n}\n\n/* borrowed from complex_hash */\nstatic long\nc@lname@_arrtype_hash(PyObject *obj)\n{\n long hashreal, hashimag, combined;\n hashreal = _Py_HashDouble((double) \\\n (((PyC@name@ScalarObject *)obj)->obval).real);\n\n if (hashreal == -1) return -1;\n hashimag = _Py_HashDouble((double) \\\n (((PyC@name@ScalarObject *)obj)->obval).imag);\n if (hashimag == -1) return -1;\n\n combined = hashreal + 1000003 * hashimag;\n if (combined == -1) combined = -2;\n return combined;\n}\n/**end repeat**/\n\nstatic long\nobject_arrtype_hash(PyObject *obj)\n{\n return PyObject_Hash(((PyObjectScalarObject *)obj)->obval);\n}\n\n/* just hash the pointer */\nstatic long\nvoid_arrtype_hash(PyObject *obj)\n{\n return _Py_HashPointer((void *)(((PyVoidScalarObject *)obj)->obval));\n}\n\n/**begin repeat\n#name=bool, string, unicode, void, object#\n#NAME=Bool, String, Unicode, Void, Object#\n*/\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@_arrtype\",\t /*tp_name*/\n sizeof(Py@NAME@ScalarObject),\t /*tp_basicsize*/\n};\n/**end repeat**/\n\n/**begin repeat\n#NAME=Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble#\n#name=int*5, uint*5, float*3, complex*3#\n#CNAME=(CHAR, SHORT, INT, LONG, LONGLONG)*2, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE#\n*/\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@\" STRBITSOF_@CNAME@ \"_arrtype\",\t /*tp_name*/\n sizeof(Py@NAME@ScalarObject),\t /*tp_basicsize*/\n};\n\n/**end repeat**/\n\n\n\n\nstatic PyNumberMethods longdoubletype_as_number;\nstatic PyNumberMethods clongdoubletype_as_number;\n\nstatic void \ninitialize_numeric_types(void)\n{\n\tPyGenericArrType_Type.tp_dealloc = (destructor)gentype_dealloc;\n\tPyGenericArrType_Type.tp_as_number = &gentype_as_number;\n\tPyGenericArrType_Type.tp_as_buffer = &gentype_as_buffer;\n\tPyGenericArrType_Type.tp_flags = BASEFLAGS;\n\tPyGenericArrType_Type.tp_methods = gentype_methods;\n\tPyGenericArrType_Type.tp_getset = gentype_getsets;\n\tPyGenericArrType_Type.tp_new = NULL;\n\tPyGenericArrType_Type.tp_free = PyObject_Del;\n\tPyGenericArrType_Type.tp_repr = gentype_repr;\n\tPyGenericArrType_Type.tp_str = gentype_str;\n\tPyGenericArrType_Type.tp_richcompare = gentype_richcompare;\n\n\t/**begin repeat\n#NAME=Numeric, Integer, SignedInteger, UnsignedInteger, Inexact, Floating, \nComplexFloating, Flexible, Character#\n\t*/\n Py@NAME@ArrType_Type.tp_flags = BASEFLAGS;\n\t/**end repeat**/\n\n\t/**begin repeat\n#name=bool, byte, short, int, long, longlong, ubyte, ushort, uint, ulong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, string, unicode, void, object#\n#NAME=Bool, Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, String, Unicode, Void, Object#\n\t*/\n\tPy@NAME@ArrType_Type.tp_flags = LEAFFLAGS;\n\tPy@NAME@ArrType_Type.tp_new = @name@_arrtype_new;\n\tPy@NAME@ArrType_Type.tp_richcompare = gentype_richcompare;\n\t/**end repeat**/\n\t/* Allow the Void type to be subclassed -- for adding new types */\n\tPyVoidArrType_Type.tp_flags = BASEFLAGS;\n\n /**begin repeat\n#name=bool, byte, short, ubyte, ushort, uint, ulong, ulonglong, float, longdouble, cfloat, clongdouble, void, object#\n#NAME=Bool, Byte, Short, UByte, UShort, UInt, ULong, ULongLong, Float, LongDouble, CFloat, CLongDouble, Void, Object#\n */\n Py@NAME@ArrType_Type.tp_hash = @name@_arrtype_hash;\n /**end repeat**/\n\n#if SIZEOF_INT != SIZEOF_LONG\n /* We won't be inheriting from Python Int type. */\n PyIntArrType_Type.tp_hash = int_arrtype_hash;\n#endif\n\n#if SIZEOF_LONG != SIZEOF_LONGLONG\n /* We won't be inheriting from Python Int type. */\n PyLongLongArrType_Type.tp_hash = longlong_arrtype_hash;\n#endif\n\n\t/* These need to be coded specially because getitem does not\n\t return a normal Python type\n\t*/\n\tPyLongDoubleArrType_Type.tp_as_number = &longdoubletype_as_number;\n\tPyCLongDoubleArrType_Type.tp_as_number = &clongdoubletype_as_number;\n\n\t/**begin repeat\n#name=int, long, hex, oct, float, repr, str#\n#kind=tp_as_number->nb*5, tp*2#\n\t*/\n\tPyLongDoubleArrType_Type.@kind@_@name@ = longdoubletype_@name@;\n\tPyCLongDoubleArrType_Type.@kind@_@name@ = clongdoubletype_@name@;\n\t/**end repeat**/\n\n\tPyStringArrType_Type.tp_itemsize = sizeof(char);\n\tPyStringArrType_Type.tp_dealloc = string_arrtype_dealloc;\n\tPyFlexibleArrType_Type.tp_dealloc = flexible_dealloc;\n\tPyObjectArrType_Type.tp_dealloc = object_arrtype_dealloc;\n\n\tPyArrayIter_Type.tp_iter = PyObject_SelfIter;\n\tPyArrayMapIter_Type.tp_iter = PyObject_SelfIter;\n}\n\n\nstatic PyTypeObject *typeobjects[] = {\n\t&PyBoolArrType_Type,\n\t&PyByteArrType_Type,\n\t&PyUByteArrType_Type,\n\t&PyShortArrType_Type,\n\t&PyUShortArrType_Type,\n\t&PyIntArrType_Type,\n\t&PyUIntArrType_Type,\n\t&PyLongArrType_Type,\n\t&PyULongArrType_Type,\n\t&PyLongLongArrType_Type,\n\t&PyULongLongArrType_Type,\n\t&PyFloatArrType_Type,\n\t&PyDoubleArrType_Type,\n\t&PyLongDoubleArrType_Type,\n\t&PyCFloatArrType_Type,\n\t&PyCDoubleArrType_Type,\n\t&PyCLongDoubleArrType_Type,\n\t&PyObjectArrType_Type,\n\t&PyStringArrType_Type,\n\t&PyUnicodeArrType_Type,\n\t&PyVoidArrType_Type\n};\n\n\nstatic int\nPyArray_TypenumFromTypeObject(PyObject *type) \n{\n\tint typenum, i;\n\n\ttypenum = PyArray_NOTYPE;\n i = 0;\n\twhile(i < PyArray_NTYPES) {\n\t\tif (type == (PyObject *)typeobjects[i]) {\n\t\t\ttypenum = i;\n\t\t\tbreak;\n\t\t}\n i++;\n\t}\n\tif (typenum != PyArray_NOTYPE)\n\t\treturn typenum;\n\n\t/* Find registered types */\n\t\n\t/* here */\n\n\t/* Convert generic types to specific types */\n\tif ((type == (PyObject *) &PyNumericArrType_Type) || \\\n\t (type == (PyObject *) &PyInexactArrType_Type) || \\\n\t (type == (PyObject *) &PyFloatingArrType_Type))\n\t\treturn PyArray_DOUBLE;\n\telse if (type == (PyObject *)&PyComplexFloatingArrType_Type)\n\t\treturn PyArray_CDOUBLE;\n\telse if ((type == (PyObject *)&PyIntegerArrType_Type) ||\t\\\n\t\t (type == (PyObject *)&PySignedIntegerArrType_Type))\n\t\treturn PyArray_LONG;\n\telse if (type == (PyObject *) &PyUnsignedIntegerArrType_Type)\n\t\treturn PyArray_ULONG;\n else if (type == (PyObject *) &PyCharacterArrType_Type)\n\t\treturn PyArray_STRING;\n\telse if (type == (PyObject *) &PyFlexibleArrType_Type)\n\t\treturn PyArray_VOID;\n\telse if (type == (PyObject *)&PyBool_Type)\n\t\ttypenum = PyArray_BOOL;\n\telse if (type == (PyObject *)&PyInt_Type)\n\t\ttypenum = PyArray_LONG;\n\telse if (type == (PyObject *)&PyFloat_Type)\n\t\ttypenum = PyArray_DOUBLE;\t\n\telse if (type == (PyObject *)&PyComplex_Type)\n\t\ttypenum = PyArray_CDOUBLE;\n\telse if (type == (PyObject *)&PyString_Type)\n\t\ttypenum = PyArray_STRING;\n\telse if (type == (PyObject *)&PyUnicode_Type)\n\t\ttypenum = PyArray_UNICODE;\n\telse if (type == (PyObject *)&PyBuffer_Type)\n\t\ttypenum = PyArray_VOID;\n\telse\n\t\ttypenum = PyArray_OBJECT;\n\treturn typenum;\n}\n\nstatic void \nPyArray_TypecodeFromTypeObject(PyObject *type, PyArray_Typecode *typecode) {\n\tint itemsize = 0;\n\tint type_num;\n\n\ttype_num = PyArray_TypenumFromTypeObject(type);\n\ttypecode->type_num = type_num;\n\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n itemsize = 0;\n\t}\n\telse {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type_num);\n\t\tif (descr != NULL)\n\t\t\titemsize = descr->elsize;\n\t}\n\ttypecode->itemsize = itemsize;\n\treturn;\n}\n\nstatic void \nPyArray_TypecodeFromScalar(PyObject *sc, PyArray_Typecode *typecode)\n{\n\tint type_num;\n\n PyArray_TypecodeFromTypeObject((PyObject *)sc->ob_type, typecode);\n if (typecode->itemsize == 0) {\n type_num = typecode->type_num;\n\t\tif (type_num == PyArray_STRING) \n\t\t\ttypecode->itemsize = PyString_GET_SIZE(sc);\n\t\telse if (type_num == PyArray_UNICODE)\n\t\t\ttypecode->itemsize = PyUnicode_GET_DATA_SIZE(sc);\n\t\telse if (type_num == PyArray_VOID) {\n\t\t\ttypecode->itemsize = \\\n\t\t\t\t((PyVoidScalarObject *)sc)->ob_size;\n\t\t}\n }\n\treturn;\n}\n\nstatic PyObject *\nPyArray_TypeObjectFromType(int type)\n{\n\tPyArray_Descr *descr;\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr == NULL) return NULL;\n\tPy_INCREF((PyObject *)descr->typeobj);\n\treturn (PyObject *)descr->typeobj;\n}\n\n", "source_code_before": "/* -*- c -*- */\n\n/**begin repeat\n\n#name=Bool, Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, Object,#\n#type=Bool, signed char, short, int, long, longlong, unsigned char, unsigned short, unsigned int, unsigned long, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, PyObject *,char#\n*/\ntypedef struct {\n\tPyObject_HEAD;\n\t@type@ obval;\n} Py@name@ScalarObject;\n\n/**end repeat**/\n\n/* Inheritance established later when tp_bases is set (or tp_base for \n single inheritance) */\n\n/**begin repeat\n\n#name=numeric, integer, signedinteger, unsignedinteger, inexact, floating, complexfloating, flexible, \ncharacter#\n#NAME=Numeric, Integer, SignedInteger, UnsignedInteger, Inexact, Floating, ComplexFloating, Flexible, Character#\n*/\n\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@_arrtype\",\t\t /*tp_name*/\n sizeof(PyObject),\t\t /*tp_basicsize*/\n};\n/**end repeat**/\n\n\n#define PyStringScalarObject PyStringObject\n#define PyUnicodeScalarObject PyUnicodeObject\n\ntypedef struct {\n\tPyObject_VAR_HEAD;\n\tchar *obval;\n} PyVoidScalarObject;\n\n/* 0-dim array from array-scalar object */\n\nstatic PyObject *\nPyArray_FromScalar(PyObject *scalar, PyArray_Typecode *outcode)\n{\n\tPyArray_Typecode typecode;\n\tPyObject *r;\n\tchar *memptr;\n\tPyObject *ret;\n\n\t/* convert to 0-dim array of scalar typecode */\n\tPyArray_TypecodeFromScalar(scalar, &typecode);\n\tr = PyArray_New(&PyArray_Type, 0, NULL, typecode.type_num,\n\t\t\tNULL, NULL, typecode.itemsize, 0, NULL);\n\tif (r==NULL) return NULL;\n\n\tswitch(typecode.type_num) {\n\tcase PyArray_STRING:\n\t\tmemptr = PyString_AS_STRING(scalar);\n\t\tbreak;\n\tcase PyArray_UNICODE:\n\t\tmemptr = (char *)PyUnicode_AS_DATA(scalar);\n\t\tbreak;\n\tcase PyArray_VOID:\n\t\tmemptr = (((PyVoidScalarObject *)scalar)->obval);\n\t\tbreak;\n\tdefault:\n\t\tmemptr = &(((PyScalarObject *)scalar)->obval);\n\t\tbreak;\n\t}\n\n\tmemcpy(PyArray_DATA(r), memptr, PyArray_ITEMSIZE(r));\n\tif (PyArray_ISOBJECT(r)) {\n\t\tPy_INCREF(*((PyObject **)memptr));\n\t}\n\t\n\tif (outcode == NULL || \\\n\t outcode->type_num == PyArray_NOTYPE ||\t\\\n\t outcode->type_num == PyArray_TYPE(r))\n\t\treturn r;\n\n\t/* cast if necessary to desired output typecode */\n\tret = PyArray_CastToType((PyArrayObject *)r, outcode);\n\tPy_DECREF(r);\n\treturn ret;\n}\n\n\nstatic void\ngentype_dealloc(PyObject *v) \n{\n\tv->ob_type->tp_free(v);\n}\n\n\nstatic PyObject *\ngentype_power(PyObject *m1, PyObject *m2, PyObject *m3)\n{\n\tPyObject *arr, *ret, *arg2;\n\tchar *msg=\"unsupported operand type(s) for ** or pow()\";\n\t\n\tif (!PyArray_IsScalar(m1,Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_power(m1,m2, \n\t\t\t\t\t\t\t\t Py_None);\n\t\t}\n\t\telse {\n\t\t\tif (!PyArray_IsScalar(m2,Generic)) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_power(m1, arr,\n\t\t\t\t\t\t\t\t Py_None);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_power(m1,m2, \n\t\t\t\t\t\t\t\t Py_None);\n\t\t}\n\t\telse {\n\t\t\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_power(arr, m2,\n\t\t\t\t\t\t\t\t Py_None);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tarr=arg2=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\targ2 = PyArray_FromScalar(m2, NULL);\t\n\tif (arr == NULL || arg2 == NULL) {\n\t\tPy_XDECREF(arr); Py_XDECREF(arg2); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_power(arr, arg2, Py_None);\n\tPy_DECREF(arr);\n\tPy_DECREF(arg2);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_generic_method(PyObject *self, PyObject *args, PyObject *kwds, \n\t\t char *str)\n{\n\tPyObject *arr, *meth, *ret;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tmeth = PyObject_GetAttrString(arr, str);\n\tif (kwds == NULL) \n\t\tret = PyObject_CallObject(meth, args);\n\telse\n\t\tret = PyObject_Call(meth, args, kwds);\n\tPy_DECREF(meth);\n\tPy_DECREF(arr);\n\treturn PyArray_Return((PyArrayObject *)ret);\n}\n\n/**begin repeat\n\n#name=add, subtract, divide, remainder, divmod, lshift, rshift, and, xor, or, floor_divide, true_divide#\n#PYNAME=Add, Subtract, Divide, Remainder, Divmod, Lshift, Rshift, And, Xor, Or, FloorDivide, TrueDivide#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *m1, PyObject *m2)\n{\n\tPyObject *arr, *ret, *tup;\n\n\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_@name@(m1,m2);\n\t\t}\n else if ((m1->ob_type->tp_as_number == NULL) ||\n\t\t\t (m1->ob_type->tp_as_number->nb_@name@ == NULL)) {\n\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_@name@(m1, arr);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\telse {\n\t\t\t/* Convert m2 to a Python object and then try */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m2, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_@PYNAME@(m1, arr);\n\t\t\tif (ret==NULL) {\n\t\t\t\tPyObject *newarr;\n\t\t\t\tPyErr_Clear();\n\t\t\t\t/* Convert object to Array scalar and try again */\n\t\t\t\tnewarr = PyArray_FromAny(m1, NULL, 0, 0, 0);\n\t\t\t\tif (newarr!=NULL) {\n\t\t\t\t\tret = newarr->ob_type->tp_as_number->nb_@name@(m1, newarr);\n\t\t\t\t\tPy_DECREF(newarr);\n\t\t\t\t}\n\t\t\t}\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_@name@(m1,m2);\n\t\t}\n\t\telse if ((m2->ob_type->tp_as_number == NULL) ||\n\t\t\t (m2->ob_type->tp_as_number->nb_@name@ == NULL)) {\n\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\tif (arr == NULL) return NULL;\n\t\t\tret = arr->ob_type->tp_as_number->nb_@name@(arr, m2);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\telse {\n\t\t\t/* Convert m1 to a Python object and then try */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m1, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tret = PyNumber_@PYNAME@(arr,m2);\n\t\t\tif (ret==NULL) {\n\t\t\t\tPyObject *newarr;\n\t\t\t\tPyErr_Clear();\n\t\t\t\t/* Convert object to Array and try again */\n\t\t\t\tnewarr = PyArray_FromAny(m1, NULL, 0, 0, 0);\n\t\t\t\tif (newarr!=NULL) {\n\t\t\t\t\tret = newarr->ob_type->tp_as_number->nb_@name@(newarr, m2);\n\t\t\t\t\tPy_DECREF(newarr);\n\t\t\t\t}\n\t\t\t}\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tarr=tup=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\ttup = PyArray_FromScalar(m2, NULL);\n\tif (arr == NULL || tup == NULL) {\n\t\tPy_XDECREF(tup); Py_XDECREF(arr); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_@name@(arr, tup);\n\tPy_DECREF(arr);\n\tPy_DECREF(tup);\n\treturn ret;\n}\n/**end repeat**/\n\n\nstatic PyObject *\ngentype_multiply(PyObject *m1, PyObject *m2)\n{\n\tPyObject *arr, *ret, *tup;\n\tlong repeat;\n\n\tif (!PyArray_IsScalar(m1, Generic)) {\n\t\tif (PyArray_Check(m1)) {\n\t\t\tret = m1->ob_type->tp_as_number->nb_multiply(m1,m2);\n\t\t}\n\t\telse if ((m1->ob_type->tp_as_number == NULL) ||\n\t\t\t (m1->ob_type->tp_as_number->nb_multiply == NULL)) {\n\t\t\t/* Convert m2 to an int and assume sequence\n\t\t\t repeat */\n\t\t\trepeat = PyInt_AsLong(m2);\n\t\t\tif (repeat == -1 && PyErr_Occurred()) return NULL;\n\t\t\tret = PySequence_Repeat(m1, (int) repeat);\n\t\t\tif (ret == NULL) {\n\t\t\t\tPyErr_Clear();\n\t\t\t\tarr = PyArray_FromScalar(m2, NULL);\n\t\t\t\tif (arr == NULL) return NULL;\n\t\t\t\tret = arr->ob_type->tp_as_number->\\\n\t\t\t\t\tnb_multiply(m1, arr);\n\t\t\t\tPy_DECREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t/* Convert m2 to a Python object */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m2, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_Multiply(m1, arr);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\tif (!PyArray_IsScalar(m2, Generic)) {\n\t\tif (PyArray_Check(m2)) {\n\t\t\tret = m2->ob_type->tp_as_number->nb_multiply(m1,m2);\n\t\t}\n\t\telse if ((m2->ob_type->tp_as_number == NULL) ||\n\t\t\t (m2->ob_type->tp_as_number->nb_multiply == NULL)) {\n\t\t\t/* Convert m1 to an int and assume sequence\n\t\t\t repeat */\n\t\t\trepeat = PyInt_AsLong(m1);\n\t\t\tif (repeat == -1 && PyErr_Occurred()) return NULL;\n\t\t\tret = PySequence_Repeat(m2, (int) repeat);\n\t\t\tif (ret == NULL) {\n\t\t\t\tPyErr_Clear();\n\t\t\t\tarr = PyArray_FromScalar(m1, NULL);\n\t\t\t\tif (arr == NULL) return NULL;\n\t\t\t\tret = arr->ob_type->tp_as_number->\t\\\n\t\t\t\t\tnb_multiply(arr, m2);\n\t\t\t\tPy_DECREF(arr);\n\t\t\t}\t\t\t\n\t\t}\n\t\telse {\n\t\t\t/* Convert m1 to a Python object */\n\t\t\ttup = PyTuple_New(0);\n\t\t\tarr = gentype_generic_method(m1, tup, NULL, \n\t\t\t\t\t\t \"toscalar\");\n\t\t\tPy_DECREF(tup);\n\t\t\tif (arr == NULL) return NULL;\n ret = PyNumber_Multiply(arr, m2);\n\t\t\tPy_DECREF(arr);\n\t\t}\n\t\treturn ret;\n\t}\n\t/* Both are array scalar objects */\n\tarr=tup=NULL;\n\tarr = PyArray_FromScalar(m1, NULL);\n\ttup = PyArray_FromScalar(m2, NULL);\n\tif (arr == NULL || tup == NULL) {\n\t\tPy_XDECREF(tup); Py_XDECREF(arr); return NULL;\n\t}\n\tret = arr->ob_type->tp_as_number->nb_multiply(arr, tup);\n\tPy_DECREF(arr);\n\tPy_DECREF(tup);\n\treturn ret;\n\n}\n\n\n\n/**begin repeat\n\n#name=negative, absolute, invert, int, long, float, oct, hex#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *m1)\n{\n\tPyObject *arr, *ret;\n\n\tarr = PyArray_FromScalar(m1, NULL);\n\tif (arr == NULL) return NULL;\n\tret = arr->ob_type->tp_as_number->nb_@name@(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n/**end repeat**/\n\nstatic int\ngentype_nonzero_number(PyObject *m1)\n{\n\tPyObject *arr;\n\tint ret;\n\n\tarr = PyArray_FromScalar(m1, NULL);\n\tif (arr == NULL) return -1;\n\tret = arr->ob_type->tp_as_number->nb_nonzero(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_str(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tif (arr==NULL) return NULL;\n\tret = PyObject_Str(arr->descr->getitem(arr->data, arr));\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_repr(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tif (arr==NULL) return NULL;\n\tret = PyObject_Repr(arr->descr->getitem(arr->data, arr));\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic void\nformat_longdouble(char *buf, size_t buflen, longdouble val, int precision)\n{\n register char *cp;\n\n PyOS_snprintf(buf, buflen, \"%.*\" LONGDOUBLE_FMT, precision, val);\n cp = buf;\n if (*cp == '-')\n cp++;\n for (; *cp != '\\0'; cp++) {\n if (!isdigit(Py_CHARMASK(*cp)))\n break;\n }\n if (*cp == '\\0') {\n *cp++ = '.';\n *cp++ = '0';\n *cp++ = '\\0';\n }\n}\n\n#if SIZEOF_LONGDOUBLE == SIZEOF_DOUBLE\n#define PREC_REPR 15\n#define PREC_STR 15\n#else\n#define PREC_REPR 21\n#define PREC_STR 21\n#endif\n\nstatic PyObject *\nlongdoubletype_repr(PyObject *self)\n{\n static char buf[100];\n format_longdouble(buf, sizeof(buf), ((PyLongDoubleScalarObject *)self)->obval, PREC_REPR);\n return PyString_FromString(buf);\n}\n\nstatic PyObject *\nclongdoubletype_repr(PyObject *self)\n{\n static char buf1[100];\n static char buf2[100];\n\tstatic char buf3[202];\n clongdouble x;\n x = ((PyCLongDoubleScalarObject *)self)->obval;\n format_longdouble(buf1, sizeof(buf1), x.real, PREC_REPR);\n format_longdouble(buf2, sizeof(buf2), x.imag, PREC_REPR);\n\n\tsnprintf(buf3, sizeof(buf3), \"(%s+%sj)\", buf1, buf2);\n\treturn PyString_FromString(buf3);\n}\n\n#define longdoubletype_str longdoubletype_repr\n#define clongdoubletype_str clongdoubletype_repr\n\n/** Could improve this with a PyLong_FromLongDouble(longdouble ldval)\n but this would need some more work...\n**/\n\n/**begin repeat\n\n#name=(int, long, hex, oct, float)*2#\n#KIND=(Long*4, Float)*2#\n#char=,,,,,c*5#\n#CHAR=,,,,,C*5#\n#POST=,,,,,.real*5#\n*/\nstatic PyObject *\n@char@longdoubletype_@name@(PyObject *self)\n{\n\tdouble dval;\n\tPyObject *obj, *ret;\n\t\n\tdval = (double)(((Py@CHAR@LongDoubleScalarObject *)self)->obval)@POST@;\n\tobj = Py@KIND@_FromDouble(dval);\n\tret = obj->ob_type->tp_as_number->nb_@name@(obj);\n\tPy_DECREF(obj);\n\treturn ret;\n}\n/**end repeat**/\n\n\nstatic PyObject *gentype_copy(PyObject *, PyObject *);\n\nstatic PyNumberMethods gentype_as_number = {\n (binaryfunc)gentype_add,\t\t /*nb_add*/\n (binaryfunc)gentype_subtract,\t\t /*nb_subtract*/\n (binaryfunc)gentype_multiply,\t\t /*nb_multiply*/\n (binaryfunc)gentype_divide,\t\t /*nb_divide*/\n (binaryfunc)gentype_remainder,\t /*nb_remainder*/\n (binaryfunc)gentype_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)gentype_power,\t\t /*nb_power*/\n (unaryfunc)gentype_negative,\t \n (unaryfunc)gentype_copy,\t\t /*nb_pos*/ \n (unaryfunc)gentype_absolute,\t\t /*(unaryfunc)gentype_abs,*/\n (inquiry)gentype_nonzero_number,\t\t /*nb_nonzero*/\n (unaryfunc)gentype_invert,\t\t /*nb_invert*/\n (binaryfunc)gentype_lshift,\t /*nb_lshift*/\n (binaryfunc)gentype_rshift,\t /*nb_rshift*/\n (binaryfunc)gentype_and,\t /*nb_and*/\n (binaryfunc)gentype_xor,\t /*nb_xor*/\n (binaryfunc)gentype_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)gentype_int,\t\t /*nb_int*/\n (unaryfunc)gentype_long,\t\t /*nb_long*/\n (unaryfunc)gentype_float,\t\t /*nb_float*/\n (unaryfunc)gentype_oct,\t\t /*nb_oct*/\n (unaryfunc)gentype_hex,\t\t /*nb_hex*/\n 0, /*inplace_add*/\n 0, /*inplace_subtract*/\n 0, /*inplace_multiply*/\n 0, /*inplace_divide*/\n 0, /*inplace_remainder*/\n 0, /*inplace_power*/\n 0, /*inplace_lshift*/\n 0, /*inplace_rshift*/\n 0, /*inplace_and*/\n 0, /*inplace_xor*/\n 0, /*inplace_or*/\n (binaryfunc)gentype_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)gentype_true_divide,\t /*nb_true_divide*/\n 0, /*nb_inplace_floor_divide*/\n 0, /*nb_inplace_true_divide*/\n\n};\n\nstatic PyObject *\ngentype_richcompare(PyObject *self, PyObject *other, int cmp_op) \n{\n\n\tPyObject *arr, *ret;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tret = arr->ob_type->tp_richcompare(arr, other, cmp_op);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_ndim_get(PyObject *self)\n{\n\treturn PyInt_FromLong(0);\n}\n\nstatic PyObject *\ngentype_flags_get(PyObject *self)\n{\n\tPyObject *dict;\n\tdict = PyDict_New();\t\n\n#define ADDFLAG(flag, val) PyDict_SetItemString(dict, #flag, Py_##val);\n\n ADDFLAG(CONTIGUOUS, True);\n ADDFLAG(OWN_DATA, True);\n ADDFLAG(FORTRAN, True);\n ADDFLAG(ALIGNED, True);\n ADDFLAG(NOTSWAPPED, True);\n ADDFLAG(WRITEABLE, False);\n ADDFLAG(UPDATEIFCOPY, False);\n\treturn dict;\n#undef ADDFLAG\n}\n\nstatic PyObject *\ngentype_shape_get(PyObject *self)\n{\n\treturn PyTuple_New(0);\n}\n\n/*\nstatic int\ngentype_shape_set(PyObject *self, PyObject *val)\n{\n\tif (!PyTuple_Check(val) || PyTuple_GET_SIZE(val) > 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \\\n\t\t\t\t\"invalid shape for scalar\");\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n*/\n\n\nstatic PyObject *\ngentype_data_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\n\treturn PyBuffer_FromObject(self, 0, typecode.itemsize);\n}\n\n\nstatic PyObject *\ngentype_itemsize_get(PyObject *self)\n{\t\n\tPyArray_Typecode typecode;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\treturn PyInt_FromLong((long) typecode.itemsize);\n}\n\nstatic PyObject *\ngentype_size_get(PyObject *self)\n{\n\treturn PyInt_FromLong(1);\n}\n\n\nstatic PyObject *\ngentype_typechar_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\tPyArray_Descr *descr;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\tdescr = PyArray_DescrFromType(typecode.type_num);\n\tif (PyArray_IsScalar(self, Flexible)) \n\t\treturn PyString_FromFormat(\"%c%d\", (int)(descr->type),\n\t\t\t\t\t typecode.itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(descr->type), 1);\n}\n\nstatic PyObject *\ngentype_typestr_get(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tret = PyObject_GetAttrString((PyObject *)arr, \"dtypestr\");\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyObject *\ngentype_descr_get(PyObject *self)\n{\n\tPyArrayObject *arr;\n\tPyObject *ret;\n\n\tarr = (PyArrayObject *)PyArray_FromScalar(self, NULL);\n\tret = PyObject_GetAttrString((PyObject *)arr, \"__array_descr__\");\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\n\nstatic PyObject *\ngentype_typenum_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\treturn PyInt_FromLong((long) typecode.type_num);\n}\n\nstatic PyObject *\ngentype_type_get(PyObject *self)\n{\n\treturn (PyObject *)self->ob_type;\n}\n\n\nstatic PyObject *\ngentype_base_get(PyObject *self)\n{\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\n\nstatic PyObject *\ngentype_real_get(PyObject *self)\n{\n\tPyArray_Typecode typecode;\n\n\tif (PyArray_IsScalar(self, ComplexFloating)) {\n\t\tPyArray_TypecodeFromScalar(self, &typecode);\n\t\treturn PyArray_Scalar(&(((PyScalarObject *)self)->obval),\n\t\t\t\t typecode.type_num-PyArray_NUM_FLOATTYPE,\n\t\t\t\t typecode.itemsize >> 1, 0);\n\t}\n\telse if PyArray_IsScalar(self, Object) {\n\t\tPyObject *obj = ((PyObjectScalarObject *)self)->obval;\n\t\tPyObject *ret;\n\t\tret = PyObject_GetAttrString(obj, \"real\");\n\t\tif (ret != NULL) return ret;\n\t}\n\tPy_INCREF(self);\n\treturn (PyObject *)self;\n}\n\nstatic PyObject *\ngentype_imag_get(PyObject *self)\n{\t\n\tPyArray_Typecode typecode;\n\tPyArray_TypecodeFromScalar(self, &typecode);\n\tif (PyArray_IsScalar(self, ComplexFloating)) {\n\t\ttypecode.itemsize >>= 1;\n\t\treturn PyArray_Scalar(&(((PyScalarObject *)self)->obval)\n\t\t\t\t + typecode.itemsize, \n\t\t\t\t typecode.type_num-PyArray_NUM_FLOATTYPE,\n\t\t\t\t typecode.itemsize, 0);\n\t}\n\telse if PyArray_IsScalar(self, Object) {\n\t\tPyObject *obj = ((PyObjectScalarObject *)self)->obval;\n\t\tPyObject *ret;\n\t\tret = PyObject_GetAttrString(obj, \"imag\");\n\t\tif (ret == NULL) {\n\t\t\tPyErr_Clear();\n\t\t\tobj = PyInt_FromLong(0);\n\t\t\tret = PyArray_Scalar((char *)&obj, PyArray_OBJECT, \n\t\t\t\t\t sizeof(void *), 0);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t\treturn ret;\n\t}\n\telse {\n\t\tPyObject *ret;\n\t\tchar *temp;\n\t\ttemp = PyDataMem_NEW(typecode.itemsize);\n\t\tmemset(temp, '\\0', typecode.itemsize);\n\t\tret = PyArray_Scalar(temp, typecode.type_num,\n\t\t\t\t typecode.itemsize, 0);\n\t\tPyDataMem_FREE(temp);\n\t\treturn ret;\n\t}\n}\n\nstatic PyObject *\ngentype_flat_get(PyObject *self)\n{\n\tPyObject *ret, *arr;\n\n\tarr = PyArray_FromScalar(self, NULL);\n\tif (arr == NULL) return NULL;\n\tret = PyArray_IterNew(arr);\n\tPy_DECREF(arr);\n\treturn ret;\n}\n\nstatic PyGetSetDef gentype_getsets[] = {\n {\"ndim\", \n\t (getter)gentype_ndim_get, \n\t (setter) 0, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)gentype_flags_get, \n\t (setter)0, \n\t \"integer value of flags\"},\n {\"shape\", \n\t (getter)gentype_shape_get, \n\t (setter)0, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)gentype_shape_get, \n\t (setter) 0, \n\t \"tuple of bytes steps in each dimension\"},\n {\"data\",\n\t (getter)gentype_data_get, \n\t (setter) 0, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)gentype_itemsize_get, \n\t (setter)0, \n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)gentype_size_get,\n (setter)0,\n \"number of elements in the gentype\"},\n\t{\"base\",\n\t (getter)gentype_base_get,\n\t (setter)0,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)gentype_type_get, \n\t (setter)0, \n\t \"get gentype type class\"},\n\t{\"dtypechar\",\n\t (getter)gentype_typechar_get,\n\t (setter)0,\n\t \"get gentype type character code\"},\n\t{\"dtypenum\",\n\t (getter)gentype_typenum_get,\n\t (setter)0,\n\t \"get gentype type number code\"},\n\t{\"dtypestr\",\n\t (getter)gentype_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)gentype_real_get, \n\t (setter)0,\n\t \"real part of scalar\"},\n {\"imag\", \n\t (getter)gentype_imag_get, \n\t (setter)0, \n\t \"imaginary part of scalar\"},\n\t{\"flat\", \n\t (getter)gentype_flat_get, \n\t (setter)0, \n\t \"a 1-d view of scalar\"}, \n\t{\"__array_data__\", \n\t (getter)gentype_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)gentype_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)gentype_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)gentype_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)gentype_shape_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t/* Does not have __array_priority__ because it is not a subtype.\n\t */\n \t{NULL, NULL, NULL, NULL} /* Sentinel */\n};\n\n/* 0-dim array from scalar object */\n\nstatic char doc_getarray[] = \"sc.__array__(|type) return 0-dim array\";\n\nstatic PyObject *\ngentype_getarray(PyObject *scalar, PyObject *args) \n{\n\tPyArray_Typecode outcode = {PyArray_NOTYPE, 0, 0};\n\n\tif (!PyArg_ParseTuple(args, \"|O&\", &PyArray_TypecodeConverter,\n\t\t\t &outcode)) return NULL;\n\treturn PyArray_FromScalar(scalar, &outcode);\n}\n\nstatic char doc_sc_wraparray[] = \"sc.__array_wrap__(obj) return scalar from array\";\n\nstatic PyObject *\ngentype_wraparray(PyObject *scalar, PyObject *args)\n{\n\tPyObject *arr;\n\n\tif (PyTuple_Size(args) < 1) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"only accepts 1 argument.\");\n\t\treturn NULL;\n\t}\n\tarr = PyTuple_GET_ITEM(args, 0);\n\tif (!PyArray_Check(arr)) {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"can only be called with ndarray object\");\n\t\treturn NULL;\n\t}\n\n\treturn PyArray_Scalar(PyArray_DATA(arr), PyArray_TYPE(arr),\n\t\t\t PyArray_ITEMSIZE(arr), !PyArray_ISNOTSWAPPED(arr));\n}\n\n\n/**begin repeat\n\n#name=tolist, toscalar, tostring, astype, copy, resize, __deepcopy__, choose, sort, argsort, searchsorted, argmax, argmin, reshape, view, swapaxes, max, min, ptp, conj, conjugate, nonzero, all, any, flatten, ravel#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *self, PyObject *args)\n{\n\treturn gentype_generic_method(self, args, NULL, \"@name@\");\n}\n/**end repeat**/\n\nstatic PyObject *\ngentype_squeeze(PyObject *self, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\n\tPy_INCREF(self);\n\treturn self;\n}\n\nstatic int\ngentype_getreadbuf(PyObject *, int, void **);\n\nstatic PyObject *\ngentype_byteswap(PyObject *self, PyObject *args)\n{\n\tBool inplace=FALSE;\n\t\n\tif (!PyArg_ParseTuple(args, \"|O&\", PyArray_BoolConverter, &inplace))\n\t\treturn NULL;\n\t\n\tif (inplace) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"cannot byteswap a scalar in-place\");\n\t\treturn NULL;\n\t}\n\telse {\n\t\t/* get the data, copyswap it and pass it to a new Array scalar\n\t\t */\n\t\tchar *data;\n\t\tint numbytes;\n\t\tPyArray_Typecode type;\n\t\tPyArray_Descr *descr;\n\t\tPyObject *new;\n\t\tchar *newmem;\n\n\t\tnumbytes = gentype_getreadbuf(self, 0, (void **)&data);\n\t\tPyArray_TypecodeFromScalar(self, &type);\n\t\tnewmem = malloc(type.itemsize);\n\t\tif (newmem == NULL) return PyErr_NoMemory();\n\t\telse memcpy(newmem, data, type.itemsize);\n\t\tdescr = PyArray_DescrFromType(type.type_num);\n\t\tdescr->copyswap(newmem, NULL, 1, type.itemsize);\t\t\n\t\tnew = PyArray_Scalar(newmem, type.type_num, type.itemsize, 0);\n\t\tfree(newmem);\n\t\treturn new;\n\t}\n}\n\n/**begin repeat\n\n#name=transpose, getfield, take, put, putmask, repeat, tofile, mean, trace, diagonal, clip, std, sum, cumsum, prod, cumprod, compress#\n*/\n\nstatic PyObject *\ngentype_@name@(PyObject *self, PyObject *args, PyObject *kwds)\n{\n\treturn gentype_generic_method(self, args, kwds, \"@name@\");\n}\n/**end repeat**/\n\n\nstatic PyObject *\ngentype_reduce(PyObject *self, PyObject *args)\n{\n\tPyObject *ret=NULL, *obj=NULL, *mod=NULL;\n\tconst char *buffer; \n\tint buflen;\n\n\t/* Return a tuple of (callable object, arguments) */\n\n\tret = PyTuple_New(2);\n\tif (ret == NULL) return NULL;\t\n\tif (PyObject_AsReadBuffer(self, (const void **)&buffer, &buflen)<0) {\n\t\tPy_DECREF(ret); return NULL;\n\t}\n\tmod = PyImport_ImportModule(\"scipy.base.multiarray\");\n\tif (mod == NULL) return NULL;\n\tobj = PyObject_GetAttrString(mod, \"scalar\");\n\tPy_DECREF(mod);\n\tif (obj == NULL) return NULL;\n\tPyTuple_SET_ITEM(ret, 0, obj);\n\tobj = PyObject_GetAttrString((PyObject *)self, \"dtypestr\");\n\tif PyArray_IsScalar(self, Object) {\n\t\tmod = ((PyObjectScalarObject *)self)->obval;\n\t\tPyTuple_SET_ITEM(ret, 1,\n\t\t\t\t Py_BuildValue(\"NO\", obj, mod));\n\t}\n\telse {\n\t\tmod = PyString_FromStringAndSize(buffer, buflen);\n\t\tPyTuple_SET_ITEM(ret, 1, \n\t\t\t\t Py_BuildValue(\"NN\", obj, mod));\n\t}\n\treturn ret;\n}\n\n/* ignores everything */\nstatic PyObject *\ngentype_setstate(PyObject *self, PyObject *args)\n{\n\tPy_INCREF(Py_None);\n\treturn (Py_None);\n}\n\nstatic PyObject *\ngentype_dump(PyObject *self, PyObject *args)\n{\n\tPyObject *file=NULL;\n\tint ret;\n\n\tif (!PyArg_ParseTuple(args, \"O\", &file))\n\t\treturn NULL;\n\tret = PyArray_Dump(self, file, 2);\n\tif (ret < 0) return NULL;\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyObject *\ngentype_dumps(PyObject *self, PyObject *args)\n{\n\tif (!PyArg_ParseTuple(args, \"\"))\n\t\treturn NULL;\n\treturn PyArray_Dumps(self, 2);\n}\n\n\n/* setting flags cannot be done for scalars */\nstatic PyObject *\ngentype_setflags(PyObject *self, PyObject *args, PyObject *kwds)\n{\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic int _array_typecode_fromstr(char *, int *, PyArray_Typecode *);\n\n/* need to fill in doc-strings for these methods on import -- copy from \n array docstrings \n*/\nstatic PyMethodDef gentype_methods[] = {\n {\"tolist\",\t (PyCFunction)gentype_tolist,\t1, NULL},\n {\"toscalar\", (PyCFunction)gentype_toscalar, METH_VARARGS, NULL},\n\t{\"tofile\", (PyCFunction)gentype_tofile, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"tostring\", (PyCFunction)gentype_tostring, METH_VARARGS, NULL},\n {\"byteswap\", (PyCFunction)gentype_byteswap,1, NULL},\n {\"astype\", (PyCFunction)gentype_astype, 1, NULL},\n\t{\"getfield\", (PyCFunction)gentype_getfield, \n\t METH_VARARGS | METH_KEYWORDS, NULL},\n {\"copy\", (PyCFunction)gentype_copy, 1, NULL}, \n {\"resize\", (PyCFunction)gentype_resize, 1, NULL}, \n\n\t{\"__array__\", (PyCFunction)gentype_getarray, 1, doc_getarray},\n\t{\"__array_wrap__\", (PyCFunction)gentype_wraparray, 1, doc_sc_wraparray},\n\n /* for the copy module */\n {\"__copy__\", (PyCFunction)gentype_copy, 1, NULL},\n {\"__deepcopy__\", (PyCFunction)gentype___deepcopy__, 1, NULL},\n\n\n {\"__reduce__\", (PyCFunction) gentype_reduce, 1, NULL},\t\n\t/* For consistency does nothing */\n\t{\"__setstate__\", (PyCFunction) gentype_setstate, 1, NULL},\n\n\t{\"dumps\", (PyCFunction) gentype_dumps, 1, NULL},\n\t{\"dump\", (PyCFunction) gentype_dump, 1, NULL},\n\n\t/* Methods for array */\n\t{\"transpose\",\t(PyCFunction)gentype_transpose, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"take\",\t(PyCFunction)gentype_take, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"put\",\t(PyCFunction)gentype_put, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"putmask\",\t(PyCFunction)gentype_putmask, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"repeat\",\t(PyCFunction)gentype_repeat, \n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"choose\",\t(PyCFunction)gentype_choose, \n\t METH_VARARGS, NULL},\t\n\t{\"sort\",\t(PyCFunction)gentype_sort, \n\t METH_VARARGS, NULL},\n\t{\"argsort\",\t(PyCFunction)gentype_argsort, \n\t METH_VARARGS, NULL},\n\t{\"searchsorted\", (PyCFunction)gentype_searchsorted, \n\t METH_VARARGS, NULL},\t\n\t{\"argmax\",\t(PyCFunction)gentype_argmax, \n\t METH_VARARGS, NULL},\n\t{\"argmin\", (PyCFunction)gentype_argmin,\n\t METH_VARARGS, NULL},\n\t{\"reshape\",\t(PyCFunction)gentype_reshape, \n\t METH_VARARGS, NULL},\n\t{\"squeeze\",\t(PyCFunction)gentype_squeeze, \n\t METH_VARARGS, NULL},\n\t{\"view\", (PyCFunction)gentype_view, \n\t METH_VARARGS, NULL},\n\t{\"swapaxes\", (PyCFunction)gentype_swapaxes,\n\t METH_VARARGS, NULL},\n\t{\"max\", (PyCFunction)gentype_max,\n\t METH_VARARGS, NULL},\n\t{\"min\", (PyCFunction)gentype_min,\n\t METH_VARARGS, NULL},\n\t{\"ptp\", (PyCFunction)gentype_ptp,\n\t METH_VARARGS, NULL},\n\t{\"mean\", (PyCFunction)gentype_mean,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"trace\", (PyCFunction)gentype_trace,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"diagonal\", (PyCFunction)gentype_diagonal,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"clip\", (PyCFunction)gentype_clip,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"conj\", (PyCFunction)gentype_conj,\n\t METH_VARARGS, NULL},\n\t{\"conjugate\", (PyCFunction)gentype_conjugate,\n\t METH_VARARGS, NULL},\n\t{\"nonzero\", (PyCFunction)gentype_nonzero,\n\t METH_VARARGS, NULL},\n\t{\"std\", (PyCFunction)gentype_std,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"sum\", (PyCFunction)gentype_sum,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"cumsum\", (PyCFunction)gentype_cumsum,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"prod\", (PyCFunction)gentype_prod,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"cumprod\", (PyCFunction)gentype_cumprod,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"all\", (PyCFunction)gentype_all,\n\t METH_VARARGS, NULL},\n\t{\"any\", (PyCFunction)gentype_any,\n\t METH_VARARGS, NULL},\n\t{\"compress\", (PyCFunction)gentype_compress,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t{\"flatten\", (PyCFunction)gentype_flatten,\n\t METH_VARARGS, NULL},\n\t{\"ravel\", (PyCFunction)gentype_ravel,\n\t METH_VARARGS, NULL},\n\t{\"setflags\", (PyCFunction)gentype_setflags,\n\t METH_VARARGS|METH_KEYWORDS, NULL},\n\t/* add other methods!!! */\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\nstatic int\ngentype_getreadbuf(PyObject *self, int segment, void **ptrptr)\n{\n\tint numbytes;\n\tPyArray_Typecode outcode;\n\t\n\tif (segment != 0) {\n\t\tPyErr_SetString(PyExc_SystemError, \n\t\t\t\t\"Accessing non-existent array segment\");\n\t\treturn -1;\n\t}\n\n\tPyArray_TypecodeFromScalar(self, &outcode);\n\tnumbytes = outcode.itemsize;\n\tif PyArray_IsScalar(self, Flexible) {\n\t\tif PyArray_IsScalar(self, String)\n\t\t\t*ptrptr = PyString_AS_STRING(self);\n\t\telse if PyArray_IsScalar(self, Unicode)\n\t\t\t*ptrptr = (char *)PyUnicode_AS_DATA(self);\n\t\telse if PyArray_IsScalar(self, Void)\n\t\t\t*ptrptr = ((PyVoidScalarObject *)self)->obval;\n\t}\n\telse \n\t\t*ptrptr = (void *)&(((PyScalarObject *)self)->obval);\n\n\treturn numbytes;\n}\n\nstatic int\ngentype_getsegcount(PyObject *self, int *lenp)\n{\n\tPyArray_Typecode outcode;\n\n\tPyArray_TypecodeFromScalar(self, &outcode);\n\tif (lenp)\n\t\t*lenp = outcode.itemsize;\n\treturn 1;\n}\n\nstatic int\ngentype_getcharbuf(PyObject *self, int segment, const char **ptrptr)\n{\n\tif (PyArray_IsScalar(self, String) ||\t\\\n\t PyArray_IsScalar(self, Unicode))\n\t\treturn gentype_getreadbuf(self, segment, (void **)ptrptr);\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError,\n\t\t\t\t\"Non-character array cannot be interpreted \"\\\n\t\t\t\t\"as character buffer.\");\n\t\treturn -1;\n\t}\n}\n\n\nstatic PyBufferProcs gentype_as_buffer = {\n (getreadbufferproc)gentype_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)0, /*bf_getwritebuffer*/\n (getsegcountproc)gentype_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)gentype_getcharbuf, /*bf_getcharbuffer*/\n};\n\n\n#define BASEFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES\n#define LEAFFLAGS Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES\n\nstatic PyTypeObject PyGenericArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"generic_arrtype\",\t /*tp_name*/\n sizeof(PyObject),\t\t /*tp_basicsize*/\n};\n\n/* works for VOID and UNICODE */\n\nstatic void\nflexible_dealloc(PyObject *v) \n{\n\tPyDataMem_FREE(((PyVoidScalarObject *)v)->obval);\n\tv->ob_type->tp_free(v);\n}\n\nstatic void\nstring_arrtype_dealloc(PyObject *v)\n{\n\tv->ob_type->tp_free(v);\n}\n\nstatic void\nobject_arrtype_dealloc(PyObject *v)\n{\n\tPy_DECREF(((PyObjectScalarObject *)v)->obval);\n\tv->ob_type->tp_free(v);\n}\n\n/* string and unicode inherit from Python Type first and so GET_ITEM is different to\n get to the Python Type.\n */\n\n/**begin repeat \n#name=byte, short, int, long, longlong, ubyte, ushort, uint, ulong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, string, unicode, object#\n#TYPE=BYTE, SHORT, INT, LONG, LONGLONG, UBYTE, USHORT, UINT, ULONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, OBJECT#\n#num=1*16,0,0,1#\n*/\nstatic PyObject *\n@name@_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj=NULL;\n\tPyObject *arr;\n\tPyArray_Typecode typecode = {PyArray_NOTYPE, 0, 0};\n\n\tif (type->tp_bases && (PyTuple_GET_SIZE(type->tp_bases)==2)) {\n\t\tPyTypeObject *sup;\n\t\tPyObject *ret;\n\t\t/* We are inheriting from a Python type as well so\n\t\t give it first dibs on conversion */\n\t\tsup = (PyTypeObject *)PyTuple_GET_ITEM(type->tp_bases, @num@);\n\t\tret = sup->tp_new(type, args, kwds);\n\t\tif (ret) return ret;\n\t\tPyErr_Clear();\n\t\t/* now do default conversion */\n\t}\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\n\ttypecode.type_num = PyArray_@TYPE@;\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n/**end repeat**/\n\n/* bool->tp_new only returns Py_True or Py_False */\nstatic PyObject *\nbool_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj=NULL;\n\tPyObject *arr;\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n\nstatic PyObject *\nvoid_arrtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n\tPyObject *obj, *arr;\n\tulonglong memu=1;\n\tPyObject *new=NULL;\n\tPyArray_Typecode typecode = {PyArray_VOID, 0, 0};\n\tchar *destptr;\n\n\tif (!PyArg_ParseTuple(args, \"O\", &obj)) return NULL;\n\t/* For a VOID scalar first see if obj is an integer or long \n\t and create new memory of that size (filled with 0) for the scalar\n\t*/\n\n\tif (PyLong_Check(obj) || PyInt_Check(obj) || \\\n\t PyArray_IsScalar(obj, Integer) ||\n\t (PyArray_Check(obj) && PyArray_NDIM(obj)==0 &&\t\\\n\t PyArray_ISINTEGER(obj))) {\n\t\tnew = obj->ob_type->tp_as_number->nb_long(obj);\n\t}\n\tif (new && PyLong_Check(new)) {\n\t\tPyObject *ret;\n\t\tmemu = PyLong_AsUnsignedLongLong(new);\n\t\tPy_DECREF(new);\n\t\tif (PyErr_Occurred() || (memu > MAX_INT)) {\n\t\t\tPyErr_Clear();\n\t\t\tPyErr_Format(PyExc_OverflowError, \n\t\t\t\t \"size must be smaller than %d\",\n\t\t\t\t (int) MAX_INT);\n\t\t\treturn NULL;\n\t\t}\n\t\tdestptr = PyDataMem_NEW((int) memu);\n\t\tif (destptr == NULL) return PyErr_NoMemory();\n\t\tret = type->tp_alloc(type, 0);\n\t\tif (ret == NULL) {\n\t\t\tPyDataMem_FREE(destptr);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\t((PyVoidScalarObject *)ret)->obval = destptr;\n\t\t((PyVoidScalarObject *)ret)->ob_size = (int) memu;\n\t\tmemset(destptr, '\\0', (size_t) memu);\n\t\treturn ret;\n\t}\n\n\tarr = PyArray_FromAny(obj, &typecode, 0, 0, FORCECAST);\n\treturn PyArray_Return((PyArrayObject *)arr);\n}\n\n\n/**************** Define Hash functions ********************/\n\n/**begin repeat\n#lname=bool,ubyte,ushort#\n#name=Bool,UByte, UShort#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n return (long)(((Py@name@ScalarObject *)obj)->obval);\n}\n/**end repeat**/\n\n/**begin repeat\n#lname=byte,short,uint,ulong#\n#name=Byte,Short,UInt,ULong#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((Py@name@ScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n/**end repeat**/\n\n#if SIZEOF_INT != SIZEOF_LONG\nstatic long\nint_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((PyIntScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n#endif\n\n/**begin repeat\n#char=,u#\n#Char=,U#\n#ext=&& (x >= LONG_MIN),#\n*/\n#if SIZEOF_LONG != SIZEOF_LONGLONG\n/* we assume SIZEOF_LONGLONG=2*SIZEOF_LONG */\nstatic long\n@char@longlong_arrtype_hash(PyObject *obj)\n{\n long y;\n @char@longlong x = (((Py@Char@LongLongScalarObject *)obj)->obval);\n\n if ((x <= LONG_MAX)@ext@) {\n y = (long) x;\n }\n else {\n union Mask {\n long hashvals[2];\n @char@longlong v;\n } both;\n\n both.v = x;\n y = both.hashvals[0] + (1000003)*both.hashvals[1];\n }\n if (y == -1) y = -2;\n return y;\n}\n#endif\n/**end repeat**/\n\n#if SIZEOF_LONG==SIZEOF_LONGLONG\nstatic long\nulonglong_arrtype_hash(PyObject *obj)\n{\n long x = (long)(((PyULongLongScalarObject *)obj)->obval);\n if (x == -1) x=-2;\n return x;\n}\n#endif\n\n\n\n/* Wrong thing to do for longdouble, but....*/\n/**begin repeat\n#lname=float, longdouble#\n#name=Float, LongDouble#\n */\nstatic long\n@lname@_arrtype_hash(PyObject *obj)\n{\n return _Py_HashDouble((double) ((Py@name@ScalarObject *)obj)->obval);\n}\n\n/* borrowed from complex_hash */\nstatic long\nc@lname@_arrtype_hash(PyObject *obj)\n{\n long hashreal, hashimag, combined;\n hashreal = _Py_HashDouble((double) \\\n (((PyC@name@ScalarObject *)obj)->obval).real);\n\n if (hashreal == -1) return -1;\n hashimag = _Py_HashDouble((double) \\\n (((PyC@name@ScalarObject *)obj)->obval).imag);\n if (hashimag == -1) return -1;\n\n combined = hashreal + 1000003 * hashimag;\n if (combined == -1) combined = -2;\n return combined;\n}\n/**end repeat**/\n\nstatic long\nobject_arrtype_hash(PyObject *obj)\n{\n return PyObject_Hash(((PyObjectScalarObject *)obj)->obval);\n}\n\n/* just hash the pointer */\nstatic long\nvoid_arrtype_hash(PyObject *obj)\n{\n return _Py_HashPointer((void *)(((PyVoidScalarObject *)obj)->obval));\n}\n\n/**begin repeat\n#name=bool, string, unicode, void, object#\n#NAME=Bool, String, Unicode, Void, Object#\n*/\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@_arrtype\",\t /*tp_name*/\n sizeof(Py@NAME@ScalarObject),\t /*tp_basicsize*/\n};\n/**end repeat**/\n\n/**begin repeat\n#NAME=Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble#\n#name=int*5, uint*5, float*3, complex*3#\n#CNAME=(CHAR, SHORT, INT, LONG, LONGLONG)*2, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE#\n*/\nstatic PyTypeObject Py@NAME@ArrType_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"@name@\" STRBITSOF_@CNAME@ \"_arrtype\",\t /*tp_name*/\n sizeof(Py@NAME@ScalarObject),\t /*tp_basicsize*/\n};\n\n/**end repeat**/\n\n\n\n\nstatic PyNumberMethods longdoubletype_as_number;\nstatic PyNumberMethods clongdoubletype_as_number;\n\nstatic void \ninitialize_numeric_types(void)\n{\n\tPyGenericArrType_Type.tp_dealloc = (destructor)gentype_dealloc;\n\tPyGenericArrType_Type.tp_as_number = &gentype_as_number;\n\tPyGenericArrType_Type.tp_as_buffer = &gentype_as_buffer;\n\tPyGenericArrType_Type.tp_flags = BASEFLAGS;\n\tPyGenericArrType_Type.tp_methods = gentype_methods;\n\tPyGenericArrType_Type.tp_getset = gentype_getsets;\n\tPyGenericArrType_Type.tp_new = NULL;\n\tPyGenericArrType_Type.tp_free = PyObject_Del;\n\tPyGenericArrType_Type.tp_repr = gentype_repr;\n\tPyGenericArrType_Type.tp_str = gentype_str;\n\tPyGenericArrType_Type.tp_richcompare = gentype_richcompare;\n\n\t/**begin repeat\n#NAME=Numeric, Integer, SignedInteger, UnsignedInteger, Inexact, Floating, \nComplexFloating, Flexible, Character#\n\t*/\n Py@NAME@ArrType_Type.tp_flags = BASEFLAGS;\n\t/**end repeat**/\n\n\t/**begin repeat\n#name=bool, byte, short, int, long, longlong, ubyte, ushort, uint, ulong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, string, unicode, void, object#\n#NAME=Bool, Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, String, Unicode, Void, Object#\n\t*/\n\tPy@NAME@ArrType_Type.tp_flags = LEAFFLAGS;\n\tPy@NAME@ArrType_Type.tp_new = @name@_arrtype_new;\n\tPy@NAME@ArrType_Type.tp_richcompare = gentype_richcompare;\n\t/**end repeat**/\n\t/* Allow the Void type to be subclassed -- for adding new types */\n\tPyVoidArrType_Type.tp_flags = BASEFLAGS;\n\n /**begin repeat\n#name=bool, byte, short, longlong, ubyte, ushort, uint, ulong, ulonglong, float, longdouble, cfloat, clongdouble, void, object#\n#NAME=Bool, Byte, Short, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, LongDouble, CFloat, CLongDouble, Void, Object#\n */\n Py@NAME@ArrType_Type.tp_hash = @name@_arrtype_hash;\n /**end repeat**/\n\n#if SIZEOF_INT != SIZEOF_LONG\n /* We won't be inheriting from Python Int type. */\n PyIntArrType_Type.tp_hash = int_arrtype_hash;\n#endif\n\n#if SIZEOF_LONG != SIZEOF_LONGLONG\n /* We won't be inheriting from Python Int type. */\n PyLongLongArrType_Type.tp_hash = longlong_arrtype_hash;\n#endif\n\n\t/* These need to be coded specially because getitem does not\n\t return a normal Python type\n\t*/\n\tPyLongDoubleArrType_Type.tp_as_number = &longdoubletype_as_number;\n\tPyCLongDoubleArrType_Type.tp_as_number = &clongdoubletype_as_number;\n\n\t/**begin repeat\n#name=int, long, hex, oct, float, repr, str#\n#kind=tp_as_number->nb*5, tp*2#\n\t*/\n\tPyLongDoubleArrType_Type.@kind@_@name@ = longdoubletype_@name@;\n\tPyCLongDoubleArrType_Type.@kind@_@name@ = clongdoubletype_@name@;\n\t/**end repeat**/\n\n\tPyStringArrType_Type.tp_itemsize = sizeof(char);\n\tPyStringArrType_Type.tp_dealloc = string_arrtype_dealloc;\n\tPyFlexibleArrType_Type.tp_dealloc = flexible_dealloc;\n\tPyObjectArrType_Type.tp_dealloc = object_arrtype_dealloc;\n\n\tPyArrayIter_Type.tp_iter = PyObject_SelfIter;\n\tPyArrayMapIter_Type.tp_iter = PyObject_SelfIter;\n}\n\n\nstatic PyTypeObject *typeobjects[] = {\n\t&PyBoolArrType_Type,\n\t&PyByteArrType_Type,\n\t&PyUByteArrType_Type,\n\t&PyShortArrType_Type,\n\t&PyUShortArrType_Type,\n\t&PyIntArrType_Type,\n\t&PyUIntArrType_Type,\n\t&PyLongArrType_Type,\n\t&PyULongArrType_Type,\n\t&PyLongLongArrType_Type,\n\t&PyULongLongArrType_Type,\n\t&PyFloatArrType_Type,\n\t&PyDoubleArrType_Type,\n\t&PyLongDoubleArrType_Type,\n\t&PyCFloatArrType_Type,\n\t&PyCDoubleArrType_Type,\n\t&PyCLongDoubleArrType_Type,\n\t&PyObjectArrType_Type,\n\t&PyStringArrType_Type,\n\t&PyUnicodeArrType_Type,\n\t&PyVoidArrType_Type\n};\n\n\nstatic int\nPyArray_TypenumFromTypeObject(PyObject *type) \n{\n\tint typenum, i;\n\n\ttypenum = PyArray_NOTYPE;\n i = 0;\n\twhile(i < PyArray_NTYPES) {\n\t\tif (type == (PyObject *)typeobjects[i]) {\n\t\t\ttypenum = i;\n\t\t\tbreak;\n\t\t}\n i++;\n\t}\n\tif (typenum != PyArray_NOTYPE)\n\t\treturn typenum;\n\n\t/* Find registered types */\n\t\n\t/* here */\n\n\t/* Convert generic types to specific types */\n\tif ((type == (PyObject *) &PyNumericArrType_Type) || \\\n\t (type == (PyObject *) &PyInexactArrType_Type) || \\\n\t (type == (PyObject *) &PyFloatingArrType_Type))\n\t\treturn PyArray_DOUBLE;\n\telse if (type == (PyObject *)&PyComplexFloatingArrType_Type)\n\t\treturn PyArray_CDOUBLE;\n\telse if ((type == (PyObject *)&PyIntegerArrType_Type) ||\t\\\n\t\t (type == (PyObject *)&PySignedIntegerArrType_Type))\n\t\treturn PyArray_LONG;\n\telse if (type == (PyObject *) &PyUnsignedIntegerArrType_Type)\n\t\treturn PyArray_ULONG;\n else if (type == (PyObject *) &PyCharacterArrType_Type)\n\t\treturn PyArray_STRING;\n\telse if (type == (PyObject *) &PyFlexibleArrType_Type)\n\t\treturn PyArray_VOID;\n\telse if (type == (PyObject *)&PyBool_Type)\n\t\ttypenum = PyArray_BOOL;\n\telse if (type == (PyObject *)&PyInt_Type)\n\t\ttypenum = PyArray_LONG;\n\telse if (type == (PyObject *)&PyFloat_Type)\n\t\ttypenum = PyArray_DOUBLE;\t\n\telse if (type == (PyObject *)&PyComplex_Type)\n\t\ttypenum = PyArray_CDOUBLE;\n\telse if (type == (PyObject *)&PyString_Type)\n\t\ttypenum = PyArray_STRING;\n\telse if (type == (PyObject *)&PyUnicode_Type)\n\t\ttypenum = PyArray_UNICODE;\n\telse if (type == (PyObject *)&PyBuffer_Type)\n\t\ttypenum = PyArray_VOID;\n\telse\n\t\ttypenum = PyArray_OBJECT;\n\treturn typenum;\n}\n\nstatic void \nPyArray_TypecodeFromTypeObject(PyObject *type, PyArray_Typecode *typecode) {\n\tint itemsize = 0;\n\tint type_num;\n\n\ttype_num = PyArray_TypenumFromTypeObject(type);\n\ttypecode->type_num = type_num;\n\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n itemsize = 0;\n\t}\n\telse {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type_num);\n\t\tif (descr != NULL)\n\t\t\titemsize = descr->elsize;\n\t}\n\ttypecode->itemsize = itemsize;\n\treturn;\n}\n\nstatic void \nPyArray_TypecodeFromScalar(PyObject *sc, PyArray_Typecode *typecode)\n{\n\tint type_num;\n\n PyArray_TypecodeFromTypeObject((PyObject *)sc->ob_type, typecode);\n if (typecode->itemsize == 0) {\n type_num = typecode->type_num;\n\t\tif (type_num == PyArray_STRING) \n\t\t\ttypecode->itemsize = PyString_GET_SIZE(sc);\n\t\telse if (type_num == PyArray_UNICODE)\n\t\t\ttypecode->itemsize = PyUnicode_GET_DATA_SIZE(sc);\n\t\telse if (type_num == PyArray_VOID) {\n\t\t\ttypecode->itemsize = \\\n\t\t\t\t((PyVoidScalarObject *)sc)->ob_size;\n\t\t}\n }\n\treturn;\n}\n\nstatic PyObject *\nPyArray_TypeObjectFromType(int type)\n{\n\tPyArray_Descr *descr;\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr == NULL) return NULL;\n\tPy_INCREF((PyObject *)descr->typeobj);\n\treturn (PyObject *)descr->typeobj;\n}\n\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ "#name=bool, byte, short, ubyte, ushort, uint, ulong, ulonglong, float, longdouble, cfloat, clongdouble, void, object#", "#NAME=Bool, Byte, Short, UByte, UShort, UInt, ULong, ULongLong, Float, LongDouble, CFloat, CLongDouble, Void, Object#" ], "deleted": [ "#name=bool, byte, short, longlong, ubyte, ushort, uint, ulong, ulonglong, float, longdouble, cfloat, clongdouble, void, object#", "#NAME=Bool, Byte, Short, LongLong, UByte, UShort, UInt, ULong, ULongLong, Float, LongDouble, CFloat, CLongDouble, Void, Object#" ] } }, { "old_path": "scipy/corelib/mtrand/distributions.c", "new_path": "scipy/corelib/mtrand/distributions.c", "filename": "distributions.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -787,4 +787,4 @@ long rk_logseries(rk_state *state, double p)\n if (V <= q*q) return (long)floor(1 + log(V)/log(q));\n if (V <= q) return 1;\n return 2;\n-}\n\\ No newline at end of file\n+}\n", "added_lines": 1, "deleted_lines": 1, "source_code": "/* Copyright 2005 Robert Kern (robert.kern@gmail.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n * \n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/* The implementations of rk_hypergeometric_hyp(), rk_hypergeometric_hrua(),\n * and rk_triangular() were adapted from Ivan Frohne's rv.py which has this \n * license:\n * \n * Copyright 1998 by Ivan Frohne; Wasilla, Alaska, U.S.A.\n * All Rights Reserved\n *\n * Permission to use, copy, modify and distribute this software and its\n * documentation for any purpose, free of charge, is granted subject to the\n * following conditions:\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the software.\n *\n * THE SOFTWARE AND DOCUMENTATION IS PROVIDED WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR\n * OR COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM OR DAMAGES IN A CONTRACT\n * ACTION, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR ITS DOCUMENTATION.\n */\n\n#include \n#include \"distributions.h\"\n#include \"mconf.h\"\n#include \n\n#ifndef min\n#define min(x,y) ((xy)?x:y)\n#endif\n\ndouble rk_normal(rk_state *state, double loc, double scale)\n{\n return loc + scale*rk_gauss(state);\n}\n\ndouble rk_standard_exponential(rk_state *state)\n{\n /* We use -log(1-U) since U is [0, 1) */\n return -log(1.0 - rk_double(state));\n}\n\ndouble rk_exponential(rk_state *state, double scale)\n{\n return scale * rk_standard_exponential(state);\n}\n\ndouble rk_uniform(rk_state *state, double loc, double scale)\n{\n return loc + scale*rk_double(state);\n}\n\n#define LOG4 1.3862943611198906\n#define ONELOG92 2.5040773967762742\n\ndouble rk_standard_gamma(rk_state *state, double shape)\n{\n double b, c, lam;\n double U, V, X, Y, Z, R;\n\n if (shape == 1.0)\n {\n return rk_standard_exponential(state);\n }\n else if (shape < 1.0)\n {\n while (1)\n {\n U = rk_double(state);\n V = rk_standard_exponential(state);\n if (U <= 1.0 - shape)\n {\n X = pow(U, 1./shape);\n if (X <= V)\n {\n return X;\n }\n }\n else\n {\n Y = -log((1-U)/shape);\n X = pow(1.0 - shape + shape*Y, 1./shape);\n if (X <= (V + Y))\n {\n return X;\n }\n }\n }\n }\n else\n {\n b = shape - LOG4;\n lam = sqrt(2.0*shape - 1.0);\n c = shape + lam;\n \n while (1)\n {\n U = rk_double(state);\n V = rk_double(state);\n Y = log(V/(1.0-V))/lam;\n X = shape*exp(Y); \n Z = U*V*V;\n R = b + c*Y - X;\n if ((R >= 4.5*Z - ONELOG92) || (R >= log(Z)))\n {\n break;\n }\n }\n return X;\n }\n}\n\n#undef LOG4\n#undef ONELOG92\n\ndouble rk_gamma(rk_state *state, double shape, double scale)\n{\n return scale * rk_standard_gamma(state, shape);\n}\n\ndouble rk_beta(rk_state *state, double a, double b)\n{\n double Ga, Gb;\n\n if ((a <= 1.0) && (b <= 1.0))\n {\n double U, V, X, Y;\n /* Use Jonk's algorithm */\n\n while (1)\n {\n U = rk_double(state);\n V = rk_double(state);\n X = pow(U, 1.0/a);\n Y = pow(V, 1.0/b);\n\n if ((X + Y) <= 1.0)\n {\n return X;\n }\n }\n }\n else\n {\n Ga = rk_standard_gamma(state, a);\n Gb = rk_standard_gamma(state, b);\n return Ga/(Ga + Gb);\n }\n}\n\ndouble rk_chisquare(rk_state *state, double df)\n{\n return 2.0*rk_standard_gamma(state, df/2.0);\n}\n\ndouble rk_noncentral_chisquare(rk_state *state, double df, double nonc)\n{\n double Chi2, N;\n\n Chi2 = rk_chisquare(state, df-1);\n N = rk_gauss(state) + sqrt(nonc);\n return Chi2 + N*N;\n}\n\ndouble rk_f(rk_state *state, double dfnum, double dfden)\n{\n return rk_chisquare(state, dfnum) / rk_chisquare(state, dfden);\n}\n\ndouble rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc)\n{\n return ((rk_noncentral_chisquare(state, dfnum, nonc)*dfden) /\n (rk_chisquare(state, dfden)*dfnum));\n}\n\nlong rk_binomial_btpe(rk_state *state, long n, double p)\n{\n double r,q,fm,p1,xm,xl,xr,c,laml,lamr,p2,p3,p4;\n double a,u,v,s,F,rho,t,A,nrq,x1,x2,f1,f2,z,z2,w,w2,x;\n long m,y,k,i;\n\n if (!(state->has_binomial) || \n (state->nsave != n) ||\n (state->psave != p))\n {\n /* initialize */\n state->nsave = n;\n state->psave = p;\n state->has_binomial = 1;\n state->r = r = min(p, 1.0-p);\n state->q = q = 1.0 - r;\n state->fm = fm = n*r+r;\n state->m = m = (long)floor(state->fm);\n state->p1 = p1 = floor(2.195*sqrt(n*r*q)-4.6*q) + 0.5;\n state->xm = xm = m + 0.5;\n state->xl = xl = xm - p1;\n state->xr = xr = xm + p1;\n state->c = c = 0.134 + 20.5/(15.3 + m);\n a = (fm - xl)/(fm-xl*r);\n state->laml = laml = a*(1.0 + a/2.0);\n a = (xr - fm)/(xr*q);\n state->lamr = lamr = a*(1.0 + a/2.0);\n state->p2 = p2 = p1*(1.0 + 2.0*c);\n state->p3 = p3 = p2 + c/laml;\n state->p4 = p4 = p3 + c/lamr;\n }\n else\n {\n r = state->r;\n q = state->q;\n fm = state->fm;\n m = state->m;\n p1 = state->p1;\n xm = state->xm;\n xl = state->xl;\n xr = state->xr;\n c = state->c;\n laml = state->laml;\n lamr = state->lamr;\n p2 = state->p2;\n p3 = state->p3;\n p4 = state->p4;\n }\n\n /* sigh ... */\n Step10:\n nrq = n*r*q;\n u = rk_double(state)*p4;\n v = rk_double(state);\n if (u > p1) goto Step20;\n y = (long)floor(xm - p1*v + u);\n goto Step60;\n\n Step20:\n if (u > p2) goto Step30;\n x = xl + (u - p1)/c;\n v = v*c + 1.0 - fabs(m - x + 0.5)/p1;\n if (v > 1.0) goto Step10;\n y = (long)floor(x);\n goto Step50;\n\n Step30:\n if (u > p3) goto Step40;\n y = (long)floor(xl + log(v)/laml);\n if (y < 0) goto Step10;\n v = v*(u-p2)*laml;\n goto Step50;\n\n Step40:\n y = (int)floor(xr - log(v)/lamr);\n if (y > n) goto Step10;\n v = v*(u-p3)*lamr;\n\n Step50:\n k = fabs(y - m);\n if ((k > 20) && (k < ((nrq)/2.0 - 1))) goto Step52;\n\n s = r/q;\n a = s*(n+1);\n F = 1.0;\n if (m < y)\n {\n for (i=m; i<=y; i++)\n {\n F *= (a/i - s);\n }\n }\n else if (m > y)\n {\n for (i=y; i<=m; i++)\n {\n F /= (a/i - s);\n }\n }\n else\n {\n if (v > F) goto Step10;\n goto Step60;\n }\n\n Step52:\n rho = (k/(nrq))*((k*(k/3.0 + 0.625) + 0.16666666666666666)/nrq + 0.5);\n t = -k*k/(2*nrq);\n A = log(v);\n if (A < (t - rho)) goto Step60;\n if (A > (t + rho)) goto Step10;\n\n x1 = y+1;\n f1 = m+1;\n z = n+1-m;\n w = n-y+1;\n x2 = x1*x1;\n f2 = f1*f1;\n z2 = z*z;\n w2 = w*w;\n if (A > (xm*log(f1/x1)\n + (n-m+0.5)*log(z/w)\n + (y-m)*log(w*r/(x1*q))\n + (13680.-(462.-(132.-(99.-140./f2)/f2)/f2)/f2)/f1/166320.\n + (13680.-(462.-(132.-(99.-140./z2)/z2)/z2)/z2)/z/166320.\n + (13680.-(462.-(132.-(99.-140./x2)/x2)/x2)/x2)/x1/166320.\n + (13680.-(462.-(132.-(99.-140./w2)/w2)/w2)/w2)/w/166320.))\n {\n goto Step10;\n }\n\n Step60:\n if (p > 0.5)\n {\n y = n - y;\n }\n\n return y;\n}\n\nlong rk_binomial_waiting(rk_state *state, long n, double p)\n{\n double q, E, Sum;\n long X;\n\n q = -log(1.0 - p);\n\n X = 0;\n Sum = 0.0;\n\n while (Sum <= q)\n {\n if (X == n)\n {\n X += 1;\n break;\n }\n E = rk_standard_exponential(state);\n Sum += E / (n - X);\n X++;\n }\n return X-1;\n}\n\nlong rk_binomial(rk_state *state, long n, double p)\n{\n double q;\n\n if (p <= 0.5)\n {\n if (p*n <= 30.0)\n {\n return rk_binomial_waiting(state, n, p);\n }\n else\n {\n return rk_binomial_btpe(state, n, p);\n }\n }\n else\n {\n q = 1.0-p;\n if (q*n <= 30.0)\n {\n return n - rk_binomial_waiting(state, n, q);\n }\n else\n {\n return n - rk_binomial_btpe(state, n, q);\n }\n }\n\n}\n\nlong rk_negative_binomial(rk_state *state, long n, double p)\n{\n double Y;\n\n Y = rk_gamma(state, n, (1-p)/p);\n return rk_poisson(state, Y);\n}\n\nlong rk_poisson_mult(rk_state *state, double lam)\n{\n long X;\n double prod, U, enlam;\n\n enlam = exp(-lam);\n X = 0;\n prod = 1.0;\n while (1)\n {\n U = rk_double(state);\n prod *= U;\n if (prod > enlam)\n {\n X += 1;\n }\n else\n {\n return X;\n }\n }\n}\n\n#define LS2PI 0.91893853320467267\n#define TWELFTH 0.083333333333333333333333\nlong rk_poisson_ptrs(rk_state *state, double lam)\n{\n long k;\n double U, V, slam, loglam, a, b, invalpha, vr, us;\n\n slam = sqrt(lam);\n loglam = log(lam);\n b = 0.931 + 2.53*slam;\n a = -0.059 + 0.02483*b;\n invalpha = 1.1239 + 1.1328/(b-3.4);\n vr = 0.9277 - 3.6224/(b-2);\n\n while (1)\n {\n U = rk_double(state) - 0.5;\n V = rk_double(state);\n us = 0.5 - fabs(U);\n k = (long)floor((2*a/us + b)*U + lam + 0.43);\n if ((us >= 0.07) && (V <= vr))\n {\n return k;\n }\n if ((k < 0) ||\n ((us < 0.013) && (V > us)))\n {\n continue;\n }\n if ((log(V) + log(invalpha) - log(a/(us*us)+b)) <=\n (-lam + k*loglam - lgam(k+1)))\n {\n return k;\n }\n\n \n }\n\n}\n\nlong rk_poisson(rk_state *state, double lam)\n{\n if (lam >= 10)\n {\n return rk_poisson_ptrs(state, lam);\n }\n else\n {\n return rk_poisson_mult(state, lam);\n }\n}\n\ndouble rk_standard_cauchy(rk_state *state)\n{\n return rk_gauss(state) / rk_gauss(state);\n}\n\ndouble rk_standard_t(rk_state *state, double df)\n{\n double N, G, X;\n\n N = rk_gauss(state);\n G = rk_standard_gamma(state, df/2);\n X = sqrt(df/2)*N/sqrt(G);\n return X;\n}\n\ndouble rk_vonmises(rk_state *state, double mu, double kappa)\n{\n double r, rho, s;\n double U, V, W, Y, Z;\n double result, mod;\n\n if (kappa < 1e-8)\n {\n return M_PI * (2*rk_double(state)-1);\n }\n else\n {\n r = 1 + sqrt(1 + 4*kappa*kappa);\n rho = (r - sqrt(2*r))/(2*kappa);\n s = (1 + rho*rho)/(2*rho);\n\n while (1)\n {\n U = 2*rk_double(state) - 1;\n V = 2*rk_double(state) - 1;\n Z = cos(M_PI*U);\n W = (1 + s*Z)/(s + Z);\n Y = kappa * (s - W);\n if ((Y*(2-Y) - V >= 0) || (log(Y/V)+1 - Y >= 0))\n {\n break;\n }\n }\n\n if (U < 0)\n {\n result = acos(W);\n }\n else\n {\n result = -acos(W);\n }\n result += mu + M_PI;\n mod = fmod(result, 2*M_PI);\n if (mod && (mod < 0))\n {\n mod += 2*M_PI;\n }\n return mod - M_PI;\n }\n}\n\ndouble rk_pareto(rk_state *state, double a)\n{\n return exp(rk_standard_exponential(state)/a) - 1;\n}\n\ndouble rk_weibull(rk_state *state, double a)\n{\n return pow(rk_standard_exponential(state), 1./a);\n}\n\ndouble rk_power(rk_state *state, double a)\n{\n return pow(1 - exp(-rk_standard_exponential(state)), 1./a);\n}\n\ndouble rk_laplace(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = rk_double(state);\n if (U < 0.5)\n {\n U = loc + scale * log(U + U);\n } else \n {\n U = loc - scale * log(2.0 - U - U);\n }\n return U;\n}\n\ndouble rk_gumbel(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = 1.0 - rk_double(state);\n return loc - scale * log(-log(U));\n}\n\ndouble rk_logistic(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = rk_double(state);\n return loc + scale * log(U/(1.0 - U));\n}\n\ndouble rk_lognormal(rk_state *state, double mean, double sigma)\n{\n return exp(rk_normal(state, mean, sigma));\n}\n\ndouble rk_rayleigh(rk_state *state, double mode)\n{\n return mode*sqrt(-2.0 * log(1.0 - rk_double(state)));\n}\n\ndouble rk_wald(rk_state *state, double mean, double scale)\n{\n double U, X, Y;\n double mu_2l;\n \n mu_2l = mean / (2*scale);\n Y = rk_gauss(state);\n Y = mean*Y*Y;\n X = mean + mu_2l*(Y - sqrt(4*scale*Y + Y*Y));\n U = rk_double(state);\n if (U <= mean/(mean+X))\n {\n return X;\n } else\n {\n return mean*mean/X;\n }\n}\n\nlong rk_zipf(rk_state *state, double a)\n{\n double T, U, V;\n long X;\n double b;\n \n b = pow(2.0, a-1.0);\n do\n {\n U = rk_double(state);\n V = rk_double(state);\n X = (long)floor(pow(U, -1.0/(a-1.0)));\n T = pow(1.0 + 1.0/X, a-1.0); \n } while ((V *X*(T-1.0)/(b-1.0)) > (T/b));\n return X;\n}\n\nlong rk_geometric_search(rk_state *state, double p)\n{\n double U;\n long X;\n double sum, prod, q;\n \n X = 1;\n sum = prod = p;\n q = 1.0 - p;\n U = rk_double(state);\n while (U > sum)\n {\n prod *= q;\n sum += prod;\n X++;\n }\n return X;\n}\n\nlong rk_geometric_inversion(rk_state *state, double p)\n{\n return (long)ceil(log(1.0-rk_double(state))/log(1.0-p));\n}\n\nlong rk_geometric(rk_state *state, double p)\n{\n if (p >= 0.333333333333333333333333)\n {\n return rk_geometric_search(state, p);\n } else\n {\n return rk_geometric_inversion(state, p);\n }\n}\n\nlong rk_hypergeometric_hyp(rk_state *state, long good, long bad, long sample)\n{\n long d1, K, Z;\n double d2, U, Y;\n \n d1 = bad + good - sample;\n d2 = (double)min(bad, good);\n \n Y = d2;\n K = sample;\n while (Y > 0.0)\n {\n U = rk_double(state);\n Y -= (long)floor(U + Y/(d1 + K));\n K--;\n if (K == 0) break;\n }\n Z = (long)(d2 - Y);\n if (bad > good) Z = sample - Z;\n return Z;\n}\n\n/* D1 = 2*sqrt(2/e) */\n/* D2 = 3 - 2*sqrt(3/e) */\n#define D1 1.7155277699214135\n#define D2 0.8989161620588988\nlong rk_hypergeometric_hrua(rk_state *state, long good, long bad, long sample)\n{\n long mingoodbad, maxgoodbad, popsize, m, d9;\n double d4, d5, d6, d7, d8, d10, d11;\n long Z;\n double T, W, X, Y;\n \n mingoodbad = min(good, bad);\n popsize = good + bad;\n maxgoodbad = max(good, bad);\n m = min(sample, popsize - sample);\n d4 = ((double)mingoodbad) / popsize;\n d5 = 1.0 - d4;\n d6 = m*d4 + 0.5;\n d7 = sqrt((popsize - m) * sample * d4 *d5 / (popsize-1) + 0.5);\n d8 = D1*d7 + D2;\n d9 = (long)floor((double)((m+1)*(mingoodbad+1))/(popsize+2));\n d10 = (lgam(d9+1) + lgam(mingoodbad-d9+1) + lgam(m-d9+1) + \n lgam(maxgoodbad-m+d9+1));\n d11 = min(min(m, mingoodbad)+1.0, floor(d6+16*d7));\n /* 16 for 16-decimal-digit precision in D1 and D2 */\n \n while (1)\n {\n X = rk_double(state);\n Y = rk_double(state);\n W = d6 + d8*(Y- 0.5)/X;\n \n /* fast rejection: */\n if ((W < 0.0) || (W >= d11)) continue;\n \n Z = (long)floor(W);\n T = d10 - (lgam(Z+1) + lgam(mingoodbad-Z+1) + lgam(m-Z+1) +\n lgam(maxgoodbad-m+Z+1));\n \n /* fast acceptance: */\n if ((X*(4.0-X)-3.0) <= T) break;\n \n /* fast rejection: */\n if (X*(X-T) >= 1) continue;\n\n if (2.0*log(X) <= T) break; /* acceptance */\n }\n \n /* this is a correction to HRUA* by Ivan Frohne in rv.py */\n if (bad > good) Z = m - Z;\n \n /* another fix from rv.py to allow sample to exceed popsize/2 */\n if (m < sample) Z = bad - Z;\n \n return Z;\n}\n#undef D1\n#undef D2\n\nlong rk_hypergeometric(rk_state *state, long good, long bad, long sample)\n{\n if (sample > 10)\n {\n return rk_hypergeometric_hrua(state, good, bad, sample);\n } else\n {\n return rk_hypergeometric_hyp(state, good, bad, sample);\n }\n}\n\ndouble rk_triangular(rk_state *state, double left, double mode, double right)\n{\n double base, leftbase, ratio, leftprod, rightprod;\n double U;\n \n base = right - left;\n leftbase = mode - left;\n ratio = leftbase / base;\n leftprod = leftbase*base;\n rightprod = (right - mode)*base;\n \n U = rk_double(state);\n if (U <= ratio)\n {\n return left + sqrt(U*leftprod);\n } else \n {\n return right - sqrt((1.0 - U) * rightprod); \n }\n}\n\nlong rk_logseries(rk_state *state, double p)\n{\n double q, r, U, V;\n \n r = log(1.0 - p);\n \n V = rk_double(state);\n if (V >= p) return 1;\n U = rk_double(state);\n q = 1.0 - exp(r*U);\n if (V <= q*q) return (long)floor(1 + log(V)/log(q));\n if (V <= q) return 1;\n return 2;\n}\n", "source_code_before": "/* Copyright 2005 Robert Kern (robert.kern@gmail.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n * \n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/* The implementations of rk_hypergeometric_hyp(), rk_hypergeometric_hrua(),\n * and rk_triangular() were adapted from Ivan Frohne's rv.py which has this \n * license:\n * \n * Copyright 1998 by Ivan Frohne; Wasilla, Alaska, U.S.A.\n * All Rights Reserved\n *\n * Permission to use, copy, modify and distribute this software and its\n * documentation for any purpose, free of charge, is granted subject to the\n * following conditions:\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the software.\n *\n * THE SOFTWARE AND DOCUMENTATION IS PROVIDED WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO MERCHANTABILITY, FITNESS\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR\n * OR COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM OR DAMAGES IN A CONTRACT\n * ACTION, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR ITS DOCUMENTATION.\n */\n\n#include \n#include \"distributions.h\"\n#include \"mconf.h\"\n#include \n\n#ifndef min\n#define min(x,y) ((xy)?x:y)\n#endif\n\ndouble rk_normal(rk_state *state, double loc, double scale)\n{\n return loc + scale*rk_gauss(state);\n}\n\ndouble rk_standard_exponential(rk_state *state)\n{\n /* We use -log(1-U) since U is [0, 1) */\n return -log(1.0 - rk_double(state));\n}\n\ndouble rk_exponential(rk_state *state, double scale)\n{\n return scale * rk_standard_exponential(state);\n}\n\ndouble rk_uniform(rk_state *state, double loc, double scale)\n{\n return loc + scale*rk_double(state);\n}\n\n#define LOG4 1.3862943611198906\n#define ONELOG92 2.5040773967762742\n\ndouble rk_standard_gamma(rk_state *state, double shape)\n{\n double b, c, lam;\n double U, V, X, Y, Z, R;\n\n if (shape == 1.0)\n {\n return rk_standard_exponential(state);\n }\n else if (shape < 1.0)\n {\n while (1)\n {\n U = rk_double(state);\n V = rk_standard_exponential(state);\n if (U <= 1.0 - shape)\n {\n X = pow(U, 1./shape);\n if (X <= V)\n {\n return X;\n }\n }\n else\n {\n Y = -log((1-U)/shape);\n X = pow(1.0 - shape + shape*Y, 1./shape);\n if (X <= (V + Y))\n {\n return X;\n }\n }\n }\n }\n else\n {\n b = shape - LOG4;\n lam = sqrt(2.0*shape - 1.0);\n c = shape + lam;\n \n while (1)\n {\n U = rk_double(state);\n V = rk_double(state);\n Y = log(V/(1.0-V))/lam;\n X = shape*exp(Y); \n Z = U*V*V;\n R = b + c*Y - X;\n if ((R >= 4.5*Z - ONELOG92) || (R >= log(Z)))\n {\n break;\n }\n }\n return X;\n }\n}\n\n#undef LOG4\n#undef ONELOG92\n\ndouble rk_gamma(rk_state *state, double shape, double scale)\n{\n return scale * rk_standard_gamma(state, shape);\n}\n\ndouble rk_beta(rk_state *state, double a, double b)\n{\n double Ga, Gb;\n\n if ((a <= 1.0) && (b <= 1.0))\n {\n double U, V, X, Y;\n /* Use Jonk's algorithm */\n\n while (1)\n {\n U = rk_double(state);\n V = rk_double(state);\n X = pow(U, 1.0/a);\n Y = pow(V, 1.0/b);\n\n if ((X + Y) <= 1.0)\n {\n return X;\n }\n }\n }\n else\n {\n Ga = rk_standard_gamma(state, a);\n Gb = rk_standard_gamma(state, b);\n return Ga/(Ga + Gb);\n }\n}\n\ndouble rk_chisquare(rk_state *state, double df)\n{\n return 2.0*rk_standard_gamma(state, df/2.0);\n}\n\ndouble rk_noncentral_chisquare(rk_state *state, double df, double nonc)\n{\n double Chi2, N;\n\n Chi2 = rk_chisquare(state, df-1);\n N = rk_gauss(state) + sqrt(nonc);\n return Chi2 + N*N;\n}\n\ndouble rk_f(rk_state *state, double dfnum, double dfden)\n{\n return rk_chisquare(state, dfnum) / rk_chisquare(state, dfden);\n}\n\ndouble rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc)\n{\n return ((rk_noncentral_chisquare(state, dfnum, nonc)*dfden) /\n (rk_chisquare(state, dfden)*dfnum));\n}\n\nlong rk_binomial_btpe(rk_state *state, long n, double p)\n{\n double r,q,fm,p1,xm,xl,xr,c,laml,lamr,p2,p3,p4;\n double a,u,v,s,F,rho,t,A,nrq,x1,x2,f1,f2,z,z2,w,w2,x;\n long m,y,k,i;\n\n if (!(state->has_binomial) || \n (state->nsave != n) ||\n (state->psave != p))\n {\n /* initialize */\n state->nsave = n;\n state->psave = p;\n state->has_binomial = 1;\n state->r = r = min(p, 1.0-p);\n state->q = q = 1.0 - r;\n state->fm = fm = n*r+r;\n state->m = m = (long)floor(state->fm);\n state->p1 = p1 = floor(2.195*sqrt(n*r*q)-4.6*q) + 0.5;\n state->xm = xm = m + 0.5;\n state->xl = xl = xm - p1;\n state->xr = xr = xm + p1;\n state->c = c = 0.134 + 20.5/(15.3 + m);\n a = (fm - xl)/(fm-xl*r);\n state->laml = laml = a*(1.0 + a/2.0);\n a = (xr - fm)/(xr*q);\n state->lamr = lamr = a*(1.0 + a/2.0);\n state->p2 = p2 = p1*(1.0 + 2.0*c);\n state->p3 = p3 = p2 + c/laml;\n state->p4 = p4 = p3 + c/lamr;\n }\n else\n {\n r = state->r;\n q = state->q;\n fm = state->fm;\n m = state->m;\n p1 = state->p1;\n xm = state->xm;\n xl = state->xl;\n xr = state->xr;\n c = state->c;\n laml = state->laml;\n lamr = state->lamr;\n p2 = state->p2;\n p3 = state->p3;\n p4 = state->p4;\n }\n\n /* sigh ... */\n Step10:\n nrq = n*r*q;\n u = rk_double(state)*p4;\n v = rk_double(state);\n if (u > p1) goto Step20;\n y = (long)floor(xm - p1*v + u);\n goto Step60;\n\n Step20:\n if (u > p2) goto Step30;\n x = xl + (u - p1)/c;\n v = v*c + 1.0 - fabs(m - x + 0.5)/p1;\n if (v > 1.0) goto Step10;\n y = (long)floor(x);\n goto Step50;\n\n Step30:\n if (u > p3) goto Step40;\n y = (long)floor(xl + log(v)/laml);\n if (y < 0) goto Step10;\n v = v*(u-p2)*laml;\n goto Step50;\n\n Step40:\n y = (int)floor(xr - log(v)/lamr);\n if (y > n) goto Step10;\n v = v*(u-p3)*lamr;\n\n Step50:\n k = fabs(y - m);\n if ((k > 20) && (k < ((nrq)/2.0 - 1))) goto Step52;\n\n s = r/q;\n a = s*(n+1);\n F = 1.0;\n if (m < y)\n {\n for (i=m; i<=y; i++)\n {\n F *= (a/i - s);\n }\n }\n else if (m > y)\n {\n for (i=y; i<=m; i++)\n {\n F /= (a/i - s);\n }\n }\n else\n {\n if (v > F) goto Step10;\n goto Step60;\n }\n\n Step52:\n rho = (k/(nrq))*((k*(k/3.0 + 0.625) + 0.16666666666666666)/nrq + 0.5);\n t = -k*k/(2*nrq);\n A = log(v);\n if (A < (t - rho)) goto Step60;\n if (A > (t + rho)) goto Step10;\n\n x1 = y+1;\n f1 = m+1;\n z = n+1-m;\n w = n-y+1;\n x2 = x1*x1;\n f2 = f1*f1;\n z2 = z*z;\n w2 = w*w;\n if (A > (xm*log(f1/x1)\n + (n-m+0.5)*log(z/w)\n + (y-m)*log(w*r/(x1*q))\n + (13680.-(462.-(132.-(99.-140./f2)/f2)/f2)/f2)/f1/166320.\n + (13680.-(462.-(132.-(99.-140./z2)/z2)/z2)/z2)/z/166320.\n + (13680.-(462.-(132.-(99.-140./x2)/x2)/x2)/x2)/x1/166320.\n + (13680.-(462.-(132.-(99.-140./w2)/w2)/w2)/w2)/w/166320.))\n {\n goto Step10;\n }\n\n Step60:\n if (p > 0.5)\n {\n y = n - y;\n }\n\n return y;\n}\n\nlong rk_binomial_waiting(rk_state *state, long n, double p)\n{\n double q, E, Sum;\n long X;\n\n q = -log(1.0 - p);\n\n X = 0;\n Sum = 0.0;\n\n while (Sum <= q)\n {\n if (X == n)\n {\n X += 1;\n break;\n }\n E = rk_standard_exponential(state);\n Sum += E / (n - X);\n X++;\n }\n return X-1;\n}\n\nlong rk_binomial(rk_state *state, long n, double p)\n{\n double q;\n\n if (p <= 0.5)\n {\n if (p*n <= 30.0)\n {\n return rk_binomial_waiting(state, n, p);\n }\n else\n {\n return rk_binomial_btpe(state, n, p);\n }\n }\n else\n {\n q = 1.0-p;\n if (q*n <= 30.0)\n {\n return n - rk_binomial_waiting(state, n, q);\n }\n else\n {\n return n - rk_binomial_btpe(state, n, q);\n }\n }\n\n}\n\nlong rk_negative_binomial(rk_state *state, long n, double p)\n{\n double Y;\n\n Y = rk_gamma(state, n, (1-p)/p);\n return rk_poisson(state, Y);\n}\n\nlong rk_poisson_mult(rk_state *state, double lam)\n{\n long X;\n double prod, U, enlam;\n\n enlam = exp(-lam);\n X = 0;\n prod = 1.0;\n while (1)\n {\n U = rk_double(state);\n prod *= U;\n if (prod > enlam)\n {\n X += 1;\n }\n else\n {\n return X;\n }\n }\n}\n\n#define LS2PI 0.91893853320467267\n#define TWELFTH 0.083333333333333333333333\nlong rk_poisson_ptrs(rk_state *state, double lam)\n{\n long k;\n double U, V, slam, loglam, a, b, invalpha, vr, us;\n\n slam = sqrt(lam);\n loglam = log(lam);\n b = 0.931 + 2.53*slam;\n a = -0.059 + 0.02483*b;\n invalpha = 1.1239 + 1.1328/(b-3.4);\n vr = 0.9277 - 3.6224/(b-2);\n\n while (1)\n {\n U = rk_double(state) - 0.5;\n V = rk_double(state);\n us = 0.5 - fabs(U);\n k = (long)floor((2*a/us + b)*U + lam + 0.43);\n if ((us >= 0.07) && (V <= vr))\n {\n return k;\n }\n if ((k < 0) ||\n ((us < 0.013) && (V > us)))\n {\n continue;\n }\n if ((log(V) + log(invalpha) - log(a/(us*us)+b)) <=\n (-lam + k*loglam - lgam(k+1)))\n {\n return k;\n }\n\n \n }\n\n}\n\nlong rk_poisson(rk_state *state, double lam)\n{\n if (lam >= 10)\n {\n return rk_poisson_ptrs(state, lam);\n }\n else\n {\n return rk_poisson_mult(state, lam);\n }\n}\n\ndouble rk_standard_cauchy(rk_state *state)\n{\n return rk_gauss(state) / rk_gauss(state);\n}\n\ndouble rk_standard_t(rk_state *state, double df)\n{\n double N, G, X;\n\n N = rk_gauss(state);\n G = rk_standard_gamma(state, df/2);\n X = sqrt(df/2)*N/sqrt(G);\n return X;\n}\n\ndouble rk_vonmises(rk_state *state, double mu, double kappa)\n{\n double r, rho, s;\n double U, V, W, Y, Z;\n double result, mod;\n\n if (kappa < 1e-8)\n {\n return M_PI * (2*rk_double(state)-1);\n }\n else\n {\n r = 1 + sqrt(1 + 4*kappa*kappa);\n rho = (r - sqrt(2*r))/(2*kappa);\n s = (1 + rho*rho)/(2*rho);\n\n while (1)\n {\n U = 2*rk_double(state) - 1;\n V = 2*rk_double(state) - 1;\n Z = cos(M_PI*U);\n W = (1 + s*Z)/(s + Z);\n Y = kappa * (s - W);\n if ((Y*(2-Y) - V >= 0) || (log(Y/V)+1 - Y >= 0))\n {\n break;\n }\n }\n\n if (U < 0)\n {\n result = acos(W);\n }\n else\n {\n result = -acos(W);\n }\n result += mu + M_PI;\n mod = fmod(result, 2*M_PI);\n if (mod && (mod < 0))\n {\n mod += 2*M_PI;\n }\n return mod - M_PI;\n }\n}\n\ndouble rk_pareto(rk_state *state, double a)\n{\n return exp(rk_standard_exponential(state)/a) - 1;\n}\n\ndouble rk_weibull(rk_state *state, double a)\n{\n return pow(rk_standard_exponential(state), 1./a);\n}\n\ndouble rk_power(rk_state *state, double a)\n{\n return pow(1 - exp(-rk_standard_exponential(state)), 1./a);\n}\n\ndouble rk_laplace(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = rk_double(state);\n if (U < 0.5)\n {\n U = loc + scale * log(U + U);\n } else \n {\n U = loc - scale * log(2.0 - U - U);\n }\n return U;\n}\n\ndouble rk_gumbel(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = 1.0 - rk_double(state);\n return loc - scale * log(-log(U));\n}\n\ndouble rk_logistic(rk_state *state, double loc, double scale)\n{\n double U;\n \n U = rk_double(state);\n return loc + scale * log(U/(1.0 - U));\n}\n\ndouble rk_lognormal(rk_state *state, double mean, double sigma)\n{\n return exp(rk_normal(state, mean, sigma));\n}\n\ndouble rk_rayleigh(rk_state *state, double mode)\n{\n return mode*sqrt(-2.0 * log(1.0 - rk_double(state)));\n}\n\ndouble rk_wald(rk_state *state, double mean, double scale)\n{\n double U, X, Y;\n double mu_2l;\n \n mu_2l = mean / (2*scale);\n Y = rk_gauss(state);\n Y = mean*Y*Y;\n X = mean + mu_2l*(Y - sqrt(4*scale*Y + Y*Y));\n U = rk_double(state);\n if (U <= mean/(mean+X))\n {\n return X;\n } else\n {\n return mean*mean/X;\n }\n}\n\nlong rk_zipf(rk_state *state, double a)\n{\n double T, U, V;\n long X;\n double b;\n \n b = pow(2.0, a-1.0);\n do\n {\n U = rk_double(state);\n V = rk_double(state);\n X = (long)floor(pow(U, -1.0/(a-1.0)));\n T = pow(1.0 + 1.0/X, a-1.0); \n } while ((V *X*(T-1.0)/(b-1.0)) > (T/b));\n return X;\n}\n\nlong rk_geometric_search(rk_state *state, double p)\n{\n double U;\n long X;\n double sum, prod, q;\n \n X = 1;\n sum = prod = p;\n q = 1.0 - p;\n U = rk_double(state);\n while (U > sum)\n {\n prod *= q;\n sum += prod;\n X++;\n }\n return X;\n}\n\nlong rk_geometric_inversion(rk_state *state, double p)\n{\n return (long)ceil(log(1.0-rk_double(state))/log(1.0-p));\n}\n\nlong rk_geometric(rk_state *state, double p)\n{\n if (p >= 0.333333333333333333333333)\n {\n return rk_geometric_search(state, p);\n } else\n {\n return rk_geometric_inversion(state, p);\n }\n}\n\nlong rk_hypergeometric_hyp(rk_state *state, long good, long bad, long sample)\n{\n long d1, K, Z;\n double d2, U, Y;\n \n d1 = bad + good - sample;\n d2 = (double)min(bad, good);\n \n Y = d2;\n K = sample;\n while (Y > 0.0)\n {\n U = rk_double(state);\n Y -= (long)floor(U + Y/(d1 + K));\n K--;\n if (K == 0) break;\n }\n Z = (long)(d2 - Y);\n if (bad > good) Z = sample - Z;\n return Z;\n}\n\n/* D1 = 2*sqrt(2/e) */\n/* D2 = 3 - 2*sqrt(3/e) */\n#define D1 1.7155277699214135\n#define D2 0.8989161620588988\nlong rk_hypergeometric_hrua(rk_state *state, long good, long bad, long sample)\n{\n long mingoodbad, maxgoodbad, popsize, m, d9;\n double d4, d5, d6, d7, d8, d10, d11;\n long Z;\n double T, W, X, Y;\n \n mingoodbad = min(good, bad);\n popsize = good + bad;\n maxgoodbad = max(good, bad);\n m = min(sample, popsize - sample);\n d4 = ((double)mingoodbad) / popsize;\n d5 = 1.0 - d4;\n d6 = m*d4 + 0.5;\n d7 = sqrt((popsize - m) * sample * d4 *d5 / (popsize-1) + 0.5);\n d8 = D1*d7 + D2;\n d9 = (long)floor((double)((m+1)*(mingoodbad+1))/(popsize+2));\n d10 = (lgam(d9+1) + lgam(mingoodbad-d9+1) + lgam(m-d9+1) + \n lgam(maxgoodbad-m+d9+1));\n d11 = min(min(m, mingoodbad)+1.0, floor(d6+16*d7));\n /* 16 for 16-decimal-digit precision in D1 and D2 */\n \n while (1)\n {\n X = rk_double(state);\n Y = rk_double(state);\n W = d6 + d8*(Y- 0.5)/X;\n \n /* fast rejection: */\n if ((W < 0.0) || (W >= d11)) continue;\n \n Z = (long)floor(W);\n T = d10 - (lgam(Z+1) + lgam(mingoodbad-Z+1) + lgam(m-Z+1) +\n lgam(maxgoodbad-m+Z+1));\n \n /* fast acceptance: */\n if ((X*(4.0-X)-3.0) <= T) break;\n \n /* fast rejection: */\n if (X*(X-T) >= 1) continue;\n\n if (2.0*log(X) <= T) break; /* acceptance */\n }\n \n /* this is a correction to HRUA* by Ivan Frohne in rv.py */\n if (bad > good) Z = m - Z;\n \n /* another fix from rv.py to allow sample to exceed popsize/2 */\n if (m < sample) Z = bad - Z;\n \n return Z;\n}\n#undef D1\n#undef D2\n\nlong rk_hypergeometric(rk_state *state, long good, long bad, long sample)\n{\n if (sample > 10)\n {\n return rk_hypergeometric_hrua(state, good, bad, sample);\n } else\n {\n return rk_hypergeometric_hyp(state, good, bad, sample);\n }\n}\n\ndouble rk_triangular(rk_state *state, double left, double mode, double right)\n{\n double base, leftbase, ratio, leftprod, rightprod;\n double U;\n \n base = right - left;\n leftbase = mode - left;\n ratio = leftbase / base;\n leftprod = leftbase*base;\n rightprod = (right - mode)*base;\n \n U = rk_double(state);\n if (U <= ratio)\n {\n return left + sqrt(U*leftprod);\n } else \n {\n return right - sqrt((1.0 - U) * rightprod); \n }\n}\n\nlong rk_logseries(rk_state *state, double p)\n{\n double q, r, U, V;\n \n r = log(1.0 - p);\n \n V = rk_double(state);\n if (V >= p) return 1;\n U = rk_double(state);\n q = 1.0 - exp(r*U);\n if (V <= q*q) return (long)floor(1 + log(V)/log(q));\n if (V <= q) return 1;\n return 2;\n}", "methods": [ { "name": "rk_normal", "long_name": "rk_normal( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "loc", "scale" ], "start_line": 54, "end_line": 57, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_exponential", "long_name": "rk_standard_exponential( rk_state * state)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "state" ], "start_line": 59, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "rk_exponential", "long_name": "rk_exponential( rk_state * state , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "state", "scale" ], "start_line": 65, "end_line": 68, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_uniform", "long_name": "rk_uniform( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "loc", "scale" ], "start_line": 70, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_gamma", "long_name": "rk_standard_gamma( rk_state * state , double shape)", "filename": "distributions.c", "nloc": 54, "complexity": 10, "token_count": 271, "parameters": [ "state", "shape" ], "start_line": 78, "end_line": 133, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "rk_gamma", "long_name": "rk_gamma( rk_state * state , double shape , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "shape", "scale" ], "start_line": 138, "end_line": 141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_beta", "long_name": "rk_beta( rk_state * state , double a , double b)", "filename": "distributions.c", "nloc": 25, "complexity": 5, "token_count": 131, "parameters": [ "state", "a", "b" ], "start_line": 143, "end_line": 171, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "rk_chisquare", "long_name": "rk_chisquare( rk_state * state , double df)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 23, "parameters": [ "state", "df" ], "start_line": 173, "end_line": 176, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_noncentral_chisquare", "long_name": "rk_noncentral_chisquare( rk_state * state , double df , double nonc)", "filename": "distributions.c", "nloc": 7, "complexity": 1, "token_count": 49, "parameters": [ "state", "df", "nonc" ], "start_line": 178, "end_line": 185, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "rk_f", "long_name": "rk_f( rk_state * state , double dfnum , double dfden)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 29, "parameters": [ "state", "dfnum", "dfden" ], "start_line": 187, "end_line": 190, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_noncentral_f", "long_name": "rk_noncentral_f( rk_state * state , double dfnum , double dfden , double nonc)", "filename": "distributions.c", "nloc": 5, "complexity": 1, "token_count": 44, "parameters": [ "state", "dfnum", "dfden", "nonc" ], "start_line": 192, "end_line": 196, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "rk_binomial_btpe", "long_name": "rk_binomial_btpe( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 126, "complexity": 21, "token_count": 1119, "parameters": [ "state", "n", "p" ], "start_line": 198, "end_line": 336, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "rk_binomial_waiting", "long_name": "rk_binomial_waiting( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 20, "complexity": 3, "token_count": 89, "parameters": [ "state", "n", "p" ], "start_line": 338, "end_line": 360, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "rk_binomial", "long_name": "rk_binomial( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 27, "complexity": 4, "token_count": 104, "parameters": [ "state", "n", "p" ], "start_line": 362, "end_line": 390, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "rk_negative_binomial", "long_name": "rk_negative_binomial( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 42, "parameters": [ "state", "n", "p" ], "start_line": 392, "end_line": 398, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_poisson_mult", "long_name": "rk_poisson_mult( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 21, "complexity": 3, "token_count": 73, "parameters": [ "state", "lam" ], "start_line": 400, "end_line": 421, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "rk_poisson_ptrs", "long_name": "rk_poisson_ptrs( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 32, "complexity": 8, "token_count": 236, "parameters": [ "state", "lam" ], "start_line": 425, "end_line": 461, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "rk_poisson", "long_name": "rk_poisson( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 11, "complexity": 2, "token_count": 38, "parameters": [ "state", "lam" ], "start_line": 463, "end_line": 473, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "rk_standard_cauchy", "long_name": "rk_standard_cauchy( rk_state * state)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "state" ], "start_line": 475, "end_line": 478, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_t", "long_name": "rk_standard_t( rk_state * state , double df)", "filename": "distributions.c", "nloc": 8, "complexity": 1, "token_count": 55, "parameters": [ "state", "df" ], "start_line": 480, "end_line": 488, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "rk_vonmises", "long_name": "rk_vonmises( rk_state * state , double mu , double kappa)", "filename": "distributions.c", "nloc": 43, "complexity": 8, "token_count": 278, "parameters": [ "state", "mu", "kappa" ], "start_line": 490, "end_line": 535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "rk_pareto", "long_name": "rk_pareto( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "a" ], "start_line": 537, "end_line": 540, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_weibull", "long_name": "rk_weibull( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "a" ], "start_line": 542, "end_line": 545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_power", "long_name": "rk_power( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 30, "parameters": [ "state", "a" ], "start_line": 547, "end_line": 550, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_laplace", "long_name": "rk_laplace( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 13, "complexity": 2, "token_count": 66, "parameters": [ "state", "loc", "scale" ], "start_line": 552, "end_line": 565, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "rk_gumbel", "long_name": "rk_gumbel( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 40, "parameters": [ "state", "loc", "scale" ], "start_line": 567, "end_line": 573, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_logistic", "long_name": "rk_logistic( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 40, "parameters": [ "state", "loc", "scale" ], "start_line": 575, "end_line": 581, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_lognormal", "long_name": "rk_lognormal( rk_state * state , double mean , double sigma)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "state", "mean", "sigma" ], "start_line": 583, "end_line": 586, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_rayleigh", "long_name": "rk_rayleigh( rk_state * state , double mode)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 30, "parameters": [ "state", "mode" ], "start_line": 588, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_wald", "long_name": "rk_wald( rk_state * state , double mean , double scale)", "filename": "distributions.c", "nloc": 17, "complexity": 2, "token_count": 106, "parameters": [ "state", "mean", "scale" ], "start_line": 593, "end_line": 610, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "rk_zipf", "long_name": "rk_zipf( rk_state * state , double a)", "filename": "distributions.c", "nloc": 15, "complexity": 2, "token_count": 119, "parameters": [ "state", "a" ], "start_line": 612, "end_line": 627, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "rk_geometric_search", "long_name": "rk_geometric_search( rk_state * state , double p)", "filename": "distributions.c", "nloc": 17, "complexity": 2, "token_count": 70, "parameters": [ "state", "p" ], "start_line": 629, "end_line": 646, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "rk_geometric_inversion", "long_name": "rk_geometric_inversion( rk_state * state , double p)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 35, "parameters": [ "state", "p" ], "start_line": 648, "end_line": 651, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_geometric", "long_name": "rk_geometric( rk_state * state , double p)", "filename": "distributions.c", "nloc": 10, "complexity": 2, "token_count": 38, "parameters": [ "state", "p" ], "start_line": 653, "end_line": 662, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "rk_hypergeometric_hyp", "long_name": "rk_hypergeometric_hyp( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 19, "complexity": 4, "token_count": 129, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 664, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "rk_hypergeometric_hrua", "long_name": "rk_hypergeometric_hrua( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 36, "complexity": 9, "token_count": 416, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 690, "end_line": 741, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "rk_hypergeometric", "long_name": "rk_hypergeometric( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 10, "complexity": 2, "token_count": 52, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 745, "end_line": 754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "rk_triangular", "long_name": "rk_triangular( rk_state * state , double left , double mode , double right)", "filename": "distributions.c", "nloc": 18, "complexity": 2, "token_count": 107, "parameters": [ "state", "left", "mode", "right" ], "start_line": 756, "end_line": 775, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "rk_logseries", "long_name": "rk_logseries( rk_state * state , double p)", "filename": "distributions.c", "nloc": 12, "complexity": 4, "token_count": 102, "parameters": [ "state", "p" ], "start_line": 777, "end_line": 790, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "methods_before": [ { "name": "rk_normal", "long_name": "rk_normal( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "loc", "scale" ], "start_line": 54, "end_line": 57, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_exponential", "long_name": "rk_standard_exponential( rk_state * state)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "state" ], "start_line": 59, "end_line": 63, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "rk_exponential", "long_name": "rk_exponential( rk_state * state , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "state", "scale" ], "start_line": 65, "end_line": 68, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_uniform", "long_name": "rk_uniform( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "loc", "scale" ], "start_line": 70, "end_line": 73, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_gamma", "long_name": "rk_standard_gamma( rk_state * state , double shape)", "filename": "distributions.c", "nloc": 54, "complexity": 10, "token_count": 271, "parameters": [ "state", "shape" ], "start_line": 78, "end_line": 133, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 56, "top_nesting_level": 0 }, { "name": "rk_gamma", "long_name": "rk_gamma( rk_state * state , double shape , double scale)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "shape", "scale" ], "start_line": 138, "end_line": 141, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_beta", "long_name": "rk_beta( rk_state * state , double a , double b)", "filename": "distributions.c", "nloc": 25, "complexity": 5, "token_count": 131, "parameters": [ "state", "a", "b" ], "start_line": 143, "end_line": 171, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "rk_chisquare", "long_name": "rk_chisquare( rk_state * state , double df)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 23, "parameters": [ "state", "df" ], "start_line": 173, "end_line": 176, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_noncentral_chisquare", "long_name": "rk_noncentral_chisquare( rk_state * state , double df , double nonc)", "filename": "distributions.c", "nloc": 7, "complexity": 1, "token_count": 49, "parameters": [ "state", "df", "nonc" ], "start_line": 178, "end_line": 185, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "rk_f", "long_name": "rk_f( rk_state * state , double dfnum , double dfden)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 29, "parameters": [ "state", "dfnum", "dfden" ], "start_line": 187, "end_line": 190, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_noncentral_f", "long_name": "rk_noncentral_f( rk_state * state , double dfnum , double dfden , double nonc)", "filename": "distributions.c", "nloc": 5, "complexity": 1, "token_count": 44, "parameters": [ "state", "dfnum", "dfden", "nonc" ], "start_line": 192, "end_line": 196, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "rk_binomial_btpe", "long_name": "rk_binomial_btpe( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 126, "complexity": 21, "token_count": 1119, "parameters": [ "state", "n", "p" ], "start_line": 198, "end_line": 336, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 139, "top_nesting_level": 0 }, { "name": "rk_binomial_waiting", "long_name": "rk_binomial_waiting( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 20, "complexity": 3, "token_count": 89, "parameters": [ "state", "n", "p" ], "start_line": 338, "end_line": 360, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "rk_binomial", "long_name": "rk_binomial( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 27, "complexity": 4, "token_count": 104, "parameters": [ "state", "n", "p" ], "start_line": 362, "end_line": 390, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "rk_negative_binomial", "long_name": "rk_negative_binomial( rk_state * state , long n , double p)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 42, "parameters": [ "state", "n", "p" ], "start_line": 392, "end_line": 398, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_poisson_mult", "long_name": "rk_poisson_mult( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 21, "complexity": 3, "token_count": 73, "parameters": [ "state", "lam" ], "start_line": 400, "end_line": 421, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "rk_poisson_ptrs", "long_name": "rk_poisson_ptrs( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 32, "complexity": 8, "token_count": 236, "parameters": [ "state", "lam" ], "start_line": 425, "end_line": 461, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "rk_poisson", "long_name": "rk_poisson( rk_state * state , double lam)", "filename": "distributions.c", "nloc": 11, "complexity": 2, "token_count": 38, "parameters": [ "state", "lam" ], "start_line": 463, "end_line": 473, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "rk_standard_cauchy", "long_name": "rk_standard_cauchy( rk_state * state)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "state" ], "start_line": 475, "end_line": 478, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_standard_t", "long_name": "rk_standard_t( rk_state * state , double df)", "filename": "distributions.c", "nloc": 8, "complexity": 1, "token_count": 55, "parameters": [ "state", "df" ], "start_line": 480, "end_line": 488, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "rk_vonmises", "long_name": "rk_vonmises( rk_state * state , double mu , double kappa)", "filename": "distributions.c", "nloc": 43, "complexity": 8, "token_count": 278, "parameters": [ "state", "mu", "kappa" ], "start_line": 490, "end_line": 535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "rk_pareto", "long_name": "rk_pareto( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "a" ], "start_line": 537, "end_line": 540, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_weibull", "long_name": "rk_weibull( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "state", "a" ], "start_line": 542, "end_line": 545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_power", "long_name": "rk_power( rk_state * state , double a)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 30, "parameters": [ "state", "a" ], "start_line": 547, "end_line": 550, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_laplace", "long_name": "rk_laplace( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 13, "complexity": 2, "token_count": 66, "parameters": [ "state", "loc", "scale" ], "start_line": 552, "end_line": 565, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 }, { "name": "rk_gumbel", "long_name": "rk_gumbel( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 40, "parameters": [ "state", "loc", "scale" ], "start_line": 567, "end_line": 573, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_logistic", "long_name": "rk_logistic( rk_state * state , double loc , double scale)", "filename": "distributions.c", "nloc": 6, "complexity": 1, "token_count": 40, "parameters": [ "state", "loc", "scale" ], "start_line": 575, "end_line": 581, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "rk_lognormal", "long_name": "rk_lognormal( rk_state * state , double mean , double sigma)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "state", "mean", "sigma" ], "start_line": 583, "end_line": 586, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_rayleigh", "long_name": "rk_rayleigh( rk_state * state , double mode)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 30, "parameters": [ "state", "mode" ], "start_line": 588, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_wald", "long_name": "rk_wald( rk_state * state , double mean , double scale)", "filename": "distributions.c", "nloc": 17, "complexity": 2, "token_count": 106, "parameters": [ "state", "mean", "scale" ], "start_line": 593, "end_line": 610, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "rk_zipf", "long_name": "rk_zipf( rk_state * state , double a)", "filename": "distributions.c", "nloc": 15, "complexity": 2, "token_count": 119, "parameters": [ "state", "a" ], "start_line": 612, "end_line": 627, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "rk_geometric_search", "long_name": "rk_geometric_search( rk_state * state , double p)", "filename": "distributions.c", "nloc": 17, "complexity": 2, "token_count": 70, "parameters": [ "state", "p" ], "start_line": 629, "end_line": 646, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "rk_geometric_inversion", "long_name": "rk_geometric_inversion( rk_state * state , double p)", "filename": "distributions.c", "nloc": 4, "complexity": 1, "token_count": 35, "parameters": [ "state", "p" ], "start_line": 648, "end_line": 651, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "rk_geometric", "long_name": "rk_geometric( rk_state * state , double p)", "filename": "distributions.c", "nloc": 10, "complexity": 2, "token_count": 38, "parameters": [ "state", "p" ], "start_line": 653, "end_line": 662, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "rk_hypergeometric_hyp", "long_name": "rk_hypergeometric_hyp( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 19, "complexity": 4, "token_count": 129, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 664, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "rk_hypergeometric_hrua", "long_name": "rk_hypergeometric_hrua( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 36, "complexity": 9, "token_count": 416, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 690, "end_line": 741, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "rk_hypergeometric", "long_name": "rk_hypergeometric( rk_state * state , long good , long bad , long sample)", "filename": "distributions.c", "nloc": 10, "complexity": 2, "token_count": 52, "parameters": [ "state", "good", "bad", "sample" ], "start_line": 745, "end_line": 754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "rk_triangular", "long_name": "rk_triangular( rk_state * state , double left , double mode , double right)", "filename": "distributions.c", "nloc": 18, "complexity": 2, "token_count": 107, "parameters": [ "state", "left", "mode", "right" ], "start_line": 756, "end_line": 775, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "rk_logseries", "long_name": "rk_logseries( rk_state * state , double p)", "filename": "distributions.c", "nloc": 12, "complexity": 4, "token_count": 102, "parameters": [ "state", "p" ], "start_line": 777, "end_line": 790, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "rk_logseries", "long_name": "rk_logseries( rk_state * state , double p)", "filename": "distributions.c", "nloc": 12, "complexity": 4, "token_count": 102, "parameters": [ "state", "p" ], "start_line": 777, "end_line": 790, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 14, "top_nesting_level": 0 } ], "nloc": 624, "complexity": 115, "token_count": 4213, "diff_parsed": { "added": [ "}" ], "deleted": [ "}" ] } }, { "old_path": "scipy/corelib/mtrand/mtrand.c", "new_path": "scipy/corelib/mtrand/mtrand.c", "filename": "mtrand.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -1,4 +1,4 @@\n-/* Generated by Pyrex 0.9.3.1 on Fri Oct 7 02:05:13 2005 */\n+/* Generated by Pyrex 0.9.3.1 on Sat Oct 8 00:19:00 2005 */\n \n #include \"Python.h\"\n #include \"structmember.h\"\n@@ -97,19 +97,20 @@ static PyObject *__pyx_k42;\n static double __pyx_k43;\n static double __pyx_k44;\n static PyObject *__pyx_k45;\n-static PyObject *__pyx_k46;\n+static double __pyx_k46;\n static PyObject *__pyx_k47;\n static PyObject *__pyx_k48;\n static PyObject *__pyx_k49;\n static PyObject *__pyx_k50;\n-static double __pyx_k51;\n-static PyObject *__pyx_k52;\n+static PyObject *__pyx_k51;\n+static double __pyx_k52;\n static PyObject *__pyx_k53;\n static PyObject *__pyx_k54;\n static PyObject *__pyx_k55;\n static PyObject *__pyx_k56;\n static PyObject *__pyx_k57;\n static PyObject *__pyx_k58;\n+static PyObject *__pyx_k59;\n static PyObject *(__pyx_f_6mtrand_cont0_array(rk_state (*),double ((*)(rk_state (*))),PyObject *)); /*proto*/\n static PyObject *(__pyx_f_6mtrand_cont1_array(rk_state (*),double ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/\n static PyObject *(__pyx_f_6mtrand_cont2_array(rk_state (*),double ((*)(rk_state (*),double ,double )),PyObject *,double ,double )); /*proto*/\n@@ -187,11 +188,11 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":124 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":124 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":125 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":125 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -200,7 +201,7 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":127 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":127 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -220,22 +221,22 @@ static PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":128 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":128 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":129 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":129 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":130 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":130 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":131 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":131 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":132 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":132 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -269,11 +270,11 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":140 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":140 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":141 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":141 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -282,7 +283,7 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":143 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":143 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -302,22 +303,22 @@ static PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":144 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":144 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":145 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":145 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":146 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":146 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":147 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":147 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":148 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":148 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -351,11 +352,11 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":157 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":157 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":158 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":158 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -364,7 +365,7 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":160 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":160 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -384,22 +385,22 @@ static PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":161 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":161 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":162 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":162 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":163 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":163 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":164 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":164 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":165 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":165 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -433,11 +434,11 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":175 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":175 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":176 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":176 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -446,7 +447,7 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":178 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":178 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -466,22 +467,22 @@ static PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":179 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":179 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":180 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":180 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":181 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":181 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":182 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":182 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":183 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":183 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -517,11 +518,11 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*_\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":191 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":191 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":192 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":192 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -530,7 +531,7 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*_\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":194 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":194 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -550,22 +551,22 @@ static PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*_\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":195 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":195 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":196 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":196 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":197 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":197 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":198 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":198 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":199 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":199 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -599,11 +600,11 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":207 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":207 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":208 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":208 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -612,7 +613,7 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":210 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":210 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -632,22 +633,22 @@ static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":211 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":211 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":212 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":212 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":213 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":213 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":214 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":214 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":215 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":215 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -681,11 +682,11 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":224 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":224 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":225 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":225 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -694,7 +695,7 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":227 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":227 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -714,22 +715,22 @@ static PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":228 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":228 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":229 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":229 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":230 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":230 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":231 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":231 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":232 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":232 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -763,11 +764,11 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*_\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":240 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":240 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":241 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":241 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -776,7 +777,7 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*_\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":243 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":243 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -796,22 +797,22 @@ static PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*_\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":244 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":244 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":245 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":245 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":246 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":246 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":247 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":247 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":248 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":248 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -840,31 +841,31 @@ static double __pyx_f_6mtrand_kahan_sum(double (*__pyx_v_darr),long __pyx_v_n) {\n long __pyx_v_i;\n double __pyx_r;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":253 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":253 */\n __pyx_v_sum = (__pyx_v_darr[0]);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":254 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":254 */\n __pyx_v_c = 0.0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":255 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":255 */\n for (__pyx_v_i = 1; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":256 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":256 */\n __pyx_v_y = ((__pyx_v_darr[__pyx_v_i]) - __pyx_v_c);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":257 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":257 */\n __pyx_v_t = (__pyx_v_sum + __pyx_v_y);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":258 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":258 */\n __pyx_v_c = ((__pyx_v_t - __pyx_v_sum) - __pyx_v_y);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":259 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":259 */\n __pyx_v_sum = __pyx_v_t;\n __pyx_L2:;\n }\n __pyx_L3:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":260 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":260 */\n __pyx_r = __pyx_v_sum;\n goto __pyx_L0;\n \n@@ -891,10 +892,10 @@ static int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObje\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_seed);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":283 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":283 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state (*))PyMem_Malloc((sizeof(rk_state ))));\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":285 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":285 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n@@ -923,11 +924,11 @@ static void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {\n int __pyx_1;\n Py_INCREF(__pyx_v_self);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":288 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":288 */\n __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":289 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":289 */\n PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n@@ -962,11 +963,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyOb\n Py_INCREF(__pyx_v_seed);\n __pyx_v_obj = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_obj);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":303 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":303 */\n __pyx_1 = __pyx_v_seed == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":304 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":304 */\n __pyx_v_errcode = rk_randomseed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n@@ -983,20 +984,20 @@ static PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyOb\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":306 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":306 */\n __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; goto __pyx_L1;}\n rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":308 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":308 */\n __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_3;\n __pyx_3 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":309 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":309 */\n init_by_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,((unsigned long (*))__pyx_v_obj->data),(__pyx_v_obj->dimensions[0]));\n }\n __pyx_L2:;\n@@ -1033,7 +1034,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n __pyx_v_state = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_state);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":318 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":318 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n@@ -1054,10 +1055,10 @@ static PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self,\n __pyx_v_state = ((PyObject *)__pyx_1);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":319 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":319 */\n memcpy(((void (*))__pyx_v_state->data),((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,(624 * (sizeof(long ))));\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":320 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":320 */\n __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}\n Py_INCREF(__pyx_n_MT19937);\n@@ -1087,11 +1088,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self,\n \n static PyObject *__pyx_n_ValueError;\n \n-static PyObject *__pyx_k61p;\n static PyObject *__pyx_k62p;\n+static PyObject *__pyx_k63p;\n \n-static char (__pyx_k61[]) = \"algorithm must be 'MT19937'\";\n-static char (__pyx_k62[]) = \"state must be 624 longs\";\n+static char (__pyx_k62[]) = \"algorithm must be 'MT19937'\";\n+static char (__pyx_k63[]) = \"state must be 624 longs\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_set_state[] = \"Set the state from a tuple.\\n \\n state = (\\'MT19937\\', int key[624], int pos)\\n \\n set_state(state)\\n \";\n@@ -1114,7 +1115,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self,\n __pyx_v_algorithm_name = Py_None; Py_INCREF(__pyx_v_algorithm_name);\n __pyx_v_key = Py_None; Py_INCREF(__pyx_v_key);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":331 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":331 */\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n@@ -1122,16 +1123,16 @@ static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self,\n __pyx_v_algorithm_name = __pyx_2;\n __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":332 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":332 */\n if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n __pyx_3 = __pyx_3 != 0;\n if (__pyx_3) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":333 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":333 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n- Py_INCREF(__pyx_k61p);\n- PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k61p);\n+ Py_INCREF(__pyx_k62p);\n+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k62p);\n __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -1142,7 +1143,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self,\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":334 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":334 */\n __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_v_key);\n@@ -1155,21 +1156,21 @@ static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self,\n if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":335 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":335 */\n __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_4;\n __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":336 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":336 */\n __pyx_3 = ((__pyx_v_obj->dimensions[0]) != 624);\n if (__pyx_3) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":337 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":337 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n- Py_INCREF(__pyx_k62p);\n- PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k62p);\n+ Py_INCREF(__pyx_k63p);\n+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k63p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n@@ -1180,10 +1181,10 @@ static PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self,\n }\n __pyx_L3:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":338 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":338 */\n memcpy(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,((void (*))__pyx_v_obj->data),(624 * (sizeof(long ))));\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":339 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":339 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos;\n \n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n@@ -1213,7 +1214,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_se\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":343 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":343 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n@@ -1248,7 +1249,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_se\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_state);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":346 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":346 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n Py_INCREF(__pyx_v_state);\n@@ -1287,7 +1288,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":349 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":349 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n@@ -1337,7 +1338,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_s\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":357 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":357 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n@@ -1367,7 +1368,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":364 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":364 */\n __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n@@ -1385,9 +1386,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k63p;\n+static PyObject *__pyx_k64p;\n \n-static char (__pyx_k63[]) = \"low >= high\";\n+static char (__pyx_k64[]) = \"low >= high\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_randint[] = \"Return random integers x such that low <= x < high.\\n\\n randint(low, high=None, size=None) -> random values\\n\\n If high is None, then 0 <= x < low.\\n \";\n@@ -1418,42 +1419,42 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":379 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":379 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":380 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":380 */\n __pyx_v_lo = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":381 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":381 */\n __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n goto __pyx_L2;\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":383 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":383 */\n __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}\n __pyx_v_lo = __pyx_2;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":384 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":384 */\n __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":386 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":386 */\n __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":387 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":387 */\n __pyx_1 = (__pyx_v_diff < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":388 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":388 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n- Py_INCREF(__pyx_k63p);\n- PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k63p);\n+ Py_INCREF(__pyx_k64p);\n+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k64p);\n __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n@@ -1464,11 +1465,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P\n }\n __pyx_L3:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":390 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":390 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":391 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":391 */\n __pyx_3 = PyLong_FromUnsignedLong(rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n@@ -1477,7 +1478,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":393 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":393 */\n __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n@@ -1497,22 +1498,22 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, P\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":394 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":394 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":395 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":395 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":396 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":396 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":397 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":397 */\n (__pyx_v_array_data[__pyx_v_i]) = (__pyx_v_lo + rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state));\n __pyx_L5:;\n }\n __pyx_L6:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":398 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":398 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n@@ -1549,22 +1550,22 @@ static PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyO\n Py_INCREF(__pyx_v_self);\n __pyx_v_bytestring = Py_None; Py_INCREF(__pyx_v_bytestring);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":406 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":406 */\n __pyx_v_bytes = PyMem_Malloc(__pyx_v_length);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":407 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":407 */\n rk_fill(__pyx_v_bytes,__pyx_v_length,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":408 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":408 */\n __pyx_1 = PyString_FromString(((char (*))__pyx_v_bytes)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; goto __pyx_L1;}\n Py_DECREF(__pyx_v_bytestring);\n __pyx_v_bytestring = __pyx_1;\n __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":409 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":409 */\n PyMem_Free(__pyx_v_bytes);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":410 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":410 */\n Py_INCREF(__pyx_v_bytestring);\n __pyx_r = __pyx_v_bytestring;\n goto __pyx_L0;\n@@ -1597,7 +1598,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":417 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":417 */\n __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_low,(__pyx_v_high - __pyx_v_low)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n@@ -1639,7 +1640,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyOb\n }\n Py_INCREF(__pyx_v_self);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":426 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":426 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n@@ -1654,7 +1655,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyOb\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":427 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":427 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n@@ -1667,7 +1668,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyOb\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":429 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":429 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n@@ -1718,7 +1719,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyO\n }\n Py_INCREF(__pyx_v_self);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":437 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":437 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n@@ -1733,7 +1734,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyO\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":438 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":438 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n@@ -1746,7 +1747,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyO\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":440 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":440 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n@@ -1796,16 +1797,16 @@ static PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v\n Py_INCREF(__pyx_v_high);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":449 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":449 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":450 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":450 */\n Py_INCREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n __pyx_v_high = __pyx_v_low;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":451 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":451 */\n __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n Py_DECREF(__pyx_v_low);\n __pyx_v_low = __pyx_2;\n@@ -1814,7 +1815,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":452 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":452 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n@@ -1861,7 +1862,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":460 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":460 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n@@ -1879,9 +1880,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k65p;\n+static PyObject *__pyx_k66p;\n \n-static char (__pyx_k65[]) = \"scale <= 0\";\n+static char (__pyx_k66[]) = \"scale <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_normal[] = \"Normal distribution (mean=loc, stdev=scale).\\n\\n normal(loc=0.0, scale=1.0, size=None) -> random values\\n \";\n@@ -1902,15 +1903,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, Py\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":467 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":467 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":468 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":468 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n- Py_INCREF(__pyx_k65p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k65p);\n+ Py_INCREF(__pyx_k66p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -1921,7 +1922,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, Py\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":469 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":469 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -1941,11 +1942,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, Py\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k66p;\n static PyObject *__pyx_k67p;\n+static PyObject *__pyx_k68p;\n \n-static char (__pyx_k66[]) = \"a <= 0\";\n-static char (__pyx_k67[]) = \"b <= 0\";\n+static char (__pyx_k67[]) = \"a <= 0\";\n+static char (__pyx_k68[]) = \"b <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_beta[] = \"Beta distribution over [0, 1].\\n\\n beta(a, b, size=None) -> random values\\n \";\n@@ -1964,15 +1965,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyOb\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":476 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":476 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":477 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":477 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n- Py_INCREF(__pyx_k66p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);\n+ Py_INCREF(__pyx_k67p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -1984,11 +1985,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyOb\n __pyx_1 = (__pyx_v_b <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":479 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":479 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n- Py_INCREF(__pyx_k67p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);\n+ Py_INCREF(__pyx_k68p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -1999,7 +2000,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyOb\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":480 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":480 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_a,__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2019,9 +2020,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyOb\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k68p;\n+static PyObject *__pyx_k69p;\n \n-static char (__pyx_k68[]) = \"scale <= 0\";\n+static char (__pyx_k69[]) = \"scale <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_exponential[] = \"Exponential distribution.\\n\\n exponential(scale=1.0, size=None) -> random values\\n \";\n@@ -2040,15 +2041,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_sel\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":487 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":487 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":488 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":488 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n- Py_INCREF(__pyx_k68p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);\n+ Py_INCREF(__pyx_k69p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2059,7 +2060,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_sel\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":489 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":489 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2091,7 +2092,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":496 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":496 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n@@ -2109,9 +2110,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k69p;\n+static PyObject *__pyx_k70p;\n \n-static char (__pyx_k69[]) = \"shape <= 0\";\n+static char (__pyx_k70[]) = \"shape <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_standard_gamma[] = \"Standard Gamma distribution.\\n\\n standard_gamma(shape, size=None) -> random values\\n \";\n@@ -2129,15 +2130,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":503 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":503 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":504 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":504 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n- Py_INCREF(__pyx_k69p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);\n+ Py_INCREF(__pyx_k70p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2148,7 +2149,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":505 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":505 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2168,11 +2169,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k70p;\n static PyObject *__pyx_k71p;\n+static PyObject *__pyx_k72p;\n \n-static char (__pyx_k70[]) = \"shape <= 0\";\n-static char (__pyx_k71[]) = \"scale <= 0\";\n+static char (__pyx_k71[]) = \"shape <= 0\";\n+static char (__pyx_k72[]) = \"scale <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_gamma[] = \"Gamma distribution.\\n\\n gamma(shape, scale=1.0, size=None) -> random values\\n \";\n@@ -2192,15 +2193,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyO\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":512 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":512 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":513 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":513 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n- Py_INCREF(__pyx_k70p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);\n+ Py_INCREF(__pyx_k71p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2212,11 +2213,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyO\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":515 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":515 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n- Py_INCREF(__pyx_k71p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);\n+ Py_INCREF(__pyx_k72p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2227,7 +2228,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyO\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":516 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":516 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_shape,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2247,11 +2248,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyO\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k72p;\n static PyObject *__pyx_k73p;\n+static PyObject *__pyx_k74p;\n \n-static char (__pyx_k72[]) = \"dfnum <= 0\";\n-static char (__pyx_k73[]) = \"dfden <= 0\";\n+static char (__pyx_k73[]) = \"dfnum <= 0\";\n+static char (__pyx_k74[]) = \"dfden <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_f[] = \"F distribution.\\n\\n f(dfnum, dfden, size=None) -> random values\\n \";\n@@ -2270,15 +2271,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObjec\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":523 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":523 */\n __pyx_1 = (__pyx_v_dfnum <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":524 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":524 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n- Py_INCREF(__pyx_k72p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);\n+ Py_INCREF(__pyx_k73p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2290,11 +2291,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObjec\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":526 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":526 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n- Py_INCREF(__pyx_k73p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);\n+ Py_INCREF(__pyx_k74p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2305,7 +2306,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObjec\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":527 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":527 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2325,13 +2326,13 @@ static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObjec\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k74p;\n static PyObject *__pyx_k75p;\n static PyObject *__pyx_k76p;\n+static PyObject *__pyx_k77p;\n \n-static char (__pyx_k74[]) = \"dfnum <= 1\";\n-static char (__pyx_k75[]) = \"dfden <= 0\";\n-static char (__pyx_k76[]) = \"nonc < 0\";\n+static char (__pyx_k75[]) = \"dfnum <= 1\";\n+static char (__pyx_k76[]) = \"dfden <= 0\";\n+static char (__pyx_k77[]) = \"nonc < 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_noncentral_f[] = \"Noncentral F distribution.\\n\\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\\n \";\n@@ -2351,15 +2352,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_se\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":534 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":534 */\n __pyx_1 = (__pyx_v_dfnum <= 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":535 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":535 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n- Py_INCREF(__pyx_k74p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);\n+ Py_INCREF(__pyx_k75p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2371,11 +2372,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_se\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":537 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":537 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n- Py_INCREF(__pyx_k75p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);\n+ Py_INCREF(__pyx_k76p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2387,11 +2388,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_se\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":539 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":539 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n- Py_INCREF(__pyx_k76p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);\n+ Py_INCREF(__pyx_k77p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2402,7 +2403,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_se\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":540 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":540 */\n __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2422,9 +2423,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_se\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k77p;\n+static PyObject *__pyx_k78p;\n \n-static char (__pyx_k77[]) = \"df <= 0\";\n+static char (__pyx_k78[]) = \"df <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_chisquare[] = \"Chi^2 distribution.\\n\\n chisquare(df, size=None) -> random values\\n \";\n@@ -2442,15 +2443,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":548 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":548 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":549 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":549 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n- Py_INCREF(__pyx_k77p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);\n+ Py_INCREF(__pyx_k78p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2461,7 +2462,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self,\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":550 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":550 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2481,11 +2482,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k78p;\n static PyObject *__pyx_k79p;\n+static PyObject *__pyx_k80p;\n \n-static char (__pyx_k78[]) = \"df <= 1\";\n-static char (__pyx_k79[]) = \"nonc < 0\";\n+static char (__pyx_k79[]) = \"df <= 1\";\n+static char (__pyx_k80[]) = \"nonc < 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_noncentral_chisquare[] = \"Noncentral Chi^2 distribution.\\n\\n noncentral_chisquare(df, nonc, size=None) -> random values\\n \";\n@@ -2504,15 +2505,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":557 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":557 */\n __pyx_1 = (__pyx_v_df <= 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":558 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":558 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n- Py_INCREF(__pyx_k78p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);\n+ Py_INCREF(__pyx_k79p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2524,11 +2525,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":560 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":560 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n- Py_INCREF(__pyx_k79p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);\n+ Py_INCREF(__pyx_k80p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2539,7 +2540,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":561 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":561 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_df,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2571,7 +2572,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":569 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":569 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n@@ -2589,9 +2590,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k80p;\n+static PyObject *__pyx_k81p;\n \n-static char (__pyx_k80[]) = \"df <= 0\";\n+static char (__pyx_k81[]) = \"df <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_standard_t[] = \"Standard Student\\'s t distribution with df degrees of freedom.\\n\\n standard_t(df, size=None)\\n \";\n@@ -2609,15 +2610,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":576 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":576 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":577 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":577 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n- Py_INCREF(__pyx_k80p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);\n+ Py_INCREF(__pyx_k81p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2628,7 +2629,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":578 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":578 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2648,9 +2649,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k81p;\n+static PyObject *__pyx_k82p;\n \n-static char (__pyx_k81[]) = \"kappa < 0\";\n+static char (__pyx_k82[]) = \"kappa < 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_vonmises[] = \"von Mises circular distribution with mode mu and dispersion parameter\\n kappa on [-pi, pi].\\n\\n vonmises(mu, kappa, size=None)\\n \";\n@@ -2669,15 +2670,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":586 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":586 */\n __pyx_1 = (__pyx_v_kappa < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":587 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":587 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n- Py_INCREF(__pyx_k81p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);\n+ Py_INCREF(__pyx_k82p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2688,7 +2689,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":588 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":588 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_mu,__pyx_v_kappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2708,9 +2709,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k82p;\n+static PyObject *__pyx_k83p;\n \n-static char (__pyx_k82[]) = \"a <= 0\";\n+static char (__pyx_k83[]) = \"a <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_pareto[] = \"Pareto distribution.\\n\\n pareto(a, size=None)\\n \";\n@@ -2728,15 +2729,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, Py\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":595 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":595 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":596 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":596 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n- Py_INCREF(__pyx_k82p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);\n+ Py_INCREF(__pyx_k83p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2747,7 +2748,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, Py\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":597 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":597 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2767,9 +2768,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, Py\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k83p;\n+static PyObject *__pyx_k84p;\n \n-static char (__pyx_k83[]) = \"a <= 0\";\n+static char (__pyx_k84[]) = \"a <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_weibull[] = \"Weibull distribution.\\n\\n weibull(a, size=None)\\n \";\n@@ -2787,15 +2788,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":604 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":604 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":605 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":605 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n- Py_INCREF(__pyx_k83p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);\n+ Py_INCREF(__pyx_k84p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2806,7 +2807,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, P\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":606 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":606 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2826,9 +2827,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, P\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k84p;\n+static PyObject *__pyx_k85p;\n \n-static char (__pyx_k84[]) = \"a <= 0\";\n+static char (__pyx_k85[]) = \"a <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_power[] = \"Power distribution.\\n\\n power(a, size=None)\\n \";\n@@ -2846,15 +2847,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyO\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":613 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":613 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":614 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":614 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n- Py_INCREF(__pyx_k84p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);\n+ Py_INCREF(__pyx_k85p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2865,7 +2866,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyO\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":615 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":615 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2885,9 +2886,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyO\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k85p;\n+static PyObject *__pyx_k86p;\n \n-static char (__pyx_k85[]) = \"scale <= 0.0\";\n+static char (__pyx_k86[]) = \"scale <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_laplace[] = \"Laplace distribution.\\n \\n laplace(loc=0.0, scale=1.0, size=None)\\n \";\n@@ -2908,15 +2909,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":622 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":622 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":623 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":623 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n- Py_INCREF(__pyx_k85p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);\n+ Py_INCREF(__pyx_k86p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2927,7 +2928,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, P\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":624 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":624 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -2947,9 +2948,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, P\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k86p;\n+static PyObject *__pyx_k87p;\n \n-static char (__pyx_k86[]) = \"scale <= 0.0\";\n+static char (__pyx_k87[]) = \"scale <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_gumbel[] = \"Gumbel distribution.\\n \\n gumbel(loc=0.0, scale=1.0, size=None)\\n \";\n@@ -2970,15 +2971,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, Py\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":631 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":631 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":632 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":632 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n- Py_INCREF(__pyx_k86p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);\n+ Py_INCREF(__pyx_k87p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -2989,7 +2990,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, Py\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":633 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":633 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3009,9 +3010,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, Py\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k87p;\n+static PyObject *__pyx_k88p;\n \n-static char (__pyx_k87[]) = \"scale <= 0.0\";\n+static char (__pyx_k88[]) = \"scale <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_logistic[] = \"Logistic distribution.\\n \\n logistic(loc=0.0, scale=1.0, size=None)\\n \";\n@@ -3032,15 +3033,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":640 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":640 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":641 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":641 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n- Py_INCREF(__pyx_k87p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);\n+ Py_INCREF(__pyx_k88p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3051,7 +3052,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":642 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":642 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3071,9 +3072,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k88p;\n+static PyObject *__pyx_k89p;\n \n-static char (__pyx_k88[]) = \"sigma <= 0.0\";\n+static char (__pyx_k89[]) = \"sigma <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_lognormal[] = \"Log-normal distribution.\\n \\n Note that the mean parameter is not the mean of this distribution, but \\n the underlying normal distribution.\\n \\n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\\n \\n lognormal(mean=0.0, sigma=1.0, size=None)\\n \";\n@@ -3094,15 +3095,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self,\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":654 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":654 */\n __pyx_1 = (__pyx_v_sigma <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":655 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":655 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n- Py_INCREF(__pyx_k88p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);\n+ Py_INCREF(__pyx_k89p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3113,7 +3114,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self,\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":656 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":656 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_mean,__pyx_v_sigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3133,35 +3134,36 @@ static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k89p;\n+static PyObject *__pyx_k90p;\n \n-static char (__pyx_k89[]) = \"mode <= 0.0\";\n+static char (__pyx_k90[]) = \"scale <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n-static char __pyx_doc_6mtrand_11RandomState_rayleigh[] = \"Rayleigh distribution.\\n \\n rayleigh(mode, size=None)\\n \";\n+static char __pyx_doc_6mtrand_11RandomState_rayleigh[] = \"Rayleigh distribution.\\n \\n rayleigh(scale=1.0, size=None)\\n \";\n static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n- double __pyx_v_mode;\n+ double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n- static char *__pyx_argnames[] = {\"mode\",\"size\",0};\n- __pyx_v_size = __pyx_k46;\n- if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_mode, &__pyx_v_size)) return 0;\n+ static char *__pyx_argnames[] = {\"scale\",\"size\",0};\n+ __pyx_v_scale = __pyx_k46;\n+ __pyx_v_size = __pyx_k47;\n+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":663 */\n- __pyx_1 = (__pyx_v_mode <= 0.0);\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":663 */\n+ __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":664 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":664 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n- Py_INCREF(__pyx_k89p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);\n+ Py_INCREF(__pyx_k90p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3172,8 +3174,8 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":665 */\n- __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_mode); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":665 */\n+ __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n@@ -3192,11 +3194,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k90p;\n static PyObject *__pyx_k91p;\n+static PyObject *__pyx_k92p;\n \n-static char (__pyx_k90[]) = \"mean <= 0.0\";\n-static char (__pyx_k91[]) = \"scale <= 0.0\";\n+static char (__pyx_k91[]) = \"mean <= 0.0\";\n+static char (__pyx_k92[]) = \"scale <= 0.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_wald[] = \"Wald (inverse Gaussian) distribution.\\n \\n wald(mean, scale, size=None)\\n \";\n@@ -3210,20 +3212,20 @@ static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyOb\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"scale\",\"size\",0};\n- __pyx_v_size = __pyx_k47;\n+ __pyx_v_size = __pyx_k48;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":672 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":672 */\n __pyx_1 = (__pyx_v_mean <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":673 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":673 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n- Py_INCREF(__pyx_k90p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);\n+ Py_INCREF(__pyx_k91p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3235,11 +3237,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyOb\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":675 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":675 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n- Py_INCREF(__pyx_k91p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);\n+ Py_INCREF(__pyx_k92p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3250,7 +3252,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyOb\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":676 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":676 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_mean,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3270,13 +3272,13 @@ static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyOb\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k92p;\n static PyObject *__pyx_k93p;\n static PyObject *__pyx_k94p;\n+static PyObject *__pyx_k95p;\n \n-static char (__pyx_k92[]) = \"left > mode\";\n-static char (__pyx_k93[]) = \"mode > right\";\n-static char (__pyx_k94[]) = \"left == right\";\n+static char (__pyx_k93[]) = \"left > mode\";\n+static char (__pyx_k94[]) = \"mode > right\";\n+static char (__pyx_k95[]) = \"left == right\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_triangular[] = \"Triangular distribution starting at left, peaking at mode, and \\n ending at right (left <= mode <= right).\\n \\n triangular(left, mode, right, size=None)\\n \";\n@@ -3291,20 +3293,20 @@ static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"left\",\"mode\",\"right\",\"size\",0};\n- __pyx_v_size = __pyx_k48;\n+ __pyx_v_size = __pyx_k49;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ddd|O\", __pyx_argnames, &__pyx_v_left, &__pyx_v_mode, &__pyx_v_right, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":684 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":684 */\n __pyx_1 = (__pyx_v_left > __pyx_v_mode);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":685 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":685 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n- Py_INCREF(__pyx_k92p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);\n+ Py_INCREF(__pyx_k93p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3316,11 +3318,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self\n __pyx_1 = (__pyx_v_mode > __pyx_v_right);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":687 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":687 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n- Py_INCREF(__pyx_k93p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);\n+ Py_INCREF(__pyx_k94p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3332,11 +3334,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self\n __pyx_1 = (__pyx_v_left == __pyx_v_right);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":689 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":689 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n- Py_INCREF(__pyx_k94p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);\n+ Py_INCREF(__pyx_k95p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3347,7 +3349,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":690 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":690 */\n __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_left,__pyx_v_mode,__pyx_v_right); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3367,13 +3369,13 @@ static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k95p;\n static PyObject *__pyx_k96p;\n static PyObject *__pyx_k97p;\n+static PyObject *__pyx_k98p;\n \n-static char (__pyx_k95[]) = \"n <= 0\";\n-static char (__pyx_k96[]) = \"p < 0\";\n-static char (__pyx_k97[]) = \"p > 1\";\n+static char (__pyx_k96[]) = \"n <= 0\";\n+static char (__pyx_k97[]) = \"p < 0\";\n+static char (__pyx_k98[]) = \"p > 1\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_binomial[] = \"Binomial distribution of n trials and p probability of success.\\n\\n binomial(n, p, size=None) -> random values\\n \";\n@@ -3387,20 +3389,20 @@ static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"n\",\"p\",\"size\",0};\n- __pyx_v_size = __pyx_k49;\n+ __pyx_v_size = __pyx_k50;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ld|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":699 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":699 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":700 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":700 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n- Py_INCREF(__pyx_k95p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);\n+ Py_INCREF(__pyx_k96p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3412,11 +3414,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":702 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":702 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n- Py_INCREF(__pyx_k96p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);\n+ Py_INCREF(__pyx_k97p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3428,11 +3430,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":704 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":704 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n- Py_INCREF(__pyx_k97p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);\n+ Py_INCREF(__pyx_k98p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3443,7 +3445,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":705 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":705 */\n __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3463,13 +3465,13 @@ static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k98p;\n static PyObject *__pyx_k99p;\n static PyObject *__pyx_k100p;\n+static PyObject *__pyx_k101p;\n \n-static char (__pyx_k98[]) = \"n <= 0\";\n-static char (__pyx_k99[]) = \"p < 0\";\n-static char (__pyx_k100[]) = \"p > 1\";\n+static char (__pyx_k99[]) = \"n <= 0\";\n+static char (__pyx_k100[]) = \"p < 0\";\n+static char (__pyx_k101[]) = \"p > 1\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_negative_binomial[] = \"Negative Binomial distribution.\\n\\n negative_binomial(n, p, size=None) -> random values\\n \";\n@@ -3483,20 +3485,20 @@ static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"n\",\"p\",\"size\",0};\n- __pyx_v_size = __pyx_k50;\n+ __pyx_v_size = __pyx_k51;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ld|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":712 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":712 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":713 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":713 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n- Py_INCREF(__pyx_k98p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);\n+ Py_INCREF(__pyx_k99p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3508,11 +3510,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":715 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":715 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n- Py_INCREF(__pyx_k99p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);\n+ Py_INCREF(__pyx_k100p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3524,11 +3526,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":717 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":717 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n- Py_INCREF(__pyx_k100p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);\n+ Py_INCREF(__pyx_k101p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3539,7 +3541,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":718 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":718 */\n __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3559,9 +3561,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k101p;\n+static PyObject *__pyx_k102p;\n \n-static char (__pyx_k101[]) = \"lam <= 0\";\n+static char (__pyx_k102[]) = \"lam <= 0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_poisson[] = \"Poisson distribution.\\n\\n poisson(lam=1.0, size=None) -> random values\\n \";\n@@ -3574,21 +3576,21 @@ static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, P\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"lam\",\"size\",0};\n- __pyx_v_lam = __pyx_k51;\n- __pyx_v_size = __pyx_k52;\n+ __pyx_v_lam = __pyx_k52;\n+ __pyx_v_size = __pyx_k53;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_lam, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":726 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":726 */\n __pyx_1 = (__pyx_v_lam <= 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":727 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":727 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n- Py_INCREF(__pyx_k101p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);\n+ Py_INCREF(__pyx_k102p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3599,7 +3601,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, P\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":728 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":728 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_lam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3619,9 +3621,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, P\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k102p;\n+static PyObject *__pyx_k103p;\n \n-static char (__pyx_k102[]) = \"a <= 1.0\";\n+static char (__pyx_k103[]) = \"a <= 1.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_zipf[] = \"Zipf distribution.\\n \\n zipf(a, size=None)\\n \";\n@@ -3634,20 +3636,20 @@ static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyOb\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n- __pyx_v_size = __pyx_k53;\n+ __pyx_v_size = __pyx_k54;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":735 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":735 */\n __pyx_1 = (__pyx_v_a <= 1.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":736 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":736 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n- Py_INCREF(__pyx_k102p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);\n+ Py_INCREF(__pyx_k103p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3658,7 +3660,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyOb\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":737 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":737 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3678,11 +3680,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyOb\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k103p;\n static PyObject *__pyx_k104p;\n+static PyObject *__pyx_k105p;\n \n-static char (__pyx_k103[]) = \"p < 0.0\";\n-static char (__pyx_k104[]) = \"p > 1.0\";\n+static char (__pyx_k104[]) = \"p < 0.0\";\n+static char (__pyx_k105[]) = \"p > 1.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_geometric[] = \"Geometric distribution with p being the probability of \\\"success\\\" on\\n an individual trial.\\n \\n geometric(p, size=None)\\n \";\n@@ -3695,20 +3697,20 @@ static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self,\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"p\",\"size\",0};\n- __pyx_v_size = __pyx_k54;\n+ __pyx_v_size = __pyx_k55;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":745 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":745 */\n __pyx_1 = (__pyx_v_p < 0.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":746 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":746 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n- Py_INCREF(__pyx_k103p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);\n+ Py_INCREF(__pyx_k104p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3720,11 +3722,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self,\n __pyx_1 = (__pyx_v_p > 1.0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":748 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":748 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n- Py_INCREF(__pyx_k104p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);\n+ Py_INCREF(__pyx_k105p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3735,7 +3737,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self,\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":749 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":749 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3755,15 +3757,15 @@ static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self,\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k105p;\n static PyObject *__pyx_k106p;\n static PyObject *__pyx_k107p;\n static PyObject *__pyx_k108p;\n+static PyObject *__pyx_k109p;\n \n-static char (__pyx_k105[]) = \"ngood < 1\";\n-static char (__pyx_k106[]) = \"nbad < 1\";\n-static char (__pyx_k107[]) = \"ngood + nbad < nsample\";\n-static char (__pyx_k108[]) = \"nsample < 1\";\n+static char (__pyx_k106[]) = \"ngood < 1\";\n+static char (__pyx_k107[]) = \"nbad < 1\";\n+static char (__pyx_k108[]) = \"ngood + nbad < nsample\";\n+static char (__pyx_k109[]) = \"nsample < 1\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_hypergeometric[] = \"Hypergeometric distribution.\\n \\n Consider an urn with ngood \\\"good\\\" balls and nbad \\\"bad\\\" balls. If one \\n were to draw nsample balls from the urn without replacement, then \\n the hypergeometric distribution describes the distribution of \\\"good\\\" \\n balls in the sample.\\n \\n hypergeometric(ngood, nbad, nsample, size=None) \\n \";\n@@ -3778,20 +3780,20 @@ static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"ngood\",\"nbad\",\"nsample\",\"size\",0};\n- __pyx_v_size = __pyx_k55;\n+ __pyx_v_size = __pyx_k56;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lll|O\", __pyx_argnames, &__pyx_v_ngood, &__pyx_v_nbad, &__pyx_v_nsample, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":761 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":761 */\n __pyx_1 = (__pyx_v_ngood < 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":762 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":762 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n- Py_INCREF(__pyx_k105p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);\n+ Py_INCREF(__pyx_k106p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3803,11 +3805,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_\n __pyx_1 = (__pyx_v_nbad < 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":764 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":764 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n- Py_INCREF(__pyx_k106p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);\n+ Py_INCREF(__pyx_k107p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3819,11 +3821,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_\n __pyx_1 = ((__pyx_v_ngood + __pyx_v_nbad) < __pyx_v_nsample);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":766 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":766 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n- Py_INCREF(__pyx_k107p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);\n+ Py_INCREF(__pyx_k108p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k108p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3835,11 +3837,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_\n __pyx_1 = (__pyx_v_nsample < 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":768 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":768 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n- Py_INCREF(__pyx_k108p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k108p);\n+ Py_INCREF(__pyx_k109p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3850,7 +3852,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":769 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":769 */\n __pyx_2 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ngood,__pyx_v_nbad,__pyx_v_nsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3870,11 +3872,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_\n return __pyx_r;\n }\n \n-static PyObject *__pyx_k109p;\n static PyObject *__pyx_k110p;\n+static PyObject *__pyx_k111p;\n \n-static char (__pyx_k109[]) = \"p < 0\";\n-static char (__pyx_k110[]) = \"p > 1\";\n+static char (__pyx_k110[]) = \"p < 0\";\n+static char (__pyx_k111[]) = \"p > 1\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_logseries[] = \"Logarithmic series distribution.\\n \\n logseries(p, size=None)\\n \";\n@@ -3887,20 +3889,20 @@ static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self,\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"p\",\"size\",0};\n- __pyx_v_size = __pyx_k56;\n+ __pyx_v_size = __pyx_k57;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":777 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":777 */\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":778 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":778 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n- Py_INCREF(__pyx_k109p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p);\n+ Py_INCREF(__pyx_k110p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k110p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3912,11 +3914,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self,\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":780 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":780 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n- Py_INCREF(__pyx_k110p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k110p);\n+ Py_INCREF(__pyx_k111p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k111p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -3927,7 +3929,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self,\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":781 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":781 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n@@ -3962,13 +3964,13 @@ static PyObject *__pyx_n_sqrt;\n static PyObject *__pyx_n_add;\n static PyObject *__pyx_n_tuple;\n \n-static PyObject *__pyx_k111p;\n static PyObject *__pyx_k112p;\n static PyObject *__pyx_k113p;\n+static PyObject *__pyx_k114p;\n \n-static char (__pyx_k111[]) = \"mean must be 1 dimensional\";\n-static char (__pyx_k112[]) = \"cov must be 2 dimensional and square\";\n-static char (__pyx_k113[]) = \"mean and cov must have same length\";\n+static char (__pyx_k112[]) = \"mean must be 1 dimensional\";\n+static char (__pyx_k113[]) = \"cov must be 2 dimensional and square\";\n+static char (__pyx_k114[]) = \"mean and cov must have same length\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_multivariate_normal[] = \"Return an array containing multivariate normally distributed random numbers\\n with specified mean and covariance.\\n\\n multivariate_normal(mean, cov) -> random values\\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\\n\\n mean must be a 1 dimensional array. cov must be a square two dimensional\\n array with the same number of rows and columns as mean has elements.\\n\\n The first form returns a single 1-D array containing a multivariate\\n normal.\\n\\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\\n normal.\\n \";\n@@ -3989,7 +3991,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n int __pyx_4;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"cov\",\"size\",0};\n- __pyx_v_size = __pyx_k57;\n+ __pyx_v_size = __pyx_k58;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"OO|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_cov, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_mean);\n@@ -4002,7 +4004,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s);\n __pyx_v_v = Py_None; Py_INCREF(__pyx_v_v);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":802 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":802 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n@@ -4016,7 +4018,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n __pyx_v_mean = __pyx_3;\n __pyx_3 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":803 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":803 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -4030,11 +4032,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n __pyx_v_cov = __pyx_2;\n __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":804 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":804 */\n __pyx_4 = __pyx_v_size == Py_None;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":805 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":805 */\n __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_1;\n@@ -4043,14 +4045,14 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":807 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":807 */\n Py_INCREF(__pyx_v_size);\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_v_size;\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":808 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":808 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n@@ -4066,11 +4068,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":809 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":809 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n- Py_INCREF(__pyx_k111p);\n- PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k111p);\n+ Py_INCREF(__pyx_k112p);\n+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -4081,7 +4083,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n }\n __pyx_L3:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":810 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":810 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n@@ -4113,11 +4115,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n }\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":811 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":811 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n- Py_INCREF(__pyx_k112p);\n- PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);\n+ Py_INCREF(__pyx_k113p);\n+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k113p);\n __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -4128,7 +4130,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n }\n __pyx_L4:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":812 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":812 */\n __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n@@ -4145,11 +4147,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":813 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":813 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n- Py_INCREF(__pyx_k113p);\n- PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k113p);\n+ Py_INCREF(__pyx_k114p);\n+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k114p);\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n@@ -4160,7 +4162,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n }\n __pyx_L5:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":815 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":815 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n@@ -4175,7 +4177,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":816 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":816 */\n __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyList_SET_ITEM(__pyx_1, 0, __pyx_v_shape);\n@@ -4186,7 +4188,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n }\n __pyx_L6:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":817 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":817 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n@@ -4199,7 +4201,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n __pyx_v_final_shape = __pyx_1;\n __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":818 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":818 */\n __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n@@ -4214,7 +4216,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":822 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":822 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n@@ -4237,7 +4239,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n __pyx_v_x = __pyx_5;\n __pyx_5 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":823 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":823 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -4276,7 +4278,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":833 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":833 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_linalg); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -4303,7 +4305,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":834 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":834 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_matrixmultiply); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -4330,7 +4332,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n __pyx_v_x = __pyx_1;\n __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":837 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":837 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -4346,7 +4348,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":838 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":838 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n@@ -4357,7 +4359,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":839 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":839 */\n Py_INCREF(__pyx_v_x);\n __pyx_r = __pyx_v_x;\n goto __pyx_L0;\n@@ -4387,9 +4389,9 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__p\n \n static PyObject *__pyx_n_zeros;\n \n-static PyObject *__pyx_k114p;\n+static PyObject *__pyx_k115p;\n \n-static char (__pyx_k114[]) = \"sum(pvals) > 1.0\";\n+static char (__pyx_k115[]) = \"sum(pvals) > 1.0\";\n \n static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\n static char __pyx_doc_6mtrand_11RandomState_multinomial[] = \"Multinomial distribution.\\n \\n multinomial(n, pvals, size=None) -> random values\\n\\n pvals is a sequence of probabilities that should sum to 1 (however, the\\n last element is always assumed to account for the remaining probability\\n as long as sum(pvals[:-1]) <= 1).\\n \";\n@@ -4416,7 +4418,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n long __pyx_4;\n int __pyx_5;\n static char *__pyx_argnames[] = {\"n\",\"pvals\",\"size\",0};\n- __pyx_v_size = __pyx_k58;\n+ __pyx_v_size = __pyx_k59;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lO|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_pvals, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_pvals);\n@@ -4426,7 +4428,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape);\n __pyx_v_multin = Py_None; Py_INCREF(__pyx_v_multin);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":857 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":857 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_INCREF(__pyx_v_pvals);\n@@ -4438,24 +4440,24 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_v_d = __pyx_4;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":858 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":858 */\n __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_parr));\n __pyx_v_parr = __pyx_1;\n __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":859 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":859 */\n __pyx_v_pix = ((double (*))__pyx_v_parr->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":861 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":861 */\n __pyx_5 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix,(__pyx_v_d - 1)) > 1.0);\n if (__pyx_5) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":862 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":862 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n- Py_INCREF(__pyx_k114p);\n- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k114p);\n+ Py_INCREF(__pyx_k115p);\n+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k115p);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -4466,11 +4468,11 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":864 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":864 */\n __pyx_5 = __pyx_v_size == Py_None;\n if (__pyx_5) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":865 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":865 */\n __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n@@ -4493,7 +4495,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_5) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":867 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":867 */\n __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n@@ -4507,7 +4509,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":869 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":869 */\n __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);\n@@ -4520,7 +4522,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n }\n __pyx_L3:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":871 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":871 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n@@ -4539,71 +4541,71 @@ static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_sel\n __pyx_v_multin = __pyx_1;\n __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":872 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":872 */\n Py_INCREF(((PyObject *)__pyx_v_multin));\n Py_DECREF(((PyObject *)__pyx_v_mnarr));\n __pyx_v_mnarr = ((PyObject *)__pyx_v_multin);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":873 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":873 */\n __pyx_v_mnix = ((long (*))__pyx_v_mnarr->data);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":874 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":874 */\n __pyx_v_i = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":875 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":875 */\n while (1) {\n __pyx_L4:;\n __pyx_5 = (__pyx_v_i < PyArray_SIZE(__pyx_v_mnarr));\n if (!__pyx_5) break;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":876 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":876 */\n __pyx_v_Sum = 1.0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":877 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":877 */\n __pyx_v_dn = __pyx_v_n;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":878 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":878 */\n __pyx_4 = (__pyx_v_d - 1);\n for (__pyx_v_j = 0; __pyx_v_j < __pyx_4; ++__pyx_v_j) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":879 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":879 */\n (__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));\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":880 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":880 */\n __pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]));\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":881 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":881 */\n __pyx_5 = (__pyx_v_dn <= 0);\n if (__pyx_5) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":882 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":882 */\n goto __pyx_L7;\n goto __pyx_L8;\n }\n __pyx_L8:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":883 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":883 */\n __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j]));\n __pyx_L6:;\n }\n __pyx_L7:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":884 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":884 */\n __pyx_5 = (__pyx_v_dn > 0);\n if (__pyx_5) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":885 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":885 */\n (__pyx_v_mnix[((__pyx_v_i + __pyx_v_d) - 1)]) = __pyx_v_dn;\n goto __pyx_L9;\n }\n __pyx_L9:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":887 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":887 */\n __pyx_v_i = (__pyx_v_i + __pyx_v_d);\n }\n __pyx_L5:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":889 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":889 */\n Py_INCREF(__pyx_v_multin);\n __pyx_r = __pyx_v_multin;\n goto __pyx_L0;\n@@ -4644,7 +4646,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, P\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":900 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":900 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n@@ -4660,16 +4662,16 @@ static PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, P\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_v_i = __pyx_4;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":901 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":901 */\n while (1) {\n __pyx_L2:;\n __pyx_5 = (__pyx_v_i > 0);\n if (!__pyx_5) break;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":902 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":902 */\n __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":903 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":903 */\n __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -4685,7 +4687,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, P\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":904 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":904 */\n __pyx_v_i = (__pyx_v_i - 1);\n }\n __pyx_L3:;\n@@ -4722,7 +4724,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_sel\n Py_INCREF(__pyx_v_x);\n __pyx_v_arr = Py_None; Py_INCREF(__pyx_v_arr);\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":912 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":912 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n@@ -4736,7 +4738,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_sel\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":913 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":913 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_arange); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n@@ -4753,7 +4755,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_sel\n }\n /*else*/ {\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":915 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":915 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n@@ -4769,7 +4771,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_sel\n }\n __pyx_L2:;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":916 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":916 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_INCREF(__pyx_v_arr);\n@@ -4779,7 +4781,7 @@ static PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_sel\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":917 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":917 */\n Py_INCREF(__pyx_v_arr);\n __pyx_r = __pyx_v_arr;\n goto __pyx_L0;\n@@ -4879,10 +4881,9 @@ static __Pyx_InternTabEntry __pyx_intern_tab[] = {\n };\n \n static __Pyx_StringTabEntry __pyx_string_tab[] = {\n- {&__pyx_k61p, __pyx_k61, sizeof(__pyx_k61)},\n {&__pyx_k62p, __pyx_k62, sizeof(__pyx_k62)},\n {&__pyx_k63p, __pyx_k63, sizeof(__pyx_k63)},\n- {&__pyx_k65p, __pyx_k65, sizeof(__pyx_k65)},\n+ {&__pyx_k64p, __pyx_k64, sizeof(__pyx_k64)},\n {&__pyx_k66p, __pyx_k66, sizeof(__pyx_k66)},\n {&__pyx_k67p, __pyx_k67, sizeof(__pyx_k67)},\n {&__pyx_k68p, __pyx_k68, sizeof(__pyx_k68)},\n@@ -4932,6 +4933,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {\n {&__pyx_k112p, __pyx_k112, sizeof(__pyx_k112)},\n {&__pyx_k113p, __pyx_k113, sizeof(__pyx_k113)},\n {&__pyx_k114p, __pyx_k114, sizeof(__pyx_k114)},\n+ {&__pyx_k115p, __pyx_k115, sizeof(__pyx_k115)},\n {0, 0, 0}\n };\n \n@@ -5155,502 +5157,503 @@ DL_EXPORT(void) initmtrand(void) {\n if (PyObject_SetAttrString(__pyx_m, \"RandomState\", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}\n __pyx_ptype_6mtrand_RandomState = &__pyx_type_6mtrand_RandomState;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":114 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":114 */\n import_array();\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":116 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":116 */\n __pyx_1 = __Pyx_Import(__pyx_n_scipy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}\n if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":282 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":282 */\n Py_INCREF(Py_None);\n __pyx_k2 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":291 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":291 */\n Py_INCREF(Py_None);\n __pyx_k3 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":352 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":352 */\n Py_INCREF(Py_None);\n __pyx_k4 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":359 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":359 */\n Py_INCREF(Py_None);\n __pyx_k5 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":366 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":366 */\n Py_INCREF(Py_None);\n __pyx_k6 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k7 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":412 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":412 */\n __pyx_k8 = 0.0;\n __pyx_k9 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k10 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":442 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":442 */\n Py_INCREF(Py_None);\n __pyx_k11 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k12 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":455 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":455 */\n Py_INCREF(Py_None);\n __pyx_k13 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":462 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":462 */\n __pyx_k14 = 0.0;\n __pyx_k15 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k16 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":471 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":471 */\n Py_INCREF(Py_None);\n __pyx_k17 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":482 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":482 */\n __pyx_k18 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k19 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":491 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":491 */\n Py_INCREF(Py_None);\n __pyx_k20 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":498 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":498 */\n Py_INCREF(Py_None);\n __pyx_k21 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":507 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":507 */\n __pyx_k22 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k23 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":518 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":518 */\n Py_INCREF(Py_None);\n __pyx_k24 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":529 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":529 */\n Py_INCREF(Py_None);\n __pyx_k25 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":543 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":543 */\n Py_INCREF(Py_None);\n __pyx_k26 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":552 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":552 */\n Py_INCREF(Py_None);\n __pyx_k27 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":564 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":564 */\n Py_INCREF(Py_None);\n __pyx_k28 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":571 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":571 */\n Py_INCREF(Py_None);\n __pyx_k29 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":580 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":580 */\n Py_INCREF(Py_None);\n __pyx_k30 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":590 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":590 */\n Py_INCREF(Py_None);\n __pyx_k31 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":599 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":599 */\n Py_INCREF(Py_None);\n __pyx_k32 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":608 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":608 */\n Py_INCREF(Py_None);\n __pyx_k33 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":617 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":617 */\n __pyx_k34 = 0.0;\n __pyx_k35 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k36 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":626 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":626 */\n __pyx_k37 = 0.0;\n __pyx_k38 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k39 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":635 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":635 */\n __pyx_k40 = 0.0;\n __pyx_k41 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k42 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":644 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":644 */\n __pyx_k43 = 0.0;\n __pyx_k44 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k45 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":658 */\n- Py_INCREF(Py_None);\n- __pyx_k46 = Py_None;\n-\n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":667 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":658 */\n+ __pyx_k46 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k47 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":678 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":667 */\n Py_INCREF(Py_None);\n __pyx_k48 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":694 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":678 */\n Py_INCREF(Py_None);\n __pyx_k49 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":707 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":694 */\n Py_INCREF(Py_None);\n __pyx_k50 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":721 */\n- __pyx_k51 = 1.0;\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":707 */\n Py_INCREF(Py_None);\n- __pyx_k52 = Py_None;\n+ __pyx_k51 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":730 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":721 */\n+ __pyx_k52 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k53 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":739 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":730 */\n Py_INCREF(Py_None);\n __pyx_k54 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":751 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":739 */\n Py_INCREF(Py_None);\n __pyx_k55 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":772 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":751 */\n Py_INCREF(Py_None);\n __pyx_k56 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":784 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":772 */\n Py_INCREF(Py_None);\n __pyx_k57 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":841 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":784 */\n Py_INCREF(Py_None);\n __pyx_k58 = Py_None;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":919 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":841 */\n+ Py_INCREF(Py_None);\n+ __pyx_k59 = Py_None;\n+\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":919 */\n __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":920 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":920 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_get_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":921 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":921 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_set_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":922 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":922 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":923 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":923 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":924 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":924 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_bytes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":925 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":925 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_uniform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":926 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":926 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rand); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":927 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":927 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randn); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":928 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":928 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_integers); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":929 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":929 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":930 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":930 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":931 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":931 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_beta); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":932 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":932 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":933 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":933 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":934 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":934 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":935 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":935 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":936 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":936 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":937 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":937 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":938 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":938 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":939 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":939 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":940 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":940 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_cauchy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":941 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":941 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":942 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":942 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_vonmises); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":943 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":943 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_pareto); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":944 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":944 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_weibull); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":945 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":945 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_power); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":946 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":946 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_laplace); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":947 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":947 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gumbel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":948 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":948 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logistic); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":949 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":949 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lognormal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":950 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":950 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rayleigh); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":951 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":951 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_wald); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":952 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":952 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_triangular); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":954 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":954 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":955 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":955 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_negative_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":956 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":956 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_poisson); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":957 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":957 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zipf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":958 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":958 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_geometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":959 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":959 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_hypergeometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":960 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":960 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logseries); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_logseries, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":962 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":962 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multivariate_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":963 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":963 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multinomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":965 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":965 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n \n- /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":966 */\n+ /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":966 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_permutation); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n", "added_lines": 604, "deleted_lines": 601, "source_code": "/* Generated by Pyrex 0.9.3.1 on Sat Oct 8 00:19:00 2005 */\n\n#include \"Python.h\"\n#include \"structmember.h\"\n#ifndef PY_LONG_LONG\n #define PY_LONG_LONG LONG_LONG\n#endif\n#include \"string.h\"\n#include \"math.h\"\n#include \"scipy/arrayobject.h\"\n#include \"randomkit.h\"\n#include \"distributions.h\"\n#include \"initarray.h\"\n\n\ntypedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/\ntypedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/\nstatic PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/\nstatic int __Pyx_EndUnpack(PyObject *, int); /*proto*/\nstatic int __Pyx_PrintItem(PyObject *); /*proto*/\nstatic int __Pyx_PrintNewline(void); /*proto*/\nstatic void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/\nstatic void __Pyx_ReRaise(void); /*proto*/\nstatic PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/\nstatic PyObject *__Pyx_GetExcValue(void); /*proto*/\nstatic int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/\nstatic int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/\nstatic int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/\nstatic void __Pyx_WriteUnraisable(char *name); /*proto*/\nstatic void __Pyx_AddTraceback(char *funcname); /*proto*/\nstatic PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/\nstatic int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/\nstatic int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/\nstatic PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/\nstatic int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/\nstatic int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/\nstatic PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/\n\nstatic PyObject *__pyx_m;\nstatic PyObject *__pyx_b;\nstatic int __pyx_lineno;\nstatic char *__pyx_filename;\nstaticforward char **__pyx_f;\n\n/* Declarations from mtrand */\n\nstaticforward PyTypeObject __pyx_type_6mtrand_RandomState;\n\nstruct __pyx_obj_6mtrand_RandomState {\n PyObject_HEAD\n rk_state (*internal_state);\n};\n\nstatic PyTypeObject *__pyx_ptype_6mtrand_ArrayType = 0;\nstatic PyTypeObject *__pyx_ptype_6mtrand_RandomState = 0;\nstatic PyObject *__pyx_k2;\nstatic PyObject *__pyx_k3;\nstatic PyObject *__pyx_k4;\nstatic PyObject *__pyx_k5;\nstatic PyObject *__pyx_k6;\nstatic PyObject *__pyx_k7;\nstatic double __pyx_k8;\nstatic double __pyx_k9;\nstatic PyObject *__pyx_k10;\nstatic PyObject *__pyx_k11;\nstatic PyObject *__pyx_k12;\nstatic PyObject *__pyx_k13;\nstatic double __pyx_k14;\nstatic double __pyx_k15;\nstatic PyObject *__pyx_k16;\nstatic PyObject *__pyx_k17;\nstatic double __pyx_k18;\nstatic PyObject *__pyx_k19;\nstatic PyObject *__pyx_k20;\nstatic PyObject *__pyx_k21;\nstatic double __pyx_k22;\nstatic PyObject *__pyx_k23;\nstatic PyObject *__pyx_k24;\nstatic PyObject *__pyx_k25;\nstatic PyObject *__pyx_k26;\nstatic PyObject *__pyx_k27;\nstatic PyObject *__pyx_k28;\nstatic PyObject *__pyx_k29;\nstatic PyObject *__pyx_k30;\nstatic PyObject *__pyx_k31;\nstatic PyObject *__pyx_k32;\nstatic PyObject *__pyx_k33;\nstatic double __pyx_k34;\nstatic double __pyx_k35;\nstatic PyObject *__pyx_k36;\nstatic double __pyx_k37;\nstatic double __pyx_k38;\nstatic PyObject *__pyx_k39;\nstatic double __pyx_k40;\nstatic double __pyx_k41;\nstatic PyObject *__pyx_k42;\nstatic double __pyx_k43;\nstatic double __pyx_k44;\nstatic PyObject *__pyx_k45;\nstatic double __pyx_k46;\nstatic PyObject *__pyx_k47;\nstatic PyObject *__pyx_k48;\nstatic PyObject *__pyx_k49;\nstatic PyObject *__pyx_k50;\nstatic PyObject *__pyx_k51;\nstatic double __pyx_k52;\nstatic PyObject *__pyx_k53;\nstatic PyObject *__pyx_k54;\nstatic PyObject *__pyx_k55;\nstatic PyObject *__pyx_k56;\nstatic PyObject *__pyx_k57;\nstatic PyObject *__pyx_k58;\nstatic PyObject *__pyx_k59;\nstatic PyObject *(__pyx_f_6mtrand_cont0_array(rk_state (*),double ((*)(rk_state (*))),PyObject *)); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont1_array(rk_state (*),double ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont2_array(rk_state (*),double ((*)(rk_state (*),double ,double )),PyObject *,double ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont3_array(rk_state (*),double ((*)(rk_state (*),double ,double ,double )),PyObject *,double ,double ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_disc0_array(rk_state (*),long ((*)(rk_state (*))),PyObject *)); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discnp_array(rk_state (*),long ((*)(rk_state (*),long ,double )),PyObject *,long ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discnmN_array(rk_state (*),long ((*)(rk_state (*),long ,long ,long )),PyObject *,long ,long ,long )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discd_array(rk_state (*),long ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/\nstatic double (__pyx_f_6mtrand_kahan_sum(double (*),long )); /*proto*/\n\n/* Implementation of mtrand */\n\n\nstatic PyObject *__pyx_n__sp;\nstatic PyObject *__pyx_n__rand;\nstatic PyObject *__pyx_n_get_state;\nstatic PyObject *__pyx_n_set_state;\nstatic PyObject *__pyx_n_random_sample;\nstatic PyObject *__pyx_n_randint;\nstatic PyObject *__pyx_n_bytes;\nstatic PyObject *__pyx_n_uniform;\nstatic PyObject *__pyx_n_rand;\nstatic PyObject *__pyx_n_randn;\nstatic PyObject *__pyx_n_random_integers;\nstatic PyObject *__pyx_n_standard_normal;\nstatic PyObject *__pyx_n_normal;\nstatic PyObject *__pyx_n_beta;\nstatic PyObject *__pyx_n_exponential;\nstatic PyObject *__pyx_n_standard_exponential;\nstatic PyObject *__pyx_n_standard_gamma;\nstatic PyObject *__pyx_n_gamma;\nstatic PyObject *__pyx_n_f;\nstatic PyObject *__pyx_n_noncentral_f;\nstatic PyObject *__pyx_n_chisquare;\nstatic PyObject *__pyx_n_noncentral_chisquare;\nstatic PyObject *__pyx_n_standard_cauchy;\nstatic PyObject *__pyx_n_standard_t;\nstatic PyObject *__pyx_n_vonmises;\nstatic PyObject *__pyx_n_pareto;\nstatic PyObject *__pyx_n_weibull;\nstatic PyObject *__pyx_n_power;\nstatic PyObject *__pyx_n_laplace;\nstatic PyObject *__pyx_n_gumbel;\nstatic PyObject *__pyx_n_logistic;\nstatic PyObject *__pyx_n_lognormal;\nstatic PyObject *__pyx_n_rayleigh;\nstatic PyObject *__pyx_n_wald;\nstatic PyObject *__pyx_n_triangular;\nstatic PyObject *__pyx_n_binomial;\nstatic PyObject *__pyx_n_negative_binomial;\nstatic PyObject *__pyx_n_poisson;\nstatic PyObject *__pyx_n_zipf;\nstatic PyObject *__pyx_n_geometric;\nstatic PyObject *__pyx_n_hypergeometric;\nstatic PyObject *__pyx_n_logseries;\nstatic PyObject *__pyx_n_multivariate_normal;\nstatic PyObject *__pyx_n_multinomial;\nstatic PyObject *__pyx_n_shuffle;\nstatic PyObject *__pyx_n_permutation;\nstatic PyObject *__pyx_n_scipy;\n\nstatic PyObject *__pyx_n_empty;\nstatic PyObject *__pyx_n_Float64;\n\nstatic PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":124 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":125 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":127 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":128 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":129 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":130 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":131 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":132 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont0_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":140 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":141 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":143 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":144 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":145 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":146 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":147 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":148 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont1_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":157 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":158 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":160 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":161 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":162 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":163 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":164 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":165 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont2_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b,double __pyx_v_c) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":175 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":176 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":178 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":179 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":180 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":181 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":182 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":183 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont3_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_Int;\n\nstatic PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":191 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":192 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":194 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":195 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":196 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":197 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":198 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":199 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.disc0_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,double )),PyObject *__pyx_v_size,long __pyx_v_n,double __pyx_v_p) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":207 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":208 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":210 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":211 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":212 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":213 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":214 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":215 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discnp_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,long ,long )),PyObject *__pyx_v_size,long __pyx_v_n,long __pyx_v_m,long __pyx_v_N) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":224 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":225 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":227 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":228 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":229 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":230 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":231 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":232 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discnmN_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":240 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":241 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":243 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":244 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":245 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":246 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":247 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":248 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discd_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic double __pyx_f_6mtrand_kahan_sum(double (*__pyx_v_darr),long __pyx_v_n) {\n double __pyx_v_c;\n double __pyx_v_y;\n double __pyx_v_t;\n double __pyx_v_sum;\n long __pyx_v_i;\n double __pyx_r;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":253 */\n __pyx_v_sum = (__pyx_v_darr[0]);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":254 */\n __pyx_v_c = 0.0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":255 */\n for (__pyx_v_i = 1; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":256 */\n __pyx_v_y = ((__pyx_v_darr[__pyx_v_i]) - __pyx_v_c);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":257 */\n __pyx_v_t = (__pyx_v_sum + __pyx_v_y);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":258 */\n __pyx_v_c = ((__pyx_v_t - __pyx_v_sum) - __pyx_v_y);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":259 */\n __pyx_v_sum = __pyx_v_t;\n __pyx_L2:;\n }\n __pyx_L3:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":260 */\n __pyx_r = __pyx_v_sum;\n goto __pyx_L0;\n\n __pyx_r = 0;\n goto __pyx_L0;\n __pyx_L1:;\n __Pyx_WriteUnraisable(\"mtrand.kahan_sum\");\n __pyx_L0:;\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_seed;\n\nstatic int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_seed = 0;\n int __pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {\"seed\",0};\n __pyx_v_seed = __pyx_k2;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_seed)) return -1;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_seed);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":283 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state (*))PyMem_Malloc((sizeof(rk_state ))));\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":285 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_seed);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n __pyx_r = 0;\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__init__\");\n __pyx_r = -1;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_seed);\n return __pyx_r;\n}\n\nstatic void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self); /*proto*/\nstatic void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {\n int __pyx_1;\n Py_INCREF(__pyx_v_self);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":288 */\n __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":289 */\n PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n goto __pyx_L0;\n __pyx_L1:;\n __Pyx_AddTraceback(\"mtrand.RandomState.__dealloc__\");\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n}\n\nstatic PyObject *__pyx_n_type;\nstatic PyObject *__pyx_n_int;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_seed[] = \"Seed the generator.\\n\\n seed(seed=None)\\n\\n seed can be an integer, an array (or other sequence) of integers of any\\n length, or None. If seed is None, then RandomState will try to read data\\n from /dev/urandom (or the Windows analogue) if available or seed from\\n the clock otherwise.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_seed = 0;\n rk_error __pyx_v_errcode;\n PyArrayObject *__pyx_v_obj;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n unsigned long __pyx_5;\n static char *__pyx_argnames[] = {\"seed\",0};\n __pyx_v_seed = __pyx_k3;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_seed)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_seed);\n __pyx_v_obj = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_obj);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":303 */\n __pyx_1 = __pyx_v_seed == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":304 */\n __pyx_v_errcode = rk_randomseed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_seed);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n __pyx_1 = __pyx_4 == __pyx_2;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":306 */\n __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; goto __pyx_L1;}\n rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":308 */\n __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_3;\n __pyx_3 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":309 */\n init_by_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,((unsigned long (*))__pyx_v_obj->data),(__pyx_v_obj->dimensions[0]));\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.seed\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_obj);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_seed);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_MT19937;\n\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_get_state[] = \"Return a tuple representing the internal state of the generator.\\n\\n get_state() -> (\\'MT19937\\', int key[624], int pos)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyArrayObject *__pyx_v_state;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n __pyx_v_state = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_state);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":318 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n __pyx_1 = 0;\n __pyx_4 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_INCREF(((PyObject *)__pyx_1));\n Py_DECREF(((PyObject *)__pyx_v_state));\n __pyx_v_state = ((PyObject *)__pyx_1);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":319 */\n memcpy(((void (*))__pyx_v_state->data),((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,(624 * (sizeof(long ))));\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":320 */\n __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}\n Py_INCREF(__pyx_n_MT19937);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_n_MT19937);\n Py_INCREF(((PyObject *)__pyx_v_state));\n PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_state));\n PyTuple_SET_ITEM(__pyx_2, 2, __pyx_4);\n __pyx_4 = 0;\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.get_state\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_state);\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_ValueError;\n\nstatic PyObject *__pyx_k62p;\nstatic PyObject *__pyx_k63p;\n\nstatic char (__pyx_k62[]) = \"algorithm must be 'MT19937'\";\nstatic char (__pyx_k63[]) = \"state must be 624 longs\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_set_state[] = \"Set the state from a tuple.\\n \\n state = (\\'MT19937\\', int key[624], int pos)\\n \\n set_state(state)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_state = 0;\n PyArrayObject *__pyx_v_obj;\n int __pyx_v_pos;\n PyObject *__pyx_v_algorithm_name;\n PyObject *__pyx_v_key;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n int __pyx_3;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"state\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_state)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_state);\n __pyx_v_obj = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_obj);\n __pyx_v_algorithm_name = Py_None; Py_INCREF(__pyx_v_algorithm_name);\n __pyx_v_key = Py_None; Py_INCREF(__pyx_v_key);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":331 */\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_algorithm_name);\n __pyx_v_algorithm_name = __pyx_2;\n __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":332 */\n if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n __pyx_3 = __pyx_3 != 0;\n if (__pyx_3) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":333 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_INCREF(__pyx_k62p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k62p);\n __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":334 */\n __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_v_key);\n __pyx_v_key = __pyx_2;\n __pyx_2 = 0;\n __pyx_4 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n __pyx_3 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_v_pos = __pyx_3;\n if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":335 */\n __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_4;\n __pyx_4 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":336 */\n __pyx_3 = ((__pyx_v_obj->dimensions[0]) != 624);\n if (__pyx_3) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":337 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n Py_INCREF(__pyx_k63p);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k63p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":338 */\n memcpy(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,((void (*))__pyx_v_obj->data),(624 * (sizeof(long ))));\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":339 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.set_state\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_obj);\n Py_DECREF(__pyx_v_algorithm_name);\n Py_DECREF(__pyx_v_key);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_state);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":343 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__getstate__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_state = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {\"state\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_state)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_state);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":346 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n Py_INCREF(__pyx_v_state);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_state);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__setstate__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_state);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_random;\nstatic PyObject *__pyx_n___RandomState_ctor;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":349 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_5);\n __pyx_1 = 0;\n __pyx_2 = 0;\n __pyx_5 = 0;\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.__reduce__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_random_sample[] = \"Return random floats in the half-open interval [0.0, 1.0).\\n\\n random_sample(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k4;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":357 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.random_sample\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_tomaxint[] = \"Returns random integers x such that 0 <= x <= sys.maxint.\\n\\n tomaxint(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k5;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":364 */\n __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.tomaxint\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k64p;\n\nstatic char (__pyx_k64[]) = \"low >= high\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_randint[] = \"Return random integers x such that low <= x < high.\\n\\n randint(low, high=None, size=None) -> random values\\n\\n If high is None, then 0 <= x < low.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_low = 0;\n PyObject *__pyx_v_high = 0;\n PyObject *__pyx_v_size = 0;\n long __pyx_v_lo;\n long __pyx_v_hi;\n long __pyx_v_diff;\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n long __pyx_2;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_high = __pyx_k6;\n __pyx_v_size = __pyx_k7;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O|OO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_low);\n Py_INCREF(__pyx_v_high);\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":379 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":380 */\n __pyx_v_lo = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":381 */\n __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":383 */\n __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}\n __pyx_v_lo = __pyx_2;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":384 */\n __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":386 */\n __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":387 */\n __pyx_1 = (__pyx_v_diff < 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":388 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n Py_INCREF(__pyx_k64p);\n PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k64p);\n __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __Pyx_Raise(__pyx_5, 0, 0);\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":390 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":391 */\n __pyx_3 = PyLong_FromUnsignedLong(rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n goto __pyx_L4;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":393 */\n __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":394 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":395 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":396 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":397 */\n (__pyx_v_array_data[__pyx_v_i]) = (__pyx_v_lo + rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state));\n __pyx_L5:;\n }\n __pyx_L6:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":398 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L4:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.randint\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_bytes[] = \"Return random bytes.\\n\\n bytes(length) -> str\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n unsigned int __pyx_v_length;\n void (*__pyx_v_bytes);\n PyObject *__pyx_v_bytestring;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"length\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"i\", __pyx_argnames, &__pyx_v_length)) return 0;\n Py_INCREF(__pyx_v_self);\n __pyx_v_bytestring = Py_None; Py_INCREF(__pyx_v_bytestring);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":406 */\n __pyx_v_bytes = PyMem_Malloc(__pyx_v_length);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":407 */\n rk_fill(__pyx_v_bytes,__pyx_v_length,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":408 */\n __pyx_1 = PyString_FromString(((char (*))__pyx_v_bytes)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; goto __pyx_L1;}\n Py_DECREF(__pyx_v_bytestring);\n __pyx_v_bytestring = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":409 */\n PyMem_Free(__pyx_v_bytes);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":410 */\n Py_INCREF(__pyx_v_bytestring);\n __pyx_r = __pyx_v_bytestring;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.bytes\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_bytestring);\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_uniform[] = \"Uniform distribution over [low, high).\\n\\n uniform(low=0.0, high=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_low;\n double __pyx_v_high;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_low = __pyx_k8;\n __pyx_v_high = __pyx_k9;\n __pyx_v_size = __pyx_k10;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":417 */\n __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_low,(__pyx_v_high - __pyx_v_low)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.uniform\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_len;\nstatic PyObject *__pyx_n_size;\n\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_rand[] = \"Return an array of the given dimensions which is initialized to \\n random numbers from a uniform distribution in the range [0,1).\\n\\n randn(d0, d1, ..., dn) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_args = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {0};\n if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0) < 0) return 0;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) {\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n Py_XDECREF(__pyx_v_args);\n return 0;\n }\n Py_INCREF(__pyx_v_self);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":426 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n __pyx_4 = __pyx_4 == 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":427 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":429 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n if (PyDict_SetItem(__pyx_1, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_r = __pyx_5;\n __pyx_5 = 0;\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.rand\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_XDECREF(__pyx_v_args);\n Py_DECREF(__pyx_v_self);\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_randn[] = \"Returns zero-mean, unit-variance Gaussian random numbers in an \\n array of shape (d0, d1, ..., dn).\\n\\n randn(d0, d1, ..., dn) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_args = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n static char *__pyx_argnames[] = {0};\n if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0) < 0) return 0;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) {\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n Py_XDECREF(__pyx_v_args);\n return 0;\n }\n Py_INCREF(__pyx_v_self);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":437 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n __pyx_4 = __pyx_4 == 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":438 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":440 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_args);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.randn\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_XDECREF(__pyx_v_args);\n Py_DECREF(__pyx_v_self);\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_random_integers[] = \"Return random integers x such that low <= x <= high.\\n\\n random_integers(low, high=None, size=None) -> random values.\\n\\n If high is None, then 1 <= x <= low.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_low = 0;\n PyObject *__pyx_v_high = 0;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_high = __pyx_k11;\n __pyx_v_size = __pyx_k12;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O|OO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_low);\n Py_INCREF(__pyx_v_high);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":449 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":450 */\n Py_INCREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n __pyx_v_high = __pyx_v_low;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":451 */\n __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n Py_DECREF(__pyx_v_low);\n __pyx_v_low = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":452 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_INCREF(__pyx_v_low);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_low);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_size);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_4;\n __pyx_4 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.random_integers\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_normal[] = \"Standard Normal distribution (mean=0, stdev=1).\\n\\n standard_normal(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k13;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":460 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k66p;\n\nstatic char (__pyx_k66[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_normal[] = \"Normal distribution (mean=loc, stdev=scale).\\n\\n normal(loc=0.0, scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k14;\n __pyx_v_scale = __pyx_k15;\n __pyx_v_size = __pyx_k16;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":467 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":468 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n Py_INCREF(__pyx_k66p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":469 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k67p;\nstatic PyObject *__pyx_k68p;\n\nstatic char (__pyx_k67[]) = \"a <= 0\";\nstatic char (__pyx_k68[]) = \"b <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_beta[] = \"Beta distribution over [0, 1].\\n\\n beta(a, b, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n double __pyx_v_b;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"b\",\"size\",0};\n __pyx_v_size = __pyx_k17;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":476 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":477 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n Py_INCREF(__pyx_k67p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_b <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":479 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n Py_INCREF(__pyx_k68p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":480 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_a,__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.beta\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k69p;\n\nstatic char (__pyx_k69[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_exponential[] = \"Exponential distribution.\\n\\n exponential(scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"scale\",\"size\",0};\n __pyx_v_scale = __pyx_k18;\n __pyx_v_size = __pyx_k19;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":487 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":488 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n Py_INCREF(__pyx_k69p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":489 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.exponential\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_exponential[] = \"Standard exponential distribution (scale=1).\\n\\n standard_exponential(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k20;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":496 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_exponential\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k70p;\n\nstatic char (__pyx_k70[]) = \"shape <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_gamma[] = \"Standard Gamma distribution.\\n\\n standard_gamma(shape, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_shape;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"shape\",\"size\",0};\n __pyx_v_size = __pyx_k21;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_shape, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":503 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":504 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n Py_INCREF(__pyx_k70p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":505 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_gamma\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k71p;\nstatic PyObject *__pyx_k72p;\n\nstatic char (__pyx_k71[]) = \"shape <= 0\";\nstatic char (__pyx_k72[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_gamma[] = \"Gamma distribution.\\n\\n gamma(shape, scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_shape;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"shape\",\"scale\",\"size\",0};\n __pyx_v_scale = __pyx_k22;\n __pyx_v_size = __pyx_k23;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|dO\", __pyx_argnames, &__pyx_v_shape, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":512 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":513 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n Py_INCREF(__pyx_k71p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":515 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n Py_INCREF(__pyx_k72p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":516 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_shape,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.gamma\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k73p;\nstatic PyObject *__pyx_k74p;\n\nstatic char (__pyx_k73[]) = \"dfnum <= 0\";\nstatic char (__pyx_k74[]) = \"dfden <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_f[] = \"F distribution.\\n\\n f(dfnum, dfden, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_dfnum;\n double __pyx_v_dfden;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"dfnum\",\"dfden\",\"size\",0};\n __pyx_v_size = __pyx_k24;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":523 */\n __pyx_1 = (__pyx_v_dfnum <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":524 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n Py_INCREF(__pyx_k73p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":526 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n Py_INCREF(__pyx_k74p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":527 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.f\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k75p;\nstatic PyObject *__pyx_k76p;\nstatic PyObject *__pyx_k77p;\n\nstatic char (__pyx_k75[]) = \"dfnum <= 1\";\nstatic char (__pyx_k76[]) = \"dfden <= 0\";\nstatic char (__pyx_k77[]) = \"nonc < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_noncentral_f[] = \"Noncentral F distribution.\\n\\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_dfnum;\n double __pyx_v_dfden;\n double __pyx_v_nonc;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"dfnum\",\"dfden\",\"nonc\",\"size\",0};\n __pyx_v_size = __pyx_k25;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ddd|O\", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_nonc, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":534 */\n __pyx_1 = (__pyx_v_dfnum <= 1);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":535 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n Py_INCREF(__pyx_k75p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":537 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n Py_INCREF(__pyx_k76p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":539 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n Py_INCREF(__pyx_k77p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":540 */\n __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.noncentral_f\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k78p;\n\nstatic char (__pyx_k78[]) = \"df <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_chisquare[] = \"Chi^2 distribution.\\n\\n chisquare(df, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"size\",0};\n __pyx_v_size = __pyx_k26;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":548 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":549 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n Py_INCREF(__pyx_k78p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":550 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.chisquare\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k79p;\nstatic PyObject *__pyx_k80p;\n\nstatic char (__pyx_k79[]) = \"df <= 1\";\nstatic char (__pyx_k80[]) = \"nonc < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_noncentral_chisquare[] = \"Noncentral Chi^2 distribution.\\n\\n noncentral_chisquare(df, nonc, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n double __pyx_v_nonc;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"nonc\",\"size\",0};\n __pyx_v_size = __pyx_k27;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_nonc, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":557 */\n __pyx_1 = (__pyx_v_df <= 1);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":558 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n Py_INCREF(__pyx_k79p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":560 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n Py_INCREF(__pyx_k80p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":561 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_df,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.noncentral_chisquare\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_cauchy[] = \"Standard Cauchy with mode=0.\\n\\n standard_cauchy(size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k28;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":569 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_cauchy\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k81p;\n\nstatic char (__pyx_k81[]) = \"df <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_t[] = \"Standard Student\\'s t distribution with df degrees of freedom.\\n\\n standard_t(df, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"size\",0};\n __pyx_v_size = __pyx_k29;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":576 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":577 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n Py_INCREF(__pyx_k81p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":578 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_t\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k82p;\n\nstatic char (__pyx_k82[]) = \"kappa < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_vonmises[] = \"von Mises circular distribution with mode mu and dispersion parameter\\n kappa on [-pi, pi].\\n\\n vonmises(mu, kappa, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mu;\n double __pyx_v_kappa;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mu\",\"kappa\",\"size\",0};\n __pyx_v_size = __pyx_k30;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_mu, &__pyx_v_kappa, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":586 */\n __pyx_1 = (__pyx_v_kappa < 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":587 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n Py_INCREF(__pyx_k82p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":588 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_mu,__pyx_v_kappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.vonmises\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k83p;\n\nstatic char (__pyx_k83[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_pareto[] = \"Pareto distribution.\\n\\n pareto(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k31;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":595 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":596 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n Py_INCREF(__pyx_k83p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":597 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.pareto\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k84p;\n\nstatic char (__pyx_k84[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_weibull[] = \"Weibull distribution.\\n\\n weibull(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k32;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":604 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":605 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n Py_INCREF(__pyx_k84p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":606 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.weibull\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k85p;\n\nstatic char (__pyx_k85[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_power[] = \"Power distribution.\\n\\n power(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k33;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":613 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":614 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n Py_INCREF(__pyx_k85p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":615 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.power\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k86p;\n\nstatic char (__pyx_k86[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_laplace[] = \"Laplace distribution.\\n \\n laplace(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k34;\n __pyx_v_scale = __pyx_k35;\n __pyx_v_size = __pyx_k36;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":622 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":623 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n Py_INCREF(__pyx_k86p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":624 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.laplace\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k87p;\n\nstatic char (__pyx_k87[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_gumbel[] = \"Gumbel distribution.\\n \\n gumbel(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k37;\n __pyx_v_scale = __pyx_k38;\n __pyx_v_size = __pyx_k39;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":631 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":632 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n Py_INCREF(__pyx_k87p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":633 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.gumbel\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k88p;\n\nstatic char (__pyx_k88[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_logistic[] = \"Logistic distribution.\\n \\n logistic(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k40;\n __pyx_v_scale = __pyx_k41;\n __pyx_v_size = __pyx_k42;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":640 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":641 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n Py_INCREF(__pyx_k88p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":642 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.logistic\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k89p;\n\nstatic char (__pyx_k89[]) = \"sigma <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_lognormal[] = \"Log-normal distribution.\\n \\n Note that the mean parameter is not the mean of this distribution, but \\n the underlying normal distribution.\\n \\n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\\n \\n lognormal(mean=0.0, sigma=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mean;\n double __pyx_v_sigma;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"sigma\",\"size\",0};\n __pyx_v_mean = __pyx_k43;\n __pyx_v_sigma = __pyx_k44;\n __pyx_v_size = __pyx_k45;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_sigma, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":654 */\n __pyx_1 = (__pyx_v_sigma <= 0.0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":655 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n Py_INCREF(__pyx_k89p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":656 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_mean,__pyx_v_sigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.lognormal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k90p;\n\nstatic char (__pyx_k90[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_rayleigh[] = \"Rayleigh distribution.\\n \\n rayleigh(scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"scale\",\"size\",0};\n __pyx_v_scale = __pyx_k46;\n __pyx_v_size = __pyx_k47;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":663 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":664 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n Py_INCREF(__pyx_k90p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":665 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.rayleigh\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k91p;\nstatic PyObject *__pyx_k92p;\n\nstatic char (__pyx_k91[]) = \"mean <= 0.0\";\nstatic char (__pyx_k92[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_wald[] = \"Wald (inverse Gaussian) distribution.\\n \\n wald(mean, scale, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mean;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"scale\",\"size\",0};\n __pyx_v_size = __pyx_k48;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":672 */\n __pyx_1 = (__pyx_v_mean <= 0.0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":673 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n Py_INCREF(__pyx_k91p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":675 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n Py_INCREF(__pyx_k92p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":676 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_mean,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.wald\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k93p;\nstatic PyObject *__pyx_k94p;\nstatic PyObject *__pyx_k95p;\n\nstatic char (__pyx_k93[]) = \"left > mode\";\nstatic char (__pyx_k94[]) = \"mode > right\";\nstatic char (__pyx_k95[]) = \"left == right\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_triangular[] = \"Triangular distribution starting at left, peaking at mode, and \\n ending at right (left <= mode <= right).\\n \\n triangular(left, mode, right, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_left;\n double __pyx_v_mode;\n double __pyx_v_right;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"left\",\"mode\",\"right\",\"size\",0};\n __pyx_v_size = __pyx_k49;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ddd|O\", __pyx_argnames, &__pyx_v_left, &__pyx_v_mode, &__pyx_v_right, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":684 */\n __pyx_1 = (__pyx_v_left > __pyx_v_mode);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":685 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n Py_INCREF(__pyx_k93p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_mode > __pyx_v_right);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":687 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n Py_INCREF(__pyx_k94p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_left == __pyx_v_right);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":689 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n Py_INCREF(__pyx_k95p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":690 */\n __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_left,__pyx_v_mode,__pyx_v_right); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.triangular\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k96p;\nstatic PyObject *__pyx_k97p;\nstatic PyObject *__pyx_k98p;\n\nstatic char (__pyx_k96[]) = \"n <= 0\";\nstatic char (__pyx_k97[]) = \"p < 0\";\nstatic char (__pyx_k98[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_binomial[] = \"Binomial distribution of n trials and p probability of success.\\n\\n binomial(n, p, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"n\",\"p\",\"size\",0};\n __pyx_v_size = __pyx_k50;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ld|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":699 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":700 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n Py_INCREF(__pyx_k96p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":702 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n Py_INCREF(__pyx_k97p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":704 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n Py_INCREF(__pyx_k98p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":705 */\n __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.binomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k99p;\nstatic PyObject *__pyx_k100p;\nstatic PyObject *__pyx_k101p;\n\nstatic char (__pyx_k99[]) = \"n <= 0\";\nstatic char (__pyx_k100[]) = \"p < 0\";\nstatic char (__pyx_k101[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_negative_binomial[] = \"Negative Binomial distribution.\\n\\n negative_binomial(n, p, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"n\",\"p\",\"size\",0};\n __pyx_v_size = __pyx_k51;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ld|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":712 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":713 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n Py_INCREF(__pyx_k99p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":715 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n Py_INCREF(__pyx_k100p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":717 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n Py_INCREF(__pyx_k101p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":718 */\n __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.negative_binomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k102p;\n\nstatic char (__pyx_k102[]) = \"lam <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_poisson[] = \"Poisson distribution.\\n\\n poisson(lam=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_lam;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"lam\",\"size\",0};\n __pyx_v_lam = __pyx_k52;\n __pyx_v_size = __pyx_k53;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_lam, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":726 */\n __pyx_1 = (__pyx_v_lam <= 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":727 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n Py_INCREF(__pyx_k102p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":728 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_lam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.poisson\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k103p;\n\nstatic char (__pyx_k103[]) = \"a <= 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_zipf[] = \"Zipf distribution.\\n \\n zipf(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k54;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":735 */\n __pyx_1 = (__pyx_v_a <= 1.0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":736 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n Py_INCREF(__pyx_k103p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":737 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.zipf\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k104p;\nstatic PyObject *__pyx_k105p;\n\nstatic char (__pyx_k104[]) = \"p < 0.0\";\nstatic char (__pyx_k105[]) = \"p > 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_geometric[] = \"Geometric distribution with p being the probability of \\\"success\\\" on\\n an individual trial.\\n \\n geometric(p, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"p\",\"size\",0};\n __pyx_v_size = __pyx_k55;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":745 */\n __pyx_1 = (__pyx_v_p < 0.0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":746 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n Py_INCREF(__pyx_k104p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1.0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":748 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n Py_INCREF(__pyx_k105p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":749 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.geometric\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k106p;\nstatic PyObject *__pyx_k107p;\nstatic PyObject *__pyx_k108p;\nstatic PyObject *__pyx_k109p;\n\nstatic char (__pyx_k106[]) = \"ngood < 1\";\nstatic char (__pyx_k107[]) = \"nbad < 1\";\nstatic char (__pyx_k108[]) = \"ngood + nbad < nsample\";\nstatic char (__pyx_k109[]) = \"nsample < 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_hypergeometric[] = \"Hypergeometric distribution.\\n \\n Consider an urn with ngood \\\"good\\\" balls and nbad \\\"bad\\\" balls. If one \\n were to draw nsample balls from the urn without replacement, then \\n the hypergeometric distribution describes the distribution of \\\"good\\\" \\n balls in the sample.\\n \\n hypergeometric(ngood, nbad, nsample, size=None) \\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_ngood;\n long __pyx_v_nbad;\n long __pyx_v_nsample;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"ngood\",\"nbad\",\"nsample\",\"size\",0};\n __pyx_v_size = __pyx_k56;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lll|O\", __pyx_argnames, &__pyx_v_ngood, &__pyx_v_nbad, &__pyx_v_nsample, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":761 */\n __pyx_1 = (__pyx_v_ngood < 1);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":762 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n Py_INCREF(__pyx_k106p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nbad < 1);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":764 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n Py_INCREF(__pyx_k107p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = ((__pyx_v_ngood + __pyx_v_nbad) < __pyx_v_nsample);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":766 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n Py_INCREF(__pyx_k108p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k108p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nsample < 1);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":768 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n Py_INCREF(__pyx_k109p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":769 */\n __pyx_2 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ngood,__pyx_v_nbad,__pyx_v_nsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.hypergeometric\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k110p;\nstatic PyObject *__pyx_k111p;\n\nstatic char (__pyx_k110[]) = \"p < 0\";\nstatic char (__pyx_k111[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_logseries[] = \"Logarithmic series distribution.\\n \\n logseries(p, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"p\",\"size\",0};\n __pyx_v_size = __pyx_k57;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":777 */\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":778 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n Py_INCREF(__pyx_k110p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k110p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":780 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n Py_INCREF(__pyx_k111p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k111p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":781 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.logseries\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_array;\nstatic PyObject *__pyx_n_shape;\nstatic PyObject *__pyx_n_ArgumentError;\nstatic PyObject *__pyx_n_isinstance;\nstatic PyObject *__pyx_n_list;\nstatic PyObject *__pyx_n_append;\nstatic PyObject *__pyx_n_multiply;\nstatic PyObject *__pyx_n_reduce;\nstatic PyObject *__pyx_n_linalg;\nstatic PyObject *__pyx_n_singular_value_decomposition;\nstatic PyObject *__pyx_n_matrixmultiply;\nstatic PyObject *__pyx_n_sqrt;\nstatic PyObject *__pyx_n_add;\nstatic PyObject *__pyx_n_tuple;\n\nstatic PyObject *__pyx_k112p;\nstatic PyObject *__pyx_k113p;\nstatic PyObject *__pyx_k114p;\n\nstatic char (__pyx_k112[]) = \"mean must be 1 dimensional\";\nstatic char (__pyx_k113[]) = \"cov must be 2 dimensional and square\";\nstatic char (__pyx_k114[]) = \"mean and cov must have same length\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_multivariate_normal[] = \"Return an array containing multivariate normally distributed random numbers\\n with specified mean and covariance.\\n\\n multivariate_normal(mean, cov) -> random values\\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\\n\\n mean must be a 1 dimensional array. cov must be a square two dimensional\\n array with the same number of rows and columns as mean has elements.\\n\\n The first form returns a single 1-D array containing a multivariate\\n normal.\\n\\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\\n normal.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_mean = 0;\n PyObject *__pyx_v_cov = 0;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_v_shape;\n PyObject *__pyx_v_final_shape;\n PyObject *__pyx_v_x;\n PyObject *__pyx_v_u;\n PyObject *__pyx_v_s;\n PyObject *__pyx_v_v;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"cov\",\"size\",0};\n __pyx_v_size = __pyx_k58;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"OO|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_cov, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_mean);\n Py_INCREF(__pyx_v_cov);\n Py_INCREF(__pyx_v_size);\n __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape);\n __pyx_v_final_shape = Py_None; Py_INCREF(__pyx_v_final_shape);\n __pyx_v_x = Py_None; Py_INCREF(__pyx_v_x);\n __pyx_v_u = Py_None; Py_INCREF(__pyx_v_u);\n __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s);\n __pyx_v_v = Py_None; Py_INCREF(__pyx_v_v);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":802 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_INCREF(__pyx_v_mean);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_mean);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_mean);\n __pyx_v_mean = __pyx_3;\n __pyx_3 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":803 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_INCREF(__pyx_v_cov);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_cov);\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_cov);\n __pyx_v_cov = __pyx_2;\n __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":804 */\n __pyx_4 = __pyx_v_size == Py_None;\n if (__pyx_4) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":805 */\n __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":807 */\n Py_INCREF(__pyx_v_size);\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_v_size;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":808 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);\n __pyx_2 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":809 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n Py_INCREF(__pyx_k112p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_3, 0, 0);\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":810 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n __pyx_2 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (!__pyx_4) {\n __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n }\n if (__pyx_4) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":811 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_INCREF(__pyx_k113p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k113p);\n __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_1, 0, 0);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n goto __pyx_L4;\n }\n __pyx_L4:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":812 */\n __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":813 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n Py_INCREF(__pyx_k114p);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k114p);\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __Pyx_Raise(__pyx_2, 0, 0);\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n goto __pyx_L5;\n }\n __pyx_L5:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":815 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_5, 1, __pyx_1);\n __pyx_1 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_4) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":816 */\n __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyList_SET_ITEM(__pyx_1, 0, __pyx_v_shape);\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L6;\n }\n __pyx_L6:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":817 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);\n __pyx_5 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_final_shape);\n __pyx_v_final_shape = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":818 */\n __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":822 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);\n __pyx_3 = 0;\n __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_x);\n __pyx_v_x = __pyx_5;\n __pyx_5 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":823 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_final_shape);\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);\n PyTuple_SET_ITEM(__pyx_1, 1, __pyx_5);\n __pyx_3 = 0;\n __pyx_5 = 0;\n if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":833 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_linalg); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_singular_value_decomposition); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_INCREF(__pyx_v_cov);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_cov);\n __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_u);\n __pyx_v_u = __pyx_3;\n __pyx_3 = 0;\n __pyx_5 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_s);\n __pyx_v_s = __pyx_5;\n __pyx_5 = 0;\n __pyx_1 = __Pyx_UnpackItem(__pyx_2, 2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_v);\n __pyx_v_v = __pyx_1;\n __pyx_1 = 0;\n if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":834 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_matrixmultiply); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_INCREF(__pyx_v_s);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_s);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n Py_INCREF(__pyx_v_v);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_v);\n __pyx_2 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_x);\n __pyx_v_x = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":837 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_INCREF(__pyx_v_mean);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_mean);\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_x);\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_x);\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":838 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":839 */\n Py_INCREF(__pyx_v_x);\n __pyx_r = __pyx_v_x;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.multivariate_normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_shape);\n Py_DECREF(__pyx_v_final_shape);\n Py_DECREF(__pyx_v_x);\n Py_DECREF(__pyx_v_u);\n Py_DECREF(__pyx_v_s);\n Py_DECREF(__pyx_v_v);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_mean);\n Py_DECREF(__pyx_v_cov);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_zeros;\n\nstatic PyObject *__pyx_k115p;\n\nstatic char (__pyx_k115[]) = \"sum(pvals) > 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_multinomial[] = \"Multinomial distribution.\\n \\n multinomial(n, pvals, size=None) -> random values\\n\\n pvals is a sequence of probabilities that should sum to 1 (however, the\\n last element is always assumed to account for the remaining probability\\n as long as sum(pvals[:-1]) <= 1).\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n PyObject *__pyx_v_pvals = 0;\n PyObject *__pyx_v_size = 0;\n long __pyx_v_d;\n PyArrayObject *__pyx_v_parr;\n PyArrayObject *__pyx_v_mnarr;\n double (*__pyx_v_pix);\n long (*__pyx_v_mnix);\n long __pyx_v_i;\n long __pyx_v_j;\n long __pyx_v_dn;\n double __pyx_v_Sum;\n double __pyx_v_prob;\n PyObject *__pyx_v_shape;\n PyObject *__pyx_v_multin;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n long __pyx_4;\n int __pyx_5;\n static char *__pyx_argnames[] = {\"n\",\"pvals\",\"size\",0};\n __pyx_v_size = __pyx_k59;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lO|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_pvals, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_pvals);\n Py_INCREF(__pyx_v_size);\n __pyx_v_parr = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_parr);\n __pyx_v_mnarr = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_mnarr);\n __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape);\n __pyx_v_multin = Py_None; Py_INCREF(__pyx_v_multin);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":857 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_INCREF(__pyx_v_pvals);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_pvals);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_v_d = __pyx_4;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":858 */\n __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_parr));\n __pyx_v_parr = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":859 */\n __pyx_v_pix = ((double (*))__pyx_v_parr->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":861 */\n __pyx_5 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix,(__pyx_v_d - 1)) > 1.0);\n if (__pyx_5) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":862 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n Py_INCREF(__pyx_k115p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k115p);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_1, 0, 0);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":864 */\n __pyx_5 = __pyx_v_size == Py_None;\n if (__pyx_5) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":865 */\n __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L3;\n }\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n __pyx_5 = __pyx_3 == __pyx_1;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_5) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":867 */\n __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);\n __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L3;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":869 */\n __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n }\n __pyx_L3:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":871 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_1);\n __pyx_1 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_multin);\n __pyx_v_multin = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":872 */\n Py_INCREF(((PyObject *)__pyx_v_multin));\n Py_DECREF(((PyObject *)__pyx_v_mnarr));\n __pyx_v_mnarr = ((PyObject *)__pyx_v_multin);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":873 */\n __pyx_v_mnix = ((long (*))__pyx_v_mnarr->data);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":874 */\n __pyx_v_i = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":875 */\n while (1) {\n __pyx_L4:;\n __pyx_5 = (__pyx_v_i < PyArray_SIZE(__pyx_v_mnarr));\n if (!__pyx_5) break;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":876 */\n __pyx_v_Sum = 1.0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":877 */\n __pyx_v_dn = __pyx_v_n;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":878 */\n __pyx_4 = (__pyx_v_d - 1);\n for (__pyx_v_j = 0; __pyx_v_j < __pyx_4; ++__pyx_v_j) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":879 */\n (__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));\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":880 */\n __pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]));\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":881 */\n __pyx_5 = (__pyx_v_dn <= 0);\n if (__pyx_5) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":882 */\n goto __pyx_L7;\n goto __pyx_L8;\n }\n __pyx_L8:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":883 */\n __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j]));\n __pyx_L6:;\n }\n __pyx_L7:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":884 */\n __pyx_5 = (__pyx_v_dn > 0);\n if (__pyx_5) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":885 */\n (__pyx_v_mnix[((__pyx_v_i + __pyx_v_d) - 1)]) = __pyx_v_dn;\n goto __pyx_L9;\n }\n __pyx_L9:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":887 */\n __pyx_v_i = (__pyx_v_i + __pyx_v_d);\n }\n __pyx_L5:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":889 */\n Py_INCREF(__pyx_v_multin);\n __pyx_r = __pyx_v_multin;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.multinomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_parr);\n Py_DECREF(__pyx_v_mnarr);\n Py_DECREF(__pyx_v_shape);\n Py_DECREF(__pyx_v_multin);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_pvals);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_shuffle[] = \"Modify a sequence in-place by shuffling its contents.\\n \\n shuffle(x)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_x = 0;\n long __pyx_v_i;\n long __pyx_v_j;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n long __pyx_4;\n int __pyx_5;\n static char *__pyx_argnames[] = {\"x\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_x)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":900 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_v_i = __pyx_4;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":901 */\n while (1) {\n __pyx_L2:;\n __pyx_5 = (__pyx_v_i > 0);\n if (!__pyx_5) break;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":902 */\n __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":903 */\n __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":904 */\n __pyx_v_i = (__pyx_v_i - 1);\n }\n __pyx_L3:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.shuffle\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_x);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_arange;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_permutation[] = \"Given an integer, return a shuffled sequence of integers >= 0 and \\n < x; given a sequence, return a shuffled array copy.\\n\\n permutation(x)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_x = 0;\n PyObject *__pyx_v_arr;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n static char *__pyx_argnames[] = {\"x\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_x)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n __pyx_v_arr = Py_None; Py_INCREF(__pyx_v_arr);\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":912 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n __pyx_4 = __pyx_3 == __pyx_1;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":913 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_arange); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x);\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_arr);\n __pyx_v_arr = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":915 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_arr);\n __pyx_v_arr = __pyx_3;\n __pyx_3 = 0;\n }\n __pyx_L2:;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":916 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_INCREF(__pyx_v_arr);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_arr);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":917 */\n Py_INCREF(__pyx_v_arr);\n __pyx_r = __pyx_v_arr;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.permutation\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_arr);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_x);\n return __pyx_r;\n}\n\nstatic __Pyx_InternTabEntry __pyx_intern_tab[] = {\n {&__pyx_n_ArgumentError, \"ArgumentError\"},\n {&__pyx_n_Float64, \"Float64\"},\n {&__pyx_n_Int, \"Int\"},\n {&__pyx_n_MT19937, \"MT19937\"},\n {&__pyx_n_ValueError, \"ValueError\"},\n {&__pyx_n___RandomState_ctor, \"__RandomState_ctor\"},\n {&__pyx_n__rand, \"_rand\"},\n {&__pyx_n__sp, \"_sp\"},\n {&__pyx_n_add, \"add\"},\n {&__pyx_n_append, \"append\"},\n {&__pyx_n_arange, \"arange\"},\n {&__pyx_n_array, \"array\"},\n {&__pyx_n_beta, \"beta\"},\n {&__pyx_n_binomial, \"binomial\"},\n {&__pyx_n_bytes, \"bytes\"},\n {&__pyx_n_chisquare, \"chisquare\"},\n {&__pyx_n_empty, \"empty\"},\n {&__pyx_n_exponential, \"exponential\"},\n {&__pyx_n_f, \"f\"},\n {&__pyx_n_gamma, \"gamma\"},\n {&__pyx_n_geometric, \"geometric\"},\n {&__pyx_n_get_state, \"get_state\"},\n {&__pyx_n_gumbel, \"gumbel\"},\n {&__pyx_n_hypergeometric, \"hypergeometric\"},\n {&__pyx_n_int, \"int\"},\n {&__pyx_n_isinstance, \"isinstance\"},\n {&__pyx_n_laplace, \"laplace\"},\n {&__pyx_n_len, \"len\"},\n {&__pyx_n_linalg, \"linalg\"},\n {&__pyx_n_list, \"list\"},\n {&__pyx_n_logistic, \"logistic\"},\n {&__pyx_n_lognormal, \"lognormal\"},\n {&__pyx_n_logseries, \"logseries\"},\n {&__pyx_n_matrixmultiply, \"matrixmultiply\"},\n {&__pyx_n_multinomial, \"multinomial\"},\n {&__pyx_n_multiply, \"multiply\"},\n {&__pyx_n_multivariate_normal, \"multivariate_normal\"},\n {&__pyx_n_negative_binomial, \"negative_binomial\"},\n {&__pyx_n_noncentral_chisquare, \"noncentral_chisquare\"},\n {&__pyx_n_noncentral_f, \"noncentral_f\"},\n {&__pyx_n_normal, \"normal\"},\n {&__pyx_n_pareto, \"pareto\"},\n {&__pyx_n_permutation, \"permutation\"},\n {&__pyx_n_poisson, \"poisson\"},\n {&__pyx_n_power, \"power\"},\n {&__pyx_n_rand, \"rand\"},\n {&__pyx_n_randint, \"randint\"},\n {&__pyx_n_randn, \"randn\"},\n {&__pyx_n_random, \"random\"},\n {&__pyx_n_random_integers, \"random_integers\"},\n {&__pyx_n_random_sample, \"random_sample\"},\n {&__pyx_n_rayleigh, \"rayleigh\"},\n {&__pyx_n_reduce, \"reduce\"},\n {&__pyx_n_scipy, \"scipy\"},\n {&__pyx_n_seed, \"seed\"},\n {&__pyx_n_set_state, \"set_state\"},\n {&__pyx_n_shape, \"shape\"},\n {&__pyx_n_shuffle, \"shuffle\"},\n {&__pyx_n_singular_value_decomposition, \"singular_value_decomposition\"},\n {&__pyx_n_size, \"size\"},\n {&__pyx_n_sqrt, \"sqrt\"},\n {&__pyx_n_standard_cauchy, \"standard_cauchy\"},\n {&__pyx_n_standard_exponential, \"standard_exponential\"},\n {&__pyx_n_standard_gamma, \"standard_gamma\"},\n {&__pyx_n_standard_normal, \"standard_normal\"},\n {&__pyx_n_standard_t, \"standard_t\"},\n {&__pyx_n_triangular, \"triangular\"},\n {&__pyx_n_tuple, \"tuple\"},\n {&__pyx_n_type, \"type\"},\n {&__pyx_n_uniform, \"uniform\"},\n {&__pyx_n_vonmises, \"vonmises\"},\n {&__pyx_n_wald, \"wald\"},\n {&__pyx_n_weibull, \"weibull\"},\n {&__pyx_n_zeros, \"zeros\"},\n {&__pyx_n_zipf, \"zipf\"},\n {0, 0}\n};\n\nstatic __Pyx_StringTabEntry __pyx_string_tab[] = {\n {&__pyx_k62p, __pyx_k62, sizeof(__pyx_k62)},\n {&__pyx_k63p, __pyx_k63, sizeof(__pyx_k63)},\n {&__pyx_k64p, __pyx_k64, sizeof(__pyx_k64)},\n {&__pyx_k66p, __pyx_k66, sizeof(__pyx_k66)},\n {&__pyx_k67p, __pyx_k67, sizeof(__pyx_k67)},\n {&__pyx_k68p, __pyx_k68, sizeof(__pyx_k68)},\n {&__pyx_k69p, __pyx_k69, sizeof(__pyx_k69)},\n {&__pyx_k70p, __pyx_k70, sizeof(__pyx_k70)},\n {&__pyx_k71p, __pyx_k71, sizeof(__pyx_k71)},\n {&__pyx_k72p, __pyx_k72, sizeof(__pyx_k72)},\n {&__pyx_k73p, __pyx_k73, sizeof(__pyx_k73)},\n {&__pyx_k74p, __pyx_k74, sizeof(__pyx_k74)},\n {&__pyx_k75p, __pyx_k75, sizeof(__pyx_k75)},\n {&__pyx_k76p, __pyx_k76, sizeof(__pyx_k76)},\n {&__pyx_k77p, __pyx_k77, sizeof(__pyx_k77)},\n {&__pyx_k78p, __pyx_k78, sizeof(__pyx_k78)},\n {&__pyx_k79p, __pyx_k79, sizeof(__pyx_k79)},\n {&__pyx_k80p, __pyx_k80, sizeof(__pyx_k80)},\n {&__pyx_k81p, __pyx_k81, sizeof(__pyx_k81)},\n {&__pyx_k82p, __pyx_k82, sizeof(__pyx_k82)},\n {&__pyx_k83p, __pyx_k83, sizeof(__pyx_k83)},\n {&__pyx_k84p, __pyx_k84, sizeof(__pyx_k84)},\n {&__pyx_k85p, __pyx_k85, sizeof(__pyx_k85)},\n {&__pyx_k86p, __pyx_k86, sizeof(__pyx_k86)},\n {&__pyx_k87p, __pyx_k87, sizeof(__pyx_k87)},\n {&__pyx_k88p, __pyx_k88, sizeof(__pyx_k88)},\n {&__pyx_k89p, __pyx_k89, sizeof(__pyx_k89)},\n {&__pyx_k90p, __pyx_k90, sizeof(__pyx_k90)},\n {&__pyx_k91p, __pyx_k91, sizeof(__pyx_k91)},\n {&__pyx_k92p, __pyx_k92, sizeof(__pyx_k92)},\n {&__pyx_k93p, __pyx_k93, sizeof(__pyx_k93)},\n {&__pyx_k94p, __pyx_k94, sizeof(__pyx_k94)},\n {&__pyx_k95p, __pyx_k95, sizeof(__pyx_k95)},\n {&__pyx_k96p, __pyx_k96, sizeof(__pyx_k96)},\n {&__pyx_k97p, __pyx_k97, sizeof(__pyx_k97)},\n {&__pyx_k98p, __pyx_k98, sizeof(__pyx_k98)},\n {&__pyx_k99p, __pyx_k99, sizeof(__pyx_k99)},\n {&__pyx_k100p, __pyx_k100, sizeof(__pyx_k100)},\n {&__pyx_k101p, __pyx_k101, sizeof(__pyx_k101)},\n {&__pyx_k102p, __pyx_k102, sizeof(__pyx_k102)},\n {&__pyx_k103p, __pyx_k103, sizeof(__pyx_k103)},\n {&__pyx_k104p, __pyx_k104, sizeof(__pyx_k104)},\n {&__pyx_k105p, __pyx_k105, sizeof(__pyx_k105)},\n {&__pyx_k106p, __pyx_k106, sizeof(__pyx_k106)},\n {&__pyx_k107p, __pyx_k107, sizeof(__pyx_k107)},\n {&__pyx_k108p, __pyx_k108, sizeof(__pyx_k108)},\n {&__pyx_k109p, __pyx_k109, sizeof(__pyx_k109)},\n {&__pyx_k110p, __pyx_k110, sizeof(__pyx_k110)},\n {&__pyx_k111p, __pyx_k111, sizeof(__pyx_k111)},\n {&__pyx_k112p, __pyx_k112, sizeof(__pyx_k112)},\n {&__pyx_k113p, __pyx_k113, sizeof(__pyx_k113)},\n {&__pyx_k114p, __pyx_k114, sizeof(__pyx_k114)},\n {&__pyx_k115p, __pyx_k115, sizeof(__pyx_k115)},\n {0, 0, 0}\n};\n\nstatic PyObject *__pyx_tp_new_6mtrand_RandomState(PyTypeObject *t, PyObject *a, PyObject *k) {\n PyObject *o = (*t->tp_alloc)(t, 0);\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return o;\n}\n\nstatic void __pyx_tp_dealloc_6mtrand_RandomState(PyObject *o) {\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n {\n PyObject *etype, *eval, *etb;\n PyErr_Fetch(&etype, &eval, &etb);\n ++o->ob_refcnt;\n __pyx_f_6mtrand_11RandomState___dealloc__(o);\n if (PyErr_Occurred()) PyErr_WriteUnraisable(o);\n --o->ob_refcnt;\n PyErr_Restore(etype, eval, etb);\n }\n (*o->ob_type->tp_free)(o);\n}\n\nstatic int __pyx_tp_traverse_6mtrand_RandomState(PyObject *o, visitproc v, void *a) {\n int e;\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return 0;\n}\n\nstatic int __pyx_tp_clear_6mtrand_RandomState(PyObject *o) {\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return 0;\n}\n\nstatic struct PyMethodDef __pyx_methods_6mtrand_RandomState[] = {\n {\"seed\", (PyCFunction)__pyx_f_6mtrand_11RandomState_seed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_seed},\n {\"get_state\", (PyCFunction)__pyx_f_6mtrand_11RandomState_get_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_get_state},\n {\"set_state\", (PyCFunction)__pyx_f_6mtrand_11RandomState_set_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_set_state},\n {\"__getstate__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___getstate__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"__setstate__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___setstate__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"__reduce__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___reduce__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"random_sample\", (PyCFunction)__pyx_f_6mtrand_11RandomState_random_sample, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_random_sample},\n {\"tomaxint\", (PyCFunction)__pyx_f_6mtrand_11RandomState_tomaxint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_tomaxint},\n {\"randint\", (PyCFunction)__pyx_f_6mtrand_11RandomState_randint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_randint},\n {\"bytes\", (PyCFunction)__pyx_f_6mtrand_11RandomState_bytes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_bytes},\n {\"uniform\", (PyCFunction)__pyx_f_6mtrand_11RandomState_uniform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_uniform},\n {\"rand\", (PyCFunction)__pyx_f_6mtrand_11RandomState_rand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_rand},\n {\"randn\", (PyCFunction)__pyx_f_6mtrand_11RandomState_randn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_randn},\n {\"random_integers\", (PyCFunction)__pyx_f_6mtrand_11RandomState_random_integers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_random_integers},\n {\"standard_normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_normal},\n {\"normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_normal},\n {\"beta\", (PyCFunction)__pyx_f_6mtrand_11RandomState_beta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_beta},\n {\"exponential\", (PyCFunction)__pyx_f_6mtrand_11RandomState_exponential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_exponential},\n {\"standard_exponential\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_exponential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_exponential},\n {\"standard_gamma\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_gamma},\n {\"gamma\", (PyCFunction)__pyx_f_6mtrand_11RandomState_gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_gamma},\n {\"f\", (PyCFunction)__pyx_f_6mtrand_11RandomState_f, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_f},\n {\"noncentral_f\", (PyCFunction)__pyx_f_6mtrand_11RandomState_noncentral_f, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_noncentral_f},\n {\"chisquare\", (PyCFunction)__pyx_f_6mtrand_11RandomState_chisquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_chisquare},\n {\"noncentral_chisquare\", (PyCFunction)__pyx_f_6mtrand_11RandomState_noncentral_chisquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_noncentral_chisquare},\n {\"standard_cauchy\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_cauchy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_cauchy},\n {\"standard_t\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_t, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_t},\n {\"vonmises\", (PyCFunction)__pyx_f_6mtrand_11RandomState_vonmises, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_vonmises},\n {\"pareto\", (PyCFunction)__pyx_f_6mtrand_11RandomState_pareto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_pareto},\n {\"weibull\", (PyCFunction)__pyx_f_6mtrand_11RandomState_weibull, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_weibull},\n {\"power\", (PyCFunction)__pyx_f_6mtrand_11RandomState_power, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_power},\n {\"laplace\", (PyCFunction)__pyx_f_6mtrand_11RandomState_laplace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_laplace},\n {\"gumbel\", (PyCFunction)__pyx_f_6mtrand_11RandomState_gumbel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_gumbel},\n {\"logistic\", (PyCFunction)__pyx_f_6mtrand_11RandomState_logistic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logistic},\n {\"lognormal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_lognormal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_lognormal},\n {\"rayleigh\", (PyCFunction)__pyx_f_6mtrand_11RandomState_rayleigh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_rayleigh},\n {\"wald\", (PyCFunction)__pyx_f_6mtrand_11RandomState_wald, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_wald},\n {\"triangular\", (PyCFunction)__pyx_f_6mtrand_11RandomState_triangular, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_triangular},\n {\"binomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_binomial},\n {\"negative_binomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_negative_binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_negative_binomial},\n {\"poisson\", (PyCFunction)__pyx_f_6mtrand_11RandomState_poisson, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_poisson},\n {\"zipf\", (PyCFunction)__pyx_f_6mtrand_11RandomState_zipf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_zipf},\n {\"geometric\", (PyCFunction)__pyx_f_6mtrand_11RandomState_geometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_geometric},\n {\"hypergeometric\", (PyCFunction)__pyx_f_6mtrand_11RandomState_hypergeometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_hypergeometric},\n {\"logseries\", (PyCFunction)__pyx_f_6mtrand_11RandomState_logseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logseries},\n {\"multivariate_normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_multivariate_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multivariate_normal},\n {\"multinomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_multinomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multinomial},\n {\"shuffle\", (PyCFunction)__pyx_f_6mtrand_11RandomState_shuffle, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_shuffle},\n {\"permutation\", (PyCFunction)__pyx_f_6mtrand_11RandomState_permutation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_permutation},\n {0, 0, 0, 0}\n};\n\nstatic PyNumberMethods __pyx_tp_as_number_RandomState = {\n 0, /*nb_add*/\n 0, /*nb_subtract*/\n 0, /*nb_multiply*/\n 0, /*nb_divide*/\n 0, /*nb_remainder*/\n 0, /*nb_divmod*/\n 0, /*nb_power*/\n 0, /*nb_negative*/\n 0, /*nb_positive*/\n 0, /*nb_absolute*/\n 0, /*nb_nonzero*/\n 0, /*nb_invert*/\n 0, /*nb_lshift*/\n 0, /*nb_rshift*/\n 0, /*nb_and*/\n 0, /*nb_xor*/\n 0, /*nb_or*/\n 0, /*nb_coerce*/\n 0, /*nb_int*/\n 0, /*nb_long*/\n 0, /*nb_float*/\n 0, /*nb_oct*/\n 0, /*nb_hex*/\n 0, /*nb_inplace_add*/\n 0, /*nb_inplace_subtract*/\n 0, /*nb_inplace_multiply*/\n 0, /*nb_inplace_divide*/\n 0, /*nb_inplace_remainder*/\n 0, /*nb_inplace_power*/\n 0, /*nb_inplace_lshift*/\n 0, /*nb_inplace_rshift*/\n 0, /*nb_inplace_and*/\n 0, /*nb_inplace_xor*/\n 0, /*nb_inplace_or*/\n 0, /*nb_floor_divide*/\n 0, /*nb_true_divide*/\n 0, /*nb_inplace_floor_divide*/\n 0, /*nb_inplace_true_divide*/\n};\n\nstatic PySequenceMethods __pyx_tp_as_sequence_RandomState = {\n 0, /*sq_length*/\n 0, /*sq_concat*/\n 0, /*sq_repeat*/\n 0, /*sq_item*/\n 0, /*sq_slice*/\n 0, /*sq_ass_item*/\n 0, /*sq_ass_slice*/\n 0, /*sq_contains*/\n 0, /*sq_inplace_concat*/\n 0, /*sq_inplace_repeat*/\n};\n\nstatic PyMappingMethods __pyx_tp_as_mapping_RandomState = {\n 0, /*mp_length*/\n 0, /*mp_subscript*/\n 0, /*mp_ass_subscript*/\n};\n\nstatic PyBufferProcs __pyx_tp_as_buffer_RandomState = {\n 0, /*bf_getreadbuffer*/\n 0, /*bf_getwritebuffer*/\n 0, /*bf_getsegcount*/\n 0, /*bf_getcharbuffer*/\n};\n\nstatichere PyTypeObject __pyx_type_6mtrand_RandomState = {\n PyObject_HEAD_INIT(0)\n 0, /*ob_size*/\n \"mtrand.RandomState\", /*tp_name*/\n sizeof(struct __pyx_obj_6mtrand_RandomState), /*tp_basicsize*/\n 0, /*tp_itemsize*/\n __pyx_tp_dealloc_6mtrand_RandomState, /*tp_dealloc*/\n 0, /*tp_print*/\n 0, /*tp_getattr*/\n 0, /*tp_setattr*/\n 0, /*tp_compare*/\n 0, /*tp_repr*/\n &__pyx_tp_as_number_RandomState, /*tp_as_number*/\n &__pyx_tp_as_sequence_RandomState, /*tp_as_sequence*/\n &__pyx_tp_as_mapping_RandomState, /*tp_as_mapping*/\n 0, /*tp_hash*/\n 0, /*tp_call*/\n 0, /*tp_str*/\n 0, /*tp_getattro*/\n 0, /*tp_setattro*/\n &__pyx_tp_as_buffer_RandomState, /*tp_as_buffer*/\n Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/\n \"Container for the Mersenne Twister PRNG.\\n\\n Constructor\\n -----------\\n RandomState(seed=None): initializes the PRNG with the given seed. See the\\n seed() method for details.\\n\\n Distribution Methods\\n -----------------\\n RandomState exposes a number of methods for generating random numbers drawn\\n from a variety of probability distributions. In addition to the\\n distribution-specific arguments, each method takes a keyword argument\\n size=None. If size is None, then a single value is generated and returned.\\n If size is an integer, then a 1-D scipy array filled with generated values\\n is returned. If size is a tuple, then a scipy array with that shape is\\n filled and returned.\\n \", /*tp_doc*/\n __pyx_tp_traverse_6mtrand_RandomState, /*tp_traverse*/\n __pyx_tp_clear_6mtrand_RandomState, /*tp_clear*/\n 0, /*tp_richcompare*/\n 0, /*tp_weaklistoffset*/\n 0, /*tp_iter*/\n 0, /*tp_iternext*/\n __pyx_methods_6mtrand_RandomState, /*tp_methods*/\n 0, /*tp_members*/\n 0, /*tp_getset*/\n 0, /*tp_base*/\n 0, /*tp_dict*/\n 0, /*tp_descr_get*/\n 0, /*tp_descr_set*/\n 0, /*tp_dictoffset*/\n __pyx_f_6mtrand_11RandomState___init__, /*tp_init*/\n 0, /*tp_alloc*/\n __pyx_tp_new_6mtrand_RandomState, /*tp_new*/\n 0, /*tp_free*/\n 0, /*tp_is_gc*/\n 0, /*tp_bases*/\n 0, /*tp_mro*/\n 0, /*tp_cache*/\n 0, /*tp_subclasses*/\n 0, /*tp_weaklist*/\n};\n\nstatic struct PyMethodDef __pyx_methods[] = {\n {0, 0, 0, 0}\n};\n\nDL_EXPORT(void) initmtrand(void); /*proto*/\nDL_EXPORT(void) initmtrand(void) {\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n __pyx_m = Py_InitModule4(\"mtrand\", __pyx_methods, 0, 0, PYTHON_API_VERSION);\n if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n __pyx_b = PyImport_AddModule(\"__builtin__\");\n if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (PyObject_SetAttrString(__pyx_m, \"__builtins__\", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n __pyx_ptype_6mtrand_ArrayType = __Pyx_ImportType(\"scipy\", \"ArrayType\", sizeof(PyArrayObject)); if (!__pyx_ptype_6mtrand_ArrayType) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; goto __pyx_L1;}\n if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}\n if (PyObject_SetAttrString(__pyx_m, \"RandomState\", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}\n __pyx_ptype_6mtrand_RandomState = &__pyx_type_6mtrand_RandomState;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":114 */\n import_array();\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":116 */\n __pyx_1 = __Pyx_Import(__pyx_n_scipy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}\n if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":282 */\n Py_INCREF(Py_None);\n __pyx_k2 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":291 */\n Py_INCREF(Py_None);\n __pyx_k3 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":352 */\n Py_INCREF(Py_None);\n __pyx_k4 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":359 */\n Py_INCREF(Py_None);\n __pyx_k5 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":366 */\n Py_INCREF(Py_None);\n __pyx_k6 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k7 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":412 */\n __pyx_k8 = 0.0;\n __pyx_k9 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k10 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":442 */\n Py_INCREF(Py_None);\n __pyx_k11 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k12 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":455 */\n Py_INCREF(Py_None);\n __pyx_k13 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":462 */\n __pyx_k14 = 0.0;\n __pyx_k15 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k16 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":471 */\n Py_INCREF(Py_None);\n __pyx_k17 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":482 */\n __pyx_k18 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k19 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":491 */\n Py_INCREF(Py_None);\n __pyx_k20 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":498 */\n Py_INCREF(Py_None);\n __pyx_k21 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":507 */\n __pyx_k22 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k23 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":518 */\n Py_INCREF(Py_None);\n __pyx_k24 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":529 */\n Py_INCREF(Py_None);\n __pyx_k25 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":543 */\n Py_INCREF(Py_None);\n __pyx_k26 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":552 */\n Py_INCREF(Py_None);\n __pyx_k27 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":564 */\n Py_INCREF(Py_None);\n __pyx_k28 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":571 */\n Py_INCREF(Py_None);\n __pyx_k29 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":580 */\n Py_INCREF(Py_None);\n __pyx_k30 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":590 */\n Py_INCREF(Py_None);\n __pyx_k31 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":599 */\n Py_INCREF(Py_None);\n __pyx_k32 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":608 */\n Py_INCREF(Py_None);\n __pyx_k33 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":617 */\n __pyx_k34 = 0.0;\n __pyx_k35 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k36 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":626 */\n __pyx_k37 = 0.0;\n __pyx_k38 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k39 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":635 */\n __pyx_k40 = 0.0;\n __pyx_k41 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k42 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":644 */\n __pyx_k43 = 0.0;\n __pyx_k44 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k45 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":658 */\n __pyx_k46 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k47 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":667 */\n Py_INCREF(Py_None);\n __pyx_k48 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":678 */\n Py_INCREF(Py_None);\n __pyx_k49 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":694 */\n Py_INCREF(Py_None);\n __pyx_k50 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":707 */\n Py_INCREF(Py_None);\n __pyx_k51 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":721 */\n __pyx_k52 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k53 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":730 */\n Py_INCREF(Py_None);\n __pyx_k54 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":739 */\n Py_INCREF(Py_None);\n __pyx_k55 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":751 */\n Py_INCREF(Py_None);\n __pyx_k56 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":772 */\n Py_INCREF(Py_None);\n __pyx_k57 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":784 */\n Py_INCREF(Py_None);\n __pyx_k58 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":841 */\n Py_INCREF(Py_None);\n __pyx_k59 = Py_None;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":919 */\n __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":920 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_get_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":921 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_set_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":922 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":923 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":924 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_bytes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":925 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_uniform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":926 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rand); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":927 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randn); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":928 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_integers); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":929 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":930 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":931 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_beta); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":932 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":933 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":934 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":935 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":936 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":937 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":938 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":939 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":940 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_cauchy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":941 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":942 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_vonmises); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":943 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_pareto); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":944 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_weibull); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":945 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_power); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":946 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_laplace); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":947 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gumbel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":948 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logistic); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":949 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lognormal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":950 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rayleigh); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":951 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_wald); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":952 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_triangular); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":954 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":955 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_negative_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":956 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_poisson); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":957 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zipf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":958 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_geometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":959 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_hypergeometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":960 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logseries); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_logseries, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":962 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multivariate_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":963 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multinomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":965 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":966 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_permutation); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n return;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n __Pyx_AddTraceback(\"mtrand\");\n}\n\nstatic char *__pyx_filenames[] = {\n \"mtrand.pyx\",\n \"scipy.pxi\",\n};\nstatichere char **__pyx_f = __pyx_filenames;\n\n/* Runtime support code */\n\nstatic int __Pyx_GetStarArgs(\n PyObject **args, \n PyObject **kwds,\n char *kwd_list[], \n int nargs,\n PyObject **args2, \n PyObject **kwds2)\n{\n PyObject *x = 0, *args1 = 0, *kwds1 = 0;\n \n if (args2)\n *args2 = 0;\n if (kwds2)\n *kwds2 = 0;\n \n if (args2) {\n args1 = PyTuple_GetSlice(*args, 0, nargs);\n if (!args1)\n goto bad;\n *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_Size(*args));\n if (!*args2)\n goto bad;\n }\n else {\n args1 = *args;\n Py_INCREF(args1);\n }\n \n if (kwds2) {\n if (*kwds) {\n char **p;\n kwds1 = PyDict_New();\n if (!kwds)\n goto bad;\n *kwds2 = PyDict_Copy(*kwds);\n if (!*kwds2)\n goto bad;\n for (p = kwd_list; *p; p++) {\n x = PyDict_GetItemString(*kwds, *p);\n if (x) {\n if (PyDict_SetItemString(kwds1, *p, x) < 0)\n goto bad;\n if (PyDict_DelItemString(*kwds2, *p) < 0)\n goto bad;\n }\n }\n }\n else {\n *kwds2 = PyDict_New();\n if (!*kwds2)\n goto bad;\n }\n }\n else {\n kwds1 = *kwds;\n Py_XINCREF(kwds1);\n }\n \n *args = args1;\n *kwds = kwds1;\n return 0;\nbad:\n Py_XDECREF(args1);\n Py_XDECREF(kwds1);\n if (*args2)\n Py_XDECREF(*args2);\n if (*kwds2)\n Py_XDECREF(*kwds2);\n return -1;\n}\n\nstatic PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {\n PyObject *__import__ = 0;\n PyObject *empty_list = 0;\n PyObject *module = 0;\n PyObject *global_dict = 0;\n PyObject *empty_dict = 0;\n PyObject *list;\n __import__ = PyObject_GetAttrString(__pyx_b, \"__import__\");\n if (!__import__)\n goto bad;\n if (from_list)\n list = from_list;\n else {\n empty_list = PyList_New(0);\n if (!empty_list)\n goto bad;\n list = empty_list;\n }\n global_dict = PyModule_GetDict(__pyx_m);\n if (!global_dict)\n goto bad;\n empty_dict = PyDict_New();\n if (!empty_dict)\n goto bad;\n module = PyObject_CallFunction(__import__, \"OOOO\",\n name, global_dict, empty_dict, list);\nbad:\n Py_XDECREF(empty_list);\n Py_XDECREF(__import__);\n Py_XDECREF(empty_dict);\n return module;\n}\n\nstatic PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {\n PyObject *result;\n result = PyObject_GetAttr(dict, name);\n if (!result)\n PyErr_SetObject(PyExc_NameError, name);\n return result;\n}\n\nstatic void __Pyx_WriteUnraisable(char *name) {\n PyObject *old_exc, *old_val, *old_tb;\n PyObject *ctx;\n PyErr_Fetch(&old_exc, &old_val, &old_tb);\n ctx = PyString_FromString(name);\n PyErr_Restore(old_exc, old_val, old_tb);\n if (!ctx)\n ctx = Py_None;\n PyErr_WriteUnraisable(ctx);\n}\n\nstatic void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {\n Py_XINCREF(type);\n Py_XINCREF(value);\n Py_XINCREF(tb);\n /* First, check the traceback argument, replacing None with NULL. */\n if (tb == Py_None) {\n Py_DECREF(tb);\n tb = 0;\n }\n else if (tb != NULL && !PyTraceBack_Check(tb)) {\n PyErr_SetString(PyExc_TypeError,\n \"raise: arg 3 must be a traceback or None\");\n goto raise_error;\n }\n /* Next, replace a missing value with None */\n if (value == NULL) {\n value = Py_None;\n Py_INCREF(value);\n }\n /* Next, repeatedly, replace a tuple exception with its first item */\n while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {\n PyObject *tmp = type;\n type = PyTuple_GET_ITEM(type, 0);\n Py_INCREF(type);\n Py_DECREF(tmp);\n }\n if (PyString_Check(type))\n ;\n else if (PyClass_Check(type))\n ; /*PyErr_NormalizeException(&type, &value, &tb);*/\n else if (PyInstance_Check(type)) {\n /* Raising an instance. The value should be a dummy. */\n if (value != Py_None) {\n PyErr_SetString(PyExc_TypeError,\n \"instance exception may not have a separate value\");\n goto raise_error;\n }\n else {\n /* Normalize to raise , */\n Py_DECREF(value);\n value = type;\n type = (PyObject*) ((PyInstanceObject*)type)->in_class;\n Py_INCREF(type);\n }\n }\n else {\n /* Not something you can raise. You get an exception\n anyway, just not what you specified :-) */\n PyErr_Format(PyExc_TypeError,\n \"exceptions must be strings, classes, or \"\n \"instances, not %s\", type->ob_type->tp_name);\n goto raise_error;\n }\n PyErr_Restore(type, value, tb);\n return;\nraise_error:\n Py_XDECREF(value);\n Py_XDECREF(type);\n Py_XDECREF(tb);\n return;\n}\n\nstatic void __Pyx_UnpackError(void) {\n PyErr_SetString(PyExc_ValueError, \"unpack sequence of wrong size\");\n}\n\nstatic PyObject *__Pyx_UnpackItem(PyObject *seq, int i) {\n PyObject *item;\n if (!(item = PySequence_GetItem(seq, i))) {\n if (PyErr_ExceptionMatches(PyExc_IndexError))\n \t__Pyx_UnpackError();\n }\n return item;\n}\n\nstatic int __Pyx_EndUnpack(PyObject *seq, int i) {\n PyObject *item;\n if (item = PySequence_GetItem(seq, i)) {\n Py_DECREF(item);\n __Pyx_UnpackError();\n return -1;\n }\n PyErr_Clear();\n return 0;\n}\n\nstatic int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {\n while (t->p) {\n *t->p = PyString_InternFromString(t->s);\n if (!*t->p)\n return -1;\n ++t;\n }\n return 0;\n}\n\nstatic int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {\n while (t->p) {\n *t->p = PyString_FromStringAndSize(t->s, t->n - 1);\n if (!*t->p)\n return -1;\n ++t;\n }\n return 0;\n}\n\nstatic PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, \n long size) \n{\n PyObject *py_module_name = 0;\n PyObject *py_class_name = 0;\n PyObject *py_name_list = 0;\n PyObject *py_module = 0;\n PyObject *result = 0;\n \n py_module_name = PyString_FromString(module_name);\n if (!py_module_name)\n goto bad;\n py_class_name = PyString_FromString(class_name);\n if (!py_class_name)\n goto bad;\n py_name_list = PyList_New(1);\n if (!py_name_list)\n goto bad;\n Py_INCREF(py_class_name);\n if (PyList_SetItem(py_name_list, 0, py_class_name) < 0)\n goto bad;\n py_module = __Pyx_Import(py_module_name, py_name_list);\n if (!py_module)\n goto bad;\n result = PyObject_GetAttr(py_module, py_class_name);\n if (!result)\n goto bad;\n if (!PyType_Check(result)) {\n PyErr_Format(PyExc_TypeError, \n \"%s.%s is not a type object\",\n module_name, class_name);\n goto bad;\n }\n if (((PyTypeObject *)result)->tp_basicsize != size) {\n PyErr_Format(PyExc_ValueError, \n \"%s.%s does not appear to be the correct type object\",\n module_name, class_name);\n goto bad;\n }\n goto done;\nbad:\n Py_XDECREF(result);\n result = 0;\ndone:\n Py_XDECREF(py_module_name);\n Py_XDECREF(py_class_name);\n Py_XDECREF(py_name_list);\n return (PyTypeObject *)result;\n}\n\n#include \"compile.h\"\n#include \"frameobject.h\"\n#include \"traceback.h\"\n\nstatic void __Pyx_AddTraceback(char *funcname) {\n PyObject *py_srcfile = 0;\n PyObject *py_funcname = 0;\n PyObject *py_globals = 0;\n PyObject *empty_tuple = 0;\n PyObject *empty_string = 0;\n PyCodeObject *py_code = 0;\n PyFrameObject *py_frame = 0;\n \n py_srcfile = PyString_FromString(__pyx_filename);\n if (!py_srcfile) goto bad;\n py_funcname = PyString_FromString(funcname);\n if (!py_funcname) goto bad;\n py_globals = PyModule_GetDict(__pyx_m);\n if (!py_globals) goto bad;\n empty_tuple = PyTuple_New(0);\n if (!empty_tuple) goto bad;\n empty_string = PyString_FromString(\"\");\n if (!empty_string) goto bad;\n py_code = PyCode_New(\n 0, /*int argcount,*/\n 0, /*int nlocals,*/\n 0, /*int stacksize,*/\n 0, /*int flags,*/\n empty_string, /*PyObject *code,*/\n empty_tuple, /*PyObject *consts,*/\n empty_tuple, /*PyObject *names,*/\n empty_tuple, /*PyObject *varnames,*/\n empty_tuple, /*PyObject *freevars,*/\n empty_tuple, /*PyObject *cellvars,*/\n py_srcfile, /*PyObject *filename,*/\n py_funcname, /*PyObject *name,*/\n __pyx_lineno, /*int firstlineno,*/\n empty_string /*PyObject *lnotab*/\n );\n if (!py_code) goto bad;\n py_frame = PyFrame_New(\n PyThreadState_Get(), /*PyThreadState *tstate,*/\n py_code, /*PyCodeObject *code,*/\n py_globals, /*PyObject *globals,*/\n 0 /*PyObject *locals*/\n );\n if (!py_frame) goto bad;\n py_frame->f_lineno = __pyx_lineno;\n PyTraceBack_Here(py_frame);\nbad:\n Py_XDECREF(py_srcfile);\n Py_XDECREF(py_funcname);\n Py_XDECREF(empty_tuple);\n Py_XDECREF(empty_string);\n Py_XDECREF(py_code);\n Py_XDECREF(py_frame);\n}\n", "source_code_before": "/* Generated by Pyrex 0.9.3.1 on Fri Oct 7 02:05:13 2005 */\n\n#include \"Python.h\"\n#include \"structmember.h\"\n#ifndef PY_LONG_LONG\n #define PY_LONG_LONG LONG_LONG\n#endif\n#include \"string.h\"\n#include \"math.h\"\n#include \"scipy/arrayobject.h\"\n#include \"randomkit.h\"\n#include \"distributions.h\"\n#include \"initarray.h\"\n\n\ntypedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/\ntypedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/\nstatic PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/\nstatic int __Pyx_EndUnpack(PyObject *, int); /*proto*/\nstatic int __Pyx_PrintItem(PyObject *); /*proto*/\nstatic int __Pyx_PrintNewline(void); /*proto*/\nstatic void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/\nstatic void __Pyx_ReRaise(void); /*proto*/\nstatic PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/\nstatic PyObject *__Pyx_GetExcValue(void); /*proto*/\nstatic int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/\nstatic int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/\nstatic int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/\nstatic void __Pyx_WriteUnraisable(char *name); /*proto*/\nstatic void __Pyx_AddTraceback(char *funcname); /*proto*/\nstatic PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/\nstatic int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/\nstatic int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/\nstatic PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/\nstatic int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/\nstatic int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/\nstatic PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/\n\nstatic PyObject *__pyx_m;\nstatic PyObject *__pyx_b;\nstatic int __pyx_lineno;\nstatic char *__pyx_filename;\nstaticforward char **__pyx_f;\n\n/* Declarations from mtrand */\n\nstaticforward PyTypeObject __pyx_type_6mtrand_RandomState;\n\nstruct __pyx_obj_6mtrand_RandomState {\n PyObject_HEAD\n rk_state (*internal_state);\n};\n\nstatic PyTypeObject *__pyx_ptype_6mtrand_ArrayType = 0;\nstatic PyTypeObject *__pyx_ptype_6mtrand_RandomState = 0;\nstatic PyObject *__pyx_k2;\nstatic PyObject *__pyx_k3;\nstatic PyObject *__pyx_k4;\nstatic PyObject *__pyx_k5;\nstatic PyObject *__pyx_k6;\nstatic PyObject *__pyx_k7;\nstatic double __pyx_k8;\nstatic double __pyx_k9;\nstatic PyObject *__pyx_k10;\nstatic PyObject *__pyx_k11;\nstatic PyObject *__pyx_k12;\nstatic PyObject *__pyx_k13;\nstatic double __pyx_k14;\nstatic double __pyx_k15;\nstatic PyObject *__pyx_k16;\nstatic PyObject *__pyx_k17;\nstatic double __pyx_k18;\nstatic PyObject *__pyx_k19;\nstatic PyObject *__pyx_k20;\nstatic PyObject *__pyx_k21;\nstatic double __pyx_k22;\nstatic PyObject *__pyx_k23;\nstatic PyObject *__pyx_k24;\nstatic PyObject *__pyx_k25;\nstatic PyObject *__pyx_k26;\nstatic PyObject *__pyx_k27;\nstatic PyObject *__pyx_k28;\nstatic PyObject *__pyx_k29;\nstatic PyObject *__pyx_k30;\nstatic PyObject *__pyx_k31;\nstatic PyObject *__pyx_k32;\nstatic PyObject *__pyx_k33;\nstatic double __pyx_k34;\nstatic double __pyx_k35;\nstatic PyObject *__pyx_k36;\nstatic double __pyx_k37;\nstatic double __pyx_k38;\nstatic PyObject *__pyx_k39;\nstatic double __pyx_k40;\nstatic double __pyx_k41;\nstatic PyObject *__pyx_k42;\nstatic double __pyx_k43;\nstatic double __pyx_k44;\nstatic PyObject *__pyx_k45;\nstatic PyObject *__pyx_k46;\nstatic PyObject *__pyx_k47;\nstatic PyObject *__pyx_k48;\nstatic PyObject *__pyx_k49;\nstatic PyObject *__pyx_k50;\nstatic double __pyx_k51;\nstatic PyObject *__pyx_k52;\nstatic PyObject *__pyx_k53;\nstatic PyObject *__pyx_k54;\nstatic PyObject *__pyx_k55;\nstatic PyObject *__pyx_k56;\nstatic PyObject *__pyx_k57;\nstatic PyObject *__pyx_k58;\nstatic PyObject *(__pyx_f_6mtrand_cont0_array(rk_state (*),double ((*)(rk_state (*))),PyObject *)); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont1_array(rk_state (*),double ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont2_array(rk_state (*),double ((*)(rk_state (*),double ,double )),PyObject *,double ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_cont3_array(rk_state (*),double ((*)(rk_state (*),double ,double ,double )),PyObject *,double ,double ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_disc0_array(rk_state (*),long ((*)(rk_state (*))),PyObject *)); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discnp_array(rk_state (*),long ((*)(rk_state (*),long ,double )),PyObject *,long ,double )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discnmN_array(rk_state (*),long ((*)(rk_state (*),long ,long ,long )),PyObject *,long ,long ,long )); /*proto*/\nstatic PyObject *(__pyx_f_6mtrand_discd_array(rk_state (*),long ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/\nstatic double (__pyx_f_6mtrand_kahan_sum(double (*),long )); /*proto*/\n\n/* Implementation of mtrand */\n\n\nstatic PyObject *__pyx_n__sp;\nstatic PyObject *__pyx_n__rand;\nstatic PyObject *__pyx_n_get_state;\nstatic PyObject *__pyx_n_set_state;\nstatic PyObject *__pyx_n_random_sample;\nstatic PyObject *__pyx_n_randint;\nstatic PyObject *__pyx_n_bytes;\nstatic PyObject *__pyx_n_uniform;\nstatic PyObject *__pyx_n_rand;\nstatic PyObject *__pyx_n_randn;\nstatic PyObject *__pyx_n_random_integers;\nstatic PyObject *__pyx_n_standard_normal;\nstatic PyObject *__pyx_n_normal;\nstatic PyObject *__pyx_n_beta;\nstatic PyObject *__pyx_n_exponential;\nstatic PyObject *__pyx_n_standard_exponential;\nstatic PyObject *__pyx_n_standard_gamma;\nstatic PyObject *__pyx_n_gamma;\nstatic PyObject *__pyx_n_f;\nstatic PyObject *__pyx_n_noncentral_f;\nstatic PyObject *__pyx_n_chisquare;\nstatic PyObject *__pyx_n_noncentral_chisquare;\nstatic PyObject *__pyx_n_standard_cauchy;\nstatic PyObject *__pyx_n_standard_t;\nstatic PyObject *__pyx_n_vonmises;\nstatic PyObject *__pyx_n_pareto;\nstatic PyObject *__pyx_n_weibull;\nstatic PyObject *__pyx_n_power;\nstatic PyObject *__pyx_n_laplace;\nstatic PyObject *__pyx_n_gumbel;\nstatic PyObject *__pyx_n_logistic;\nstatic PyObject *__pyx_n_lognormal;\nstatic PyObject *__pyx_n_rayleigh;\nstatic PyObject *__pyx_n_wald;\nstatic PyObject *__pyx_n_triangular;\nstatic PyObject *__pyx_n_binomial;\nstatic PyObject *__pyx_n_negative_binomial;\nstatic PyObject *__pyx_n_poisson;\nstatic PyObject *__pyx_n_zipf;\nstatic PyObject *__pyx_n_geometric;\nstatic PyObject *__pyx_n_hypergeometric;\nstatic PyObject *__pyx_n_logseries;\nstatic PyObject *__pyx_n_multivariate_normal;\nstatic PyObject *__pyx_n_multinomial;\nstatic PyObject *__pyx_n_shuffle;\nstatic PyObject *__pyx_n_permutation;\nstatic PyObject *__pyx_n_scipy;\n\nstatic PyObject *__pyx_n_empty;\nstatic PyObject *__pyx_n_Float64;\n\nstatic PyObject *__pyx_f_6mtrand_cont0_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":124 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":125 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":127 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":128 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":129 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":130 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":131 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":132 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont0_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont1_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":140 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":141 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":143 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":144 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":145 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":146 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":147 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":148 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont1_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont2_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":157 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":158 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":160 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":161 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":162 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":163 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":164 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":165 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont2_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_cont3_array(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b,double __pyx_v_c) {\n double (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":175 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":176 */\n __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":178 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":179 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":180 */\n __pyx_v_array_data = ((double (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":181 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":182 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":183 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.cont3_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_Int;\n\nstatic PyObject *__pyx_f_6mtrand_disc0_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*))),PyObject *__pyx_v_size) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":191 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":192 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":194 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":195 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":196 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":197 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":198 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":199 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.disc0_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,double )),PyObject *__pyx_v_size,long __pyx_v_n,double __pyx_v_p) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":207 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":208 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":210 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":211 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":212 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":213 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":214 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":215 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discnp_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discnmN_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,long ,long )),PyObject *__pyx_v_size,long __pyx_v_n,long __pyx_v_m,long __pyx_v_N) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":224 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":225 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":227 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":228 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":229 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":230 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":231 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":232 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discnmN_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_discd_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) {\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":240 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":241 */\n __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":243 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":244 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":245 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":246 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":247 */\n (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);\n __pyx_L3:;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":248 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.discd_array\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic double __pyx_f_6mtrand_kahan_sum(double (*__pyx_v_darr),long __pyx_v_n) {\n double __pyx_v_c;\n double __pyx_v_y;\n double __pyx_v_t;\n double __pyx_v_sum;\n long __pyx_v_i;\n double __pyx_r;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":253 */\n __pyx_v_sum = (__pyx_v_darr[0]);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":254 */\n __pyx_v_c = 0.0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":255 */\n for (__pyx_v_i = 1; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":256 */\n __pyx_v_y = ((__pyx_v_darr[__pyx_v_i]) - __pyx_v_c);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":257 */\n __pyx_v_t = (__pyx_v_sum + __pyx_v_y);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":258 */\n __pyx_v_c = ((__pyx_v_t - __pyx_v_sum) - __pyx_v_y);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":259 */\n __pyx_v_sum = __pyx_v_t;\n __pyx_L2:;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":260 */\n __pyx_r = __pyx_v_sum;\n goto __pyx_L0;\n\n __pyx_r = 0;\n goto __pyx_L0;\n __pyx_L1:;\n __Pyx_WriteUnraisable(\"mtrand.kahan_sum\");\n __pyx_L0:;\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_seed;\n\nstatic int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic int __pyx_f_6mtrand_11RandomState___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_seed = 0;\n int __pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {\"seed\",0};\n __pyx_v_seed = __pyx_k2;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_seed)) return -1;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_seed);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":283 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state (*))PyMem_Malloc((sizeof(rk_state ))));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":285 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_seed);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n __pyx_r = 0;\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__init__\");\n __pyx_r = -1;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_seed);\n return __pyx_r;\n}\n\nstatic void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self); /*proto*/\nstatic void __pyx_f_6mtrand_11RandomState___dealloc__(PyObject *__pyx_v_self) {\n int __pyx_1;\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":288 */\n __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":289 */\n PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n goto __pyx_L0;\n __pyx_L1:;\n __Pyx_AddTraceback(\"mtrand.RandomState.__dealloc__\");\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n}\n\nstatic PyObject *__pyx_n_type;\nstatic PyObject *__pyx_n_int;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_seed[] = \"Seed the generator.\\n\\n seed(seed=None)\\n\\n seed can be an integer, an array (or other sequence) of integers of any\\n length, or None. If seed is None, then RandomState will try to read data\\n from /dev/urandom (or the Windows analogue) if available or seed from\\n the clock otherwise.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_seed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_seed = 0;\n rk_error __pyx_v_errcode;\n PyArrayObject *__pyx_v_obj;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n unsigned long __pyx_5;\n static char *__pyx_argnames[] = {\"seed\",0};\n __pyx_v_seed = __pyx_k3;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_seed)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_seed);\n __pyx_v_obj = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_obj);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":303 */\n __pyx_1 = __pyx_v_seed == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":304 */\n __pyx_v_errcode = rk_randomseed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n Py_INCREF(__pyx_v_seed);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_seed);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}\n __pyx_1 = __pyx_4 == __pyx_2;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":306 */\n __pyx_5 = PyLong_AsUnsignedLong(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; goto __pyx_L1;}\n rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":308 */\n __pyx_3 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_seed,PyArray_LONG,1,1)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_3;\n __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":309 */\n init_by_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,((unsigned long (*))__pyx_v_obj->data),(__pyx_v_obj->dimensions[0]));\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.seed\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_obj);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_seed);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_MT19937;\n\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_get_state[] = \"Return a tuple representing the internal state of the generator.\\n\\n get_state() -> (\\'MT19937\\', int key[624], int pos)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_get_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyArrayObject *__pyx_v_state;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n __pyx_v_state = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":318 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n __pyx_1 = 0;\n __pyx_4 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_INCREF(((PyObject *)__pyx_1));\n Py_DECREF(((PyObject *)__pyx_v_state));\n __pyx_v_state = ((PyObject *)__pyx_1);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":319 */\n memcpy(((void (*))__pyx_v_state->data),((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,(624 * (sizeof(long ))));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":320 */\n __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}\n Py_INCREF(__pyx_n_MT19937);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_n_MT19937);\n Py_INCREF(((PyObject *)__pyx_v_state));\n PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_state));\n PyTuple_SET_ITEM(__pyx_2, 2, __pyx_4);\n __pyx_4 = 0;\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.get_state\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_state);\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_ValueError;\n\nstatic PyObject *__pyx_k61p;\nstatic PyObject *__pyx_k62p;\n\nstatic char (__pyx_k61[]) = \"algorithm must be 'MT19937'\";\nstatic char (__pyx_k62[]) = \"state must be 624 longs\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_set_state[] = \"Set the state from a tuple.\\n \\n state = (\\'MT19937\\', int key[624], int pos)\\n \\n set_state(state)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_set_state(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_state = 0;\n PyArrayObject *__pyx_v_obj;\n int __pyx_v_pos;\n PyObject *__pyx_v_algorithm_name;\n PyObject *__pyx_v_key;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n int __pyx_3;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"state\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_state)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_state);\n __pyx_v_obj = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_obj);\n __pyx_v_algorithm_name = Py_None; Py_INCREF(__pyx_v_algorithm_name);\n __pyx_v_key = Py_None; Py_INCREF(__pyx_v_key);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":331 */\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_algorithm_name);\n __pyx_v_algorithm_name = __pyx_2;\n __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":332 */\n if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; goto __pyx_L1;}\n __pyx_3 = __pyx_3 != 0;\n if (__pyx_3) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":333 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_INCREF(__pyx_k61p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k61p);\n __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":334 */\n __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_v_key);\n __pyx_v_key = __pyx_2;\n __pyx_2 = 0;\n __pyx_4 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n __pyx_3 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_v_pos = __pyx_3;\n if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":335 */\n __pyx_4 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_key,PyArray_LONG,1,1)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_obj));\n __pyx_v_obj = __pyx_4;\n __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":336 */\n __pyx_3 = ((__pyx_v_obj->dimensions[0]) != 624);\n if (__pyx_3) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":337 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n Py_INCREF(__pyx_k62p);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k62p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":338 */\n memcpy(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key,((void (*))__pyx_v_obj->data),(624 * (sizeof(long ))));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":339 */\n ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.set_state\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_obj);\n Py_DECREF(__pyx_v_algorithm_name);\n Py_DECREF(__pyx_v_key);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_state);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":343 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__getstate__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_state = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n static char *__pyx_argnames[] = {\"state\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_state)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":346 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n Py_INCREF(__pyx_v_state);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_state);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.__setstate__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_state);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_random;\nstatic PyObject *__pyx_n___RandomState_ctor;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyObject *__pyx_f_6mtrand_11RandomState___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) return 0;\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":349 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_5);\n __pyx_1 = 0;\n __pyx_2 = 0;\n __pyx_5 = 0;\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.__reduce__\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_random_sample[] = \"Return random floats in the half-open interval [0.0, 1.0).\\n\\n random_sample(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_sample(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k4;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":357 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.random_sample\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_tomaxint[] = \"Returns random integers x such that 0 <= x <= sys.maxint.\\n\\n tomaxint(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_tomaxint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k5;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":364 */\n __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.tomaxint\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k63p;\n\nstatic char (__pyx_k63[]) = \"low >= high\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_randint[] = \"Return random integers x such that low <= x < high.\\n\\n randint(low, high=None, size=None) -> random values\\n\\n If high is None, then 0 <= x < low.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_low = 0;\n PyObject *__pyx_v_high = 0;\n PyObject *__pyx_v_size = 0;\n long __pyx_v_lo;\n long __pyx_v_hi;\n long __pyx_v_diff;\n long (*__pyx_v_array_data);\n PyArrayObject *__pyx_v_array;\n long __pyx_v_length;\n long __pyx_v_i;\n PyObject *__pyx_r;\n int __pyx_1;\n long __pyx_2;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_high = __pyx_k6;\n __pyx_v_size = __pyx_k7;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O|OO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_low);\n Py_INCREF(__pyx_v_high);\n Py_INCREF(__pyx_v_size);\n __pyx_v_array = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":379 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":380 */\n __pyx_v_lo = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":381 */\n __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":383 */\n __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}\n __pyx_v_lo = __pyx_2;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":384 */\n __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; goto __pyx_L1;}\n __pyx_v_hi = __pyx_2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":386 */\n __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":387 */\n __pyx_1 = (__pyx_v_diff < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":388 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n Py_INCREF(__pyx_k63p);\n PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k63p);\n __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __Pyx_Raise(__pyx_5, 0, 0);\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":390 */\n __pyx_1 = __pyx_v_size == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":391 */\n __pyx_3 = PyLong_FromUnsignedLong(rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}\n __pyx_r = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L0;\n goto __pyx_L4;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":393 */\n __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_INCREF(((PyObject *)__pyx_4));\n Py_DECREF(((PyObject *)__pyx_v_array));\n __pyx_v_array = ((PyObject *)__pyx_4);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":394 */\n __pyx_v_length = PyArray_SIZE(__pyx_v_array);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":395 */\n __pyx_v_array_data = ((long (*))__pyx_v_array->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":396 */\n for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":397 */\n (__pyx_v_array_data[__pyx_v_i]) = (__pyx_v_lo + rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state));\n __pyx_L5:;\n }\n __pyx_L6:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":398 */\n Py_INCREF(((PyObject *)__pyx_v_array));\n __pyx_r = ((PyObject *)__pyx_v_array);\n goto __pyx_L0;\n }\n __pyx_L4:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.randint\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_array);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_bytes[] = \"Return random bytes.\\n\\n bytes(length) -> str\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_bytes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n unsigned int __pyx_v_length;\n void (*__pyx_v_bytes);\n PyObject *__pyx_v_bytestring;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"length\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"i\", __pyx_argnames, &__pyx_v_length)) return 0;\n Py_INCREF(__pyx_v_self);\n __pyx_v_bytestring = Py_None; Py_INCREF(__pyx_v_bytestring);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":406 */\n __pyx_v_bytes = PyMem_Malloc(__pyx_v_length);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":407 */\n rk_fill(__pyx_v_bytes,__pyx_v_length,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":408 */\n __pyx_1 = PyString_FromString(((char (*))__pyx_v_bytes)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; goto __pyx_L1;}\n Py_DECREF(__pyx_v_bytestring);\n __pyx_v_bytestring = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":409 */\n PyMem_Free(__pyx_v_bytes);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":410 */\n Py_INCREF(__pyx_v_bytestring);\n __pyx_r = __pyx_v_bytestring;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.bytes\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_bytestring);\n Py_DECREF(__pyx_v_self);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_uniform[] = \"Uniform distribution over [low, high).\\n\\n uniform(low=0.0, high=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_low;\n double __pyx_v_high;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_low = __pyx_k8;\n __pyx_v_high = __pyx_k9;\n __pyx_v_size = __pyx_k10;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":417 */\n __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_low,(__pyx_v_high - __pyx_v_low)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.uniform\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_len;\nstatic PyObject *__pyx_n_size;\n\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_rand[] = \"Return an array of the given dimensions which is initialized to \\n random numbers from a uniform distribution in the range [0,1).\\n\\n randn(d0, d1, ..., dn) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_args = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {0};\n if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0) < 0) return 0;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) {\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n Py_XDECREF(__pyx_v_args);\n return 0;\n }\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":426 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; goto __pyx_L1;}\n __pyx_4 = __pyx_4 == 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":427 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":429 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n if (PyDict_SetItem(__pyx_1, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_r = __pyx_5;\n __pyx_5 = 0;\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.rand\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_XDECREF(__pyx_v_args);\n Py_DECREF(__pyx_v_self);\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_randn[] = \"Returns zero-mean, unit-variance Gaussian random numbers in an \\n array of shape (d0, d1, ..., dn).\\n\\n randn(d0, d1, ..., dn) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_randn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_args = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n static char *__pyx_argnames[] = {0};\n if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0) < 0) return 0;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"\", __pyx_argnames)) {\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n Py_XDECREF(__pyx_v_args);\n return 0;\n }\n Py_INCREF(__pyx_v_self);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":437 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}\n __pyx_4 = __pyx_4 == 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":438 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":440 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n Py_INCREF(__pyx_v_args);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_args);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n }\n __pyx_L2:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.randn\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_XDECREF(__pyx_v_args);\n Py_DECREF(__pyx_v_self);\n Py_XDECREF(__pyx_args);\n Py_XDECREF(__pyx_kwds);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_random_integers[] = \"Return random integers x such that low <= x <= high.\\n\\n random_integers(low, high=None, size=None) -> random values.\\n\\n If high is None, then 1 <= x <= low.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_random_integers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_low = 0;\n PyObject *__pyx_v_high = 0;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"low\",\"high\",\"size\",0};\n __pyx_v_high = __pyx_k11;\n __pyx_v_size = __pyx_k12;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O|OO\", __pyx_argnames, &__pyx_v_low, &__pyx_v_high, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_low);\n Py_INCREF(__pyx_v_high);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":449 */\n __pyx_1 = __pyx_v_high == Py_None;\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":450 */\n Py_INCREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n __pyx_v_high = __pyx_v_low;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":451 */\n __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; goto __pyx_L1;}\n Py_DECREF(__pyx_v_low);\n __pyx_v_low = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":452 */\n __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_INCREF(__pyx_v_low);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_low);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_size);\n __pyx_4 = 0;\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_r = __pyx_4;\n __pyx_4 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.random_integers\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_low);\n Py_DECREF(__pyx_v_high);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_normal[] = \"Standard Normal distribution (mean=0, stdev=1).\\n\\n standard_normal(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k13;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":460 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k65p;\n\nstatic char (__pyx_k65[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_normal[] = \"Normal distribution (mean=loc, stdev=scale).\\n\\n normal(loc=0.0, scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k14;\n __pyx_v_scale = __pyx_k15;\n __pyx_v_size = __pyx_k16;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":467 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":468 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n Py_INCREF(__pyx_k65p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k65p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":469 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k66p;\nstatic PyObject *__pyx_k67p;\n\nstatic char (__pyx_k66[]) = \"a <= 0\";\nstatic char (__pyx_k67[]) = \"b <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_beta[] = \"Beta distribution over [0, 1].\\n\\n beta(a, b, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n double __pyx_v_b;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"b\",\"size\",0};\n __pyx_v_size = __pyx_k17;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":476 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":477 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n Py_INCREF(__pyx_k66p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_b <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":479 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n Py_INCREF(__pyx_k67p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":480 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_a,__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.beta\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k68p;\n\nstatic char (__pyx_k68[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_exponential[] = \"Exponential distribution.\\n\\n exponential(scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"scale\",\"size\",0};\n __pyx_v_scale = __pyx_k18;\n __pyx_v_size = __pyx_k19;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":487 */\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":488 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n Py_INCREF(__pyx_k68p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":489 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.exponential\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_exponential[] = \"Standard exponential distribution (scale=1).\\n\\n standard_exponential(size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k20;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":496 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_exponential\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k69p;\n\nstatic char (__pyx_k69[]) = \"shape <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_gamma[] = \"Standard Gamma distribution.\\n\\n standard_gamma(shape, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_shape;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"shape\",\"size\",0};\n __pyx_v_size = __pyx_k21;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_shape, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":503 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":504 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n Py_INCREF(__pyx_k69p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":505 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_gamma\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k70p;\nstatic PyObject *__pyx_k71p;\n\nstatic char (__pyx_k70[]) = \"shape <= 0\";\nstatic char (__pyx_k71[]) = \"scale <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_gamma[] = \"Gamma distribution.\\n\\n gamma(shape, scale=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_shape;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"shape\",\"scale\",\"size\",0};\n __pyx_v_scale = __pyx_k22;\n __pyx_v_size = __pyx_k23;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|dO\", __pyx_argnames, &__pyx_v_shape, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":512 */\n __pyx_1 = (__pyx_v_shape <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":513 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n Py_INCREF(__pyx_k70p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_scale <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":515 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n Py_INCREF(__pyx_k71p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":516 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_shape,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.gamma\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k72p;\nstatic PyObject *__pyx_k73p;\n\nstatic char (__pyx_k72[]) = \"dfnum <= 0\";\nstatic char (__pyx_k73[]) = \"dfden <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_f[] = \"F distribution.\\n\\n f(dfnum, dfden, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_dfnum;\n double __pyx_v_dfden;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"dfnum\",\"dfden\",\"size\",0};\n __pyx_v_size = __pyx_k24;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":523 */\n __pyx_1 = (__pyx_v_dfnum <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":524 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n Py_INCREF(__pyx_k72p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":526 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n Py_INCREF(__pyx_k73p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":527 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.f\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k74p;\nstatic PyObject *__pyx_k75p;\nstatic PyObject *__pyx_k76p;\n\nstatic char (__pyx_k74[]) = \"dfnum <= 1\";\nstatic char (__pyx_k75[]) = \"dfden <= 0\";\nstatic char (__pyx_k76[]) = \"nonc < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_noncentral_f[] = \"Noncentral F distribution.\\n\\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_dfnum;\n double __pyx_v_dfden;\n double __pyx_v_nonc;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"dfnum\",\"dfden\",\"nonc\",\"size\",0};\n __pyx_v_size = __pyx_k25;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ddd|O\", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_nonc, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":534 */\n __pyx_1 = (__pyx_v_dfnum <= 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":535 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n Py_INCREF(__pyx_k74p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_dfden <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":537 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n Py_INCREF(__pyx_k75p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":539 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n Py_INCREF(__pyx_k76p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":540 */\n __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_dfnum,__pyx_v_dfden,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.noncentral_f\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k77p;\n\nstatic char (__pyx_k77[]) = \"df <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_chisquare[] = \"Chi^2 distribution.\\n\\n chisquare(df, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"size\",0};\n __pyx_v_size = __pyx_k26;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":548 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":549 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n Py_INCREF(__pyx_k77p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":550 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.chisquare\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k78p;\nstatic PyObject *__pyx_k79p;\n\nstatic char (__pyx_k78[]) = \"df <= 1\";\nstatic char (__pyx_k79[]) = \"nonc < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_noncentral_chisquare[] = \"Noncentral Chi^2 distribution.\\n\\n noncentral_chisquare(df, nonc, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n double __pyx_v_nonc;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"nonc\",\"size\",0};\n __pyx_v_size = __pyx_k27;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_nonc, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":557 */\n __pyx_1 = (__pyx_v_df <= 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":558 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n Py_INCREF(__pyx_k78p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nonc < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":560 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n Py_INCREF(__pyx_k79p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":561 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_df,__pyx_v_nonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.noncentral_chisquare\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_cauchy[] = \"Standard Cauchy with mode=0.\\n\\n standard_cauchy(size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_cauchy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n static char *__pyx_argnames[] = {\"size\",0};\n __pyx_v_size = __pyx_k28;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|O\", __pyx_argnames, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":569 */\n __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; goto __pyx_L1;}\n __pyx_r = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_cauchy\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k80p;\n\nstatic char (__pyx_k80[]) = \"df <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_standard_t[] = \"Standard Student\\'s t distribution with df degrees of freedom.\\n\\n standard_t(df, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_df;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"df\",\"size\",0};\n __pyx_v_size = __pyx_k29;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":576 */\n __pyx_1 = (__pyx_v_df <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":577 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n Py_INCREF(__pyx_k80p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":578 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_df); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.standard_t\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k81p;\n\nstatic char (__pyx_k81[]) = \"kappa < 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_vonmises[] = \"von Mises circular distribution with mode mu and dispersion parameter\\n kappa on [-pi, pi].\\n\\n vonmises(mu, kappa, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mu;\n double __pyx_v_kappa;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mu\",\"kappa\",\"size\",0};\n __pyx_v_size = __pyx_k30;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_mu, &__pyx_v_kappa, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":586 */\n __pyx_1 = (__pyx_v_kappa < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":587 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n Py_INCREF(__pyx_k81p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":588 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_mu,__pyx_v_kappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.vonmises\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k82p;\n\nstatic char (__pyx_k82[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_pareto[] = \"Pareto distribution.\\n\\n pareto(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k31;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":595 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":596 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n Py_INCREF(__pyx_k82p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":597 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.pareto\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k83p;\n\nstatic char (__pyx_k83[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_weibull[] = \"Weibull distribution.\\n\\n weibull(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k32;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":604 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":605 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n Py_INCREF(__pyx_k83p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":606 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.weibull\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k84p;\n\nstatic char (__pyx_k84[]) = \"a <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_power[] = \"Power distribution.\\n\\n power(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k33;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":613 */\n __pyx_1 = (__pyx_v_a <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":614 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n Py_INCREF(__pyx_k84p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":615 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.power\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k85p;\n\nstatic char (__pyx_k85[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_laplace[] = \"Laplace distribution.\\n \\n laplace(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k34;\n __pyx_v_scale = __pyx_k35;\n __pyx_v_size = __pyx_k36;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":622 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":623 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n Py_INCREF(__pyx_k85p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":624 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.laplace\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k86p;\n\nstatic char (__pyx_k86[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_gumbel[] = \"Gumbel distribution.\\n \\n gumbel(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k37;\n __pyx_v_scale = __pyx_k38;\n __pyx_v_size = __pyx_k39;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":631 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":632 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n Py_INCREF(__pyx_k86p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":633 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.gumbel\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k87p;\n\nstatic char (__pyx_k87[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_logistic[] = \"Logistic distribution.\\n \\n logistic(loc=0.0, scale=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_loc;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"loc\",\"scale\",\"size\",0};\n __pyx_v_loc = __pyx_k40;\n __pyx_v_scale = __pyx_k41;\n __pyx_v_size = __pyx_k42;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_loc, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":640 */\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":641 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n Py_INCREF(__pyx_k87p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":642 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_loc,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.logistic\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k88p;\n\nstatic char (__pyx_k88[]) = \"sigma <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_lognormal[] = \"Log-normal distribution.\\n \\n Note that the mean parameter is not the mean of this distribution, but \\n the underlying normal distribution.\\n \\n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\\n \\n lognormal(mean=0.0, sigma=1.0, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mean;\n double __pyx_v_sigma;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"sigma\",\"size\",0};\n __pyx_v_mean = __pyx_k43;\n __pyx_v_sigma = __pyx_k44;\n __pyx_v_size = __pyx_k45;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|ddO\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_sigma, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":654 */\n __pyx_1 = (__pyx_v_sigma <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":655 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n Py_INCREF(__pyx_k88p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":656 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_mean,__pyx_v_sigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.lognormal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k89p;\n\nstatic char (__pyx_k89[]) = \"mode <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_rayleigh[] = \"Rayleigh distribution.\\n \\n rayleigh(mode, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mode;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mode\",\"size\",0};\n __pyx_v_size = __pyx_k46;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_mode, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":663 */\n __pyx_1 = (__pyx_v_mode <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":664 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n Py_INCREF(__pyx_k89p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":665 */\n __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_mode); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.rayleigh\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k90p;\nstatic PyObject *__pyx_k91p;\n\nstatic char (__pyx_k90[]) = \"mean <= 0.0\";\nstatic char (__pyx_k91[]) = \"scale <= 0.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_wald[] = \"Wald (inverse Gaussian) distribution.\\n \\n wald(mean, scale, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_mean;\n double __pyx_v_scale;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"scale\",\"size\",0};\n __pyx_v_size = __pyx_k47;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"dd|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_scale, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":672 */\n __pyx_1 = (__pyx_v_mean <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":673 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n Py_INCREF(__pyx_k90p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_scale <= 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":675 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n Py_INCREF(__pyx_k91p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":676 */\n __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_mean,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.wald\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k92p;\nstatic PyObject *__pyx_k93p;\nstatic PyObject *__pyx_k94p;\n\nstatic char (__pyx_k92[]) = \"left > mode\";\nstatic char (__pyx_k93[]) = \"mode > right\";\nstatic char (__pyx_k94[]) = \"left == right\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_triangular[] = \"Triangular distribution starting at left, peaking at mode, and \\n ending at right (left <= mode <= right).\\n \\n triangular(left, mode, right, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_left;\n double __pyx_v_mode;\n double __pyx_v_right;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"left\",\"mode\",\"right\",\"size\",0};\n __pyx_v_size = __pyx_k48;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ddd|O\", __pyx_argnames, &__pyx_v_left, &__pyx_v_mode, &__pyx_v_right, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":684 */\n __pyx_1 = (__pyx_v_left > __pyx_v_mode);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":685 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n Py_INCREF(__pyx_k92p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_mode > __pyx_v_right);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":687 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n Py_INCREF(__pyx_k93p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_left == __pyx_v_right);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":689 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n Py_INCREF(__pyx_k94p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":690 */\n __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_left,__pyx_v_mode,__pyx_v_right); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.triangular\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k95p;\nstatic PyObject *__pyx_k96p;\nstatic PyObject *__pyx_k97p;\n\nstatic char (__pyx_k95[]) = \"n <= 0\";\nstatic char (__pyx_k96[]) = \"p < 0\";\nstatic char (__pyx_k97[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_binomial[] = \"Binomial distribution of n trials and p probability of success.\\n\\n binomial(n, p, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"n\",\"p\",\"size\",0};\n __pyx_v_size = __pyx_k49;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ld|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":699 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":700 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n Py_INCREF(__pyx_k95p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":702 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n Py_INCREF(__pyx_k96p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":704 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n Py_INCREF(__pyx_k97p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":705 */\n __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.binomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k98p;\nstatic PyObject *__pyx_k99p;\nstatic PyObject *__pyx_k100p;\n\nstatic char (__pyx_k98[]) = \"n <= 0\";\nstatic char (__pyx_k99[]) = \"p < 0\";\nstatic char (__pyx_k100[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_negative_binomial[] = \"Negative Binomial distribution.\\n\\n negative_binomial(n, p, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"n\",\"p\",\"size\",0};\n __pyx_v_size = __pyx_k50;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"ld|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":712 */\n __pyx_1 = (__pyx_v_n <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":713 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n Py_INCREF(__pyx_k98p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":715 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n Py_INCREF(__pyx_k99p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":717 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n Py_INCREF(__pyx_k100p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":718 */\n __pyx_2 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_n,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.negative_binomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k101p;\n\nstatic char (__pyx_k101[]) = \"lam <= 0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_poisson[] = \"Poisson distribution.\\n\\n poisson(lam=1.0, size=None) -> random values\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_lam;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"lam\",\"size\",0};\n __pyx_v_lam = __pyx_k51;\n __pyx_v_size = __pyx_k52;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_lam, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":726 */\n __pyx_1 = (__pyx_v_lam <= 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":727 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n Py_INCREF(__pyx_k101p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":728 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_lam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.poisson\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k102p;\n\nstatic char (__pyx_k102[]) = \"a <= 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_zipf[] = \"Zipf distribution.\\n \\n zipf(a, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_a;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"a\",\"size\",0};\n __pyx_v_size = __pyx_k53;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":735 */\n __pyx_1 = (__pyx_v_a <= 1.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":736 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n Py_INCREF(__pyx_k102p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":737 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.zipf\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k103p;\nstatic PyObject *__pyx_k104p;\n\nstatic char (__pyx_k103[]) = \"p < 0.0\";\nstatic char (__pyx_k104[]) = \"p > 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_geometric[] = \"Geometric distribution with p being the probability of \\\"success\\\" on\\n an individual trial.\\n \\n geometric(p, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"p\",\"size\",0};\n __pyx_v_size = __pyx_k54;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":745 */\n __pyx_1 = (__pyx_v_p < 0.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":746 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n Py_INCREF(__pyx_k103p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1.0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":748 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n Py_INCREF(__pyx_k104p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":749 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.geometric\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k105p;\nstatic PyObject *__pyx_k106p;\nstatic PyObject *__pyx_k107p;\nstatic PyObject *__pyx_k108p;\n\nstatic char (__pyx_k105[]) = \"ngood < 1\";\nstatic char (__pyx_k106[]) = \"nbad < 1\";\nstatic char (__pyx_k107[]) = \"ngood + nbad < nsample\";\nstatic char (__pyx_k108[]) = \"nsample < 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_hypergeometric[] = \"Hypergeometric distribution.\\n \\n Consider an urn with ngood \\\"good\\\" balls and nbad \\\"bad\\\" balls. If one \\n were to draw nsample balls from the urn without replacement, then \\n the hypergeometric distribution describes the distribution of \\\"good\\\" \\n balls in the sample.\\n \\n hypergeometric(ngood, nbad, nsample, size=None) \\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_ngood;\n long __pyx_v_nbad;\n long __pyx_v_nsample;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"ngood\",\"nbad\",\"nsample\",\"size\",0};\n __pyx_v_size = __pyx_k55;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lll|O\", __pyx_argnames, &__pyx_v_ngood, &__pyx_v_nbad, &__pyx_v_nsample, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":761 */\n __pyx_1 = (__pyx_v_ngood < 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":762 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n Py_INCREF(__pyx_k105p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nbad < 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":764 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n Py_INCREF(__pyx_k106p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = ((__pyx_v_ngood + __pyx_v_nbad) < __pyx_v_nsample);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":766 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n Py_INCREF(__pyx_k107p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_nsample < 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":768 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n Py_INCREF(__pyx_k108p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k108p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":769 */\n __pyx_2 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ngood,__pyx_v_nbad,__pyx_v_nsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.hypergeometric\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_k109p;\nstatic PyObject *__pyx_k110p;\n\nstatic char (__pyx_k109[]) = \"p < 0\";\nstatic char (__pyx_k110[]) = \"p > 1\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_logseries[] = \"Logarithmic series distribution.\\n \\n logseries(p, size=None)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n double __pyx_v_p;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_r;\n int __pyx_1;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n PyObject *__pyx_4 = 0;\n static char *__pyx_argnames[] = {\"p\",\"size\",0};\n __pyx_v_size = __pyx_k56;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_size);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":777 */\n __pyx_1 = (__pyx_v_p < 0);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":778 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n Py_INCREF(__pyx_k109p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_1 = (__pyx_v_p > 1);\n if (__pyx_1) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":780 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n Py_INCREF(__pyx_k110p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k110p);\n __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_4, 0, 0);\n Py_DECREF(__pyx_4); __pyx_4 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":781 */\n __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; goto __pyx_L1;}\n __pyx_r = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_4);\n __Pyx_AddTraceback(\"mtrand.RandomState.logseries\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_array;\nstatic PyObject *__pyx_n_shape;\nstatic PyObject *__pyx_n_ArgumentError;\nstatic PyObject *__pyx_n_isinstance;\nstatic PyObject *__pyx_n_list;\nstatic PyObject *__pyx_n_append;\nstatic PyObject *__pyx_n_multiply;\nstatic PyObject *__pyx_n_reduce;\nstatic PyObject *__pyx_n_linalg;\nstatic PyObject *__pyx_n_singular_value_decomposition;\nstatic PyObject *__pyx_n_matrixmultiply;\nstatic PyObject *__pyx_n_sqrt;\nstatic PyObject *__pyx_n_add;\nstatic PyObject *__pyx_n_tuple;\n\nstatic PyObject *__pyx_k111p;\nstatic PyObject *__pyx_k112p;\nstatic PyObject *__pyx_k113p;\n\nstatic char (__pyx_k111[]) = \"mean must be 1 dimensional\";\nstatic char (__pyx_k112[]) = \"cov must be 2 dimensional and square\";\nstatic char (__pyx_k113[]) = \"mean and cov must have same length\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_multivariate_normal[] = \"Return an array containing multivariate normally distributed random numbers\\n with specified mean and covariance.\\n\\n multivariate_normal(mean, cov) -> random values\\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\\n\\n mean must be a 1 dimensional array. cov must be a square two dimensional\\n array with the same number of rows and columns as mean has elements.\\n\\n The first form returns a single 1-D array containing a multivariate\\n normal.\\n\\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\\n normal.\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_mean = 0;\n PyObject *__pyx_v_cov = 0;\n PyObject *__pyx_v_size = 0;\n PyObject *__pyx_v_shape;\n PyObject *__pyx_v_final_shape;\n PyObject *__pyx_v_x;\n PyObject *__pyx_v_u;\n PyObject *__pyx_v_s;\n PyObject *__pyx_v_v;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n PyObject *__pyx_5 = 0;\n static char *__pyx_argnames[] = {\"mean\",\"cov\",\"size\",0};\n __pyx_v_size = __pyx_k57;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"OO|O\", __pyx_argnames, &__pyx_v_mean, &__pyx_v_cov, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_mean);\n Py_INCREF(__pyx_v_cov);\n Py_INCREF(__pyx_v_size);\n __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape);\n __pyx_v_final_shape = Py_None; Py_INCREF(__pyx_v_final_shape);\n __pyx_v_x = Py_None; Py_INCREF(__pyx_v_x);\n __pyx_v_u = Py_None; Py_INCREF(__pyx_v_u);\n __pyx_v_s = Py_None; Py_INCREF(__pyx_v_s);\n __pyx_v_v = Py_None; Py_INCREF(__pyx_v_v);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":802 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_INCREF(__pyx_v_mean);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_mean);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_mean);\n __pyx_v_mean = __pyx_3;\n __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":803 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_INCREF(__pyx_v_cov);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_cov);\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_cov);\n __pyx_v_cov = __pyx_2;\n __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":804 */\n __pyx_4 = __pyx_v_size == Py_None;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":805 */\n __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":807 */\n Py_INCREF(__pyx_v_size);\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_v_size;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":808 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);\n __pyx_2 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":809 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n Py_INCREF(__pyx_k111p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k111p);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_3, 0, 0);\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}\n goto __pyx_L3;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":810 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n __pyx_2 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (!__pyx_4) {\n __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n }\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":811 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_INCREF(__pyx_k112p);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);\n __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __Pyx_Raise(__pyx_1, 0, 0);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}\n goto __pyx_L4;\n }\n __pyx_L4:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":812 */\n __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}\n __pyx_4 = __pyx_4 != 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":813 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ArgumentError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n Py_INCREF(__pyx_k113p);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k113p);\n __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __Pyx_Raise(__pyx_2, 0, 0);\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}\n goto __pyx_L5;\n }\n __pyx_L5:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":815 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_5, 1, __pyx_1);\n __pyx_1 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":816 */\n __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyList_SET_ITEM(__pyx_1, 0, __pyx_v_shape);\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_1;\n __pyx_1 = 0;\n goto __pyx_L6;\n }\n __pyx_L6:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":817 */\n __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);\n __pyx_5 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_final_shape);\n __pyx_v_final_shape = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":818 */\n __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":822 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);\n __pyx_3 = 0;\n __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_x);\n __pyx_v_x = __pyx_5;\n __pyx_5 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":823 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_final_shape);\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);\n PyTuple_SET_ITEM(__pyx_1, 1, __pyx_5);\n __pyx_3 = 0;\n __pyx_5 = 0;\n if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":833 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_linalg); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_singular_value_decomposition); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_INCREF(__pyx_v_cov);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_cov);\n __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_u);\n __pyx_v_u = __pyx_3;\n __pyx_3 = 0;\n __pyx_5 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_s);\n __pyx_v_s = __pyx_5;\n __pyx_5 = 0;\n __pyx_1 = __Pyx_UnpackItem(__pyx_2, 2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_v_v);\n __pyx_v_v = __pyx_1;\n __pyx_1 = 0;\n if (__Pyx_EndUnpack(__pyx_2, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":834 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_matrixmultiply); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_sqrt); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_INCREF(__pyx_v_s);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_s);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyNumber_Multiply(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n Py_INCREF(__pyx_v_v);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_v);\n __pyx_2 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_x);\n __pyx_v_x = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":837 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_INCREF(__pyx_v_mean);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_mean);\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_x);\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_x);\n __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":838 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_INCREF(__pyx_v_final_shape);\n PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);\n __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_5); __pyx_5 = 0;\n if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":839 */\n Py_INCREF(__pyx_v_x);\n __pyx_r = __pyx_v_x;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n Py_XDECREF(__pyx_5);\n __Pyx_AddTraceback(\"mtrand.RandomState.multivariate_normal\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_shape);\n Py_DECREF(__pyx_v_final_shape);\n Py_DECREF(__pyx_v_x);\n Py_DECREF(__pyx_v_u);\n Py_DECREF(__pyx_v_s);\n Py_DECREF(__pyx_v_v);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_mean);\n Py_DECREF(__pyx_v_cov);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_zeros;\n\nstatic PyObject *__pyx_k114p;\n\nstatic char (__pyx_k114[]) = \"sum(pvals) > 1.0\";\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_multinomial[] = \"Multinomial distribution.\\n \\n multinomial(n, pvals, size=None) -> random values\\n\\n pvals is a sequence of probabilities that should sum to 1 (however, the\\n last element is always assumed to account for the remaining probability\\n as long as sum(pvals[:-1]) <= 1).\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n long __pyx_v_n;\n PyObject *__pyx_v_pvals = 0;\n PyObject *__pyx_v_size = 0;\n long __pyx_v_d;\n PyArrayObject *__pyx_v_parr;\n PyArrayObject *__pyx_v_mnarr;\n double (*__pyx_v_pix);\n long (*__pyx_v_mnix);\n long __pyx_v_i;\n long __pyx_v_j;\n long __pyx_v_dn;\n double __pyx_v_Sum;\n double __pyx_v_prob;\n PyObject *__pyx_v_shape;\n PyObject *__pyx_v_multin;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n long __pyx_4;\n int __pyx_5;\n static char *__pyx_argnames[] = {\"n\",\"pvals\",\"size\",0};\n __pyx_v_size = __pyx_k58;\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"lO|O\", __pyx_argnames, &__pyx_v_n, &__pyx_v_pvals, &__pyx_v_size)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_pvals);\n Py_INCREF(__pyx_v_size);\n __pyx_v_parr = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_parr);\n __pyx_v_mnarr = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_mnarr);\n __pyx_v_shape = Py_None; Py_INCREF(__pyx_v_shape);\n __pyx_v_multin = Py_None; Py_INCREF(__pyx_v_multin);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":857 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_INCREF(__pyx_v_pvals);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_pvals);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_v_d = __pyx_4;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":858 */\n __pyx_1 = ((PyObject *)PyArray_ContiguousFromObject(__pyx_v_pvals,PyArray_DOUBLE,1,1)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; goto __pyx_L1;}\n Py_DECREF(((PyObject *)__pyx_v_parr));\n __pyx_v_parr = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":859 */\n __pyx_v_pix = ((double (*))__pyx_v_parr->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":861 */\n __pyx_5 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix,(__pyx_v_d - 1)) > 1.0);\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":862 */\n __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n Py_INCREF(__pyx_k114p);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k114p);\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __Pyx_Raise(__pyx_1, 0, 0);\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}\n goto __pyx_L2;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":864 */\n __pyx_5 = __pyx_v_size == Py_None;\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":865 */\n __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);\n __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L3;\n }\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}\n __pyx_5 = __pyx_3 == __pyx_1;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":867 */\n __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}\n Py_INCREF(__pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);\n __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n goto __pyx_L3;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":869 */\n __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);\n __pyx_1 = 0;\n __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_shape);\n __pyx_v_shape = __pyx_3;\n __pyx_3 = 0;\n }\n __pyx_L3:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":871 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_Int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_INCREF(__pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_shape);\n PyTuple_SET_ITEM(__pyx_3, 1, __pyx_1);\n __pyx_1 = 0;\n __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_v_multin);\n __pyx_v_multin = __pyx_1;\n __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":872 */\n Py_INCREF(((PyObject *)__pyx_v_multin));\n Py_DECREF(((PyObject *)__pyx_v_mnarr));\n __pyx_v_mnarr = ((PyObject *)__pyx_v_multin);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":873 */\n __pyx_v_mnix = ((long (*))__pyx_v_mnarr->data);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":874 */\n __pyx_v_i = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":875 */\n while (1) {\n __pyx_L4:;\n __pyx_5 = (__pyx_v_i < PyArray_SIZE(__pyx_v_mnarr));\n if (!__pyx_5) break;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":876 */\n __pyx_v_Sum = 1.0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":877 */\n __pyx_v_dn = __pyx_v_n;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":878 */\n __pyx_4 = (__pyx_v_d - 1);\n for (__pyx_v_j = 0; __pyx_v_j < __pyx_4; ++__pyx_v_j) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":879 */\n (__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));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":880 */\n __pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]));\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":881 */\n __pyx_5 = (__pyx_v_dn <= 0);\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":882 */\n goto __pyx_L7;\n goto __pyx_L8;\n }\n __pyx_L8:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":883 */\n __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j]));\n __pyx_L6:;\n }\n __pyx_L7:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":884 */\n __pyx_5 = (__pyx_v_dn > 0);\n if (__pyx_5) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":885 */\n (__pyx_v_mnix[((__pyx_v_i + __pyx_v_d) - 1)]) = __pyx_v_dn;\n goto __pyx_L9;\n }\n __pyx_L9:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":887 */\n __pyx_v_i = (__pyx_v_i + __pyx_v_d);\n }\n __pyx_L5:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":889 */\n Py_INCREF(__pyx_v_multin);\n __pyx_r = __pyx_v_multin;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.multinomial\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_parr);\n Py_DECREF(__pyx_v_mnarr);\n Py_DECREF(__pyx_v_shape);\n Py_DECREF(__pyx_v_multin);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_pvals);\n Py_DECREF(__pyx_v_size);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_shuffle[] = \"Modify a sequence in-place by shuffling its contents.\\n \\n shuffle(x)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_shuffle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_x = 0;\n long __pyx_v_i;\n long __pyx_v_j;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n long __pyx_4;\n int __pyx_5;\n static char *__pyx_argnames[] = {\"x\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_x)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":900 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_v_i = __pyx_4;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":901 */\n while (1) {\n __pyx_L2:;\n __pyx_5 = (__pyx_v_i > 0);\n if (!__pyx_5) break;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":902 */\n __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":903 */\n __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":904 */\n __pyx_v_i = (__pyx_v_i - 1);\n }\n __pyx_L3:;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.shuffle\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_x);\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_n_arange;\n\nstatic PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic char __pyx_doc_6mtrand_11RandomState_permutation[] = \"Given an integer, return a shuffled sequence of integers >= 0 and \\n < x; given a sequence, return a shuffled array copy.\\n\\n permutation(x)\\n \";\nstatic PyObject *__pyx_f_6mtrand_11RandomState_permutation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyObject *__pyx_v_x = 0;\n PyObject *__pyx_v_arr;\n PyObject *__pyx_r;\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n PyObject *__pyx_3 = 0;\n int __pyx_4;\n static char *__pyx_argnames[] = {\"x\",0};\n if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"O\", __pyx_argnames, &__pyx_v_x)) return 0;\n Py_INCREF(__pyx_v_self);\n Py_INCREF(__pyx_v_x);\n __pyx_v_arr = Py_None; Py_INCREF(__pyx_v_arr);\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":912 */\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}\n __pyx_4 = __pyx_3 == __pyx_1;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (__pyx_4) {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":913 */\n __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_arange); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x);\n __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_v_arr);\n __pyx_v_arr = __pyx_2;\n __pyx_2 = 0;\n goto __pyx_L2;\n }\n /*else*/ {\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":915 */\n __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_INCREF(__pyx_v_x);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_v_arr);\n __pyx_v_arr = __pyx_3;\n __pyx_3 = 0;\n }\n __pyx_L2:;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":916 */\n __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_INCREF(__pyx_v_arr);\n PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_arr);\n __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n Py_DECREF(__pyx_3); __pyx_3 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":917 */\n Py_INCREF(__pyx_v_arr);\n __pyx_r = __pyx_v_arr;\n goto __pyx_L0;\n\n __pyx_r = Py_None; Py_INCREF(__pyx_r);\n goto __pyx_L0;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n Py_XDECREF(__pyx_3);\n __Pyx_AddTraceback(\"mtrand.RandomState.permutation\");\n __pyx_r = 0;\n __pyx_L0:;\n Py_DECREF(__pyx_v_arr);\n Py_DECREF(__pyx_v_self);\n Py_DECREF(__pyx_v_x);\n return __pyx_r;\n}\n\nstatic __Pyx_InternTabEntry __pyx_intern_tab[] = {\n {&__pyx_n_ArgumentError, \"ArgumentError\"},\n {&__pyx_n_Float64, \"Float64\"},\n {&__pyx_n_Int, \"Int\"},\n {&__pyx_n_MT19937, \"MT19937\"},\n {&__pyx_n_ValueError, \"ValueError\"},\n {&__pyx_n___RandomState_ctor, \"__RandomState_ctor\"},\n {&__pyx_n__rand, \"_rand\"},\n {&__pyx_n__sp, \"_sp\"},\n {&__pyx_n_add, \"add\"},\n {&__pyx_n_append, \"append\"},\n {&__pyx_n_arange, \"arange\"},\n {&__pyx_n_array, \"array\"},\n {&__pyx_n_beta, \"beta\"},\n {&__pyx_n_binomial, \"binomial\"},\n {&__pyx_n_bytes, \"bytes\"},\n {&__pyx_n_chisquare, \"chisquare\"},\n {&__pyx_n_empty, \"empty\"},\n {&__pyx_n_exponential, \"exponential\"},\n {&__pyx_n_f, \"f\"},\n {&__pyx_n_gamma, \"gamma\"},\n {&__pyx_n_geometric, \"geometric\"},\n {&__pyx_n_get_state, \"get_state\"},\n {&__pyx_n_gumbel, \"gumbel\"},\n {&__pyx_n_hypergeometric, \"hypergeometric\"},\n {&__pyx_n_int, \"int\"},\n {&__pyx_n_isinstance, \"isinstance\"},\n {&__pyx_n_laplace, \"laplace\"},\n {&__pyx_n_len, \"len\"},\n {&__pyx_n_linalg, \"linalg\"},\n {&__pyx_n_list, \"list\"},\n {&__pyx_n_logistic, \"logistic\"},\n {&__pyx_n_lognormal, \"lognormal\"},\n {&__pyx_n_logseries, \"logseries\"},\n {&__pyx_n_matrixmultiply, \"matrixmultiply\"},\n {&__pyx_n_multinomial, \"multinomial\"},\n {&__pyx_n_multiply, \"multiply\"},\n {&__pyx_n_multivariate_normal, \"multivariate_normal\"},\n {&__pyx_n_negative_binomial, \"negative_binomial\"},\n {&__pyx_n_noncentral_chisquare, \"noncentral_chisquare\"},\n {&__pyx_n_noncentral_f, \"noncentral_f\"},\n {&__pyx_n_normal, \"normal\"},\n {&__pyx_n_pareto, \"pareto\"},\n {&__pyx_n_permutation, \"permutation\"},\n {&__pyx_n_poisson, \"poisson\"},\n {&__pyx_n_power, \"power\"},\n {&__pyx_n_rand, \"rand\"},\n {&__pyx_n_randint, \"randint\"},\n {&__pyx_n_randn, \"randn\"},\n {&__pyx_n_random, \"random\"},\n {&__pyx_n_random_integers, \"random_integers\"},\n {&__pyx_n_random_sample, \"random_sample\"},\n {&__pyx_n_rayleigh, \"rayleigh\"},\n {&__pyx_n_reduce, \"reduce\"},\n {&__pyx_n_scipy, \"scipy\"},\n {&__pyx_n_seed, \"seed\"},\n {&__pyx_n_set_state, \"set_state\"},\n {&__pyx_n_shape, \"shape\"},\n {&__pyx_n_shuffle, \"shuffle\"},\n {&__pyx_n_singular_value_decomposition, \"singular_value_decomposition\"},\n {&__pyx_n_size, \"size\"},\n {&__pyx_n_sqrt, \"sqrt\"},\n {&__pyx_n_standard_cauchy, \"standard_cauchy\"},\n {&__pyx_n_standard_exponential, \"standard_exponential\"},\n {&__pyx_n_standard_gamma, \"standard_gamma\"},\n {&__pyx_n_standard_normal, \"standard_normal\"},\n {&__pyx_n_standard_t, \"standard_t\"},\n {&__pyx_n_triangular, \"triangular\"},\n {&__pyx_n_tuple, \"tuple\"},\n {&__pyx_n_type, \"type\"},\n {&__pyx_n_uniform, \"uniform\"},\n {&__pyx_n_vonmises, \"vonmises\"},\n {&__pyx_n_wald, \"wald\"},\n {&__pyx_n_weibull, \"weibull\"},\n {&__pyx_n_zeros, \"zeros\"},\n {&__pyx_n_zipf, \"zipf\"},\n {0, 0}\n};\n\nstatic __Pyx_StringTabEntry __pyx_string_tab[] = {\n {&__pyx_k61p, __pyx_k61, sizeof(__pyx_k61)},\n {&__pyx_k62p, __pyx_k62, sizeof(__pyx_k62)},\n {&__pyx_k63p, __pyx_k63, sizeof(__pyx_k63)},\n {&__pyx_k65p, __pyx_k65, sizeof(__pyx_k65)},\n {&__pyx_k66p, __pyx_k66, sizeof(__pyx_k66)},\n {&__pyx_k67p, __pyx_k67, sizeof(__pyx_k67)},\n {&__pyx_k68p, __pyx_k68, sizeof(__pyx_k68)},\n {&__pyx_k69p, __pyx_k69, sizeof(__pyx_k69)},\n {&__pyx_k70p, __pyx_k70, sizeof(__pyx_k70)},\n {&__pyx_k71p, __pyx_k71, sizeof(__pyx_k71)},\n {&__pyx_k72p, __pyx_k72, sizeof(__pyx_k72)},\n {&__pyx_k73p, __pyx_k73, sizeof(__pyx_k73)},\n {&__pyx_k74p, __pyx_k74, sizeof(__pyx_k74)},\n {&__pyx_k75p, __pyx_k75, sizeof(__pyx_k75)},\n {&__pyx_k76p, __pyx_k76, sizeof(__pyx_k76)},\n {&__pyx_k77p, __pyx_k77, sizeof(__pyx_k77)},\n {&__pyx_k78p, __pyx_k78, sizeof(__pyx_k78)},\n {&__pyx_k79p, __pyx_k79, sizeof(__pyx_k79)},\n {&__pyx_k80p, __pyx_k80, sizeof(__pyx_k80)},\n {&__pyx_k81p, __pyx_k81, sizeof(__pyx_k81)},\n {&__pyx_k82p, __pyx_k82, sizeof(__pyx_k82)},\n {&__pyx_k83p, __pyx_k83, sizeof(__pyx_k83)},\n {&__pyx_k84p, __pyx_k84, sizeof(__pyx_k84)},\n {&__pyx_k85p, __pyx_k85, sizeof(__pyx_k85)},\n {&__pyx_k86p, __pyx_k86, sizeof(__pyx_k86)},\n {&__pyx_k87p, __pyx_k87, sizeof(__pyx_k87)},\n {&__pyx_k88p, __pyx_k88, sizeof(__pyx_k88)},\n {&__pyx_k89p, __pyx_k89, sizeof(__pyx_k89)},\n {&__pyx_k90p, __pyx_k90, sizeof(__pyx_k90)},\n {&__pyx_k91p, __pyx_k91, sizeof(__pyx_k91)},\n {&__pyx_k92p, __pyx_k92, sizeof(__pyx_k92)},\n {&__pyx_k93p, __pyx_k93, sizeof(__pyx_k93)},\n {&__pyx_k94p, __pyx_k94, sizeof(__pyx_k94)},\n {&__pyx_k95p, __pyx_k95, sizeof(__pyx_k95)},\n {&__pyx_k96p, __pyx_k96, sizeof(__pyx_k96)},\n {&__pyx_k97p, __pyx_k97, sizeof(__pyx_k97)},\n {&__pyx_k98p, __pyx_k98, sizeof(__pyx_k98)},\n {&__pyx_k99p, __pyx_k99, sizeof(__pyx_k99)},\n {&__pyx_k100p, __pyx_k100, sizeof(__pyx_k100)},\n {&__pyx_k101p, __pyx_k101, sizeof(__pyx_k101)},\n {&__pyx_k102p, __pyx_k102, sizeof(__pyx_k102)},\n {&__pyx_k103p, __pyx_k103, sizeof(__pyx_k103)},\n {&__pyx_k104p, __pyx_k104, sizeof(__pyx_k104)},\n {&__pyx_k105p, __pyx_k105, sizeof(__pyx_k105)},\n {&__pyx_k106p, __pyx_k106, sizeof(__pyx_k106)},\n {&__pyx_k107p, __pyx_k107, sizeof(__pyx_k107)},\n {&__pyx_k108p, __pyx_k108, sizeof(__pyx_k108)},\n {&__pyx_k109p, __pyx_k109, sizeof(__pyx_k109)},\n {&__pyx_k110p, __pyx_k110, sizeof(__pyx_k110)},\n {&__pyx_k111p, __pyx_k111, sizeof(__pyx_k111)},\n {&__pyx_k112p, __pyx_k112, sizeof(__pyx_k112)},\n {&__pyx_k113p, __pyx_k113, sizeof(__pyx_k113)},\n {&__pyx_k114p, __pyx_k114, sizeof(__pyx_k114)},\n {0, 0, 0}\n};\n\nstatic PyObject *__pyx_tp_new_6mtrand_RandomState(PyTypeObject *t, PyObject *a, PyObject *k) {\n PyObject *o = (*t->tp_alloc)(t, 0);\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return o;\n}\n\nstatic void __pyx_tp_dealloc_6mtrand_RandomState(PyObject *o) {\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n {\n PyObject *etype, *eval, *etb;\n PyErr_Fetch(&etype, &eval, &etb);\n ++o->ob_refcnt;\n __pyx_f_6mtrand_11RandomState___dealloc__(o);\n if (PyErr_Occurred()) PyErr_WriteUnraisable(o);\n --o->ob_refcnt;\n PyErr_Restore(etype, eval, etb);\n }\n (*o->ob_type->tp_free)(o);\n}\n\nstatic int __pyx_tp_traverse_6mtrand_RandomState(PyObject *o, visitproc v, void *a) {\n int e;\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return 0;\n}\n\nstatic int __pyx_tp_clear_6mtrand_RandomState(PyObject *o) {\n struct __pyx_obj_6mtrand_RandomState *p = (struct __pyx_obj_6mtrand_RandomState *)o;\n return 0;\n}\n\nstatic struct PyMethodDef __pyx_methods_6mtrand_RandomState[] = {\n {\"seed\", (PyCFunction)__pyx_f_6mtrand_11RandomState_seed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_seed},\n {\"get_state\", (PyCFunction)__pyx_f_6mtrand_11RandomState_get_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_get_state},\n {\"set_state\", (PyCFunction)__pyx_f_6mtrand_11RandomState_set_state, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_set_state},\n {\"__getstate__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___getstate__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"__setstate__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___setstate__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"__reduce__\", (PyCFunction)__pyx_f_6mtrand_11RandomState___reduce__, METH_VARARGS|METH_KEYWORDS, 0},\n {\"random_sample\", (PyCFunction)__pyx_f_6mtrand_11RandomState_random_sample, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_random_sample},\n {\"tomaxint\", (PyCFunction)__pyx_f_6mtrand_11RandomState_tomaxint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_tomaxint},\n {\"randint\", (PyCFunction)__pyx_f_6mtrand_11RandomState_randint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_randint},\n {\"bytes\", (PyCFunction)__pyx_f_6mtrand_11RandomState_bytes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_bytes},\n {\"uniform\", (PyCFunction)__pyx_f_6mtrand_11RandomState_uniform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_uniform},\n {\"rand\", (PyCFunction)__pyx_f_6mtrand_11RandomState_rand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_rand},\n {\"randn\", (PyCFunction)__pyx_f_6mtrand_11RandomState_randn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_randn},\n {\"random_integers\", (PyCFunction)__pyx_f_6mtrand_11RandomState_random_integers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_random_integers},\n {\"standard_normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_normal},\n {\"normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_normal},\n {\"beta\", (PyCFunction)__pyx_f_6mtrand_11RandomState_beta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_beta},\n {\"exponential\", (PyCFunction)__pyx_f_6mtrand_11RandomState_exponential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_exponential},\n {\"standard_exponential\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_exponential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_exponential},\n {\"standard_gamma\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_gamma},\n {\"gamma\", (PyCFunction)__pyx_f_6mtrand_11RandomState_gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_gamma},\n {\"f\", (PyCFunction)__pyx_f_6mtrand_11RandomState_f, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_f},\n {\"noncentral_f\", (PyCFunction)__pyx_f_6mtrand_11RandomState_noncentral_f, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_noncentral_f},\n {\"chisquare\", (PyCFunction)__pyx_f_6mtrand_11RandomState_chisquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_chisquare},\n {\"noncentral_chisquare\", (PyCFunction)__pyx_f_6mtrand_11RandomState_noncentral_chisquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_noncentral_chisquare},\n {\"standard_cauchy\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_cauchy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_cauchy},\n {\"standard_t\", (PyCFunction)__pyx_f_6mtrand_11RandomState_standard_t, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_standard_t},\n {\"vonmises\", (PyCFunction)__pyx_f_6mtrand_11RandomState_vonmises, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_vonmises},\n {\"pareto\", (PyCFunction)__pyx_f_6mtrand_11RandomState_pareto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_pareto},\n {\"weibull\", (PyCFunction)__pyx_f_6mtrand_11RandomState_weibull, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_weibull},\n {\"power\", (PyCFunction)__pyx_f_6mtrand_11RandomState_power, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_power},\n {\"laplace\", (PyCFunction)__pyx_f_6mtrand_11RandomState_laplace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_laplace},\n {\"gumbel\", (PyCFunction)__pyx_f_6mtrand_11RandomState_gumbel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_gumbel},\n {\"logistic\", (PyCFunction)__pyx_f_6mtrand_11RandomState_logistic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logistic},\n {\"lognormal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_lognormal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_lognormal},\n {\"rayleigh\", (PyCFunction)__pyx_f_6mtrand_11RandomState_rayleigh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_rayleigh},\n {\"wald\", (PyCFunction)__pyx_f_6mtrand_11RandomState_wald, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_wald},\n {\"triangular\", (PyCFunction)__pyx_f_6mtrand_11RandomState_triangular, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_triangular},\n {\"binomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_binomial},\n {\"negative_binomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_negative_binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_negative_binomial},\n {\"poisson\", (PyCFunction)__pyx_f_6mtrand_11RandomState_poisson, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_poisson},\n {\"zipf\", (PyCFunction)__pyx_f_6mtrand_11RandomState_zipf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_zipf},\n {\"geometric\", (PyCFunction)__pyx_f_6mtrand_11RandomState_geometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_geometric},\n {\"hypergeometric\", (PyCFunction)__pyx_f_6mtrand_11RandomState_hypergeometric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_hypergeometric},\n {\"logseries\", (PyCFunction)__pyx_f_6mtrand_11RandomState_logseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_logseries},\n {\"multivariate_normal\", (PyCFunction)__pyx_f_6mtrand_11RandomState_multivariate_normal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multivariate_normal},\n {\"multinomial\", (PyCFunction)__pyx_f_6mtrand_11RandomState_multinomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_multinomial},\n {\"shuffle\", (PyCFunction)__pyx_f_6mtrand_11RandomState_shuffle, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_shuffle},\n {\"permutation\", (PyCFunction)__pyx_f_6mtrand_11RandomState_permutation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mtrand_11RandomState_permutation},\n {0, 0, 0, 0}\n};\n\nstatic PyNumberMethods __pyx_tp_as_number_RandomState = {\n 0, /*nb_add*/\n 0, /*nb_subtract*/\n 0, /*nb_multiply*/\n 0, /*nb_divide*/\n 0, /*nb_remainder*/\n 0, /*nb_divmod*/\n 0, /*nb_power*/\n 0, /*nb_negative*/\n 0, /*nb_positive*/\n 0, /*nb_absolute*/\n 0, /*nb_nonzero*/\n 0, /*nb_invert*/\n 0, /*nb_lshift*/\n 0, /*nb_rshift*/\n 0, /*nb_and*/\n 0, /*nb_xor*/\n 0, /*nb_or*/\n 0, /*nb_coerce*/\n 0, /*nb_int*/\n 0, /*nb_long*/\n 0, /*nb_float*/\n 0, /*nb_oct*/\n 0, /*nb_hex*/\n 0, /*nb_inplace_add*/\n 0, /*nb_inplace_subtract*/\n 0, /*nb_inplace_multiply*/\n 0, /*nb_inplace_divide*/\n 0, /*nb_inplace_remainder*/\n 0, /*nb_inplace_power*/\n 0, /*nb_inplace_lshift*/\n 0, /*nb_inplace_rshift*/\n 0, /*nb_inplace_and*/\n 0, /*nb_inplace_xor*/\n 0, /*nb_inplace_or*/\n 0, /*nb_floor_divide*/\n 0, /*nb_true_divide*/\n 0, /*nb_inplace_floor_divide*/\n 0, /*nb_inplace_true_divide*/\n};\n\nstatic PySequenceMethods __pyx_tp_as_sequence_RandomState = {\n 0, /*sq_length*/\n 0, /*sq_concat*/\n 0, /*sq_repeat*/\n 0, /*sq_item*/\n 0, /*sq_slice*/\n 0, /*sq_ass_item*/\n 0, /*sq_ass_slice*/\n 0, /*sq_contains*/\n 0, /*sq_inplace_concat*/\n 0, /*sq_inplace_repeat*/\n};\n\nstatic PyMappingMethods __pyx_tp_as_mapping_RandomState = {\n 0, /*mp_length*/\n 0, /*mp_subscript*/\n 0, /*mp_ass_subscript*/\n};\n\nstatic PyBufferProcs __pyx_tp_as_buffer_RandomState = {\n 0, /*bf_getreadbuffer*/\n 0, /*bf_getwritebuffer*/\n 0, /*bf_getsegcount*/\n 0, /*bf_getcharbuffer*/\n};\n\nstatichere PyTypeObject __pyx_type_6mtrand_RandomState = {\n PyObject_HEAD_INIT(0)\n 0, /*ob_size*/\n \"mtrand.RandomState\", /*tp_name*/\n sizeof(struct __pyx_obj_6mtrand_RandomState), /*tp_basicsize*/\n 0, /*tp_itemsize*/\n __pyx_tp_dealloc_6mtrand_RandomState, /*tp_dealloc*/\n 0, /*tp_print*/\n 0, /*tp_getattr*/\n 0, /*tp_setattr*/\n 0, /*tp_compare*/\n 0, /*tp_repr*/\n &__pyx_tp_as_number_RandomState, /*tp_as_number*/\n &__pyx_tp_as_sequence_RandomState, /*tp_as_sequence*/\n &__pyx_tp_as_mapping_RandomState, /*tp_as_mapping*/\n 0, /*tp_hash*/\n 0, /*tp_call*/\n 0, /*tp_str*/\n 0, /*tp_getattro*/\n 0, /*tp_setattro*/\n &__pyx_tp_as_buffer_RandomState, /*tp_as_buffer*/\n Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/\n \"Container for the Mersenne Twister PRNG.\\n\\n Constructor\\n -----------\\n RandomState(seed=None): initializes the PRNG with the given seed. See the\\n seed() method for details.\\n\\n Distribution Methods\\n -----------------\\n RandomState exposes a number of methods for generating random numbers drawn\\n from a variety of probability distributions. In addition to the\\n distribution-specific arguments, each method takes a keyword argument\\n size=None. If size is None, then a single value is generated and returned.\\n If size is an integer, then a 1-D scipy array filled with generated values\\n is returned. If size is a tuple, then a scipy array with that shape is\\n filled and returned.\\n \", /*tp_doc*/\n __pyx_tp_traverse_6mtrand_RandomState, /*tp_traverse*/\n __pyx_tp_clear_6mtrand_RandomState, /*tp_clear*/\n 0, /*tp_richcompare*/\n 0, /*tp_weaklistoffset*/\n 0, /*tp_iter*/\n 0, /*tp_iternext*/\n __pyx_methods_6mtrand_RandomState, /*tp_methods*/\n 0, /*tp_members*/\n 0, /*tp_getset*/\n 0, /*tp_base*/\n 0, /*tp_dict*/\n 0, /*tp_descr_get*/\n 0, /*tp_descr_set*/\n 0, /*tp_dictoffset*/\n __pyx_f_6mtrand_11RandomState___init__, /*tp_init*/\n 0, /*tp_alloc*/\n __pyx_tp_new_6mtrand_RandomState, /*tp_new*/\n 0, /*tp_free*/\n 0, /*tp_is_gc*/\n 0, /*tp_bases*/\n 0, /*tp_mro*/\n 0, /*tp_cache*/\n 0, /*tp_subclasses*/\n 0, /*tp_weaklist*/\n};\n\nstatic struct PyMethodDef __pyx_methods[] = {\n {0, 0, 0, 0}\n};\n\nDL_EXPORT(void) initmtrand(void); /*proto*/\nDL_EXPORT(void) initmtrand(void) {\n PyObject *__pyx_1 = 0;\n PyObject *__pyx_2 = 0;\n __pyx_m = Py_InitModule4(\"mtrand\", __pyx_methods, 0, 0, PYTHON_API_VERSION);\n if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n __pyx_b = PyImport_AddModule(\"__builtin__\");\n if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (PyObject_SetAttrString(__pyx_m, \"__builtins__\", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;};\n __pyx_ptype_6mtrand_ArrayType = __Pyx_ImportType(\"scipy\", \"ArrayType\", sizeof(PyArrayObject)); if (!__pyx_ptype_6mtrand_ArrayType) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; goto __pyx_L1;}\n if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}\n if (PyObject_SetAttrString(__pyx_m, \"RandomState\", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; goto __pyx_L1;}\n __pyx_ptype_6mtrand_RandomState = &__pyx_type_6mtrand_RandomState;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":114 */\n import_array();\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":116 */\n __pyx_1 = __Pyx_Import(__pyx_n_scipy, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}\n if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":282 */\n Py_INCREF(Py_None);\n __pyx_k2 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":291 */\n Py_INCREF(Py_None);\n __pyx_k3 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":352 */\n Py_INCREF(Py_None);\n __pyx_k4 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":359 */\n Py_INCREF(Py_None);\n __pyx_k5 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":366 */\n Py_INCREF(Py_None);\n __pyx_k6 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k7 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":412 */\n __pyx_k8 = 0.0;\n __pyx_k9 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k10 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":442 */\n Py_INCREF(Py_None);\n __pyx_k11 = Py_None;\n Py_INCREF(Py_None);\n __pyx_k12 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":455 */\n Py_INCREF(Py_None);\n __pyx_k13 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":462 */\n __pyx_k14 = 0.0;\n __pyx_k15 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k16 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":471 */\n Py_INCREF(Py_None);\n __pyx_k17 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":482 */\n __pyx_k18 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k19 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":491 */\n Py_INCREF(Py_None);\n __pyx_k20 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":498 */\n Py_INCREF(Py_None);\n __pyx_k21 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":507 */\n __pyx_k22 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k23 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":518 */\n Py_INCREF(Py_None);\n __pyx_k24 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":529 */\n Py_INCREF(Py_None);\n __pyx_k25 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":543 */\n Py_INCREF(Py_None);\n __pyx_k26 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":552 */\n Py_INCREF(Py_None);\n __pyx_k27 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":564 */\n Py_INCREF(Py_None);\n __pyx_k28 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":571 */\n Py_INCREF(Py_None);\n __pyx_k29 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":580 */\n Py_INCREF(Py_None);\n __pyx_k30 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":590 */\n Py_INCREF(Py_None);\n __pyx_k31 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":599 */\n Py_INCREF(Py_None);\n __pyx_k32 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":608 */\n Py_INCREF(Py_None);\n __pyx_k33 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":617 */\n __pyx_k34 = 0.0;\n __pyx_k35 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k36 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":626 */\n __pyx_k37 = 0.0;\n __pyx_k38 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k39 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":635 */\n __pyx_k40 = 0.0;\n __pyx_k41 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k42 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":644 */\n __pyx_k43 = 0.0;\n __pyx_k44 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k45 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":658 */\n Py_INCREF(Py_None);\n __pyx_k46 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":667 */\n Py_INCREF(Py_None);\n __pyx_k47 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":678 */\n Py_INCREF(Py_None);\n __pyx_k48 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":694 */\n Py_INCREF(Py_None);\n __pyx_k49 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":707 */\n Py_INCREF(Py_None);\n __pyx_k50 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":721 */\n __pyx_k51 = 1.0;\n Py_INCREF(Py_None);\n __pyx_k52 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":730 */\n Py_INCREF(Py_None);\n __pyx_k53 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":739 */\n Py_INCREF(Py_None);\n __pyx_k54 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":751 */\n Py_INCREF(Py_None);\n __pyx_k55 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":772 */\n Py_INCREF(Py_None);\n __pyx_k56 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":784 */\n Py_INCREF(Py_None);\n __pyx_k57 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":841 */\n Py_INCREF(Py_None);\n __pyx_k58 = Py_None;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":919 */\n __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":920 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_get_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":921 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_set_state); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":922 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":923 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":924 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_bytes); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":925 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_uniform); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":926 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rand); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":927 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_randn); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":928 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random_integers); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":929 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":930 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":931 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_beta); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":932 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":933 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_exponential); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":934 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":935 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gamma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":936 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":937 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_f); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":938 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":939 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_noncentral_chisquare); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":940 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_cauchy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":941 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_standard_t); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":942 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_vonmises); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":943 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_pareto); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":944 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_weibull); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":945 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_power); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":946 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_laplace); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":947 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_gumbel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":948 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logistic); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":949 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lognormal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":950 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_rayleigh); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":951 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_wald); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":952 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_triangular); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":954 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":955 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_negative_binomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":956 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_poisson); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":957 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zipf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":958 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_geometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":959 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_hypergeometric); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":960 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_logseries); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_logseries, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":962 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multivariate_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":963 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_multinomial); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":965 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_shuffle); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n\n /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":966 */\n __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_permutation); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n Py_DECREF(__pyx_1); __pyx_1 = 0;\n if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; goto __pyx_L1;}\n Py_DECREF(__pyx_2); __pyx_2 = 0;\n return;\n __pyx_L1:;\n Py_XDECREF(__pyx_1);\n Py_XDECREF(__pyx_2);\n __Pyx_AddTraceback(\"mtrand\");\n}\n\nstatic char *__pyx_filenames[] = {\n \"mtrand.pyx\",\n \"scipy.pxi\",\n};\nstatichere char **__pyx_f = __pyx_filenames;\n\n/* Runtime support code */\n\nstatic int __Pyx_GetStarArgs(\n PyObject **args, \n PyObject **kwds,\n char *kwd_list[], \n int nargs,\n PyObject **args2, \n PyObject **kwds2)\n{\n PyObject *x = 0, *args1 = 0, *kwds1 = 0;\n \n if (args2)\n *args2 = 0;\n if (kwds2)\n *kwds2 = 0;\n \n if (args2) {\n args1 = PyTuple_GetSlice(*args, 0, nargs);\n if (!args1)\n goto bad;\n *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_Size(*args));\n if (!*args2)\n goto bad;\n }\n else {\n args1 = *args;\n Py_INCREF(args1);\n }\n \n if (kwds2) {\n if (*kwds) {\n char **p;\n kwds1 = PyDict_New();\n if (!kwds)\n goto bad;\n *kwds2 = PyDict_Copy(*kwds);\n if (!*kwds2)\n goto bad;\n for (p = kwd_list; *p; p++) {\n x = PyDict_GetItemString(*kwds, *p);\n if (x) {\n if (PyDict_SetItemString(kwds1, *p, x) < 0)\n goto bad;\n if (PyDict_DelItemString(*kwds2, *p) < 0)\n goto bad;\n }\n }\n }\n else {\n *kwds2 = PyDict_New();\n if (!*kwds2)\n goto bad;\n }\n }\n else {\n kwds1 = *kwds;\n Py_XINCREF(kwds1);\n }\n \n *args = args1;\n *kwds = kwds1;\n return 0;\nbad:\n Py_XDECREF(args1);\n Py_XDECREF(kwds1);\n if (*args2)\n Py_XDECREF(*args2);\n if (*kwds2)\n Py_XDECREF(*kwds2);\n return -1;\n}\n\nstatic PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {\n PyObject *__import__ = 0;\n PyObject *empty_list = 0;\n PyObject *module = 0;\n PyObject *global_dict = 0;\n PyObject *empty_dict = 0;\n PyObject *list;\n __import__ = PyObject_GetAttrString(__pyx_b, \"__import__\");\n if (!__import__)\n goto bad;\n if (from_list)\n list = from_list;\n else {\n empty_list = PyList_New(0);\n if (!empty_list)\n goto bad;\n list = empty_list;\n }\n global_dict = PyModule_GetDict(__pyx_m);\n if (!global_dict)\n goto bad;\n empty_dict = PyDict_New();\n if (!empty_dict)\n goto bad;\n module = PyObject_CallFunction(__import__, \"OOOO\",\n name, global_dict, empty_dict, list);\nbad:\n Py_XDECREF(empty_list);\n Py_XDECREF(__import__);\n Py_XDECREF(empty_dict);\n return module;\n}\n\nstatic PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {\n PyObject *result;\n result = PyObject_GetAttr(dict, name);\n if (!result)\n PyErr_SetObject(PyExc_NameError, name);\n return result;\n}\n\nstatic void __Pyx_WriteUnraisable(char *name) {\n PyObject *old_exc, *old_val, *old_tb;\n PyObject *ctx;\n PyErr_Fetch(&old_exc, &old_val, &old_tb);\n ctx = PyString_FromString(name);\n PyErr_Restore(old_exc, old_val, old_tb);\n if (!ctx)\n ctx = Py_None;\n PyErr_WriteUnraisable(ctx);\n}\n\nstatic void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {\n Py_XINCREF(type);\n Py_XINCREF(value);\n Py_XINCREF(tb);\n /* First, check the traceback argument, replacing None with NULL. */\n if (tb == Py_None) {\n Py_DECREF(tb);\n tb = 0;\n }\n else if (tb != NULL && !PyTraceBack_Check(tb)) {\n PyErr_SetString(PyExc_TypeError,\n \"raise: arg 3 must be a traceback or None\");\n goto raise_error;\n }\n /* Next, replace a missing value with None */\n if (value == NULL) {\n value = Py_None;\n Py_INCREF(value);\n }\n /* Next, repeatedly, replace a tuple exception with its first item */\n while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {\n PyObject *tmp = type;\n type = PyTuple_GET_ITEM(type, 0);\n Py_INCREF(type);\n Py_DECREF(tmp);\n }\n if (PyString_Check(type))\n ;\n else if (PyClass_Check(type))\n ; /*PyErr_NormalizeException(&type, &value, &tb);*/\n else if (PyInstance_Check(type)) {\n /* Raising an instance. The value should be a dummy. */\n if (value != Py_None) {\n PyErr_SetString(PyExc_TypeError,\n \"instance exception may not have a separate value\");\n goto raise_error;\n }\n else {\n /* Normalize to raise , */\n Py_DECREF(value);\n value = type;\n type = (PyObject*) ((PyInstanceObject*)type)->in_class;\n Py_INCREF(type);\n }\n }\n else {\n /* Not something you can raise. You get an exception\n anyway, just not what you specified :-) */\n PyErr_Format(PyExc_TypeError,\n \"exceptions must be strings, classes, or \"\n \"instances, not %s\", type->ob_type->tp_name);\n goto raise_error;\n }\n PyErr_Restore(type, value, tb);\n return;\nraise_error:\n Py_XDECREF(value);\n Py_XDECREF(type);\n Py_XDECREF(tb);\n return;\n}\n\nstatic void __Pyx_UnpackError(void) {\n PyErr_SetString(PyExc_ValueError, \"unpack sequence of wrong size\");\n}\n\nstatic PyObject *__Pyx_UnpackItem(PyObject *seq, int i) {\n PyObject *item;\n if (!(item = PySequence_GetItem(seq, i))) {\n if (PyErr_ExceptionMatches(PyExc_IndexError))\n \t__Pyx_UnpackError();\n }\n return item;\n}\n\nstatic int __Pyx_EndUnpack(PyObject *seq, int i) {\n PyObject *item;\n if (item = PySequence_GetItem(seq, i)) {\n Py_DECREF(item);\n __Pyx_UnpackError();\n return -1;\n }\n PyErr_Clear();\n return 0;\n}\n\nstatic int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {\n while (t->p) {\n *t->p = PyString_InternFromString(t->s);\n if (!*t->p)\n return -1;\n ++t;\n }\n return 0;\n}\n\nstatic int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {\n while (t->p) {\n *t->p = PyString_FromStringAndSize(t->s, t->n - 1);\n if (!*t->p)\n return -1;\n ++t;\n }\n return 0;\n}\n\nstatic PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, \n long size) \n{\n PyObject *py_module_name = 0;\n PyObject *py_class_name = 0;\n PyObject *py_name_list = 0;\n PyObject *py_module = 0;\n PyObject *result = 0;\n \n py_module_name = PyString_FromString(module_name);\n if (!py_module_name)\n goto bad;\n py_class_name = PyString_FromString(class_name);\n if (!py_class_name)\n goto bad;\n py_name_list = PyList_New(1);\n if (!py_name_list)\n goto bad;\n Py_INCREF(py_class_name);\n if (PyList_SetItem(py_name_list, 0, py_class_name) < 0)\n goto bad;\n py_module = __Pyx_Import(py_module_name, py_name_list);\n if (!py_module)\n goto bad;\n result = PyObject_GetAttr(py_module, py_class_name);\n if (!result)\n goto bad;\n if (!PyType_Check(result)) {\n PyErr_Format(PyExc_TypeError, \n \"%s.%s is not a type object\",\n module_name, class_name);\n goto bad;\n }\n if (((PyTypeObject *)result)->tp_basicsize != size) {\n PyErr_Format(PyExc_ValueError, \n \"%s.%s does not appear to be the correct type object\",\n module_name, class_name);\n goto bad;\n }\n goto done;\nbad:\n Py_XDECREF(result);\n result = 0;\ndone:\n Py_XDECREF(py_module_name);\n Py_XDECREF(py_class_name);\n Py_XDECREF(py_name_list);\n return (PyTypeObject *)result;\n}\n\n#include \"compile.h\"\n#include \"frameobject.h\"\n#include \"traceback.h\"\n\nstatic void __Pyx_AddTraceback(char *funcname) {\n PyObject *py_srcfile = 0;\n PyObject *py_funcname = 0;\n PyObject *py_globals = 0;\n PyObject *empty_tuple = 0;\n PyObject *empty_string = 0;\n PyCodeObject *py_code = 0;\n PyFrameObject *py_frame = 0;\n \n py_srcfile = PyString_FromString(__pyx_filename);\n if (!py_srcfile) goto bad;\n py_funcname = PyString_FromString(funcname);\n if (!py_funcname) goto bad;\n py_globals = PyModule_GetDict(__pyx_m);\n if (!py_globals) goto bad;\n empty_tuple = PyTuple_New(0);\n if (!empty_tuple) goto bad;\n empty_string = PyString_FromString(\"\");\n if (!empty_string) goto bad;\n py_code = PyCode_New(\n 0, /*int argcount,*/\n 0, /*int nlocals,*/\n 0, /*int stacksize,*/\n 0, /*int flags,*/\n empty_string, /*PyObject *code,*/\n empty_tuple, /*PyObject *consts,*/\n empty_tuple, /*PyObject *names,*/\n empty_tuple, /*PyObject *varnames,*/\n empty_tuple, /*PyObject *freevars,*/\n empty_tuple, /*PyObject *cellvars,*/\n py_srcfile, /*PyObject *filename,*/\n py_funcname, /*PyObject *name,*/\n __pyx_lineno, /*int firstlineno,*/\n empty_string /*PyObject *lnotab*/\n );\n if (!py_code) goto bad;\n py_frame = PyFrame_New(\n PyThreadState_Get(), /*PyThreadState *tstate,*/\n py_code, /*PyCodeObject *code,*/\n py_globals, /*PyObject *globals,*/\n 0 /*PyObject *locals*/\n );\n if (!py_frame) goto bad;\n py_frame->f_lineno = __pyx_lineno;\n PyTraceBack_Here(py_frame);\nbad:\n Py_XDECREF(py_srcfile);\n Py_XDECREF(py_funcname);\n Py_XDECREF(empty_tuple);\n Py_XDECREF(empty_string);\n Py_XDECREF(py_code);\n Py_XDECREF(py_frame);\n}\n", "methods": [ { "name": "__pyx_f_6mtrand_cont0_array", "long_name": "__pyx_f_6mtrand_cont0_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "double", "__pyx_v_size" ], "start_line": 178, "end_line": 258, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont1_array", "long_name": "__pyx_f_6mtrand_cont1_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a" ], "start_line": 260, "end_line": 340, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont2_array", "long_name": "__pyx_f_6mtrand_cont2_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b" ], "start_line": 342, "end_line": 422, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont3_array", "long_name": "__pyx_f_6mtrand_cont3_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b , double __pyx_v_c)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b", "__pyx_v_c" ], "start_line": 424, "end_line": 504, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_disc0_array", "long_name": "__pyx_f_6mtrand_disc0_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "long", "__pyx_v_size" ], "start_line": 508, "end_line": 588, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnp_array", "long_name": "__pyx_f_6mtrand_discnp_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,double)) , PyObject * __pyx_v_size , long __pyx_v_n , double __pyx_v_p)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_p" ], "start_line": 590, "end_line": 670, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnmN_array", "long_name": "__pyx_f_6mtrand_discnmN_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,long,long)) , PyObject * __pyx_v_size , long __pyx_v_n , long __pyx_v_m , long __pyx_v_N)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_m", "__pyx_v_N" ], "start_line": 672, "end_line": 752, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discd_array", "long_name": "__pyx_f_6mtrand_discd_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_a" ], "start_line": 754, "end_line": 834, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_kahan_sum", "long_name": "__pyx_f_6mtrand_kahan_sum( double(*__pyx_v_darr) , long __pyx_v_n)", "filename": "mtrand.c", "nloc": 26, "complexity": 2, "token_count": 130, "parameters": [ "double", "__pyx_v_n" ], "start_line": 836, "end_line": 878, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___init__", "long_name": "__pyx_f_6mtrand_11RandomState___init__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 33, "complexity": 5, "token_count": 300, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 883, "end_line": 920, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___dealloc__", "long_name": "__pyx_f_6mtrand_11RandomState___dealloc__( PyObject * __pyx_v_self)", "filename": "mtrand.c", "nloc": 15, "complexity": 2, "token_count": 78, "parameters": [ "__pyx_v_self" ], "start_line": 923, "end_line": 942, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_seed", "long_name": "__pyx_f_6mtrand_11RandomState_seed( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 10, "token_count": 541, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 949, "end_line": 1018, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_get_state", "long_name": "__pyx_f_6mtrand_11RandomState_get_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 56, "complexity": 11, "token_count": 637, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1025, "end_line": 1087, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_set_state", "long_name": "__pyx_f_6mtrand_11RandomState_set_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 88, "complexity": 19, "token_count": 969, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1099, "end_line": 1205, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 107, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___getstate__", "long_name": "__pyx_f_6mtrand_11RandomState___getstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 5, "token_count": 238, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1208, "end_line": 1238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___setstate__", "long_name": "__pyx_f_6mtrand_11RandomState___setstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 5, "token_count": 271, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1241, "end_line": 1274, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___reduce__", "long_name": "__pyx_f_6mtrand_11RandomState___reduce__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 10, "token_count": 463, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1280, "end_line": 1327, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_sample", "long_name": "__pyx_f_6mtrand_11RandomState_random_sample( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1331, "end_line": 1357, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_tomaxint", "long_name": "__pyx_f_6mtrand_11RandomState_tomaxint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1361, "end_line": 1387, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randint", "long_name": "__pyx_f_6mtrand_11RandomState_randint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 111, "complexity": 19, "token_count": 1002, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1395, "end_line": 1538, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 144, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_bytes", "long_name": "__pyx_f_6mtrand_11RandomState_bytes( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 3, "token_count": 223, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1542, "end_line": 1583, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_uniform", "long_name": "__pyx_f_6mtrand_11RandomState_uniform( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 3, "token_count": 208, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1587, "end_line": 1617, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rand", "long_name": "__pyx_f_6mtrand_11RandomState_rand( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 70, "complexity": 17, "token_count": 715, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1625, "end_line": 1701, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randn", "long_name": "__pyx_f_6mtrand_11RandomState_randn( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 67, "complexity": 15, "token_count": 651, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1705, "end_line": 1778, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_integers", "long_name": "__pyx_f_6mtrand_11RandomState_random_integers( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 9, "token_count": 493, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1782, "end_line": 1851, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_normal", "long_name": "__pyx_f_6mtrand_11RandomState_standard_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1855, "end_line": 1881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_normal", "long_name": "__pyx_f_6mtrand_11RandomState_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1889, "end_line": 1943, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_beta", "long_name": "__pyx_f_6mtrand_11RandomState_beta( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1953, "end_line": 2021, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2029, "end_line": 2081, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_standard_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2085, "end_line": 2111, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_standard_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2119, "end_line": 2170, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 11, "token_count": 570, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2180, "end_line": 2249, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_f", "long_name": "__pyx_f_6mtrand_11RandomState_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2259, "end_line": 2327, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_f", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2339, "end_line": 2424, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2432, "end_line": 2483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2493, "end_line": 2561, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_cauchy", "long_name": "__pyx_f_6mtrand_11RandomState_standard_cauchy( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2565, "end_line": 2591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_t", "long_name": "__pyx_f_6mtrand_11RandomState_standard_t( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2599, "end_line": 2650, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_vonmises", "long_name": "__pyx_f_6mtrand_11RandomState_vonmises( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 395, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2658, "end_line": 2710, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_pareto", "long_name": "__pyx_f_6mtrand_11RandomState_pareto( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2718, "end_line": 2769, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_weibull", "long_name": "__pyx_f_6mtrand_11RandomState_weibull( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2777, "end_line": 2828, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_power", "long_name": "__pyx_f_6mtrand_11RandomState_power( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2836, "end_line": 2887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_laplace", "long_name": "__pyx_f_6mtrand_11RandomState_laplace( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2895, "end_line": 2949, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gumbel", "long_name": "__pyx_f_6mtrand_11RandomState_gumbel( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2957, "end_line": 3011, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logistic", "long_name": "__pyx_f_6mtrand_11RandomState_logistic( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3019, "end_line": 3073, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_lognormal", "long_name": "__pyx_f_6mtrand_11RandomState_lognormal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3081, "end_line": 3135, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rayleigh", "long_name": "__pyx_f_6mtrand_11RandomState_rayleigh( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3143, "end_line": 3195, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_wald", "long_name": "__pyx_f_6mtrand_11RandomState_wald( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3205, "end_line": 3273, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_triangular", "long_name": "__pyx_f_6mtrand_11RandomState_triangular( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3285, "end_line": 3370, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3382, "end_line": 3466, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_negative_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_negative_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3478, "end_line": 3562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_poisson", "long_name": "__pyx_f_6mtrand_11RandomState_poisson( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3570, "end_line": 3622, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_zipf", "long_name": "__pyx_f_6mtrand_11RandomState_zipf( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3630, "end_line": 3681, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_geometric", "long_name": "__pyx_f_6mtrand_11RandomState_geometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3691, "end_line": 3758, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_hypergeometric", "long_name": "__pyx_f_6mtrand_11RandomState_hypergeometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 89, "complexity": 19, "token_count": 922, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3772, "end_line": 3873, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 102, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logseries", "long_name": "__pyx_f_6mtrand_11RandomState_logseries( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3883, "end_line": 3950, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multivariate_normal", "long_name": "__pyx_f_6mtrand_11RandomState_multivariate_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 367, "complexity": 119, "token_count": 4997, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3977, "end_line": 4388, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 412, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multinomial", "long_name": "__pyx_f_6mtrand_11RandomState_multinomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 180, "complexity": 35, "token_count": 1738, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4398, "end_line": 4630, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 233, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_shuffle", "long_name": "__pyx_f_6mtrand_11RandomState_shuffle( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 63, "complexity": 18, "token_count": 729, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4634, "end_line": 4707, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_permutation", "long_name": "__pyx_f_6mtrand_11RandomState_permutation( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 79, "complexity": 18, "token_count": 836, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4713, "end_line": 4802, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "__pyx_tp_new_6mtrand_RandomState", "long_name": "__pyx_tp_new_6mtrand_RandomState( PyTypeObject * t , PyObject * a , PyObject * k)", "filename": "mtrand.c", "nloc": 5, "complexity": 1, "token_count": 47, "parameters": [ "t", "a", "k" ], "start_line": 4940, "end_line": 4944, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "__pyx_tp_dealloc_6mtrand_RandomState", "long_name": "__pyx_tp_dealloc_6mtrand_RandomState( PyObject * o)", "filename": "mtrand.c", "nloc": 13, "complexity": 2, "token_count": 91, "parameters": [ "o" ], "start_line": 4946, "end_line": 4958, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "__pyx_tp_traverse_6mtrand_RandomState", "long_name": "__pyx_tp_traverse_6mtrand_RandomState( PyObject * o , visitproc v , * a)", "filename": "mtrand.c", "nloc": 5, "complexity": 1, "token_count": 33, "parameters": [ "o", "v", "a" ], "start_line": 4960, "end_line": 4964, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "__pyx_tp_clear_6mtrand_RandomState", "long_name": "__pyx_tp_clear_6mtrand_RandomState( PyObject * o)", "filename": "mtrand.c", "nloc": 4, "complexity": 1, "token_count": 23, "parameters": [ "o" ], "start_line": 4966, "end_line": 4969, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "initmtrand", "long_name": "initmtrand()", "filename": "mtrand.c", "nloc": 349, "complexity": 146, "token_count": 5618, "parameters": [], "start_line": 5145, "end_line": 5667, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 523, "top_nesting_level": 0 }, { "name": "__Pyx_GetStarArgs", "long_name": "__Pyx_GetStarArgs( PyObject ** args , PyObject ** kwds , char * kwd_list [ ] , int nargs , PyObject ** args2 , PyObject ** kwds2)", "filename": "mtrand.c", "nloc": 66, "complexity": 17, "token_count": 324, "parameters": [ "args", "kwds", "nargs", "args2", "kwds2" ], "start_line": 5677, "end_line": 5746, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__Pyx_Import", "long_name": "__Pyx_Import( PyObject * name , PyObject * from_list)", "filename": "mtrand.c", "nloc": 32, "complexity": 6, "token_count": 159, "parameters": [ "name", "from_list" ], "start_line": 5748, "end_line": 5779, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "__Pyx_GetName", "long_name": "__Pyx_GetName( PyObject * dict , PyObject * name)", "filename": "mtrand.c", "nloc": 7, "complexity": 2, "token_count": 40, "parameters": [ "dict", "name" ], "start_line": 5781, "end_line": 5787, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "__Pyx_WriteUnraisable", "long_name": "__Pyx_WriteUnraisable( char * name)", "filename": "mtrand.c", "nloc": 10, "complexity": 2, "token_count": 64, "parameters": [ "name" ], "start_line": 5789, "end_line": 5798, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "__Pyx_Raise", "long_name": "__Pyx_Raise( PyObject * type , PyObject * value , PyObject * tb)", "filename": "mtrand.c", "nloc": 54, "complexity": 11, "token_count": 259, "parameters": [ "type", "value", "tb" ], "start_line": 5800, "end_line": 5860, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "__Pyx_UnpackError", "long_name": "__Pyx_UnpackError()", "filename": "mtrand.c", "nloc": 3, "complexity": 1, "token_count": 13, "parameters": [], "start_line": 5862, "end_line": 5864, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 0 }, { "name": "__Pyx_UnpackItem", "long_name": "__Pyx_UnpackItem( PyObject * seq , int i)", "filename": "mtrand.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "seq", "i" ], "start_line": 5866, "end_line": 5873, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "__Pyx_EndUnpack", "long_name": "__Pyx_EndUnpack( PyObject * seq , int i)", "filename": "mtrand.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "seq", "i" ], "start_line": 5875, "end_line": 5884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "__Pyx_InternStrings", "long_name": "__Pyx_InternStrings( __Pyx_InternTabEntry * t)", "filename": "mtrand.c", "nloc": 9, "complexity": 3, "token_count": 46, "parameters": [ "t" ], "start_line": 5886, "end_line": 5894, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "__Pyx_InitStrings", "long_name": "__Pyx_InitStrings( __Pyx_StringTabEntry * t)", "filename": "mtrand.c", "nloc": 9, "complexity": 3, "token_count": 52, "parameters": [ "t" ], "start_line": 5896, "end_line": 5904, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "__Pyx_ImportType", "long_name": "__Pyx_ImportType( char * module_name , char * class_name , long size)", "filename": "mtrand.c", "nloc": 48, "complexity": 9, "token_count": 237, "parameters": [ "module_name", "class_name", "size" ], "start_line": 5906, "end_line": 5954, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "__Pyx_AddTraceback", "long_name": "__Pyx_AddTraceback( char * funcname)", "filename": "mtrand.c", "nloc": 52, "complexity": 8, "token_count": 232, "parameters": [ "funcname" ], "start_line": 5960, "end_line": 6012, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 } ], "methods_before": [ { "name": "__pyx_f_6mtrand_cont0_array", "long_name": "__pyx_f_6mtrand_cont0_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "double", "__pyx_v_size" ], "start_line": 177, "end_line": 257, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont1_array", "long_name": "__pyx_f_6mtrand_cont1_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a" ], "start_line": 259, "end_line": 339, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont2_array", "long_name": "__pyx_f_6mtrand_cont2_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b" ], "start_line": 341, "end_line": 421, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont3_array", "long_name": "__pyx_f_6mtrand_cont3_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b , double __pyx_v_c)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b", "__pyx_v_c" ], "start_line": 423, "end_line": 503, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_disc0_array", "long_name": "__pyx_f_6mtrand_disc0_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "long", "__pyx_v_size" ], "start_line": 507, "end_line": 587, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnp_array", "long_name": "__pyx_f_6mtrand_discnp_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,double)) , PyObject * __pyx_v_size , long __pyx_v_n , double __pyx_v_p)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_p" ], "start_line": 589, "end_line": 669, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnmN_array", "long_name": "__pyx_f_6mtrand_discnmN_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,long,long)) , PyObject * __pyx_v_size , long __pyx_v_n , long __pyx_v_m , long __pyx_v_N)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_m", "__pyx_v_N" ], "start_line": 671, "end_line": 751, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discd_array", "long_name": "__pyx_f_6mtrand_discd_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_a" ], "start_line": 753, "end_line": 833, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_kahan_sum", "long_name": "__pyx_f_6mtrand_kahan_sum( double(*__pyx_v_darr) , long __pyx_v_n)", "filename": "mtrand.c", "nloc": 26, "complexity": 2, "token_count": 130, "parameters": [ "double", "__pyx_v_n" ], "start_line": 835, "end_line": 877, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___init__", "long_name": "__pyx_f_6mtrand_11RandomState___init__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 33, "complexity": 5, "token_count": 300, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 882, "end_line": 919, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___dealloc__", "long_name": "__pyx_f_6mtrand_11RandomState___dealloc__( PyObject * __pyx_v_self)", "filename": "mtrand.c", "nloc": 15, "complexity": 2, "token_count": 78, "parameters": [ "__pyx_v_self" ], "start_line": 922, "end_line": 941, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_seed", "long_name": "__pyx_f_6mtrand_11RandomState_seed( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 10, "token_count": 541, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 948, "end_line": 1017, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_get_state", "long_name": "__pyx_f_6mtrand_11RandomState_get_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 56, "complexity": 11, "token_count": 637, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1024, "end_line": 1086, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_set_state", "long_name": "__pyx_f_6mtrand_11RandomState_set_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 88, "complexity": 19, "token_count": 969, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1098, "end_line": 1204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 107, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___getstate__", "long_name": "__pyx_f_6mtrand_11RandomState___getstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 5, "token_count": 238, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1207, "end_line": 1237, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___setstate__", "long_name": "__pyx_f_6mtrand_11RandomState___setstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 5, "token_count": 271, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1240, "end_line": 1273, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___reduce__", "long_name": "__pyx_f_6mtrand_11RandomState___reduce__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 10, "token_count": 463, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1279, "end_line": 1326, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_sample", "long_name": "__pyx_f_6mtrand_11RandomState_random_sample( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1330, "end_line": 1356, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_tomaxint", "long_name": "__pyx_f_6mtrand_11RandomState_tomaxint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1360, "end_line": 1386, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randint", "long_name": "__pyx_f_6mtrand_11RandomState_randint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 111, "complexity": 19, "token_count": 1002, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1394, "end_line": 1537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 144, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_bytes", "long_name": "__pyx_f_6mtrand_11RandomState_bytes( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 3, "token_count": 223, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1541, "end_line": 1582, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_uniform", "long_name": "__pyx_f_6mtrand_11RandomState_uniform( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 3, "token_count": 208, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1586, "end_line": 1616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rand", "long_name": "__pyx_f_6mtrand_11RandomState_rand( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 70, "complexity": 17, "token_count": 715, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1624, "end_line": 1700, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randn", "long_name": "__pyx_f_6mtrand_11RandomState_randn( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 67, "complexity": 15, "token_count": 651, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1704, "end_line": 1777, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_integers", "long_name": "__pyx_f_6mtrand_11RandomState_random_integers( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 9, "token_count": 493, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1781, "end_line": 1850, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_normal", "long_name": "__pyx_f_6mtrand_11RandomState_standard_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1854, "end_line": 1880, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_normal", "long_name": "__pyx_f_6mtrand_11RandomState_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1888, "end_line": 1942, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_beta", "long_name": "__pyx_f_6mtrand_11RandomState_beta( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1952, "end_line": 2020, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2028, "end_line": 2080, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_standard_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2084, "end_line": 2110, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_standard_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2118, "end_line": 2169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 11, "token_count": 570, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2179, "end_line": 2248, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_f", "long_name": "__pyx_f_6mtrand_11RandomState_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2258, "end_line": 2326, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_f", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2338, "end_line": 2423, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2431, "end_line": 2482, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2492, "end_line": 2560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_cauchy", "long_name": "__pyx_f_6mtrand_11RandomState_standard_cauchy( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2564, "end_line": 2590, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_t", "long_name": "__pyx_f_6mtrand_11RandomState_standard_t( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2598, "end_line": 2649, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_vonmises", "long_name": "__pyx_f_6mtrand_11RandomState_vonmises( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 395, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2657, "end_line": 2709, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_pareto", "long_name": "__pyx_f_6mtrand_11RandomState_pareto( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2717, "end_line": 2768, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_weibull", "long_name": "__pyx_f_6mtrand_11RandomState_weibull( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2776, "end_line": 2827, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_power", "long_name": "__pyx_f_6mtrand_11RandomState_power( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2835, "end_line": 2886, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_laplace", "long_name": "__pyx_f_6mtrand_11RandomState_laplace( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2894, "end_line": 2948, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gumbel", "long_name": "__pyx_f_6mtrand_11RandomState_gumbel( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2956, "end_line": 3010, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logistic", "long_name": "__pyx_f_6mtrand_11RandomState_logistic( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3018, "end_line": 3072, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_lognormal", "long_name": "__pyx_f_6mtrand_11RandomState_lognormal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3080, "end_line": 3134, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rayleigh", "long_name": "__pyx_f_6mtrand_11RandomState_rayleigh( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3142, "end_line": 3193, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_wald", "long_name": "__pyx_f_6mtrand_11RandomState_wald( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3203, "end_line": 3271, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_triangular", "long_name": "__pyx_f_6mtrand_11RandomState_triangular( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3283, "end_line": 3368, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3380, "end_line": 3464, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_negative_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_negative_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3476, "end_line": 3560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_poisson", "long_name": "__pyx_f_6mtrand_11RandomState_poisson( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3568, "end_line": 3620, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_zipf", "long_name": "__pyx_f_6mtrand_11RandomState_zipf( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3628, "end_line": 3679, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_geometric", "long_name": "__pyx_f_6mtrand_11RandomState_geometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3689, "end_line": 3756, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_hypergeometric", "long_name": "__pyx_f_6mtrand_11RandomState_hypergeometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 89, "complexity": 19, "token_count": 922, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3770, "end_line": 3871, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 102, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logseries", "long_name": "__pyx_f_6mtrand_11RandomState_logseries( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3881, "end_line": 3948, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multivariate_normal", "long_name": "__pyx_f_6mtrand_11RandomState_multivariate_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 367, "complexity": 119, "token_count": 4997, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3975, "end_line": 4386, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 412, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multinomial", "long_name": "__pyx_f_6mtrand_11RandomState_multinomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 180, "complexity": 35, "token_count": 1738, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4396, "end_line": 4628, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 233, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_shuffle", "long_name": "__pyx_f_6mtrand_11RandomState_shuffle( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 63, "complexity": 18, "token_count": 729, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4632, "end_line": 4705, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_permutation", "long_name": "__pyx_f_6mtrand_11RandomState_permutation( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 79, "complexity": 18, "token_count": 836, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4711, "end_line": 4800, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "__pyx_tp_new_6mtrand_RandomState", "long_name": "__pyx_tp_new_6mtrand_RandomState( PyTypeObject * t , PyObject * a , PyObject * k)", "filename": "mtrand.c", "nloc": 5, "complexity": 1, "token_count": 47, "parameters": [ "t", "a", "k" ], "start_line": 4938, "end_line": 4942, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "__pyx_tp_dealloc_6mtrand_RandomState", "long_name": "__pyx_tp_dealloc_6mtrand_RandomState( PyObject * o)", "filename": "mtrand.c", "nloc": 13, "complexity": 2, "token_count": 91, "parameters": [ "o" ], "start_line": 4944, "end_line": 4956, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "__pyx_tp_traverse_6mtrand_RandomState", "long_name": "__pyx_tp_traverse_6mtrand_RandomState( PyObject * o , visitproc v , * a)", "filename": "mtrand.c", "nloc": 5, "complexity": 1, "token_count": 33, "parameters": [ "o", "v", "a" ], "start_line": 4958, "end_line": 4962, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "__pyx_tp_clear_6mtrand_RandomState", "long_name": "__pyx_tp_clear_6mtrand_RandomState( PyObject * o)", "filename": "mtrand.c", "nloc": 4, "complexity": 1, "token_count": 23, "parameters": [ "o" ], "start_line": 4964, "end_line": 4967, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "initmtrand", "long_name": "initmtrand()", "filename": "mtrand.c", "nloc": 348, "complexity": 146, "token_count": 5614, "parameters": [], "start_line": 5143, "end_line": 5664, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 522, "top_nesting_level": 0 }, { "name": "__Pyx_GetStarArgs", "long_name": "__Pyx_GetStarArgs( PyObject ** args , PyObject ** kwds , char * kwd_list [ ] , int nargs , PyObject ** args2 , PyObject ** kwds2)", "filename": "mtrand.c", "nloc": 66, "complexity": 17, "token_count": 324, "parameters": [ "args", "kwds", "nargs", "args2", "kwds2" ], "start_line": 5674, "end_line": 5743, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__Pyx_Import", "long_name": "__Pyx_Import( PyObject * name , PyObject * from_list)", "filename": "mtrand.c", "nloc": 32, "complexity": 6, "token_count": 159, "parameters": [ "name", "from_list" ], "start_line": 5745, "end_line": 5776, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "__Pyx_GetName", "long_name": "__Pyx_GetName( PyObject * dict , PyObject * name)", "filename": "mtrand.c", "nloc": 7, "complexity": 2, "token_count": 40, "parameters": [ "dict", "name" ], "start_line": 5778, "end_line": 5784, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "__Pyx_WriteUnraisable", "long_name": "__Pyx_WriteUnraisable( char * name)", "filename": "mtrand.c", "nloc": 10, "complexity": 2, "token_count": 64, "parameters": [ "name" ], "start_line": 5786, "end_line": 5795, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "__Pyx_Raise", "long_name": "__Pyx_Raise( PyObject * type , PyObject * value , PyObject * tb)", "filename": "mtrand.c", "nloc": 54, "complexity": 11, "token_count": 259, "parameters": [ "type", "value", "tb" ], "start_line": 5797, "end_line": 5857, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "__Pyx_UnpackError", "long_name": "__Pyx_UnpackError()", "filename": "mtrand.c", "nloc": 3, "complexity": 1, "token_count": 13, "parameters": [], "start_line": 5859, "end_line": 5861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 3, "top_nesting_level": 0 }, { "name": "__Pyx_UnpackItem", "long_name": "__Pyx_UnpackItem( PyObject * seq , int i)", "filename": "mtrand.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "seq", "i" ], "start_line": 5863, "end_line": 5870, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "__Pyx_EndUnpack", "long_name": "__Pyx_EndUnpack( PyObject * seq , int i)", "filename": "mtrand.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "seq", "i" ], "start_line": 5872, "end_line": 5881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "__Pyx_InternStrings", "long_name": "__Pyx_InternStrings( __Pyx_InternTabEntry * t)", "filename": "mtrand.c", "nloc": 9, "complexity": 3, "token_count": 46, "parameters": [ "t" ], "start_line": 5883, "end_line": 5891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "__Pyx_InitStrings", "long_name": "__Pyx_InitStrings( __Pyx_StringTabEntry * t)", "filename": "mtrand.c", "nloc": 9, "complexity": 3, "token_count": 52, "parameters": [ "t" ], "start_line": 5893, "end_line": 5901, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "__Pyx_ImportType", "long_name": "__Pyx_ImportType( char * module_name , char * class_name , long size)", "filename": "mtrand.c", "nloc": 48, "complexity": 9, "token_count": 237, "parameters": [ "module_name", "class_name", "size" ], "start_line": 5903, "end_line": 5951, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "__Pyx_AddTraceback", "long_name": "__Pyx_AddTraceback( char * funcname)", "filename": "mtrand.c", "nloc": 52, "complexity": 8, "token_count": 232, "parameters": [ "funcname" ], "start_line": 5957, "end_line": 6009, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "__pyx_f_6mtrand_11RandomState_lognormal", "long_name": "__pyx_f_6mtrand_11RandomState_lognormal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3081, "end_line": 3135, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_tomaxint", "long_name": "__pyx_f_6mtrand_11RandomState_tomaxint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1361, "end_line": 1387, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont2_array", "long_name": "__pyx_f_6mtrand_cont2_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b" ], "start_line": 342, "end_line": 422, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_laplace", "long_name": "__pyx_f_6mtrand_11RandomState_laplace( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2895, "end_line": 2949, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_permutation", "long_name": "__pyx_f_6mtrand_11RandomState_permutation( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 79, "complexity": 18, "token_count": 836, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4713, "end_line": 4802, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_standard_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2085, "end_line": 2111, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_triangular", "long_name": "__pyx_f_6mtrand_11RandomState_triangular( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3285, "end_line": 3370, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_geometric", "long_name": "__pyx_f_6mtrand_11RandomState_geometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3691, "end_line": 3758, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discd_array", "long_name": "__pyx_f_6mtrand_discd_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_a" ], "start_line": 754, "end_line": 834, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_sample", "long_name": "__pyx_f_6mtrand_11RandomState_random_sample( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1331, "end_line": 1357, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___reduce__", "long_name": "__pyx_f_6mtrand_11RandomState___reduce__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 10, "token_count": 463, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1280, "end_line": 1327, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_weibull", "long_name": "__pyx_f_6mtrand_11RandomState_weibull( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2777, "end_line": 2828, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_normal", "long_name": "__pyx_f_6mtrand_11RandomState_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1889, "end_line": 1943, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rand", "long_name": "__pyx_f_6mtrand_11RandomState_rand( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 70, "complexity": 17, "token_count": 715, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1625, "end_line": 1701, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 77, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logseries", "long_name": "__pyx_f_6mtrand_11RandomState_logseries( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 11, "token_count": 556, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3883, "end_line": 3950, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 68, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_set_state", "long_name": "__pyx_f_6mtrand_11RandomState_set_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 88, "complexity": 19, "token_count": 969, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1099, "end_line": 1205, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 107, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___dealloc__", "long_name": "__pyx_f_6mtrand_11RandomState___dealloc__( PyObject * __pyx_v_self)", "filename": "mtrand.c", "nloc": 15, "complexity": 2, "token_count": 78, "parameters": [ "__pyx_v_self" ], "start_line": 923, "end_line": 942, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_standard_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2119, "end_line": 2170, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont1_array", "long_name": "__pyx_f_6mtrand_cont1_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double)) , PyObject * __pyx_v_size , double __pyx_v_a)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 577, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a" ], "start_line": 260, "end_line": 340, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_poisson", "long_name": "__pyx_f_6mtrand_11RandomState_poisson( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3570, "end_line": 3622, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___getstate__", "long_name": "__pyx_f_6mtrand_11RandomState___getstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 5, "token_count": 238, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1208, "end_line": 1238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_kahan_sum", "long_name": "__pyx_f_6mtrand_kahan_sum( double(*__pyx_v_darr) , long __pyx_v_n)", "filename": "mtrand.c", "nloc": 26, "complexity": 2, "token_count": 130, "parameters": [ "double", "__pyx_v_n" ], "start_line": 836, "end_line": 878, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2432, "end_line": 2483, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_negative_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_negative_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3478, "end_line": 3562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_logistic", "long_name": "__pyx_f_6mtrand_11RandomState_logistic( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3019, "end_line": 3073, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_t", "long_name": "__pyx_f_6mtrand_11RandomState_standard_t( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2599, "end_line": 2650, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multivariate_normal", "long_name": "__pyx_f_6mtrand_11RandomState_multivariate_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 367, "complexity": 119, "token_count": 4997, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3977, "end_line": 4388, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 412, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randn", "long_name": "__pyx_f_6mtrand_11RandomState_randn( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 67, "complexity": 15, "token_count": 651, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1705, "end_line": 1778, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_randint", "long_name": "__pyx_f_6mtrand_11RandomState_randint( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 111, "complexity": 19, "token_count": 1002, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1395, "end_line": 1538, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 144, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_uniform", "long_name": "__pyx_f_6mtrand_11RandomState_uniform( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 28, "complexity": 3, "token_count": 208, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1587, "end_line": 1617, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_random_integers", "long_name": "__pyx_f_6mtrand_11RandomState_random_integers( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 9, "token_count": 493, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1782, "end_line": 1851, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnmN_array", "long_name": "__pyx_f_6mtrand_discnmN_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,long,long)) , PyObject * __pyx_v_size , long __pyx_v_n , long __pyx_v_m , long __pyx_v_N)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_m", "__pyx_v_N" ], "start_line": 672, "end_line": 752, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_normal", "long_name": "__pyx_f_6mtrand_11RandomState_standard_normal( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1855, "end_line": 1881, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_wald", "long_name": "__pyx_f_6mtrand_11RandomState_wald( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3205, "end_line": 3273, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "initmtrand", "long_name": "initmtrand()", "filename": "mtrand.c", "nloc": 349, "complexity": 146, "token_count": 5618, "parameters": [], "start_line": 5145, "end_line": 5667, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 523, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_disc0_array", "long_name": "__pyx_f_6mtrand_disc0_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "long", "__pyx_v_size" ], "start_line": 508, "end_line": 588, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_vonmises", "long_name": "__pyx_f_6mtrand_11RandomState_vonmises( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 395, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2658, "end_line": 2710, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_discnp_array", "long_name": "__pyx_f_6mtrand_discnp_array( rk_state(*__pyx_v_state) , long((*__pyx_v_func)(rk_state(*),long,double)) , PyObject * __pyx_v_size , long __pyx_v_n , double __pyx_v_p)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 586, "parameters": [ "rk_state", "long", "__pyx_v_size", "__pyx_v_n", "__pyx_v_p" ], "start_line": 590, "end_line": 670, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_f", "long_name": "__pyx_f_6mtrand_11RandomState_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2259, "end_line": 2327, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_shuffle", "long_name": "__pyx_f_6mtrand_11RandomState_shuffle( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 63, "complexity": 18, "token_count": 729, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4634, "end_line": 4707, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 74, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___setstate__", "long_name": "__pyx_f_6mtrand_11RandomState___setstate__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 5, "token_count": 271, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1241, "end_line": 1274, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gamma", "long_name": "__pyx_f_6mtrand_11RandomState_gamma( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 61, "complexity": 11, "token_count": 570, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2180, "end_line": 2249, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_standard_cauchy", "long_name": "__pyx_f_6mtrand_11RandomState_standard_cauchy( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 24, "complexity": 3, "token_count": 176, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2565, "end_line": 2591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_multinomial", "long_name": "__pyx_f_6mtrand_11RandomState_multinomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 180, "complexity": 35, "token_count": 1738, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 4398, "end_line": 4630, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 233, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_power", "long_name": "__pyx_f_6mtrand_11RandomState_power( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2836, "end_line": 2887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_seed", "long_name": "__pyx_f_6mtrand_11RandomState_seed( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 59, "complexity": 10, "token_count": 541, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 949, "end_line": 1018, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_binomial", "long_name": "__pyx_f_6mtrand_11RandomState_binomial( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 74, "complexity": 15, "token_count": 737, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3382, "end_line": 3466, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 85, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_zipf", "long_name": "__pyx_f_6mtrand_11RandomState_zipf( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3630, "end_line": 3681, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState___init__", "long_name": "__pyx_f_6mtrand_11RandomState___init__( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 33, "complexity": 5, "token_count": 300, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 883, "end_line": 920, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_beta", "long_name": "__pyx_f_6mtrand_11RandomState_beta( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1953, "end_line": 2021, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_rayleigh", "long_name": "__pyx_f_6mtrand_11RandomState_rayleigh( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3143, "end_line": 3195, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_exponential", "long_name": "__pyx_f_6mtrand_11RandomState_exponential( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 46, "complexity": 7, "token_count": 389, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2029, "end_line": 2081, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_f", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_f( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 75, "complexity": 15, "token_count": 747, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2339, "end_line": 2424, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 86, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_gumbel", "long_name": "__pyx_f_6mtrand_11RandomState_gumbel( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 48, "complexity": 7, "token_count": 403, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2957, "end_line": 3011, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare", "long_name": "__pyx_f_6mtrand_11RandomState_noncentral_chisquare( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 60, "complexity": 11, "token_count": 566, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2493, "end_line": 2561, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 69, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_bytes", "long_name": "__pyx_f_6mtrand_11RandomState_bytes( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 31, "complexity": 3, "token_count": 223, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1542, "end_line": 1583, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_hypergeometric", "long_name": "__pyx_f_6mtrand_11RandomState_hypergeometric( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 89, "complexity": 19, "token_count": 922, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 3772, "end_line": 3873, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 102, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont0_array", "long_name": "__pyx_f_6mtrand_cont0_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*))) , PyObject * __pyx_v_size)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 568, "parameters": [ "rk_state", "double", "__pyx_v_size" ], "start_line": 178, "end_line": 258, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_get_state", "long_name": "__pyx_f_6mtrand_11RandomState_get_state( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 56, "complexity": 11, "token_count": 637, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 1025, "end_line": 1087, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_cont3_array", "long_name": "__pyx_f_6mtrand_cont3_array( rk_state(*__pyx_v_state) , double((*__pyx_v_func)(rk_state(*),double,double,double)) , PyObject * __pyx_v_size , double __pyx_v_a , double __pyx_v_b , double __pyx_v_c)", "filename": "mtrand.c", "nloc": 64, "complexity": 10, "token_count": 595, "parameters": [ "rk_state", "double", "__pyx_v_size", "__pyx_v_a", "__pyx_v_b", "__pyx_v_c" ], "start_line": 424, "end_line": 504, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "__pyx_f_6mtrand_11RandomState_pareto", "long_name": "__pyx_f_6mtrand_11RandomState_pareto( PyObject * __pyx_v_self , PyObject * __pyx_args , PyObject * __pyx_kwds)", "filename": "mtrand.c", "nloc": 45, "complexity": 7, "token_count": 385, "parameters": [ "__pyx_v_self", "__pyx_args", "__pyx_kwds" ], "start_line": 2718, "end_line": 2769, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 52, "top_nesting_level": 0 } ], "nloc": 4995, "complexity": 906, "token_count": 48035, "diff_parsed": { "added": [ "/* Generated by Pyrex 0.9.3.1 on Sat Oct 8 00:19:00 2005 */", "static double __pyx_k46;", "static PyObject *__pyx_k51;", "static double __pyx_k52;", "static PyObject *__pyx_k59;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":124 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":125 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":127 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":128 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":129 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":130 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":131 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":132 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":140 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":141 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":143 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":144 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":145 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":146 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":147 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":148 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":157 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":158 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":160 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":161 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":162 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":163 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":164 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":165 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":175 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":176 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":178 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":179 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":180 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":181 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":182 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":183 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":191 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":192 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":194 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":195 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":196 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":197 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":198 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":199 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":207 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":208 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":210 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":211 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":212 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":213 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":214 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":215 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":224 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":225 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":227 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":228 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":229 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":230 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":231 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":232 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":240 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":241 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":243 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":244 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":245 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":246 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":247 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":248 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":253 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":254 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":255 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":256 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":257 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":258 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":259 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":260 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":283 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":285 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":288 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":289 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":303 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":304 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":306 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":308 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":309 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":318 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":319 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":320 */", "static PyObject *__pyx_k63p;", "static char (__pyx_k62[]) = \"algorithm must be 'MT19937'\";", "static char (__pyx_k63[]) = \"state must be 624 longs\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":331 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":332 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":333 */", " Py_INCREF(__pyx_k62p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k62p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":334 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":335 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":336 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":337 */", " Py_INCREF(__pyx_k63p);", " PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k63p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":338 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":339 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":343 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":346 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":349 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":357 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":364 */", "static PyObject *__pyx_k64p;", "static char (__pyx_k64[]) = \"low >= high\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":379 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":380 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":381 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":383 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":384 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":386 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":387 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":388 */", " Py_INCREF(__pyx_k64p);", " PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k64p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":390 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":391 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":393 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":394 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":395 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":396 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":397 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":398 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":406 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":407 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":408 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":409 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":410 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":417 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":426 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":427 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":429 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":437 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":438 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":440 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":449 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":450 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":451 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":452 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":460 */", "static PyObject *__pyx_k66p;", "static char (__pyx_k66[]) = \"scale <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":467 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":468 */", " Py_INCREF(__pyx_k66p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":469 */", "static PyObject *__pyx_k68p;", "static char (__pyx_k67[]) = \"a <= 0\";", "static char (__pyx_k68[]) = \"b <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":476 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":477 */", " Py_INCREF(__pyx_k67p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":479 */", " Py_INCREF(__pyx_k68p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":480 */", "static PyObject *__pyx_k69p;", "static char (__pyx_k69[]) = \"scale <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":487 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":488 */", " Py_INCREF(__pyx_k69p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":489 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":496 */", "static PyObject *__pyx_k70p;", "static char (__pyx_k70[]) = \"shape <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":503 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":504 */", " Py_INCREF(__pyx_k70p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":505 */", "static PyObject *__pyx_k72p;", "static char (__pyx_k71[]) = \"shape <= 0\";", "static char (__pyx_k72[]) = \"scale <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":512 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":513 */", " Py_INCREF(__pyx_k71p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":515 */", " Py_INCREF(__pyx_k72p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":516 */", "static PyObject *__pyx_k74p;", "static char (__pyx_k73[]) = \"dfnum <= 0\";", "static char (__pyx_k74[]) = \"dfden <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":523 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":524 */", " Py_INCREF(__pyx_k73p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":526 */", " Py_INCREF(__pyx_k74p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":527 */", "static PyObject *__pyx_k77p;", "static char (__pyx_k75[]) = \"dfnum <= 1\";", "static char (__pyx_k76[]) = \"dfden <= 0\";", "static char (__pyx_k77[]) = \"nonc < 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":534 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":535 */", " Py_INCREF(__pyx_k75p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":537 */", " Py_INCREF(__pyx_k76p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":539 */", " Py_INCREF(__pyx_k77p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":540 */", "static PyObject *__pyx_k78p;", "static char (__pyx_k78[]) = \"df <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":548 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":549 */", " Py_INCREF(__pyx_k78p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":550 */", "static PyObject *__pyx_k80p;", "static char (__pyx_k79[]) = \"df <= 1\";", "static char (__pyx_k80[]) = \"nonc < 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":557 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":558 */", " Py_INCREF(__pyx_k79p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":560 */", " Py_INCREF(__pyx_k80p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":561 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":569 */", "static PyObject *__pyx_k81p;", "static char (__pyx_k81[]) = \"df <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":576 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":577 */", " Py_INCREF(__pyx_k81p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":578 */", "static PyObject *__pyx_k82p;", "static char (__pyx_k82[]) = \"kappa < 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":586 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":587 */", " Py_INCREF(__pyx_k82p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":588 */", "static PyObject *__pyx_k83p;", "static char (__pyx_k83[]) = \"a <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":595 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":596 */", " Py_INCREF(__pyx_k83p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":597 */", "static PyObject *__pyx_k84p;", "static char (__pyx_k84[]) = \"a <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":604 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":605 */", " Py_INCREF(__pyx_k84p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":606 */", "static PyObject *__pyx_k85p;", "static char (__pyx_k85[]) = \"a <= 0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":613 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":614 */", " Py_INCREF(__pyx_k85p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":615 */", "static PyObject *__pyx_k86p;", "static char (__pyx_k86[]) = \"scale <= 0.0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":622 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":623 */", " Py_INCREF(__pyx_k86p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":624 */", "static PyObject *__pyx_k87p;", "static char (__pyx_k87[]) = \"scale <= 0.0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":631 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":632 */", " Py_INCREF(__pyx_k87p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":633 */", "static PyObject *__pyx_k88p;", "static char (__pyx_k88[]) = \"scale <= 0.0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":640 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":641 */", " Py_INCREF(__pyx_k88p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":642 */", "static PyObject *__pyx_k89p;", "static char (__pyx_k89[]) = \"sigma <= 0.0\";", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":654 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":655 */", " Py_INCREF(__pyx_k89p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":656 */", "static PyObject *__pyx_k90p;", "static char (__pyx_k90[]) = \"scale <= 0.0\";", "static char __pyx_doc_6mtrand_11RandomState_rayleigh[] = \"Rayleigh distribution.\\n \\n rayleigh(scale=1.0, size=None)\\n \";", " double __pyx_v_scale;", " static char *__pyx_argnames[] = {\"scale\",\"size\",0};", " __pyx_v_scale = __pyx_k46;", " __pyx_v_size = __pyx_k47;", " if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"|dO\", __pyx_argnames, &__pyx_v_scale, &__pyx_v_size)) return 0;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":663 */", " __pyx_1 = (__pyx_v_scale <= 0.0);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":664 */", " Py_INCREF(__pyx_k90p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":665 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_scale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}", "static PyObject *__pyx_k92p;", "static char (__pyx_k91[]) = \"mean <= 0.0\";", "static char (__pyx_k92[]) = \"scale <= 0.0\";", " __pyx_v_size = __pyx_k48;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":672 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":673 */", " Py_INCREF(__pyx_k91p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":675 */", " Py_INCREF(__pyx_k92p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":676 */", "static PyObject *__pyx_k95p;", "static char (__pyx_k93[]) = \"left > mode\";", "static char (__pyx_k94[]) = \"mode > right\";", "static char (__pyx_k95[]) = \"left == right\";", " __pyx_v_size = __pyx_k49;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":684 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":685 */", " Py_INCREF(__pyx_k93p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":687 */", " Py_INCREF(__pyx_k94p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":689 */", " Py_INCREF(__pyx_k95p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":690 */", "static PyObject *__pyx_k98p;", "static char (__pyx_k96[]) = \"n <= 0\";", "static char (__pyx_k97[]) = \"p < 0\";", "static char (__pyx_k98[]) = \"p > 1\";", " __pyx_v_size = __pyx_k50;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":699 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":700 */", " Py_INCREF(__pyx_k96p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":702 */", " Py_INCREF(__pyx_k97p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":704 */", " Py_INCREF(__pyx_k98p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":705 */", "static PyObject *__pyx_k101p;", "static char (__pyx_k99[]) = \"n <= 0\";", "static char (__pyx_k100[]) = \"p < 0\";", "static char (__pyx_k101[]) = \"p > 1\";", " __pyx_v_size = __pyx_k51;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":712 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":713 */", " Py_INCREF(__pyx_k99p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":715 */", " Py_INCREF(__pyx_k100p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":717 */", " Py_INCREF(__pyx_k101p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":718 */", "static PyObject *__pyx_k102p;", "static char (__pyx_k102[]) = \"lam <= 0\";", " __pyx_v_lam = __pyx_k52;", " __pyx_v_size = __pyx_k53;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":726 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":727 */", " Py_INCREF(__pyx_k102p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":728 */", "static PyObject *__pyx_k103p;", "static char (__pyx_k103[]) = \"a <= 1.0\";", " __pyx_v_size = __pyx_k54;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":735 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":736 */", " Py_INCREF(__pyx_k103p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":737 */", "static PyObject *__pyx_k105p;", "static char (__pyx_k104[]) = \"p < 0.0\";", "static char (__pyx_k105[]) = \"p > 1.0\";", " __pyx_v_size = __pyx_k55;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":745 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":746 */", " Py_INCREF(__pyx_k104p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":748 */", " Py_INCREF(__pyx_k105p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":749 */", "static PyObject *__pyx_k109p;", "static char (__pyx_k106[]) = \"ngood < 1\";", "static char (__pyx_k107[]) = \"nbad < 1\";", "static char (__pyx_k108[]) = \"ngood + nbad < nsample\";", "static char (__pyx_k109[]) = \"nsample < 1\";", " __pyx_v_size = __pyx_k56;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":761 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":762 */", " Py_INCREF(__pyx_k106p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":764 */", " Py_INCREF(__pyx_k107p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":766 */", " Py_INCREF(__pyx_k108p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k108p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":768 */", " Py_INCREF(__pyx_k109p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":769 */", "static PyObject *__pyx_k111p;", "static char (__pyx_k110[]) = \"p < 0\";", "static char (__pyx_k111[]) = \"p > 1\";", " __pyx_v_size = __pyx_k57;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":777 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":778 */", " Py_INCREF(__pyx_k110p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k110p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":780 */", " Py_INCREF(__pyx_k111p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k111p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":781 */", "static PyObject *__pyx_k114p;", "static char (__pyx_k112[]) = \"mean must be 1 dimensional\";", "static char (__pyx_k113[]) = \"cov must be 2 dimensional and square\";", "static char (__pyx_k114[]) = \"mean and cov must have same length\";", " __pyx_v_size = __pyx_k58;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":802 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":803 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":804 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":805 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":807 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":808 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":809 */", " Py_INCREF(__pyx_k112p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":810 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":811 */", " Py_INCREF(__pyx_k113p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k113p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":812 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":813 */", " Py_INCREF(__pyx_k114p);", " PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k114p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":815 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":816 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":817 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":818 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":822 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":823 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":833 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":834 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":837 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":838 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":839 */", "static PyObject *__pyx_k115p;", "static char (__pyx_k115[]) = \"sum(pvals) > 1.0\";", " __pyx_v_size = __pyx_k59;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":857 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":858 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":859 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":861 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":862 */", " Py_INCREF(__pyx_k115p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k115p);", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":864 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":865 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":867 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":869 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":871 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":872 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":873 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":874 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":875 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":876 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":877 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":878 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":879 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":880 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":881 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":882 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":883 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":884 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":885 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":887 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":889 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":900 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":901 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":902 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":903 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":904 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":912 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":913 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":915 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":916 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":917 */", " {&__pyx_k64p, __pyx_k64, sizeof(__pyx_k64)},", " {&__pyx_k115p, __pyx_k115, sizeof(__pyx_k115)},", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":114 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":116 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":282 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":291 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":352 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":359 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":366 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":412 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":442 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":455 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":462 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":471 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":482 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":491 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":498 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":507 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":518 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":529 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":543 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":552 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":564 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":571 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":580 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":590 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":599 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":608 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":617 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":626 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":635 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":644 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":658 */", " __pyx_k46 = 1.0;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":667 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":678 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":694 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":707 */", " __pyx_k51 = Py_None;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":721 */", " __pyx_k52 = 1.0;", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":730 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":739 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":751 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":772 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":784 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":841 */", " Py_INCREF(Py_None);", " __pyx_k59 = Py_None;", "", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":919 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":920 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":921 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":922 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":923 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":924 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":925 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":926 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":927 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":928 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":929 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":930 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":931 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":932 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":933 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":934 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":935 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":936 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":937 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":938 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":939 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":940 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":941 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":942 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":943 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":944 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":945 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":946 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":947 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":948 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":949 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":950 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":951 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":952 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":954 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":955 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":956 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":957 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":958 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":959 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":960 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":962 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":963 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":965 */", " /* \"/home/oliphant/newcore/scipy/corelib/mtrand/mtrand.pyx\":966 */" ], "deleted": [ "/* Generated by Pyrex 0.9.3.1 on Fri Oct 7 02:05:13 2005 */", "static PyObject *__pyx_k46;", "static double __pyx_k51;", "static PyObject *__pyx_k52;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":124 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":125 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":127 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":128 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":129 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":130 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":131 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":132 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":140 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":141 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":143 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":144 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":145 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":146 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":147 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":148 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":157 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":158 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":160 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":161 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":162 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":163 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":164 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":165 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":175 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":176 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":178 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":179 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":180 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":181 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":182 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":183 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":191 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":192 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":194 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":195 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":196 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":197 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":198 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":199 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":207 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":208 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":210 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":211 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":212 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":213 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":214 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":215 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":224 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":225 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":227 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":228 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":229 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":230 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":231 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":232 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":240 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":241 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":243 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":244 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":245 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":246 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":247 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":248 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":253 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":254 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":255 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":256 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":257 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":258 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":259 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":260 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":283 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":285 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":288 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":289 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":303 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":304 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":306 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":308 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":309 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":318 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":319 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":320 */", "static PyObject *__pyx_k61p;", "static char (__pyx_k61[]) = \"algorithm must be 'MT19937'\";", "static char (__pyx_k62[]) = \"state must be 624 longs\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":331 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":332 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":333 */", " Py_INCREF(__pyx_k61p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k61p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":334 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":335 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":336 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":337 */", " Py_INCREF(__pyx_k62p);", " PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k62p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":338 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":339 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":343 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":346 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":349 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":357 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":364 */", "static PyObject *__pyx_k63p;", "static char (__pyx_k63[]) = \"low >= high\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":379 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":380 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":381 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":383 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":384 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":386 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":387 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":388 */", " Py_INCREF(__pyx_k63p);", " PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k63p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":390 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":391 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":393 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":394 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":395 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":396 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":397 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":398 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":406 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":407 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":408 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":409 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":410 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":417 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":426 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":427 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":429 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":437 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":438 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":440 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":449 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":450 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":451 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":452 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":460 */", "static PyObject *__pyx_k65p;", "static char (__pyx_k65[]) = \"scale <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":467 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":468 */", " Py_INCREF(__pyx_k65p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k65p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":469 */", "static PyObject *__pyx_k66p;", "static char (__pyx_k66[]) = \"a <= 0\";", "static char (__pyx_k67[]) = \"b <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":476 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":477 */", " Py_INCREF(__pyx_k66p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k66p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":479 */", " Py_INCREF(__pyx_k67p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k67p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":480 */", "static PyObject *__pyx_k68p;", "static char (__pyx_k68[]) = \"scale <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":487 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":488 */", " Py_INCREF(__pyx_k68p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k68p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":489 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":496 */", "static PyObject *__pyx_k69p;", "static char (__pyx_k69[]) = \"shape <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":503 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":504 */", " Py_INCREF(__pyx_k69p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k69p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":505 */", "static PyObject *__pyx_k70p;", "static char (__pyx_k70[]) = \"shape <= 0\";", "static char (__pyx_k71[]) = \"scale <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":512 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":513 */", " Py_INCREF(__pyx_k70p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k70p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":515 */", " Py_INCREF(__pyx_k71p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k71p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":516 */", "static PyObject *__pyx_k72p;", "static char (__pyx_k72[]) = \"dfnum <= 0\";", "static char (__pyx_k73[]) = \"dfden <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":523 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":524 */", " Py_INCREF(__pyx_k72p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k72p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":526 */", " Py_INCREF(__pyx_k73p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":527 */", "static PyObject *__pyx_k74p;", "static char (__pyx_k74[]) = \"dfnum <= 1\";", "static char (__pyx_k75[]) = \"dfden <= 0\";", "static char (__pyx_k76[]) = \"nonc < 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":534 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":535 */", " Py_INCREF(__pyx_k74p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":537 */", " Py_INCREF(__pyx_k75p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":539 */", " Py_INCREF(__pyx_k76p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":540 */", "static PyObject *__pyx_k77p;", "static char (__pyx_k77[]) = \"df <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":548 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":549 */", " Py_INCREF(__pyx_k77p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":550 */", "static PyObject *__pyx_k78p;", "static char (__pyx_k78[]) = \"df <= 1\";", "static char (__pyx_k79[]) = \"nonc < 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":557 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":558 */", " Py_INCREF(__pyx_k78p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k78p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":560 */", " Py_INCREF(__pyx_k79p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":561 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":569 */", "static PyObject *__pyx_k80p;", "static char (__pyx_k80[]) = \"df <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":576 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":577 */", " Py_INCREF(__pyx_k80p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k80p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":578 */", "static PyObject *__pyx_k81p;", "static char (__pyx_k81[]) = \"kappa < 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":586 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":587 */", " Py_INCREF(__pyx_k81p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":588 */", "static PyObject *__pyx_k82p;", "static char (__pyx_k82[]) = \"a <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":595 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":596 */", " Py_INCREF(__pyx_k82p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k82p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":597 */", "static PyObject *__pyx_k83p;", "static char (__pyx_k83[]) = \"a <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":604 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":605 */", " Py_INCREF(__pyx_k83p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":606 */", "static PyObject *__pyx_k84p;", "static char (__pyx_k84[]) = \"a <= 0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":613 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":614 */", " Py_INCREF(__pyx_k84p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":615 */", "static PyObject *__pyx_k85p;", "static char (__pyx_k85[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":622 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":623 */", " Py_INCREF(__pyx_k85p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":624 */", "static PyObject *__pyx_k86p;", "static char (__pyx_k86[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":631 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":632 */", " Py_INCREF(__pyx_k86p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k86p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":633 */", "static PyObject *__pyx_k87p;", "static char (__pyx_k87[]) = \"scale <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":640 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":641 */", " Py_INCREF(__pyx_k87p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":642 */", "static PyObject *__pyx_k88p;", "static char (__pyx_k88[]) = \"sigma <= 0.0\";", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":654 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":655 */", " Py_INCREF(__pyx_k88p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":656 */", "static PyObject *__pyx_k89p;", "static char (__pyx_k89[]) = \"mode <= 0.0\";", "static char __pyx_doc_6mtrand_11RandomState_rayleigh[] = \"Rayleigh distribution.\\n \\n rayleigh(mode, size=None)\\n \";", " double __pyx_v_mode;", " static char *__pyx_argnames[] = {\"mode\",\"size\",0};", " __pyx_v_size = __pyx_k46;", " if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, \"d|O\", __pyx_argnames, &__pyx_v_mode, &__pyx_v_size)) return 0;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":663 */", " __pyx_1 = (__pyx_v_mode <= 0.0);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":664 */", " Py_INCREF(__pyx_k89p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":665 */", " __pyx_2 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_mode); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}", "static PyObject *__pyx_k90p;", "static char (__pyx_k90[]) = \"mean <= 0.0\";", "static char (__pyx_k91[]) = \"scale <= 0.0\";", " __pyx_v_size = __pyx_k47;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":672 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":673 */", " Py_INCREF(__pyx_k90p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":675 */", " Py_INCREF(__pyx_k91p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":676 */", "static PyObject *__pyx_k92p;", "static char (__pyx_k92[]) = \"left > mode\";", "static char (__pyx_k93[]) = \"mode > right\";", "static char (__pyx_k94[]) = \"left == right\";", " __pyx_v_size = __pyx_k48;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":684 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":685 */", " Py_INCREF(__pyx_k92p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":687 */", " Py_INCREF(__pyx_k93p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":689 */", " Py_INCREF(__pyx_k94p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":690 */", "static PyObject *__pyx_k95p;", "static char (__pyx_k95[]) = \"n <= 0\";", "static char (__pyx_k96[]) = \"p < 0\";", "static char (__pyx_k97[]) = \"p > 1\";", " __pyx_v_size = __pyx_k49;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":699 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":700 */", " Py_INCREF(__pyx_k95p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k95p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":702 */", " Py_INCREF(__pyx_k96p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k96p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":704 */", " Py_INCREF(__pyx_k97p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":705 */", "static PyObject *__pyx_k98p;", "static char (__pyx_k98[]) = \"n <= 0\";", "static char (__pyx_k99[]) = \"p < 0\";", "static char (__pyx_k100[]) = \"p > 1\";", " __pyx_v_size = __pyx_k50;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":712 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":713 */", " Py_INCREF(__pyx_k98p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":715 */", " Py_INCREF(__pyx_k99p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":717 */", " Py_INCREF(__pyx_k100p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":718 */", "static PyObject *__pyx_k101p;", "static char (__pyx_k101[]) = \"lam <= 0\";", " __pyx_v_lam = __pyx_k51;", " __pyx_v_size = __pyx_k52;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":726 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":727 */", " Py_INCREF(__pyx_k101p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":728 */", "static PyObject *__pyx_k102p;", "static char (__pyx_k102[]) = \"a <= 1.0\";", " __pyx_v_size = __pyx_k53;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":735 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":736 */", " Py_INCREF(__pyx_k102p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":737 */", "static PyObject *__pyx_k103p;", "static char (__pyx_k103[]) = \"p < 0.0\";", "static char (__pyx_k104[]) = \"p > 1.0\";", " __pyx_v_size = __pyx_k54;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":745 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":746 */", " Py_INCREF(__pyx_k103p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":748 */", " Py_INCREF(__pyx_k104p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":749 */", "static PyObject *__pyx_k105p;", "static char (__pyx_k105[]) = \"ngood < 1\";", "static char (__pyx_k106[]) = \"nbad < 1\";", "static char (__pyx_k107[]) = \"ngood + nbad < nsample\";", "static char (__pyx_k108[]) = \"nsample < 1\";", " __pyx_v_size = __pyx_k55;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":761 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":762 */", " Py_INCREF(__pyx_k105p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":764 */", " Py_INCREF(__pyx_k106p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":766 */", " Py_INCREF(__pyx_k107p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":768 */", " Py_INCREF(__pyx_k108p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k108p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":769 */", "static PyObject *__pyx_k109p;", "static char (__pyx_k109[]) = \"p < 0\";", "static char (__pyx_k110[]) = \"p > 1\";", " __pyx_v_size = __pyx_k56;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":777 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":778 */", " Py_INCREF(__pyx_k109p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":780 */", " Py_INCREF(__pyx_k110p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k110p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":781 */", "static PyObject *__pyx_k111p;", "static char (__pyx_k111[]) = \"mean must be 1 dimensional\";", "static char (__pyx_k112[]) = \"cov must be 2 dimensional and square\";", "static char (__pyx_k113[]) = \"mean and cov must have same length\";", " __pyx_v_size = __pyx_k57;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":802 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":803 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":804 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":805 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":807 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":808 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":809 */", " Py_INCREF(__pyx_k111p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k111p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":810 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":811 */", " Py_INCREF(__pyx_k112p);", " PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":812 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":813 */", " Py_INCREF(__pyx_k113p);", " PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k113p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":815 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":816 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":817 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":818 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":822 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":823 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":833 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":834 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":837 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":838 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":839 */", "static PyObject *__pyx_k114p;", "static char (__pyx_k114[]) = \"sum(pvals) > 1.0\";", " __pyx_v_size = __pyx_k58;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":857 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":858 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":859 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":861 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":862 */", " Py_INCREF(__pyx_k114p);", " PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k114p);", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":864 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":865 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":867 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":869 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":871 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":872 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":873 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":874 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":875 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":876 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":877 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":878 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":879 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":880 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":881 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":882 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":883 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":884 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":885 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":887 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":889 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":900 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":901 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":902 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":903 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":904 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":912 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":913 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":915 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":916 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":917 */", " {&__pyx_k61p, __pyx_k61, sizeof(__pyx_k61)},", " {&__pyx_k65p, __pyx_k65, sizeof(__pyx_k65)},", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":114 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":116 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":282 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":291 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":352 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":359 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":366 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":412 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":442 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":455 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":462 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":471 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":482 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":491 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":498 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":507 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":518 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":529 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":543 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":552 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":564 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":571 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":580 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":590 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":599 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":608 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":617 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":626 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":635 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":644 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":658 */", " Py_INCREF(Py_None);", " __pyx_k46 = Py_None;", "", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":667 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":678 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":694 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":707 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":721 */", " __pyx_k51 = 1.0;", " __pyx_k52 = Py_None;", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":730 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":739 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":751 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":772 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":784 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":841 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":919 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":920 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":921 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":922 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":923 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":924 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":925 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":926 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":927 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":928 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":929 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":930 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":931 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":932 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":933 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":934 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":935 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":936 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":937 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":938 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":939 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":940 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":941 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":942 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":943 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":944 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":945 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":946 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":947 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":948 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":949 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":950 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":951 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":952 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":954 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":955 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":956 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":957 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":958 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":959 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":960 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":962 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":963 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":965 */", " /* \"/Users/kern/svk-projects/scipy_core/scipy/corelib/mtrand/mtrand.pyx\":966 */" ] } }, { "old_path": "scipy/corelib/mtrand/mtrand.pyx", "new_path": "scipy/corelib/mtrand/mtrand.pyx", "filename": "mtrand.pyx", "extension": "pyx", "change_type": "MODIFY", "diff": "@@ -655,14 +655,14 @@ def lognormal(self, double mean=0.0, double sigma=1.0, size=None):\n raise ValueError(\"sigma <= 0.0\")\n return cont2_array(self.internal_state, rk_lognormal, size, mean, sigma)\n \n- def rayleigh(self, double mode, size=None):\n+ def rayleigh(self, double scale=1.0, size=None):\n \"\"\"Rayleigh distribution.\n \n- rayleigh(mode, size=None)\n+ rayleigh(scale=1.0, size=None)\n \"\"\"\n- if mode <= 0.0:\n- raise ValueError(\"mode <= 0.0\")\n- return cont1_array(self.internal_state, rk_rayleigh, size, mode)\n+ if scale <= 0.0:\n+ raise ValueError(\"scale <= 0.0\")\n+ return cont1_array(self.internal_state, rk_rayleigh, size, scale)\n \n def wald(self, double mean, double scale, size=None):\n \"\"\"Wald (inverse Gaussian) distribution.\n", "added_lines": 5, "deleted_lines": 5, "source_code": "# mtrand.pyx -- A Pyrex wrapper of Jean-Sebastien Roy's RandomKit\n#\n# Copyright 2005 Robert Kern (robert.kern@gmail.com)\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n# \n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n# \n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\ninclude \"Python.pxi\"\ninclude \"scipy.pxi\"\n\ncdef extern from \"math.h\":\n double exp(double x)\n double log(double x)\n double floor(double x)\n double sin(double x)\n double cos(double x)\n\ncdef extern from \"randomkit.h\":\n\n ctypedef struct rk_state:\n unsigned long key[624]\n int pos\n\n ctypedef enum rk_error:\n RK_NOERR = 0\n RK_ENODEV = 1\n RK_ERR_MAX = 2\n\n char *rk_strerror[2]\n \n # 0xFFFFFFFFUL\n unsigned long RK_MAX\n\n void rk_seed(unsigned long seed, rk_state *state)\n rk_error rk_randomseed(rk_state *state)\n unsigned long rk_random(rk_state *state)\n long rk_long(rk_state *state)\n unsigned long rk_ulong(rk_state *state)\n unsigned long rk_interval(unsigned long max, rk_state *state)\n double rk_double(rk_state *state)\n void rk_fill(void *buffer, size_t size, rk_state *state)\n rk_error rk_devfill(void *buffer, size_t size, int strong)\n rk_error rk_altfill(void *buffer, size_t size, int strong,\n rk_state *state)\n double rk_gauss(rk_state *state)\n\ncdef extern from \"distributions.h\":\n \n double rk_normal(rk_state *state, double loc, double scale)\n double rk_standard_exponential(rk_state *state)\n double rk_exponential(rk_state *state, double scale)\n double rk_uniform(rk_state *state, double loc, double scale)\n double rk_standard_gamma(rk_state *state, double shape)\n double rk_gamma(rk_state *state, double shape, double scale)\n double rk_beta(rk_state *state, double a, double b)\n double rk_chisquare(rk_state *state, double df)\n double rk_noncentral_chisquare(rk_state *state, double df, double nonc)\n double rk_f(rk_state *state, double dfnum, double dfden)\n double rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc)\n double rk_standard_cauchy(rk_state *state)\n double rk_standard_t(rk_state *state, double df)\n double rk_vonmises(rk_state *state, double mu, double kappa)\n double rk_pareto(rk_state *state, double a)\n double rk_weibull(rk_state *state, double a)\n double rk_power(rk_state *state, double a)\n double rk_laplace(rk_state *state, double loc, double scale)\n double rk_gumbel(rk_state *state, double loc, double scale)\n double rk_logistic(rk_state *state, double loc, double scale)\n double rk_lognormal(rk_state *state, double mode, double sigma)\n double rk_rayleigh(rk_state *state, double mode)\n double rk_wald(rk_state *state, double mean, double scale)\n double rk_triangular(rk_state *state, double left, double mode, double right)\n \n long rk_binomial(rk_state *state, long n, double p)\n long rk_negative_binomial(rk_state *state, long n, double p)\n long rk_poisson(rk_state *state, double lam)\n long rk_zipf(rk_state *state, double a)\n long rk_geometric(rk_state *state, double p)\n long rk_hypergeometric(rk_state *state, long good, long bad, long sample)\n long rk_logseries(rk_state *state, double p)\n \nctypedef double (* rk_cont0)(rk_state *state)\nctypedef double (* rk_cont1)(rk_state *state, double a)\nctypedef double (* rk_cont2)(rk_state *state, double a, double b)\nctypedef double (* rk_cont3)(rk_state *state, double a, double b, double c)\n\nctypedef long (* rk_disc0)(rk_state *state)\nctypedef long (* rk_discnp)(rk_state *state, long n, double p)\nctypedef long (* rk_discnmN)(rk_state *state, long n, long m, long N)\nctypedef long (* rk_discd)(rk_state *state, double a)\n\n\ncdef extern from \"initarray.h\":\n void init_by_array(rk_state *self, unsigned long *init_key, \n unsigned long key_length)\n\n# Initialize scipy\nimport_array()\n\nimport scipy as _sp\n\ncdef object cont0_array(rk_state *state, rk_cont0 func, object size):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state)\n return array\n\ncdef object cont1_array(rk_state *state, rk_cont1 func, object size, double a):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a)\n return array\n\ncdef object cont2_array(rk_state *state, rk_cont2 func, object size, double a, \n double b):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a, b)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a, b)\n return array\n\ncdef object cont3_array(rk_state *state, rk_cont3 func, object size, double a, \n double b, double c):\n\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n \n if size is None:\n return func(state, a, b, c)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a, b, c)\n return array\n\ncdef object disc0_array(rk_state *state, rk_disc0 func, object size):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state)\n return array\n\ncdef object discnp_array(rk_state *state, rk_discnp func, object size, long n, double p):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, n, p)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, n, p)\n return array\n\ncdef object discnmN_array(rk_state *state, rk_discnmN func, object size, \n long n, long m, long N):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, n, m, N)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, n, m, N)\n return array\n\ncdef object discd_array(rk_state *state, rk_discd func, object size, double a):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a)\n return array\n\ncdef double kahan_sum(double *darr, long n):\n cdef double c, y, t, sum\n cdef long i\n sum = darr[0]\n c = 0.0\n for i from 1 <= i < n:\n y = darr[i] - c\n t = sum + y\n c = (t-sum) - y\n sum = t\n return sum\n\ncdef class RandomState:\n \"\"\"Container for the Mersenne Twister PRNG.\n\n Constructor\n -----------\n RandomState(seed=None): initializes the PRNG with the given seed. See the\n seed() method for details.\n\n Distribution Methods\n -----------------\n RandomState exposes a number of methods for generating random numbers drawn\n from a variety of probability distributions. In addition to the\n distribution-specific arguments, each method takes a keyword argument\n size=None. If size is None, then a single value is generated and returned.\n If size is an integer, then a 1-D scipy array filled with generated values\n is returned. If size is a tuple, then a scipy array with that shape is\n filled and returned.\n \"\"\"\n cdef rk_state *internal_state\n\n def __init__(self, seed=None):\n self.internal_state = PyMem_Malloc(sizeof(rk_state))\n\n self.seed(seed)\n\n def __dealloc__(self):\n if self.internal_state != NULL:\n PyMem_Free(self.internal_state)\n\n def seed(self, seed=None):\n \"\"\"Seed the generator.\n\n seed(seed=None)\n\n seed can be an integer, an array (or other sequence) of integers of any\n length, or None. If seed is None, then RandomState will try to read data\n from /dev/urandom (or the Windows analogue) if available or seed from\n the clock otherwise.\n \"\"\"\n cdef rk_error errcode\n cdef ArrayType obj\n if seed is None:\n errcode = rk_randomseed(self.internal_state)\n elif type(seed) is int:\n rk_seed(seed, self.internal_state)\n else:\n obj = PyArray_ContiguousFromObject(seed, PyArray_LONG, 1, 1)\n init_by_array(self.internal_state, (obj.data),\n obj.dimensions[0])\n\n def get_state(self):\n \"\"\"Return a tuple representing the internal state of the generator.\n\n get_state() -> ('MT19937', int key[624], int pos)\n \"\"\"\n cdef ArrayType state\n state = _sp.empty(624, _sp.Int)\n memcpy((state.data), self.internal_state.key, 624*sizeof(long))\n return ('MT19937', state, self.internal_state.pos)\n \n def set_state(self, state):\n \"\"\"Set the state from a tuple.\n \n state = ('MT19937', int key[624], int pos)\n \n set_state(state)\n \"\"\"\n cdef ArrayType obj\n cdef int pos\n algorithm_name = state[0]\n if algorithm_name != 'MT19937':\n raise ValueError(\"algorithm must be 'MT19937'\")\n key, pos = state[1:]\n obj = PyArray_ContiguousFromObject(key, PyArray_LONG, 1, 1)\n if obj.dimensions[0] != 624:\n raise ValueError(\"state must be 624 longs\")\n memcpy(self.internal_state.key, (obj.data), 624*sizeof(long))\n self.internal_state.pos = pos\n \n # Pickling support:\n def __getstate__(self):\n return self.get_state()\n\n def __setstate__(self, state):\n self.set_state(state)\n\n def __reduce__(self):\n return (_sp.random.__RandomState_ctor, (), self.get_state())\n\n # Basic distributions:\n def random_sample(self, size=None):\n \"\"\"Return random floats in the half-open interval [0.0, 1.0).\n\n random_sample(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_double, size)\n\n def tomaxint(self, size=None):\n \"\"\"Returns random integers x such that 0 <= x <= sys.maxint.\n\n tomaxint(size=None) -> random values\n \"\"\"\n return disc0_array(self.internal_state, rk_long, size)\n\n def randint(self, low, high=None, size=None):\n \"\"\"Return random integers x such that low <= x < high.\n\n randint(low, high=None, size=None) -> random values\n\n If high is None, then 0 <= x < low.\n \"\"\"\n cdef long lo, hi, diff\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if high is None:\n lo = 0\n hi = low\n else:\n lo = low\n hi = high\n\n diff = hi - lo - 1\n if diff < 0:\n raise ValueError(\"low >= high\")\n \n if size is None:\n return rk_interval(diff, self.internal_state)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = lo + rk_interval(diff, self.internal_state)\n return array\n\n def bytes(self, unsigned int length):\n \"\"\"Return random bytes.\n\n bytes(length) -> str\n \"\"\"\n cdef void *bytes\n bytes = PyMem_Malloc(length)\n rk_fill(bytes, length, self.internal_state)\n bytestring = PyString_FromString(bytes)\n PyMem_Free(bytes)\n return bytestring\n\n def uniform(self, double low=0.0, double high=1.0, size=None):\n \"\"\"Uniform distribution over [low, high).\n\n uniform(low=0.0, high=1.0, size=None) -> random values\n \"\"\"\n return cont2_array(self.internal_state, rk_uniform, size, low, \n high-low)\n\n def rand(self, *args):\n \"\"\"Return an array of the given dimensions which is initialized to \n random numbers from a uniform distribution in the range [0,1).\n\n randn(d0, d1, ..., dn) -> random values\n \"\"\"\n if len(args) == 0:\n return self.random_sample()\n else:\n return self.random_sample(size=args)\n\n def randn(self, *args):\n \"\"\"Returns zero-mean, unit-variance Gaussian random numbers in an \n array of shape (d0, d1, ..., dn).\n\n randn(d0, d1, ..., dn) -> random values\n \"\"\"\n if len(args) == 0:\n return self.standard_normal()\n else:\n return self.standard_normal(args)\n\n def random_integers(self, low, high=None, size=None):\n \"\"\"Return random integers x such that low <= x <= high.\n\n random_integers(low, high=None, size=None) -> random values.\n\n If high is None, then 1 <= x <= low.\n \"\"\"\n if high is None:\n high = low\n low = 1\n return self.randint(low, high+1, size)\n\n # Complicated, continuous distributions:\n def standard_normal(self, size=None):\n \"\"\"Standard Normal distribution (mean=0, stdev=1).\n\n standard_normal(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_gauss, size)\n\n def normal(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Normal distribution (mean=loc, stdev=scale).\n\n normal(loc=0.0, scale=1.0, size=None) -> random values\n \"\"\"\n if scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont2_array(self.internal_state, rk_normal, size, loc, scale)\n\n def beta(self, double a, double b, size=None):\n \"\"\"Beta distribution over [0, 1].\n\n beta(a, b, size=None) -> random values\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n elif b <= 0:\n raise ValueError(\"b <= 0\")\n return cont2_array(self.internal_state, rk_beta, size, a, b)\n\n def exponential(self, double scale=1.0, size=None):\n \"\"\"Exponential distribution.\n\n exponential(scale=1.0, size=None) -> random values\n \"\"\"\n if scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont1_array(self.internal_state, rk_exponential, size, scale)\n\n def standard_exponential(self, size=None):\n \"\"\"Standard exponential distribution (scale=1).\n\n standard_exponential(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_standard_exponential, size)\n\n def standard_gamma(self, double shape, size=None):\n \"\"\"Standard Gamma distribution.\n\n standard_gamma(shape, size=None) -> random values\n \"\"\"\n if shape <= 0:\n raise ValueError(\"shape <= 0\")\n return cont1_array(self.internal_state, rk_standard_gamma, size, shape)\n\n def gamma(self, double shape, double scale=1.0, size=None):\n \"\"\"Gamma distribution.\n\n gamma(shape, scale=1.0, size=None) -> random values\n \"\"\"\n if shape <= 0:\n raise ValueError(\"shape <= 0\")\n elif scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont2_array(self.internal_state, rk_gamma, size, shape, scale)\n\n def f(self, double dfnum, double dfden, size=None):\n \"\"\"F distribution.\n\n f(dfnum, dfden, size=None) -> random values\n \"\"\"\n if dfnum <= 0:\n raise ValueError(\"dfnum <= 0\")\n elif dfden <= 0:\n raise ValueError(\"dfden <= 0\")\n return cont2_array(self.internal_state, rk_f, size, dfnum, dfden)\n\n def noncentral_f(self, double dfnum, double dfden, double nonc, size=None):\n \"\"\"Noncentral F distribution.\n\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\n \"\"\"\n if dfnum <= 1:\n raise ValueError(\"dfnum <= 1\")\n elif dfden <= 0:\n raise ValueError(\"dfden <= 0\")\n elif nonc < 0:\n raise ValueError(\"nonc < 0\")\n return cont3_array(self.internal_state, rk_noncentral_f, size, dfnum,\n dfden, nonc)\n\n def chisquare(self, double df, size=None):\n \"\"\"Chi^2 distribution.\n\n chisquare(df, size=None) -> random values\n \"\"\"\n if df <= 0:\n raise ValueError(\"df <= 0\")\n return cont1_array(self.internal_state, rk_chisquare, size, df)\n\n def noncentral_chisquare(self, double df, double nonc, size=None):\n \"\"\"Noncentral Chi^2 distribution.\n\n noncentral_chisquare(df, nonc, size=None) -> random values\n \"\"\"\n if df <= 1:\n raise ValueError(\"df <= 1\")\n elif nonc < 0:\n raise ValueError(\"nonc < 0\")\n return cont2_array(self.internal_state, rk_noncentral_chisquare, size,\n df, nonc)\n \n def standard_cauchy(self, size=None):\n \"\"\"Standard Cauchy with mode=0.\n\n standard_cauchy(size=None)\n \"\"\"\n return cont0_array(self.internal_state, rk_standard_cauchy, size)\n\n def standard_t(self, double df, size=None):\n \"\"\"Standard Student's t distribution with df degrees of freedom.\n\n standard_t(df, size=None)\n \"\"\"\n if df <= 0:\n raise ValueError(\"df <= 0\")\n return cont1_array(self.internal_state, rk_standard_t, size, df)\n\n def vonmises(self, double mu, double kappa, size=None):\n \"\"\"von Mises circular distribution with mode mu and dispersion parameter\n kappa on [-pi, pi].\n\n vonmises(mu, kappa, size=None)\n \"\"\"\n if kappa < 0:\n raise ValueError(\"kappa < 0\")\n return cont2_array(self.internal_state, rk_vonmises, size, mu, kappa)\n\n def pareto(self, double a, size=None):\n \"\"\"Pareto distribution.\n\n pareto(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_pareto, size, a)\n\n def weibull(self, double a, size=None):\n \"\"\"Weibull distribution.\n\n weibull(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_weibull, size, a)\n\n def power(self, double a, size=None):\n \"\"\"Power distribution.\n\n power(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_power, size, a)\n\n def laplace(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Laplace distribution.\n \n laplace(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_laplace, size, loc, scale)\n \n def gumbel(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Gumbel distribution.\n \n gumbel(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_gumbel, size, loc, scale)\n \n def logistic(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Logistic distribution.\n \n logistic(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_logistic, size, loc, scale)\n\n def lognormal(self, double mean=0.0, double sigma=1.0, size=None):\n \"\"\"Log-normal distribution.\n \n Note that the mean parameter is not the mean of this distribution, but \n the underlying normal distribution.\n \n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\n \n lognormal(mean=0.0, sigma=1.0, size=None)\n \"\"\"\n if sigma <= 0.0:\n raise ValueError(\"sigma <= 0.0\")\n return cont2_array(self.internal_state, rk_lognormal, size, mean, sigma)\n \n def rayleigh(self, double scale=1.0, size=None):\n \"\"\"Rayleigh distribution.\n \n rayleigh(scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont1_array(self.internal_state, rk_rayleigh, size, scale)\n \n def wald(self, double mean, double scale, size=None):\n \"\"\"Wald (inverse Gaussian) distribution.\n \n wald(mean, scale, size=None)\n \"\"\"\n if mean <= 0.0:\n raise ValueError(\"mean <= 0.0\")\n elif scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_wald, size, mean, scale)\n\n def triangular(self, double left, double mode, double right, size=None):\n \"\"\"Triangular distribution starting at left, peaking at mode, and \n ending at right (left <= mode <= right).\n \n triangular(left, mode, right, size=None)\n \"\"\"\n if left > mode:\n raise ValueError(\"left > mode\")\n elif mode > right:\n raise ValueError(\"mode > right\")\n elif left == right:\n raise ValueError(\"left == right\")\n return cont3_array(self.internal_state, rk_triangular, size, left, \n mode, right)\n\n # Complicated, discrete distributions:\n def binomial(self, long n, double p, size=None):\n \"\"\"Binomial distribution of n trials and p probability of success.\n\n binomial(n, p, size=None) -> random values\n \"\"\"\n if n <= 0:\n raise ValueError(\"n <= 0\")\n elif p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discnp_array(self.internal_state, rk_binomial, size, n, p)\n\n def negative_binomial(self, long n, double p, size=None):\n \"\"\"Negative Binomial distribution.\n\n negative_binomial(n, p, size=None) -> random values\n \"\"\"\n if n <= 0:\n raise ValueError(\"n <= 0\")\n elif p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discnp_array(self.internal_state, rk_negative_binomial, size, n,\n p)\n\n def poisson(self, double lam=1.0, size=None):\n \"\"\"Poisson distribution.\n\n poisson(lam=1.0, size=None) -> random values\n \"\"\"\n if lam <= 0:\n raise ValueError(\"lam <= 0\")\n return discd_array(self.internal_state, rk_poisson, size, lam)\n\n def zipf(self, double a, size=None):\n \"\"\"Zipf distribution.\n \n zipf(a, size=None)\n \"\"\"\n if a <= 1.0:\n raise ValueError(\"a <= 1.0\")\n return discd_array(self.internal_state, rk_zipf, size, a)\n \n def geometric(self, double p, size=None):\n \"\"\"Geometric distribution with p being the probability of \"success\" on\n an individual trial.\n \n geometric(p, size=None)\n \"\"\"\n if p < 0.0:\n raise ValueError(\"p < 0.0\")\n elif p > 1.0:\n raise ValueError(\"p > 1.0\")\n return discd_array(self.internal_state, rk_geometric, size, p)\n \n def hypergeometric(self, long ngood, long nbad, long nsample, size=None):\n \"\"\"Hypergeometric distribution.\n \n Consider an urn with ngood \"good\" balls and nbad \"bad\" balls. If one \n were to draw nsample balls from the urn without replacement, then \n the hypergeometric distribution describes the distribution of \"good\" \n balls in the sample.\n \n hypergeometric(ngood, nbad, nsample, size=None) \n \"\"\"\n if ngood < 1:\n raise ValueError(\"ngood < 1\")\n elif nbad < 1:\n raise ValueError(\"nbad < 1\")\n elif ngood + nbad < nsample:\n raise ValueError(\"ngood + nbad < nsample\")\n elif nsample < 1:\n raise ValueError(\"nsample < 1\")\n return discnmN_array(self.internal_state, rk_hypergeometric, size,\n ngood, nbad, nsample)\n\n def logseries(self, double p, size=None):\n \"\"\"Logarithmic series distribution.\n \n logseries(p, size=None)\n \"\"\"\n if p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discd_array(self.internal_state, rk_logseries, size, p)\n\n # Multivariate distributions:\n def multivariate_normal(self, mean, cov, size=None):\n \"\"\"Return an array containing multivariate normally distributed random numbers\n with specified mean and covariance.\n\n multivariate_normal(mean, cov) -> random values\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\n\n mean must be a 1 dimensional array. cov must be a square two dimensional\n array with the same number of rows and columns as mean has elements.\n\n The first form returns a single 1-D array containing a multivariate\n normal.\n\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\n normal.\n \"\"\"\n # Check preconditions on arguments\n mean = _sp.array(mean)\n cov = _sp.array(cov)\n if size is None:\n shape = []\n else:\n shape = size\n if len(mean.shape) != 1:\n raise ArgumentError(\"mean must be 1 dimensional\")\n if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]):\n raise ArgumentError(\"cov must be 2 dimensional and square\")\n if mean.shape[0] != cov.shape[0]:\n raise ArgumentError(\"mean and cov must have same length\")\n # Compute shape of output\n if isinstance(shape, int):\n shape = [shape]\n final_shape = list(shape[:])\n final_shape.append(mean.shape[0])\n # Create a matrix of independent standard normally distributed random\n # numbers. The matrix has rows with the same length as mean and as\n # many rows are necessary to form a matrix of shape final_shape.\n x = standard_normal(_sp.multiply.reduce(final_shape))\n x.shape = (_sp.multiply.reduce(final_shape[0:len(final_shape)-1]),\n mean.shape[0])\n # Transform matrix of standard normals into matrix where each row\n # contains multivariate normals with the desired covariance.\n # Compute A such that matrixmultiply(transpose(A),A) == cov.\n # Then the matrix products of the rows of x and A has the desired\n # covariance. Note that sqrt(s)*v where (u,s,v) is the singular value\n # decomposition of cov is such an A.\n \n # XXX: we really should be doing this by Cholesky decomposition\n (u,s,v) = _sp.linalg.singular_value_decomposition(cov)\n x = _sp.matrixmultiply(x*_sp.sqrt(s),v)\n # The rows of x now have the correct covariance but mean 0. Add\n # mean to each row. Then each row will have mean mean.\n _sp.add(mean,x,x)\n x.shape = tuple(final_shape)\n return x\n\n def multinomial(self, long n, object pvals, size=None):\n \"\"\"Multinomial distribution.\n \n multinomial(n, pvals, size=None) -> random values\n\n pvals is a sequence of probabilities that should sum to 1 (however, the\n last element is always assumed to account for the remaining probability\n as long as sum(pvals[:-1]) <= 1).\n \"\"\"\n cdef long d\n cdef ArrayType parr, mnarr\n cdef double *pix\n cdef long *mnix\n cdef long i, j, dn\n cdef double Sum, prob\n\n d = len(pvals)\n parr = PyArray_ContiguousFromObject(pvals, PyArray_DOUBLE, 1, 1)\n pix = parr.data\n\n if kahan_sum(pix, d-1) > 1.0:\n raise ValueError(\"sum(pvals) > 1.0\")\n\n if size is None:\n shape = (d,)\n elif type(size) is int:\n shape = (size, d)\n else:\n shape = size + (d,)\n\n multin = _sp.zeros(shape, _sp.Int)\n mnarr = multin\n mnix = mnarr.data\n i = 0\n while i < PyArray_SIZE(mnarr):\n Sum = 1.0\n dn = n\n for j from 0 <= j < d-1:\n mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum)\n dn = dn - mnix[i+j]\n if dn <= 0:\n break\n Sum = Sum - pix[j]\n if dn > 0:\n mnix[i+d-1] = dn\n\n i = i + d\n\n return multin\n\n # Shuffling and permutations:\n def shuffle(self, object x):\n \"\"\"Modify a sequence in-place by shuffling its contents.\n \n shuffle(x)\n \"\"\"\n cdef long i, j\n\n # adaptation of random.shuffle()\n i = len(x) - 1\n while i > 0:\n j = rk_interval(i, self.internal_state)\n x[i], x[j] = x[j], x[i]\n i = i - 1\n \n def permutation(self, object x):\n \"\"\"Given an integer, return a shuffled sequence of integers >= 0 and \n < x; given a sequence, return a shuffled array copy.\n\n permutation(x)\n \"\"\"\n if type(x) is int:\n arr = _sp.arange(x)\n else:\n arr = _sp.array(x)\n self.shuffle(arr)\n return arr \n\n_rand = RandomState()\nget_state = _rand.get_state\nset_state = _rand.set_state\nrandom_sample = _rand.random_sample\nrandint = _rand.randint\nbytes = _rand.bytes\nuniform = _rand.uniform\nrand = _rand.rand\nrandn = _rand.randn\nrandom_integers = _rand.random_integers\nstandard_normal = _rand.standard_normal\nnormal = _rand.normal\nbeta = _rand.beta\nexponential = _rand.exponential\nstandard_exponential = _rand.standard_exponential\nstandard_gamma = _rand.standard_gamma\ngamma = _rand.gamma\nf = _rand.f\nnoncentral_f = _rand.noncentral_f\nchisquare = _rand.chisquare\nnoncentral_chisquare = _rand.noncentral_chisquare\nstandard_cauchy = _rand.standard_cauchy\nstandard_t = _rand.standard_t\nvonmises = _rand.vonmises\npareto = _rand.pareto\nweibull = _rand.weibull\npower = _rand.power\nlaplace = _rand.laplace\ngumbel = _rand.gumbel\nlogistic = _rand.logistic\nlognormal = _rand.lognormal\nrayleigh = _rand.rayleigh\nwald = _rand.wald\ntriangular = _rand.triangular\n\nbinomial = _rand.binomial\nnegative_binomial = _rand.negative_binomial\npoisson = _rand.poisson\nzipf = _rand.zipf\ngeometric = _rand.geometric\nhypergeometric = _rand.hypergeometric\nlogseries = _rand.logseries\n\nmultivariate_normal = _rand.multivariate_normal\nmultinomial = _rand.multinomial\n\nshuffle = _rand.shuffle\npermutation = _rand.permutation\n", "source_code_before": "# mtrand.pyx -- A Pyrex wrapper of Jean-Sebastien Roy's RandomKit\n#\n# Copyright 2005 Robert Kern (robert.kern@gmail.com)\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n# \n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n# \n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\ninclude \"Python.pxi\"\ninclude \"scipy.pxi\"\n\ncdef extern from \"math.h\":\n double exp(double x)\n double log(double x)\n double floor(double x)\n double sin(double x)\n double cos(double x)\n\ncdef extern from \"randomkit.h\":\n\n ctypedef struct rk_state:\n unsigned long key[624]\n int pos\n\n ctypedef enum rk_error:\n RK_NOERR = 0\n RK_ENODEV = 1\n RK_ERR_MAX = 2\n\n char *rk_strerror[2]\n \n # 0xFFFFFFFFUL\n unsigned long RK_MAX\n\n void rk_seed(unsigned long seed, rk_state *state)\n rk_error rk_randomseed(rk_state *state)\n unsigned long rk_random(rk_state *state)\n long rk_long(rk_state *state)\n unsigned long rk_ulong(rk_state *state)\n unsigned long rk_interval(unsigned long max, rk_state *state)\n double rk_double(rk_state *state)\n void rk_fill(void *buffer, size_t size, rk_state *state)\n rk_error rk_devfill(void *buffer, size_t size, int strong)\n rk_error rk_altfill(void *buffer, size_t size, int strong,\n rk_state *state)\n double rk_gauss(rk_state *state)\n\ncdef extern from \"distributions.h\":\n \n double rk_normal(rk_state *state, double loc, double scale)\n double rk_standard_exponential(rk_state *state)\n double rk_exponential(rk_state *state, double scale)\n double rk_uniform(rk_state *state, double loc, double scale)\n double rk_standard_gamma(rk_state *state, double shape)\n double rk_gamma(rk_state *state, double shape, double scale)\n double rk_beta(rk_state *state, double a, double b)\n double rk_chisquare(rk_state *state, double df)\n double rk_noncentral_chisquare(rk_state *state, double df, double nonc)\n double rk_f(rk_state *state, double dfnum, double dfden)\n double rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc)\n double rk_standard_cauchy(rk_state *state)\n double rk_standard_t(rk_state *state, double df)\n double rk_vonmises(rk_state *state, double mu, double kappa)\n double rk_pareto(rk_state *state, double a)\n double rk_weibull(rk_state *state, double a)\n double rk_power(rk_state *state, double a)\n double rk_laplace(rk_state *state, double loc, double scale)\n double rk_gumbel(rk_state *state, double loc, double scale)\n double rk_logistic(rk_state *state, double loc, double scale)\n double rk_lognormal(rk_state *state, double mode, double sigma)\n double rk_rayleigh(rk_state *state, double mode)\n double rk_wald(rk_state *state, double mean, double scale)\n double rk_triangular(rk_state *state, double left, double mode, double right)\n \n long rk_binomial(rk_state *state, long n, double p)\n long rk_negative_binomial(rk_state *state, long n, double p)\n long rk_poisson(rk_state *state, double lam)\n long rk_zipf(rk_state *state, double a)\n long rk_geometric(rk_state *state, double p)\n long rk_hypergeometric(rk_state *state, long good, long bad, long sample)\n long rk_logseries(rk_state *state, double p)\n \nctypedef double (* rk_cont0)(rk_state *state)\nctypedef double (* rk_cont1)(rk_state *state, double a)\nctypedef double (* rk_cont2)(rk_state *state, double a, double b)\nctypedef double (* rk_cont3)(rk_state *state, double a, double b, double c)\n\nctypedef long (* rk_disc0)(rk_state *state)\nctypedef long (* rk_discnp)(rk_state *state, long n, double p)\nctypedef long (* rk_discnmN)(rk_state *state, long n, long m, long N)\nctypedef long (* rk_discd)(rk_state *state, double a)\n\n\ncdef extern from \"initarray.h\":\n void init_by_array(rk_state *self, unsigned long *init_key, \n unsigned long key_length)\n\n# Initialize scipy\nimport_array()\n\nimport scipy as _sp\n\ncdef object cont0_array(rk_state *state, rk_cont0 func, object size):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state)\n return array\n\ncdef object cont1_array(rk_state *state, rk_cont1 func, object size, double a):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a)\n return array\n\ncdef object cont2_array(rk_state *state, rk_cont2 func, object size, double a, \n double b):\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a, b)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a, b)\n return array\n\ncdef object cont3_array(rk_state *state, rk_cont3 func, object size, double a, \n double b, double c):\n\n cdef double *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n \n if size is None:\n return func(state, a, b, c)\n else:\n array = _sp.empty(size, _sp.Float64)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a, b, c)\n return array\n\ncdef object disc0_array(rk_state *state, rk_disc0 func, object size):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state)\n return array\n\ncdef object discnp_array(rk_state *state, rk_discnp func, object size, long n, double p):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, n, p)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, n, p)\n return array\n\ncdef object discnmN_array(rk_state *state, rk_discnmN func, object size, \n long n, long m, long N):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, n, m, N)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, n, m, N)\n return array\n\ncdef object discd_array(rk_state *state, rk_discd func, object size, double a):\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if size is None:\n return func(state, a)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = func(state, a)\n return array\n\ncdef double kahan_sum(double *darr, long n):\n cdef double c, y, t, sum\n cdef long i\n sum = darr[0]\n c = 0.0\n for i from 1 <= i < n:\n y = darr[i] - c\n t = sum + y\n c = (t-sum) - y\n sum = t\n return sum\n\ncdef class RandomState:\n \"\"\"Container for the Mersenne Twister PRNG.\n\n Constructor\n -----------\n RandomState(seed=None): initializes the PRNG with the given seed. See the\n seed() method for details.\n\n Distribution Methods\n -----------------\n RandomState exposes a number of methods for generating random numbers drawn\n from a variety of probability distributions. In addition to the\n distribution-specific arguments, each method takes a keyword argument\n size=None. If size is None, then a single value is generated and returned.\n If size is an integer, then a 1-D scipy array filled with generated values\n is returned. If size is a tuple, then a scipy array with that shape is\n filled and returned.\n \"\"\"\n cdef rk_state *internal_state\n\n def __init__(self, seed=None):\n self.internal_state = PyMem_Malloc(sizeof(rk_state))\n\n self.seed(seed)\n\n def __dealloc__(self):\n if self.internal_state != NULL:\n PyMem_Free(self.internal_state)\n\n def seed(self, seed=None):\n \"\"\"Seed the generator.\n\n seed(seed=None)\n\n seed can be an integer, an array (or other sequence) of integers of any\n length, or None. If seed is None, then RandomState will try to read data\n from /dev/urandom (or the Windows analogue) if available or seed from\n the clock otherwise.\n \"\"\"\n cdef rk_error errcode\n cdef ArrayType obj\n if seed is None:\n errcode = rk_randomseed(self.internal_state)\n elif type(seed) is int:\n rk_seed(seed, self.internal_state)\n else:\n obj = PyArray_ContiguousFromObject(seed, PyArray_LONG, 1, 1)\n init_by_array(self.internal_state, (obj.data),\n obj.dimensions[0])\n\n def get_state(self):\n \"\"\"Return a tuple representing the internal state of the generator.\n\n get_state() -> ('MT19937', int key[624], int pos)\n \"\"\"\n cdef ArrayType state\n state = _sp.empty(624, _sp.Int)\n memcpy((state.data), self.internal_state.key, 624*sizeof(long))\n return ('MT19937', state, self.internal_state.pos)\n \n def set_state(self, state):\n \"\"\"Set the state from a tuple.\n \n state = ('MT19937', int key[624], int pos)\n \n set_state(state)\n \"\"\"\n cdef ArrayType obj\n cdef int pos\n algorithm_name = state[0]\n if algorithm_name != 'MT19937':\n raise ValueError(\"algorithm must be 'MT19937'\")\n key, pos = state[1:]\n obj = PyArray_ContiguousFromObject(key, PyArray_LONG, 1, 1)\n if obj.dimensions[0] != 624:\n raise ValueError(\"state must be 624 longs\")\n memcpy(self.internal_state.key, (obj.data), 624*sizeof(long))\n self.internal_state.pos = pos\n \n # Pickling support:\n def __getstate__(self):\n return self.get_state()\n\n def __setstate__(self, state):\n self.set_state(state)\n\n def __reduce__(self):\n return (_sp.random.__RandomState_ctor, (), self.get_state())\n\n # Basic distributions:\n def random_sample(self, size=None):\n \"\"\"Return random floats in the half-open interval [0.0, 1.0).\n\n random_sample(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_double, size)\n\n def tomaxint(self, size=None):\n \"\"\"Returns random integers x such that 0 <= x <= sys.maxint.\n\n tomaxint(size=None) -> random values\n \"\"\"\n return disc0_array(self.internal_state, rk_long, size)\n\n def randint(self, low, high=None, size=None):\n \"\"\"Return random integers x such that low <= x < high.\n\n randint(low, high=None, size=None) -> random values\n\n If high is None, then 0 <= x < low.\n \"\"\"\n cdef long lo, hi, diff\n cdef long *array_data\n cdef ArrayType array\n cdef long length\n cdef long i\n\n if high is None:\n lo = 0\n hi = low\n else:\n lo = low\n hi = high\n\n diff = hi - lo - 1\n if diff < 0:\n raise ValueError(\"low >= high\")\n \n if size is None:\n return rk_interval(diff, self.internal_state)\n else:\n array = _sp.empty(size, _sp.Int)\n length = PyArray_SIZE(array)\n array_data = array.data\n for i from 0 <= i < length:\n array_data[i] = lo + rk_interval(diff, self.internal_state)\n return array\n\n def bytes(self, unsigned int length):\n \"\"\"Return random bytes.\n\n bytes(length) -> str\n \"\"\"\n cdef void *bytes\n bytes = PyMem_Malloc(length)\n rk_fill(bytes, length, self.internal_state)\n bytestring = PyString_FromString(bytes)\n PyMem_Free(bytes)\n return bytestring\n\n def uniform(self, double low=0.0, double high=1.0, size=None):\n \"\"\"Uniform distribution over [low, high).\n\n uniform(low=0.0, high=1.0, size=None) -> random values\n \"\"\"\n return cont2_array(self.internal_state, rk_uniform, size, low, \n high-low)\n\n def rand(self, *args):\n \"\"\"Return an array of the given dimensions which is initialized to \n random numbers from a uniform distribution in the range [0,1).\n\n randn(d0, d1, ..., dn) -> random values\n \"\"\"\n if len(args) == 0:\n return self.random_sample()\n else:\n return self.random_sample(size=args)\n\n def randn(self, *args):\n \"\"\"Returns zero-mean, unit-variance Gaussian random numbers in an \n array of shape (d0, d1, ..., dn).\n\n randn(d0, d1, ..., dn) -> random values\n \"\"\"\n if len(args) == 0:\n return self.standard_normal()\n else:\n return self.standard_normal(args)\n\n def random_integers(self, low, high=None, size=None):\n \"\"\"Return random integers x such that low <= x <= high.\n\n random_integers(low, high=None, size=None) -> random values.\n\n If high is None, then 1 <= x <= low.\n \"\"\"\n if high is None:\n high = low\n low = 1\n return self.randint(low, high+1, size)\n\n # Complicated, continuous distributions:\n def standard_normal(self, size=None):\n \"\"\"Standard Normal distribution (mean=0, stdev=1).\n\n standard_normal(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_gauss, size)\n\n def normal(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Normal distribution (mean=loc, stdev=scale).\n\n normal(loc=0.0, scale=1.0, size=None) -> random values\n \"\"\"\n if scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont2_array(self.internal_state, rk_normal, size, loc, scale)\n\n def beta(self, double a, double b, size=None):\n \"\"\"Beta distribution over [0, 1].\n\n beta(a, b, size=None) -> random values\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n elif b <= 0:\n raise ValueError(\"b <= 0\")\n return cont2_array(self.internal_state, rk_beta, size, a, b)\n\n def exponential(self, double scale=1.0, size=None):\n \"\"\"Exponential distribution.\n\n exponential(scale=1.0, size=None) -> random values\n \"\"\"\n if scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont1_array(self.internal_state, rk_exponential, size, scale)\n\n def standard_exponential(self, size=None):\n \"\"\"Standard exponential distribution (scale=1).\n\n standard_exponential(size=None) -> random values\n \"\"\"\n return cont0_array(self.internal_state, rk_standard_exponential, size)\n\n def standard_gamma(self, double shape, size=None):\n \"\"\"Standard Gamma distribution.\n\n standard_gamma(shape, size=None) -> random values\n \"\"\"\n if shape <= 0:\n raise ValueError(\"shape <= 0\")\n return cont1_array(self.internal_state, rk_standard_gamma, size, shape)\n\n def gamma(self, double shape, double scale=1.0, size=None):\n \"\"\"Gamma distribution.\n\n gamma(shape, scale=1.0, size=None) -> random values\n \"\"\"\n if shape <= 0:\n raise ValueError(\"shape <= 0\")\n elif scale <= 0:\n raise ValueError(\"scale <= 0\")\n return cont2_array(self.internal_state, rk_gamma, size, shape, scale)\n\n def f(self, double dfnum, double dfden, size=None):\n \"\"\"F distribution.\n\n f(dfnum, dfden, size=None) -> random values\n \"\"\"\n if dfnum <= 0:\n raise ValueError(\"dfnum <= 0\")\n elif dfden <= 0:\n raise ValueError(\"dfden <= 0\")\n return cont2_array(self.internal_state, rk_f, size, dfnum, dfden)\n\n def noncentral_f(self, double dfnum, double dfden, double nonc, size=None):\n \"\"\"Noncentral F distribution.\n\n noncentral_f(dfnum, dfden, nonc, size=None) -> random values\n \"\"\"\n if dfnum <= 1:\n raise ValueError(\"dfnum <= 1\")\n elif dfden <= 0:\n raise ValueError(\"dfden <= 0\")\n elif nonc < 0:\n raise ValueError(\"nonc < 0\")\n return cont3_array(self.internal_state, rk_noncentral_f, size, dfnum,\n dfden, nonc)\n\n def chisquare(self, double df, size=None):\n \"\"\"Chi^2 distribution.\n\n chisquare(df, size=None) -> random values\n \"\"\"\n if df <= 0:\n raise ValueError(\"df <= 0\")\n return cont1_array(self.internal_state, rk_chisquare, size, df)\n\n def noncentral_chisquare(self, double df, double nonc, size=None):\n \"\"\"Noncentral Chi^2 distribution.\n\n noncentral_chisquare(df, nonc, size=None) -> random values\n \"\"\"\n if df <= 1:\n raise ValueError(\"df <= 1\")\n elif nonc < 0:\n raise ValueError(\"nonc < 0\")\n return cont2_array(self.internal_state, rk_noncentral_chisquare, size,\n df, nonc)\n \n def standard_cauchy(self, size=None):\n \"\"\"Standard Cauchy with mode=0.\n\n standard_cauchy(size=None)\n \"\"\"\n return cont0_array(self.internal_state, rk_standard_cauchy, size)\n\n def standard_t(self, double df, size=None):\n \"\"\"Standard Student's t distribution with df degrees of freedom.\n\n standard_t(df, size=None)\n \"\"\"\n if df <= 0:\n raise ValueError(\"df <= 0\")\n return cont1_array(self.internal_state, rk_standard_t, size, df)\n\n def vonmises(self, double mu, double kappa, size=None):\n \"\"\"von Mises circular distribution with mode mu and dispersion parameter\n kappa on [-pi, pi].\n\n vonmises(mu, kappa, size=None)\n \"\"\"\n if kappa < 0:\n raise ValueError(\"kappa < 0\")\n return cont2_array(self.internal_state, rk_vonmises, size, mu, kappa)\n\n def pareto(self, double a, size=None):\n \"\"\"Pareto distribution.\n\n pareto(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_pareto, size, a)\n\n def weibull(self, double a, size=None):\n \"\"\"Weibull distribution.\n\n weibull(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_weibull, size, a)\n\n def power(self, double a, size=None):\n \"\"\"Power distribution.\n\n power(a, size=None)\n \"\"\"\n if a <= 0:\n raise ValueError(\"a <= 0\")\n return cont1_array(self.internal_state, rk_power, size, a)\n\n def laplace(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Laplace distribution.\n \n laplace(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_laplace, size, loc, scale)\n \n def gumbel(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Gumbel distribution.\n \n gumbel(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_gumbel, size, loc, scale)\n \n def logistic(self, double loc=0.0, double scale=1.0, size=None):\n \"\"\"Logistic distribution.\n \n logistic(loc=0.0, scale=1.0, size=None)\n \"\"\"\n if scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_logistic, size, loc, scale)\n\n def lognormal(self, double mean=0.0, double sigma=1.0, size=None):\n \"\"\"Log-normal distribution.\n \n Note that the mean parameter is not the mean of this distribution, but \n the underlying normal distribution.\n \n lognormal(mean, sigma) <=> exp(normal(mean, sigma))\n \n lognormal(mean=0.0, sigma=1.0, size=None)\n \"\"\"\n if sigma <= 0.0:\n raise ValueError(\"sigma <= 0.0\")\n return cont2_array(self.internal_state, rk_lognormal, size, mean, sigma)\n \n def rayleigh(self, double mode, size=None):\n \"\"\"Rayleigh distribution.\n \n rayleigh(mode, size=None)\n \"\"\"\n if mode <= 0.0:\n raise ValueError(\"mode <= 0.0\")\n return cont1_array(self.internal_state, rk_rayleigh, size, mode)\n \n def wald(self, double mean, double scale, size=None):\n \"\"\"Wald (inverse Gaussian) distribution.\n \n wald(mean, scale, size=None)\n \"\"\"\n if mean <= 0.0:\n raise ValueError(\"mean <= 0.0\")\n elif scale <= 0.0:\n raise ValueError(\"scale <= 0.0\")\n return cont2_array(self.internal_state, rk_wald, size, mean, scale)\n\n def triangular(self, double left, double mode, double right, size=None):\n \"\"\"Triangular distribution starting at left, peaking at mode, and \n ending at right (left <= mode <= right).\n \n triangular(left, mode, right, size=None)\n \"\"\"\n if left > mode:\n raise ValueError(\"left > mode\")\n elif mode > right:\n raise ValueError(\"mode > right\")\n elif left == right:\n raise ValueError(\"left == right\")\n return cont3_array(self.internal_state, rk_triangular, size, left, \n mode, right)\n\n # Complicated, discrete distributions:\n def binomial(self, long n, double p, size=None):\n \"\"\"Binomial distribution of n trials and p probability of success.\n\n binomial(n, p, size=None) -> random values\n \"\"\"\n if n <= 0:\n raise ValueError(\"n <= 0\")\n elif p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discnp_array(self.internal_state, rk_binomial, size, n, p)\n\n def negative_binomial(self, long n, double p, size=None):\n \"\"\"Negative Binomial distribution.\n\n negative_binomial(n, p, size=None) -> random values\n \"\"\"\n if n <= 0:\n raise ValueError(\"n <= 0\")\n elif p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discnp_array(self.internal_state, rk_negative_binomial, size, n,\n p)\n\n def poisson(self, double lam=1.0, size=None):\n \"\"\"Poisson distribution.\n\n poisson(lam=1.0, size=None) -> random values\n \"\"\"\n if lam <= 0:\n raise ValueError(\"lam <= 0\")\n return discd_array(self.internal_state, rk_poisson, size, lam)\n\n def zipf(self, double a, size=None):\n \"\"\"Zipf distribution.\n \n zipf(a, size=None)\n \"\"\"\n if a <= 1.0:\n raise ValueError(\"a <= 1.0\")\n return discd_array(self.internal_state, rk_zipf, size, a)\n \n def geometric(self, double p, size=None):\n \"\"\"Geometric distribution with p being the probability of \"success\" on\n an individual trial.\n \n geometric(p, size=None)\n \"\"\"\n if p < 0.0:\n raise ValueError(\"p < 0.0\")\n elif p > 1.0:\n raise ValueError(\"p > 1.0\")\n return discd_array(self.internal_state, rk_geometric, size, p)\n \n def hypergeometric(self, long ngood, long nbad, long nsample, size=None):\n \"\"\"Hypergeometric distribution.\n \n Consider an urn with ngood \"good\" balls and nbad \"bad\" balls. If one \n were to draw nsample balls from the urn without replacement, then \n the hypergeometric distribution describes the distribution of \"good\" \n balls in the sample.\n \n hypergeometric(ngood, nbad, nsample, size=None) \n \"\"\"\n if ngood < 1:\n raise ValueError(\"ngood < 1\")\n elif nbad < 1:\n raise ValueError(\"nbad < 1\")\n elif ngood + nbad < nsample:\n raise ValueError(\"ngood + nbad < nsample\")\n elif nsample < 1:\n raise ValueError(\"nsample < 1\")\n return discnmN_array(self.internal_state, rk_hypergeometric, size,\n ngood, nbad, nsample)\n\n def logseries(self, double p, size=None):\n \"\"\"Logarithmic series distribution.\n \n logseries(p, size=None)\n \"\"\"\n if p < 0:\n raise ValueError(\"p < 0\")\n elif p > 1:\n raise ValueError(\"p > 1\")\n return discd_array(self.internal_state, rk_logseries, size, p)\n\n # Multivariate distributions:\n def multivariate_normal(self, mean, cov, size=None):\n \"\"\"Return an array containing multivariate normally distributed random numbers\n with specified mean and covariance.\n\n multivariate_normal(mean, cov) -> random values\n multivariate_normal(mean, cov, [m, n, ...]) -> random values\n\n mean must be a 1 dimensional array. cov must be a square two dimensional\n array with the same number of rows and columns as mean has elements.\n\n The first form returns a single 1-D array containing a multivariate\n normal.\n\n The second form returns an array of shape (m, n, ..., cov.shape[0]).\n In this case, output[i,j,...,:] is a 1-D array containing a multivariate\n normal.\n \"\"\"\n # Check preconditions on arguments\n mean = _sp.array(mean)\n cov = _sp.array(cov)\n if size is None:\n shape = []\n else:\n shape = size\n if len(mean.shape) != 1:\n raise ArgumentError(\"mean must be 1 dimensional\")\n if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]):\n raise ArgumentError(\"cov must be 2 dimensional and square\")\n if mean.shape[0] != cov.shape[0]:\n raise ArgumentError(\"mean and cov must have same length\")\n # Compute shape of output\n if isinstance(shape, int):\n shape = [shape]\n final_shape = list(shape[:])\n final_shape.append(mean.shape[0])\n # Create a matrix of independent standard normally distributed random\n # numbers. The matrix has rows with the same length as mean and as\n # many rows are necessary to form a matrix of shape final_shape.\n x = standard_normal(_sp.multiply.reduce(final_shape))\n x.shape = (_sp.multiply.reduce(final_shape[0:len(final_shape)-1]),\n mean.shape[0])\n # Transform matrix of standard normals into matrix where each row\n # contains multivariate normals with the desired covariance.\n # Compute A such that matrixmultiply(transpose(A),A) == cov.\n # Then the matrix products of the rows of x and A has the desired\n # covariance. Note that sqrt(s)*v where (u,s,v) is the singular value\n # decomposition of cov is such an A.\n \n # XXX: we really should be doing this by Cholesky decomposition\n (u,s,v) = _sp.linalg.singular_value_decomposition(cov)\n x = _sp.matrixmultiply(x*_sp.sqrt(s),v)\n # The rows of x now have the correct covariance but mean 0. Add\n # mean to each row. Then each row will have mean mean.\n _sp.add(mean,x,x)\n x.shape = tuple(final_shape)\n return x\n\n def multinomial(self, long n, object pvals, size=None):\n \"\"\"Multinomial distribution.\n \n multinomial(n, pvals, size=None) -> random values\n\n pvals is a sequence of probabilities that should sum to 1 (however, the\n last element is always assumed to account for the remaining probability\n as long as sum(pvals[:-1]) <= 1).\n \"\"\"\n cdef long d\n cdef ArrayType parr, mnarr\n cdef double *pix\n cdef long *mnix\n cdef long i, j, dn\n cdef double Sum, prob\n\n d = len(pvals)\n parr = PyArray_ContiguousFromObject(pvals, PyArray_DOUBLE, 1, 1)\n pix = parr.data\n\n if kahan_sum(pix, d-1) > 1.0:\n raise ValueError(\"sum(pvals) > 1.0\")\n\n if size is None:\n shape = (d,)\n elif type(size) is int:\n shape = (size, d)\n else:\n shape = size + (d,)\n\n multin = _sp.zeros(shape, _sp.Int)\n mnarr = multin\n mnix = mnarr.data\n i = 0\n while i < PyArray_SIZE(mnarr):\n Sum = 1.0\n dn = n\n for j from 0 <= j < d-1:\n mnix[i+j] = rk_binomial(self.internal_state, dn, pix[j]/Sum)\n dn = dn - mnix[i+j]\n if dn <= 0:\n break\n Sum = Sum - pix[j]\n if dn > 0:\n mnix[i+d-1] = dn\n\n i = i + d\n\n return multin\n\n # Shuffling and permutations:\n def shuffle(self, object x):\n \"\"\"Modify a sequence in-place by shuffling its contents.\n \n shuffle(x)\n \"\"\"\n cdef long i, j\n\n # adaptation of random.shuffle()\n i = len(x) - 1\n while i > 0:\n j = rk_interval(i, self.internal_state)\n x[i], x[j] = x[j], x[i]\n i = i - 1\n \n def permutation(self, object x):\n \"\"\"Given an integer, return a shuffled sequence of integers >= 0 and \n < x; given a sequence, return a shuffled array copy.\n\n permutation(x)\n \"\"\"\n if type(x) is int:\n arr = _sp.arange(x)\n else:\n arr = _sp.array(x)\n self.shuffle(arr)\n return arr \n\n_rand = RandomState()\nget_state = _rand.get_state\nset_state = _rand.set_state\nrandom_sample = _rand.random_sample\nrandint = _rand.randint\nbytes = _rand.bytes\nuniform = _rand.uniform\nrand = _rand.rand\nrandn = _rand.randn\nrandom_integers = _rand.random_integers\nstandard_normal = _rand.standard_normal\nnormal = _rand.normal\nbeta = _rand.beta\nexponential = _rand.exponential\nstandard_exponential = _rand.standard_exponential\nstandard_gamma = _rand.standard_gamma\ngamma = _rand.gamma\nf = _rand.f\nnoncentral_f = _rand.noncentral_f\nchisquare = _rand.chisquare\nnoncentral_chisquare = _rand.noncentral_chisquare\nstandard_cauchy = _rand.standard_cauchy\nstandard_t = _rand.standard_t\nvonmises = _rand.vonmises\npareto = _rand.pareto\nweibull = _rand.weibull\npower = _rand.power\nlaplace = _rand.laplace\ngumbel = _rand.gumbel\nlogistic = _rand.logistic\nlognormal = _rand.lognormal\nrayleigh = _rand.rayleigh\nwald = _rand.wald\ntriangular = _rand.triangular\n\nbinomial = _rand.binomial\nnegative_binomial = _rand.negative_binomial\npoisson = _rand.poisson\nzipf = _rand.zipf\ngeometric = _rand.geometric\nhypergeometric = _rand.hypergeometric\nlogseries = _rand.logseries\n\nmultivariate_normal = _rand.multivariate_normal\nmultinomial = _rand.multinomial\n\nshuffle = _rand.shuffle\npermutation = _rand.permutation\n", "methods": [], "methods_before": [], "changed_methods": [], "nloc": null, "complexity": null, "token_count": null, "diff_parsed": { "added": [ " def rayleigh(self, double scale=1.0, size=None):", " rayleigh(scale=1.0, size=None)", " if scale <= 0.0:", " raise ValueError(\"scale <= 0.0\")", " return cont1_array(self.internal_state, rk_rayleigh, size, scale)" ], "deleted": [ " def rayleigh(self, double mode, size=None):", " rayleigh(mode, size=None)", " if mode <= 0.0:", " raise ValueError(\"mode <= 0.0\")", " return cont1_array(self.internal_state, rk_rayleigh, size, mode)" ] } } ] }, { "hash": "943e3817e6ac2e53bfbd1cb0c1724339044a479a", "msg": "Some printing fixes.", "author": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "committer": { "name": "Travis Oliphant", "email": "oliphant@enthought.com" }, "author_date": "2005-10-08T19:25:19+00:00", "author_timezone": 0, "committer_date": "2005-10-08T19:25:19+00:00", "committer_timezone": 0, "branches": [ "main" ], "in_main_branch": true, "merge": false, "parents": [ "fdfefd74949d72956c21c10ae4f1ef1469ffb5ab" ], "project_name": "repo_copy", "project_path": "/tmp/tmp5boscljw/repo_copy", "deletions": 5, "insertions": 9, "lines": 14, "files": 1, "dmm_unit_size": 0.0, "dmm_unit_complexity": 0.0, "dmm_unit_interfacing": 0.25, "modified_files": [ { "old_path": "scipy/base/src/arrayobject.c", "new_path": "scipy/base/src/arrayobject.c", "filename": "arrayobject.c", "extension": "c", "change_type": "MODIFY", "diff": "@@ -1027,7 +1027,8 @@ PyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format)\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n- \" %d to file\", it->index);\n+ \" %d to file\", \n+\t\t\t\t\t\t (int)it->index);\n Py_DECREF(it);\n return -1;\n }\n@@ -1065,7 +1066,8 @@ PyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format)\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n- \" to file\", it->index);\n+ \" to file\", \n+\t\t\t\t\t (int) it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n@@ -5768,7 +5770,8 @@ iter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n \t\tif (num < 0 || num >= self->size) {\n \t\t\tPyErr_Format(PyExc_IndexError,\n \t\t\t\t \"Index %d out of bounds\"\t\t\\\n-\t\t\t\t \" 0<=index<%d\", num, self->size);\n+\t\t\t\t \" 0<=index<%d\", (int) num, \n+\t\t\t\t (int) self->size);\n \t\t\tPy_DECREF(ind_it);\n \t\t\tPy_DECREF(r);\n \t\t\tPyArray_ITER_RESET(self);\n@@ -5972,7 +5975,8 @@ iter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n \t\tif ((num < 0) || (num >= self->size)) {\n \t\t\tPyErr_Format(PyExc_IndexError,\n \t\t\t\t \"Index %d out of bounds\"\t\t\\\n-\t\t\t\t \" 0<=index<%d\", num, self->size);\n+\t\t\t\t \" 0<=index<%d\", (int) num, \n+\t\t\t\t (int) self->size);\n \t\t\tPy_DECREF(ind_it);\n \t\t\treturn -1;\n \t\t}\n@@ -6628,7 +6632,7 @@ PyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n \t\t\t\tPyErr_Format(PyExc_IndexError,\n \t\t\t\t\t \"index (%d) out of range \"\\\n \t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n-\t\t\t\t\t *indptr, dimsize-1, \n+\t\t\t\t\t (int) *indptr, (int) (dimsize-1), \n \t\t\t\t\t mit->iteraxes[i]);\n \t\t\t\tgoto fail;\n \t\t\t}\n", "added_lines": 9, "deleted_lines": 5, "source_code": " /*\n Provide multidimensional arrays as a basic object type in python. \n\nBased on Original Numeric implementation\nCopyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\nwith contributions from many Numeric Python developers 1995-2004 *\n\nHeavily modified in 2005 with inspiration from Numarray \n\nby\n\nTravis Oliphant\nAssistant Professor at\nBrigham Young University \n\nmaintainer email: oliphant.travis@ieee.org\n\nNumarray design (which provided guidance) by \nSpace Science Telescope Institute \n (J. Todd Miller, Perry Greenfield, Rick White)\n\n*/\n\n/* $Id: arrayobject.c,v 1.59 2005/09/14 00:14:00 teoliphant Exp $ */\n\n/*\n#include \"Python.h\"\n#include \"structmember.h\"\n\n#define _MULTIARRAYMODULE\n#include \"Numeric3/arrayobject.h\"\n*/\n\n/* Helper functions */\n\n#define error_converting(x) (((x) == -1) && PyErr_Occurred())\n\nstatic intp\nPyArray_PyIntAsIntp(PyObject *o)\n{\n\tlonglong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INTP, 0, 0};\n\tintp ret;\n\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((intp *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (longlong) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (longlong) PyLong_AsLongLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\t\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONGLONG != SIZEOF_PY_INTPTR_T)\n\tif ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C intp\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (intp) long_value;\n}\n\n\nstatic PyObject *array_int(PyArrayObject *v);\n\nstatic int\nPyArray_PyIntAsInt(PyObject *o)\n{\n\tlong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INT, 0, 0};\n\tint ret;\n\t\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((int *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (long) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (long) PyLong_AsLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONG != SIZEOF_INT)\n\tif ((long_value < INT_MIN) || (long_value > INT_MAX)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C int\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (int) long_value;\n}\n\n\nstatic double\nPyArray_GetPriority(PyObject *obj, double default_) \n{\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n\n\tif (PyArray_CheckExact(obj))\n\t\treturn priority;\n if (PyBigArray_CheckExact(obj)) \n return PyArray_BIG_PRIORITY;\n\n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n if (PyErr_Occurred()) {\n PyErr_Clear(); \n priority = default_;\n }\n Py_XDECREF(ret);\n return priority; \n}\n\n/* Backward compatibility only */\n/* In both Zero and One\n\n ***You must free the memory once you are done with it\n using PyDataMem_FREE(ptr) or you create a memory leak***\n\n If arr is an Object array you are getting a \n BORROWED reference to Zero or One.\n Do not DECREF.\n Please INCREF if you will be hanging on to it.\n\n The memory for the ptr still must be freed in any case;\n*/\n\nstatic char *\nPyArray_Zero(PyArrayObject *arr)\n{\n char *zeroval;\n char *buf;\n int buf_len;\n PyObject *obj, *ret;\n\n zeroval = PyDataMem_NEW(arr->itemsize);\n if (zeroval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n if (PyArray_ISOBJECT(arr)) {\n obj=PyInt_FromLong((long) 0);\n memcpy(zeroval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return zeroval;\n }\n ret = PyObject_GetAttrString((PyObject *)arr, \"_zero\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_zero not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n return NULL;\n }\n memcpy(zeroval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n memset(zeroval, 0, arr->itemsize);\n return zeroval;\n}\n\nstatic char *\nPyArray_One(PyArrayObject *arr)\n{\n char *oneval;\n char *buf;\n int buf_len, ret2;\n PyObject *obj, *ret;\n\n oneval = PyDataMem_NEW(arr->itemsize);\n if (oneval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n obj = PyInt_FromLong((long) 1);\n if (PyArray_ISOBJECT(arr)) {\n memcpy(oneval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return oneval;\n }\n \n ret = PyObject_GetAttrString((PyObject *)arr, \"_one\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_one not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n PyDataMem_FREE(oneval);\n return NULL;\n }\n memcpy(oneval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n\n ret2 = arr->descr->setitem(obj, oneval, arr);\n Py_DECREF(obj);\n if (ret < 0) {\n PyDataMem_FREE(oneval);\n return NULL;\n }\n return oneval;\n}\n\n/* End deprecated */\n\n\nstatic int \ndo_sliced_copy(char *dest, intp *dest_strides, intp *dest_dimensions,\n\t int dest_nd, char *src, intp *src_strides, \n\t intp *src_dimensions, int src_nd, int elsize, \n\t int copies) {\n intp i, j;\n\t\n if (src_nd == 0 && dest_nd == 0) {\n for(j=0; j src_nd) {\n for(i=0; i<*dest_dimensions; i++, dest += *dest_strides) {\n if (do_sliced_copy(dest, dest_strides+1, \n dest_dimensions+1, dest_nd-1,\n src, src_strides, \n src_dimensions, src_nd, \n elsize, copies) == -1) \n return -1;\n }\n return 0;\n }\n\t\n if (dest_nd == 1) {\n if (*dest_dimensions != *src_dimensions) {\n PyErr_SetString(PyExc_ValueError, \n \"matrices are not aligned for copy\");\n return -1;\n }\n for(i=0; i<*dest_dimensions; i++, src += *src_strides) {\n for(j=0; j 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize) && \n ((*src_strides)[*src_nd-1] == *elsize)) {\n if ((*dest_dimensions)[*dest_nd-1] != \n (*src_dimensions)[*src_nd-1]) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"matrices are not aligned\");\n return -1;\n }\n *elsize *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1; *src_nd-=1;\n } else {\n break;\n }\n }\n if (*src_nd == 0) {\n while (*dest_nd > 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize)) {\n *copies *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1;\n } else {\n break;\n }\n }\n }\n return 0;\n}\n\nstatic char *\ncontiguous_data(PyArrayObject *src) \n{\n intp dest_strides[MAX_DIMS], *dest_strides_ptr;\n intp *dest_dimensions=src->dimensions;\n int dest_nd=src->nd;\n intp *src_strides = src->strides;\n intp *src_dimensions=src->dimensions;\n int src_nd=src->nd;\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n intp stride=elsize;\n char *new_data;\n\t\n for(i=dest_nd-1; i>=0; i--) {\n dest_strides[i] = stride;\n stride *= dest_dimensions[i];\n }\n\t\n dest_strides_ptr = dest_strides;\n\t\n if (optimize_slices(&dest_strides_ptr, &dest_dimensions, &dest_nd,\n &src_strides, &src_dimensions, &src_nd,\n &elsize, &copies) == -1) \n return NULL;\n\t\n new_data = (char *)malloc(stride);\n\t\n ret = do_sliced_copy(new_data, dest_strides_ptr, dest_dimensions, \n dest_nd, src->data, src_strides, \n src_dimensions, src_nd, elsize, copies);\n\t\n if (ret != -1) { return new_data; }\n else { free(new_data); return NULL; }\n}\n\n/* end Helper functions */\n\n\nstatic PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n int, intp *, char *, int, int, PyObject *);\n\n/* C-API functions */\n\n/* Used for arrays of python objects to increment the reference count of */\n/* every python object in the array. */\nstatic int \nPyArray_INCREF(PyArrayObject *mp) \n{\n\tintp i, n;\n\n PyObject **data, **data2;\n\t\n if (mp->descr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data;\n for(i=0; idescr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data; \n for(i=0; i 0; n--, a += 1) {\n b = a + 1;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 4:\n for (a = (char*)p ; n > 0; n--, a += 2) {\n b = a + 3;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 8:\n for (a = (char*)p ; n > 0; n--, a += 4) {\n b = a + 7;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n default:\n m = size / 2;\n for (a = (char *)p ; n > 0; n--, a += m) {\n b = a + (size-1);\n for (j=0; j 1, then dst must be contiguous */\nstatic void\ncopy_and_swap(void *dst, void *src, int itemsize, intp numitems,\n intp srcstrides, int swap) \n{\n int i;\n char *s1 = (char *)src;\n char *d1 = (char *)dst;\n \n\n if ((numitems == 1) || (itemsize == srcstrides)) \n memcpy(d1, s1, itemsize*numitems);\n else { \n for (i = 0; i < numitems; i++) {\n memcpy(d1, s1, itemsize);\n d1 += itemsize;\n s1 += srcstrides;\n } \n }\n\n if (swap)\n byte_swap_vector(d1, numitems, itemsize);\n}\n\n\n/* Computer-generated arraytype and scalartype code */\n#include \"scalartypes.inc\"\n#include \"arraytypes.inc\"\n\nstatic char *\nindex2ptr(PyArrayObject *mp, int i) \n{\n\tif (i==0 && (mp->nd == 0 || mp->dimensions[0] > 0)) \n\t\treturn mp->data;\n\t\n if (mp->nd>0 && i>0 && i < mp->dimensions[0]) {\n return mp->data+i*mp->strides[0];\n }\n PyErr_SetString(PyExc_IndexError,\"index out of bounds\");\n return NULL;\n}\n\nstatic intp \nPyArray_Size(PyObject *op) \n{\n if (PyArray_Check(op)) {\n return PyArray_SIZE((PyArrayObject *)op);\n } \n\telse {\n return 0;\n }\n}\n\n/* If destination is not the right type, then src \n will be cast to destination. \n*/\n\n/* Does a flat iterator-based copy. \n\n The arrays are assumed to have the same number of elements\n They can be different sizes and have different types however. \n*/\n\nstatic int\nPyArray_CopyInto(PyArrayObject *dest, PyArrayObject *src)\n{\n intp dsize, ssize, sbytes;\n\tint ncopies, elsize, index;\n PyArrayIterObject *dit=NULL;\n PyArrayIterObject *sit=NULL;\n\tchar *dptr;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n PyArray_CopySwapNFunc *copyswapn;\n \n if (!PyArray_ISWRITEABLE(dest)) {\n PyErr_SetString(PyExc_RuntimeError, \n \"Cannot write to array.\");\n return -1;\n }\n\n if (!PyArray_EquivArrTypes(dest, src)) {\n return PyArray_CastTo(dest, src);\n }\n\n dsize = PyArray_SIZE(dest);\n ssize = PyArray_SIZE(src);\n\tif (ssize == 0) return 0;\n if (dsize % ssize != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Destination number of elements must be\"\\\n \"an integer multiple of the source number of\"\\\n \"elements.\");\n return -1;\n }\n ncopies = dsize / ssize;\n\n\tswap = PyArray_ISNOTSWAPPED(dest) != PyArray_ISNOTSWAPPED(src);\n\tcopyswap = dest->descr->copyswap;\n\tcopyswapn = dest->descr->copyswapn;\n\n elsize = dest->itemsize;\n\n if ((PyArray_ISCONTIGUOUS(dest) && PyArray_ISCONTIGUOUS(src)) \\\n\t || (PyArray_ISFORTRAN(dest) && PyArray_ISFORTRAN(src))) {\n \n PyArray_XDECREF(dest);\n dptr = dest->data;\n sbytes = ssize * src->itemsize;\n while(ncopies--) {\n memmove(dptr, src->data, sbytes);\n dptr += sbytes;\n }\n\t\tif (swap)\n\t\t\tcopyswapn(dest->data, NULL, dsize, 1, elsize);\n PyArray_INCREF(dest);\n return 0;\n }\n\n dit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)dest);\n sit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)src);\n\n if ((dit == NULL) || (sit == NULL)) {\n Py_XDECREF(dit);\n Py_XDECREF(sit);\n return -1;\n }\n\n PyArray_XDECREF(dest);\n while(ncopies--) {\n index = ssize;\n while(index--) {\n memmove(dit->dataptr, sit->dataptr, elsize);\n\t\t\tif (swap)\n\t\t\t\tcopyswap(dit->dataptr, NULL, 1, elsize);\n PyArray_ITER_NEXT(dit);\n PyArray_ITER_NEXT(sit);\n }\n PyArray_ITER_RESET(sit);\n } \n PyArray_INCREF(dest);\n Py_DECREF(dit);\n Py_DECREF(sit);\n\treturn 0;\n}\n\n\nstatic int \nPyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) \n{\n PyArrayObject *src;\n int ret;\n\tPyArray_Typecode typecode;\n\n\n\ttypecode.type_num = dest->descr->type_num;\n\ttypecode.itemsize = dest->itemsize;\n\ttypecode.fortran = PyArray_ISFORTRAN(dest);\n\t\t\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n\t\t\t\t\t &typecode, 0,\n\t\t\t\t\t dest->nd, 0);\n if (src == NULL) return -1;\n\n ret = PyArray_CopyInto(dest, src);\n Py_DECREF(src);\n return ret;\n}\n\n\n/* These are also old calls (should use PyArray_New) */\n\n/* They all zero-out the memory as previously done */\n\nstatic PyObject *\nPyArray_FromDimsAndDataAndDescr(int nd, int *d, \n PyArray_Descr *descr,\n char *data) {\n\tPyObject *ret;\n\n#if SIZEOF_INTP != SIZEOF_INT\n\tint i;\n\tintp newd[MAX_DIMS];\n\t\n\tfor (i=0; itype_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#else\n\tret = PyArray_New(&PyArray_Type, nd, (intp *)d, \n descr->type_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#endif\n\tif (descr->type_num != PyArray_OBJECT)\n\t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_FromDimsAndData(int nd, int *d, int type, char *data) \n{\n\tPyObject *ret;\n#if SIZEOF_INTP != SIZEOF_INT\n\tintp newd[MAX_DIMS];\n\tint i;\t\n\tfor (i=0; iob_type, m1->nd, \n\t\t\t\t\t m1->dimensions,\n\t\t\t\t\t m1->descr->type_num,\n\t\t\t\t\t NULL, NULL, m1->itemsize,\n\t\t\t\t\t 0, (PyObject *)m1);\n\t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n\t\n return (PyObject *)ret;\n}\n\n\nstatic PyObject *array_item(PyArrayObject *, int);\n\nstatic PyObject *\nPyArray_Scalar(char *data, int type_num, int itemsize, int swap)\n{\n PyArray_Descr *descr;\n\tPyTypeObject *type;\n\tPyObject *obj;\t\n\tchar *destptr;\n PyArray_CopySwapFunc *copyswap;\n\n descr = PyArray_DescrFromType(type_num);\n if (descr == NULL) return NULL;\n type = descr->typeobj;\n copyswap = descr->copyswap;\n\tif (type_num == PyArray_STRING) \n\t\tobj = type->tp_alloc(type, itemsize);\n\telse\n\t\tobj = type->tp_alloc(type, 0);\n\tif (obj == NULL) return NULL;\n\tif PyTypeNum_ISFLEXIBLE(type_num) { \n\t\tif (type_num == PyArray_STRING) {\n\t\t\tdestptr = PyString_AS_STRING(obj);\n\t\t\t((PyStringObject *)obj)->ob_shash = -1;\n\t\t\t((PyStringObject *)obj)->ob_sstate =\t\\\n\t\t\t\tSSTATE_NOT_INTERNED; \n\t\t}\n\t\telse {\n\t\t\tdestptr = PyDataMem_NEW(itemsize);\n\t\t\tif (destptr == NULL) {\n\t\t\t\tPyObject_Del(obj);\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tif (type_num == PyArray_UNICODE) {\n\t\t\t\tPyUnicode_AS_UNICODE(obj) = \\\n\t\t\t\t\t(Py_UNICODE *)destptr;\n\t\t\t\t((PyUnicodeObject*)obj)->length = itemsize / \\\n\t\t\t\t\tsizeof(Py_UNICODE);\n\t\t\t\t((PyUnicodeObject*)obj)->hash = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t((PyVoidScalarObject *)obj)->obval = destptr;\n\t\t\t\t((PyVoidScalarObject *)obj)->ob_size = itemsize;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tdestptr = &(((PyScalarObject*)obj)->obval);\n\t}\n\t/* copyswap for OBJECT increments the reference count */\n copyswap(destptr, data, swap, itemsize);\n\treturn obj;\n}\n\n/* returns an Array-Scalar Object of the type of arr\n from the given pointer to memory -- main Scalar creation function\n default new method calls this. \n*/\nstatic PyObject *\nPyArray_ToScalar(char *data, PyArrayObject *arr)\n{\n\tint type_num = arr->descr->type_num;\n\tint itemsize = arr->itemsize;\n int swap = !(PyArray_ISNOTSWAPPED(arr));\n\n\treturn PyArray_Scalar(data, type_num, itemsize, swap);\n}\n\n\n/* Return Python scalar if 0-d array object is encountered */\n\nstatic PyObject *\nPyArray_Return(PyArrayObject *mp) \n{\n \n\tif (mp == NULL) return NULL;\n\n if (PyErr_Occurred()) {\n Py_XDECREF(mp);\n return NULL;\n }\n\n\tif (PyArray_Check((PyObject *)mp) && mp->nd == 0) {\n\t\tPyObject *ret;\n\t\tret = PyArray_ToScalar(mp->data, mp);\n\t\tPy_DECREF(mp);\n\t\treturn ret;\n\t}\n\telse {\n\t\treturn (PyObject *)mp;\n\t}\n}\n\n/*\n returns typenum to associate with this type >=PyArray_USERDEF.\n Also creates a copy of the VOID_DESCR table inserting it's typeobject in\n and it's typenum in the appropriate place.\n \n needs the userdecrs table and PyArray_NUMUSER variables\n defined in arratypes.inc\n*/\nstatic int \nPyArray_RegisterDataType(PyTypeObject *type)\n{\n\tPyArray_Descr *descr;\n\tint typenum;\n\tint i;\n\t\n\tif ((type == &PyVoidArrType_Type) ||\t\t\t\\\n\t !PyType_IsSubtype(type, &PyVoidArrType_Type)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can only register void subtypes.\");\n\t\treturn -1;\n\t}\n\t/* See if this type is already registered */\n\tfor (i=0; itypeobj == type)\n\t\t\treturn descr->type_num;\n\t}\n\tdescr = malloc(sizeof(PyArray_Descr));\n\tmemcpy(descr, PyArray_DescrFromType(PyArray_VOID), \n\t sizeof(PyArray_Descr));\n\ttypenum = PyArray_USERDEF + PyArray_NUMUSERTYPES;\n\tdescr->type_num = typenum;\n\tdescr->typeobj = type;\n\tuserdescrs = realloc(userdescrs, \n\t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n if (userdescrs == NULL) {\n PyErr_SetString(PyExc_MemoryError, \"RegisterDataType\");\n return -1;\n }\n\tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n\treturn typenum;\n}\n\n\n/* \n copyies over from the old descr table for anything\n NULL or zero in what is given. \n frees the copy of the Descr_table already there.\n places a pointer to the new one into the slot.\n*/\nstatic int\nPyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n{\n\tPyArray_Descr *old;\n\tint i;\n\n\tif (!PyTypeNum_ISUSERDEF(typenum)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Data type not registered.\");\n\t\treturn -1;\n\t}\n\told = userdescrs[typenum-PyArray_USERDEF];\n\tdescr->typeobj = old->typeobj;\n\tdescr->type_num = typenum;\n\n#define _NULL_CHECK(member) \\\n\tif (descr->member == NULL) descr->member = old->member\n\n\tfor (i=0; imember == 0) descr->member = old->member\n\n\t_ZERO_CHECK(kind);\n\t_ZERO_CHECK(type);\n\t_ZERO_CHECK(elsize);\n\t_ZERO_CHECK(alignment);\n#undef _ZERO_CHECK\n\n\tfree(old);\n\tuserdescrs[typenum-PyArray_USERDEF] = descr;\n\treturn 0;\n}\n\n\nstatic int\nPyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) \n{\n intp size;\n intp n, n2;\n int n3, n4;\n PyArrayIterObject *it;\n PyObject *obj, *strobj, *tupobj;\n\n n3 = strlen((const char *)sep);\n if (n3 == 0) { /* binary data */\n if (PyArray_ISOBJECT(self)) {\n PyErr_SetString(PyExc_ValueError, \"Cannot write \"\\\n\t\t\t\t\t\"object arrays to a file in \"\\\n\t\t\t\t\t\"binary mode.\");\n return -1;\n }\n\n if (PyArray_ISCONTIGUOUS(self)) {\n size = PyArray_SIZE(self);\n if ((n=fwrite((const void *)self->data, \n (size_t) self->itemsize,\n (size_t) size, fp)) < size) {\n PyErr_Format(PyExc_ValueError, \n \"%ld requested and %ld written\",\n (long) size, (long) n);\n return -1;\n }\n }\n else {\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n while(it->index < it->size) {\n if (fwrite((const void *)it->dataptr, \n (size_t) self->itemsize,\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n \" %d to file\", \n\t\t\t\t\t\t (int)it->index);\n Py_DECREF(it);\n return -1;\n }\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n } \n }\n else { /* text data */\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n\t\tn4 = strlen((const char *)format);\n while(it->index < it->size) {\n obj = self->descr->getitem(it->dataptr, self);\n if (obj == NULL) {Py_DECREF(it); return -1;}\n\t\t\tif (n4 == 0) { /* standard writing */\n\t\t\t\tstrobj = PyObject_Str(obj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n\t\t\telse { /* use format string */\n\t\t\t\ttupobj = PyTuple_New(1);\n\t\t\t\tif (tupobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t\tPyTuple_SET_ITEM(tupobj,0,obj);\n\t\t\t\tobj = PyString_FromString((const char *)format);\n\t\t\t\tif (obj == NULL) {Py_DECREF(tupobj); \n\t\t\t\t\tPy_DECREF(it); return -1;}\n\t\t\t\tstrobj = PyString_Format(obj, tupobj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tPy_DECREF(tupobj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n if ((n=fwrite(PyString_AS_STRING(strobj), \n 1, n2=PyString_GET_SIZE(strobj),\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n \" to file\", \n\t\t\t\t\t (int) it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n }\n /* write separator for all but last one */\n if (it->index != it->size-1) \n fwrite(sep, 1, n3, fp);\n Py_DECREF(strobj);\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n return 0;\n}\n\nstatic PyObject *\nPyArray_ToList(PyArrayObject *self) \n{\n PyObject *lp;\n PyArrayObject *v;\n intp sz, i;\n\t\n if (!PyArray_Check(self)) return (PyObject *)self;\n\n if (self->nd == 0) \n\t\treturn self->descr->getitem(self->data,self);\n\t\n sz = self->dimensions[0];\n lp = PyList_New(sz);\n\t\n for (i=0; ind >= self->nd) {\n\t\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\t\"array_item not returning smaller\" \\\n\t\t\t\t\t\" dimensional array\");\n\t\t\tPy_DECREF(lp);\n\t\t\treturn NULL;\n\t\t}\n PyList_SetItem(lp, i, PyArray_ToList(v));\n\t\tPy_DECREF(v);\n }\n\t\n return lp;\n}\n\nstatic PyObject *\nPyArray_ToString(PyArrayObject *self)\n{\n intp numbytes;\n intp index;\n char *dptr;\n int elsize;\n PyObject *ret;\n PyArrayIterObject *it;\n \n if (PyArray_TYPE(self) == PyArray_OBJECT) {\n PyErr_SetString(PyExc_ValueError, \"a string for the data\"\\\n\t\t\t\t\"in an object array is not appropriate.\");\n return NULL;\n }\n\n numbytes = PyArray_NBYTES(self);\n if (PyArray_ISONESEGMENT(self)) {\n ret = PyString_FromStringAndSize(self->data, (int) numbytes);\n }\n else {\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it==NULL) return NULL;\n ret = PyString_FromStringAndSize(NULL, (int) numbytes);\n if (ret == NULL) {Py_DECREF(it); return NULL;}\n dptr = PyString_AS_STRING(ret);\n index = it->size;\n elsize = self->itemsize;\n while(index--) {\n memcpy(dptr, it->dataptr, elsize);\n dptr += elsize;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n\treturn ret;\n}\n\n\n/*********************** end C-API functions **********************/\n\n\n/* array object functions */\n\nstatic void \narray_dealloc(PyArrayObject *self) {\n\n if (self->weakreflist != NULL)\n PyObject_ClearWeakRefs((PyObject *)self);\n\n if(self->base) {\n\t\t/* UPDATEIFCOPY means that base points to an \n\t\t array that should be updated with the contents\n\t\t of this array upon destruction.\n self->base->flags must have been WRITEABLE \n (checked previously) and it was locked here\n thus, unlock it.\n\t\t*/\n\t\tif (self->flags & UPDATEIFCOPY) {\n ((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tPy_INCREF(self); /* hold on to self in next call */\n PyArray_CopyInto((PyArrayObject *)self->base, self);\n\t\t\t/* Don't need to DECREF -- because we are deleting\n\t\t\t self already... */\n\t\t}\n\t\t/* In any case base is pointing to something that we need\n\t\t to DECREF -- either a view or a buffer object */\n Py_DECREF(self->base);\n }\n \n if ((self->flags & OWN_DATA) && (self->data != NULL)) {\n\t\t/* Free internal references if an Object array */\n\t\tPyArray_XDECREF(self);\n\n PyDataMem_FREE(self->data);\n }\n\t\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t}\n\t\n self->ob_type->tp_free((PyObject *)self);\n}\n\n/*************************************************************************\n **************** Implement Mapping Protocol ***************************\n *************************************************************************/\n\nstatic int \narray_length(PyArrayObject *self) \n{\n if (self->nd != 0) {\n return self->dimensions[0];\n } else {\n\t\tPyErr_SetString(PyExc_TypeError, \"len() of unsized object.\");\n\t\treturn -1;\n }\n}\n\n\nstatic PyObject *\narray_item(PyArrayObject *self, int i) \n{\n char *item;\n PyArrayObject *r;\n\n\n\tif(self->nd == 0) {\n\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\"0-d arrays can't be indexed.\");\n\t\treturn NULL;\n\t}\n if ((item = index2ptr(self, i)) == NULL) return NULL;\n\n\tr = (PyArrayObject *)PyArray_New(self->ob_type, \n\t\t\t\t\t self->nd-1, self->dimensions+1, \n\t\t\t\t\t self->descr->type_num, \n\t\t\t\t\t self->strides+1, item, \n\t\t\t\t\t self->itemsize, self->flags,\n\t\t\t\t\t (PyObject *)self);\n\tif (r == NULL) return NULL;\n\tPy_INCREF(self);\n\tr->base = (PyObject *)self;\n PyArray_UpdateFlags(r, CONTIGUOUS | FORTRAN);\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_item_nice(PyArrayObject *self, int i) \n{\n\treturn PyArray_Return((PyArrayObject *)array_item(self, i));\n}\n\n\nstatic int \narray_ass_item(PyArrayObject *self, int i, PyObject *v) \n{\n PyArrayObject *tmp;\n char *item;\n int ret;\n\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n if (i < 0) i = i+self->dimensions[0];\n\n if (self->nd > 1) {\n if((tmp = (PyArrayObject *)array_item(self, i)) == NULL)\n return -1;\n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n return ret; \n }\n\t\n if ((item = index2ptr(self, i)) == NULL) return -1;\n if (self->descr->setitem(v, item, self) == -1) return -1;\n return 0;\n}\n\n/* -------------------------------------------------------------- */\nstatic int\nslice_coerce_index(PyObject *o, int *v)\n{\n\t*v = PyArray_PyIntAsInt(o);\n\tif (error_converting(*v)) {\n\t\tPyErr_Clear();\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\n/* This is basically PySlice_GetIndicesEx, but with our coercion\n * of indices to integers (plus, that function is new in Python 2.3) */\nstatic int\nslice_GetIndices(PySliceObject *r, int length,\n int *start, int *stop, int *step,\n intp *slicelength)\n{\n\tint defstart, defstop;\n\t\n\tif (r->step == Py_None) {\n\t\t*step = 1;\n\t} else {\n\t\tif (!slice_coerce_index(r->step, step)) return -1;\n\t\tif (*step == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"slice step can not be zero\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tdefstart = *step < 0 ? length - 1 : 0;\n\tdefstop = *step < 0 ? -1 : length;\n\t\n\tif (r->start == Py_None) {\n\t\t*start = *step < 0 ? length-1 : 0;\n\t} else {\n\t\tif (!slice_coerce_index(r->start, start)) return -1;\n\t\tif (*start < 0) *start += length;\n\t\tif (*start < 0) *start = (*step < 0) ? -1 : 0;\n\t\tif (*start >= length) {\n\t\t\t*start = (*step < 0) ? length - 1 : length;\n\t\t}\n\t}\n\t\n\tif (r->stop == Py_None) {\n\t\t*stop = defstop;\n\t} else {\n\t\tif (!slice_coerce_index(r->stop, stop)) return -1;\n\t\tif (*stop < 0) *stop += length;\n if (*stop < 0) *stop = -1;\n if (*stop > length) *stop = length;\n\t}\n\t\n\tif ((*step < 0 && *stop >= *start) || \\\n\t (*step > 0 && *start >= *stop)) {\n\t\t*slicelength = 0;\n\t} else if (*step < 0) {\n\t\t*slicelength = (*stop - *start + 1) / (*step) + 1;\n\t} else {\n\t\t*slicelength = (*stop - *start - 1) / (*step) + 1;\n\t}\n\t\n\treturn 0;\n}\n\n#define PseudoIndex -1\n#define RubberIndex -2\n#define SingleIndex -3\n\nstatic int\nparse_subindex(PyObject *op, int *step_size, intp *n_steps, int max)\n{\n\tint index;\n\t\n\tif (op == Py_None) {\n\t\t*n_steps = PseudoIndex;\n\t\tindex = 0;\n\t} else if (op == Py_Ellipsis) {\n\t\t*n_steps = RubberIndex;\n\t\tindex = 0;\n\t} else if (PySlice_Check(op)) {\n\t\tint stop;\n\t\tif (slice_GetIndices((PySliceObject *)op, max,\n\t\t\t\t &index, &stop, step_size, n_steps) < 0) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"invalid slice\");\n\t\t\t}\n\t\t\tgoto fail;\n\t\t}\n\t\tif (*n_steps <= 0) {\n\t\t\t*n_steps = 0;\n\t\t\t*step_size = 1;\n\t\t\tindex = 0;\n\t\t}\n\t} else {\n\t\tindex = PyArray_PyIntAsInt(op);\n\t\tif (error_converting(index)) {\n\t\t\tPyErr_SetString(PyExc_IndexError,\n\t\t\t\t\t\"each subindex must be either a \"\\\n\t\t\t\t\t\"slice, an integer, Ellipsis, or \"\\\n\t\t\t\t\t\"newaxis\");\n\t\t\tgoto fail;\n\t\t}\n\t\t*n_steps = SingleIndex;\n\t\t*step_size = 0;\n\t\tif (index < 0) index += max;\n\t\tif (index >= max || index < 0) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \"invalid index\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn index;\n fail:\n\treturn -1;\n}\n\n\nstatic int \nparse_index(PyArrayObject *self, PyObject *op, \n intp *dimensions, intp *strides, intp *offset_ptr)\n{\n int i, j, n;\n int nd_old, nd_new, start, offset, n_add, n_pseudo;\n int step_size;\n\tintp n_steps;\n PyObject *op1=NULL;\n int is_slice;\n\n\n if (PySlice_Check(op) || op == Py_Ellipsis || op == Py_None) {\n n = 1;\n op1 = op;\n Py_INCREF(op);\t\n /* this relies on the fact that n==1 for loop below */\n is_slice = 1;\n }\n else {\n if (!PySequence_Check(op)) {\n PyErr_SetString(PyExc_IndexError, \n \"index must be either an int \"\\\n \"or a sequence\");\n return -1;\n }\n n = PySequence_Length(op);\n is_slice = 0;\n }\n\t\n nd_old = nd_new = 0;\n\t\n offset = 0;\n for(i=0; ind ? \\\n self->dimensions[nd_old] : 0);\n Py_DECREF(op1);\n if (start == -1) break;\n\t\t\n if (n_steps == PseudoIndex) {\n dimensions[nd_new] = 1; strides[nd_new] = 0; nd_new++;\n } else {\n if (n_steps == RubberIndex) {\n for(j=i+1, n_pseudo=0; jnd-(n-i-n_pseudo-1+nd_old);\n if (n_add < 0) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = \\\n self->strides[nd_old];\n nd_new++; nd_old++;\n }\n } else {\n if (nd_old >= self->nd) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n offset += self->strides[nd_old]*start;\n nd_old++;\n if (n_steps != SingleIndex) {\n dimensions[nd_new] = n_steps;\n strides[nd_new] = step_size * \\\n self->strides[nd_old-1];\n nd_new++;\n }\n }\n }\n }\n if (i < n) return -1;\n n_add = self->nd-nd_old;\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = self->strides[nd_old];\n nd_new++; nd_old++;\n }\t \n *offset_ptr = offset;\n return nd_new;\n}\n\nstatic void\n_swap_axes(PyArrayMapIterObject *mit, PyArrayObject **ret)\n{\n\tPyObject *new, *tup;\n\tint n1, n2, n3, val;\n\tint i;\n\n\ttup = PyTuple_New(mit->nd);\n\t/* tuple for transpose is \n\t (n1,..,n1+n2-1,0,..,n1-1,n1+n2,...,n3-1)\n\t n1 is the number of dimensions of \n\t the broadcasted index array \n\t n2 is the number of dimensions skipped at the\n\t start\n\t n3 is the number of dimensions of the \n\t result \n\t*/\n\tn1 = mit->iters[0]->nd_m1 + 1;\n\tn2 = mit->iteraxes[0];\n\tn3 = mit->nd;\n\tval = n1;\n\ti = 0;\n\twhile(val < n1+n2) \n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = 0;\n\twhile(val < n1)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = n1+n2;\n\twhile(val < n3)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\n\tnew = PyArray_Transpose(*ret, tup);\n\tPy_DECREF(tup);\n\tPy_DECREF(*ret);\n\t*ret = (PyArrayObject *)new;\n}\n\n\n\nstatic PyObject *\nPyArray_GetMap(PyArrayMapIterObject *mit)\n{\n\n\tPyArrayObject *ret, *temp;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\t/* Unbound map iterator --- Bind should have been called */\n\tif (mit->ait == NULL) return NULL;\n\n\t/* This relies on the map iterator object telling us the shape\n\t of the new array in nd and dimensions.\n\t*/\n\ttemp = mit->ait->ao;\n\tret = (PyArrayObject *)\\\n\t\tPyArray_New(temp->ob_type, mit->nd, mit->dimensions, \n\t\t\t temp->descr->type_num, NULL, NULL, \n\t\t\t temp->itemsize, \n\t\t\t PyArray_ISFORTRAN(temp),\n\t\t\t (PyObject *)temp);\n\tif (ret == NULL) return NULL;\n\n\t/* Now just iterate through the new array filling it in\n\t with the next object from the original array as\n\t defined by the mapping iterator */\n\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ret)) \n\t == NULL) \n\t\treturn NULL;\n\tindex = it->size;\n\tswap = ((temp->flags & NOTSWAPPED) != (ret->flags & NOTSWAPPED));\n copyswap = ret->descr->copyswap;\n\tPyArray_MapIterReset(mit);\n\twhile (index--) {\n copyswap(it->dataptr, mit->dataptr, swap, ret->itemsize);\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\t\n\t/* check for consecutive axes */\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, &ret);\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\nstatic int\nPyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)\n{\n\tPyObject *arr=NULL;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n\tPyArray_Typecode typecode = {0, 0, 0};\n PyArray_CopySwapFunc *copyswap;\n\n\t/* Unbound Map Iterator */\n\tif (mit->ait == NULL) return -1;\n\n\ttypecode.type_num = mit->ait->ao->descr->type_num;\n\ttypecode.itemsize = mit->ait->ao->itemsize;\n\n\tarr = PyArray_FromAny(op, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, (PyArrayObject **)&arr);\n\t\t}\n\t}\n\t\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) \n\t\treturn -1;\n\n\tindex = mit->size;\n\tswap = ((mit->ait->ao->flags & NOTSWAPPED) != \\\n\t\t(PyArray_FLAGS(arr) & NOTSWAPPED));\n\n copyswap = PyArray_DESCR(arr)->copyswap;\n\tPyArray_MapIterReset(mit);\n /* Need to decref OBJECT arrays */\n if (PyTypeNum_ISOBJECT(typecode.type_num)) {\n while (index--) {\n Py_XDECREF(*((PyObject **)mit->dataptr));\n Py_INCREF(*((PyObject **)it->dataptr));\n memmove(mit->dataptr, it->dataptr, sizeof(PyObject *));\n copyswap(mit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_MapIterNext(mit);\n PyArray_ITER_NEXT(it);\n if (it->index == it->size)\n PyArray_ITER_RESET(it);\n }\n return 0;\n }\n\n\twhile(index--) {\n\t\tmemmove(mit->dataptr, it->dataptr, PyArray_ITEMSIZE(arr));\n copyswap(mit->dataptr, NULL, swap, PyArray_ITEMSIZE(arr));\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t\tif (it->index == it->size)\n\t\t\tPyArray_ITER_RESET(it);\n\t}\t\t\n\treturn 0;\n}\n\n/* Called when treating array object like a mapping -- called first from \n Python when using a[object] unless object is a standard slice object\n (not an extended one). \n\n*/\n\n/* There are two situations: \n\n 1 - the subscript is a standard view and a reference to the \n array can be returned\n\n 2 - the subscript uses Boolean masks or integer indexing and\n therefore a new array is created and returned. \n\n*/\n\n/* Always returns 0-dimensional arrays */\n\nstatic PyObject *\narray_subscript(PyArrayObject *self, PyObject *op) \n{\n intp dimensions[MAX_DIMS], strides[MAX_DIMS];\n\tintp offset;\n int nd, i;\n PyArrayObject *other;\n\tPyArrayMapIterObject *mit;\n\n if (PyArray_IsScalar(op, Integer) || PyInt_Check(op) || \\\n PyLong_Check(op)) {\n intp value;\n value = PyArray_PyIntAsIntp(op);\n if (PyErr_Occurred())\n PyErr_Clear();\n else if (value >= 0) {\n if (value <= MAX_INT)\n return array_item(self, (int) value);\n }\n else if (value < 0) {\n if (value >= -MAX_INT) {\n if (self->nd > 0) value += self->dimensions[0];\n return array_item(self, (int) value);\n }\n }\n }\n\n\tif (PyArrayMapIter_Check(op)) {\n\t\tmit = (PyArrayMapIterObject *)op;\n\t\t/* bind to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\n\t\t/* If the mapiterator was created with standard indexing\n\t\t behavior, fall through to view-based code */\n\t\tif (!mit->view) return PyArray_GetMap(mit);\n\t\top = mit->indexobj;\n\t}\n\telse { /* wrap arguments into a mapiter object */\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(op);\n\t\tif (mit == NULL) return NULL;\n\t\tif (!mit->view) { /* fancy indexing */\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tother = (PyArrayObject *)PyArray_GetMap(mit);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn (PyObject *)other;\n\t\t}\n\t\tPy_DECREF(mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(op);\n\tif (!error_converting(i)) {\n\t\tif (i < 0 && self->nd > 0) i = i+self->dimensions[0];\n\t\treturn array_item(self, i);\n\t}\n\tPyErr_Clear();\n\n\t/* Standard (view-based) Indexing */\n if ((nd = parse_index(self, op, dimensions, strides, &offset)) \n == -1) \n return NULL;\n\n\t/* This will only work if new array will be a view */\n\tif ((other = (PyArrayObject *)\t\t\t\t\t\\\n\t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n\t\t\t strides, self->data+offset, \n\t\t\t self->itemsize, self->flags,\n\t\t\t (PyObject *)self)) == NULL) \n\t\treturn NULL;\n\n\n\tother->base = (PyObject *)self;\n\tPy_INCREF(self);\n\t\n\tPyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);\n\t\n\treturn (PyObject *)other;\n}\n\n\n/* Another assignment hacked by using CopyObject. */\n\n/* This only works if subscript returns a standard view. */\n\n/* Again there are two cases. In the first case, PyArray_CopyObject\n can be used. In the second case, a new indexing function has to be \n used.\n*/\n\nstatic int \narray_ass_sub(PyArrayObject *self, PyObject *index, PyObject *op) \n{\n int ret, i;\n PyArrayObject *tmp;\n\tPyArrayMapIterObject *mit;\n\t\n if (op == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n\tif (PyArrayMapIter_Check(index)) {\n\t\tmit = (PyArrayMapIterObject *)index;\n\t\t/* bind behavior to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\t\n\t\t/* fall through if standard view-based map iterator */\n\t\tif (!mit->view) return PyArray_SetMap(mit, op);\n\t\tindex = mit->indexobj;\n\t}\n\telse {\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(index);\n\t\tif (mit == NULL) return -1;\n\t\tif (!mit->view) {\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tret = PyArray_SetMap(mit, op);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn ret;\n\t\t}\n\t\tPy_DECREF((PyObject*)mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(index);\n\tif (!error_converting(i)) {\n\t\treturn array_ass_item(self, i, op);\n\t}\n\tPyErr_Clear();\n\t\n\t/* Rest of standard (view-based) indexing */\n\n if ((tmp = (PyArrayObject *)array_subscript(self, index)) == NULL)\n return -1; \n ret = PyArray_CopyObject(tmp, op);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\n/* There are places that require that array_subscript return a PyArrayObject\n and not possibly a scalar. Thus, this is the function exposed to \n Python so that 0-dim arrays are passed as scalars\n*/\n\nstatic PyObject *\narray_subscript_nice(PyArrayObject *self, PyObject *op) \n{\n\treturn PyArray_Return((PyArrayObject *)array_subscript(self, op));\n}\n\n\nstatic PyMappingMethods array_as_mapping = {\n (inquiry)array_length,\t\t /*mp_length*/\n (binaryfunc)array_subscript_nice,\t/*mp_subscript*/\n (objobjargproc)array_ass_sub,\t /*mp_ass_subscript*/\n};\n\n/****************** End of Mapping Protocol ******************************/\n\n\n/*************************************************************************\n **************** Implement Buffer Protocol ****************************\n *************************************************************************/\n\n/* removed multiple segment interface */\n\nstatic int \narray_getsegcount(PyArrayObject *self, int *lenp) \n{\n if (lenp)\n *lenp = PyArray_NBYTES(self);\n\n if (PyArray_ISONESEGMENT(self)) {\n return 1;\n }\n\n if (lenp)\n *lenp = 0;\n return 0;\n}\n\nstatic int \narray_getreadbuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (segment != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Accessing non-existing array segment\");\n return -1;\n }\n \n if (PyArray_ISONESEGMENT(self)) {\n *ptrptr = self->data;\n return PyArray_NBYTES(self);\n }\n PyErr_SetString(PyExc_ValueError, \"Array is not a single segment\");\n *ptrptr = NULL;\n return -1;\n}\n\n\nstatic int \narray_getwritebuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (PyArray_CHKFLAGS(self, WRITEABLE)) \n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_ValueError, \"Array cannot be \"\\\n \"accessed as a writeable buffer.\");\n return -1;\n }\n}\n\nstatic int \narray_getcharbuf(PyArrayObject *self, int segment, const char **ptrptr) \n{\n if (self->descr->type_num == PyArray_STRING || \\\n\t self->descr->type_num == PyArray_UNICODE)\n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_TypeError, \n \"Non-character array cannot be interpreted \"\\\n \"as character buffer.\");\n return -1;\n }\n}\n\nstatic PyBufferProcs array_as_buffer = {\n (getreadbufferproc)array_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)array_getwritebuf, /*bf_getwritebuffer*/\n (getsegcountproc)array_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)array_getcharbuf, /*bf_getcharbuffer*/\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Number Protocol ****************************\n *************************************************************************/\n\n\ntypedef struct {\n PyObject *add,\n *subtract,\n *multiply,\n *divide,\n *remainder,\n *power,\n\t\t*sqrt,\n *negative,\n *absolute,\n *invert,\n *left_shift,\n *right_shift,\n *bitwise_and,\n *bitwise_xor,\n *bitwise_or,\n *less,\n *less_equal,\n *equal,\n *not_equal,\n *greater,\n *greater_equal,\n *floor_divide,\n *TRUE_divide,\n\t\t*logical_or,\n\t\t*logical_and,\n\t\t*floor,\n\t\t*ceil,\n\t\t*maximum,\n\t\t*minimum;\t\n\t\n} NumericOps;\n\nstatic NumericOps n_ops = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL};\n\n/* Dictionary can contain any of the numeric operations, by name. \n Those not present will not be changed\n */\n\n#define SET(op) temp=PyDict_GetItemString(dict, #op);\t\\\n\tif (temp != NULL) {\t\t\t\t\\\n\t\tif (!(PyCallable_Check(temp))) return -1; \\\n Py_XDECREF(n_ops.op); \\\n\t\tn_ops.op = temp; \\\n\t}\n\n \nint \nPyArray_SetNumericOps(PyObject *dict) \n{\n PyObject *temp = NULL;\n SET(add);\n SET(subtract);\n SET(multiply);\n SET(divide);\n SET(remainder);\n SET(power);\n\tSET(sqrt);\n SET(negative);\n SET(absolute);\n SET(invert);\n SET(left_shift);\n SET(right_shift);\n SET(bitwise_and);\n SET(bitwise_or);\n SET(bitwise_xor);\n SET(less);\t \n SET(less_equal);\n SET(equal);\n SET(not_equal);\n SET(greater);\n SET(greater_equal);\n SET(floor_divide);\t\n SET(TRUE_divide);\t\n\tSET(logical_or);\n\tSET(logical_and);\n\tSET(floor);\n\tSET(ceil);\n\tSET(maximum);\n\tSET(minimum);\n return 0;\n}\n\n#define GET(op) if (PyDict_SetItemString(dict, #op, n_ops.op)==-1) \\\n\t\tgoto fail;\n\nstatic PyObject *\nPyArray_GetNumericOps(void) \n{\n\tPyObject *dict;\n\tif ((dict = PyDict_New())==NULL) \n\t\treturn NULL;\t\n\tGET(add);\n GET(subtract);\n GET(multiply);\n GET(divide);\n GET(remainder);\n GET(power);\n\tGET(sqrt);\n GET(negative);\n GET(absolute);\n GET(invert);\n GET(left_shift);\n GET(right_shift);\n GET(bitwise_and);\n GET(bitwise_or);\n GET(bitwise_xor);\n GET(less);\t \n GET(less_equal);\n GET(equal);\n GET(not_equal);\n GET(greater);\n GET(greater_equal);\n GET(floor_divide); \n GET(TRUE_divide); \n\tGET(logical_or);\n\tGET(logical_and);\n\tGET(floor);\n\tGET(ceil);\n\tGET(maximum);\n\tGET(minimum);\n\treturn dict;\t\n\n fail:\n\tPy_DECREF(dict);\n\treturn NULL;\t\t\n}\n\nstatic PyObject *\nPyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"reduce\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"accumulate\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OO)\", m1, m2);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(O)\", m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericInplaceBinaryFunction(PyArrayObject *m1, \n\t\t\t\t PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OOO)\", m1, m2, m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\narray_add(PyArrayObject *m1, PyObject *m2) \n{ \n return PyArray_GenericBinaryFunction(m1, m2, n_ops.add); \n}\n\nstatic PyObject *\narray_subtract(PyArrayObject *m1, PyObject *m2) \n{\n\treturn PyArray_GenericBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_negative(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.negative);\n}\n\nstatic PyObject *\narray_absolute(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.absolute);\n}\n\nstatic PyObject *\narray_invert(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.invert);\n}\n\nstatic PyObject *\narray_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_inplace_add(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.add);\n}\n\nstatic PyObject *\narray_inplace_subtract(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_inplace_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_inplace_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_inplace_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_inplace_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_inplace_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_inplace_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_inplace_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_inplace_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_inplace_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.TRUE_divide);\n}\n\nstatic PyObject *\narray_inplace_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_inplace_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.TRUE_divide);\n}\n\n/* Array evaluates as \"TRUE\" if any of the elements are non-zero */\nstatic int \narray_all_nonzero(PyArrayObject *mp) \n{\n\tintp index;\n\tPyArrayIterObject *it;\n\tBool anyTRUE = 0;\n\t\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)mp);\n\tif (it==NULL) return anyTRUE;\n\tindex = it->size;\n\twhile(index--) {\n\t\tif (mp->descr->nonzero(it->dataptr, mp)) {\n\t\t\tanyTRUE = 1;\n\t\t\tbreak;\n\t\t}\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\treturn anyTRUE;\n}\n\nstatic PyObject *\narray_divmod(PyArrayObject *op1, PyObject *op2) \n{\n PyObject *divp, *modp, *result;\n\n divp = array_divide(op1, op2);\n if (divp == NULL) return NULL;\n modp = array_remainder(op1, op2);\n if (modp == NULL) {\n Py_DECREF(divp);\n return NULL;\n }\n result = Py_BuildValue(\"OO\", divp, modp);\n Py_DECREF(divp);\n Py_DECREF(modp);\n return result;\n}\n\n\nstatic PyObject *\narray_int(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can be\"\\\n\t\t\t\t\" converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_int == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to int\");\n Py_DECREF(pv);\n return NULL;\n }\n\n pv2 = pv->ob_type->tp_as_number->nb_int(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_float(PyArrayObject *v) \n{\n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an \"\\\n\t\t\t\t\"int, scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_float == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to float\");\n Py_DECREF(pv);\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_float(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_long(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_long == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to long\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_long(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_oct(PyArrayObject *v) \n{\t \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_oct == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to oct\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_oct(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_hex(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_hex == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to hex\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_hex(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\n_array_copy_nice(PyArrayObject *self)\n{\n\treturn PyArray_Return((PyArrayObject *)\t\t\\\n\t\t\t PyArray_Copy(self));\n}\n\nstatic PyNumberMethods array_as_number = {\n (binaryfunc)array_add,\t\t /*nb_add*/\n (binaryfunc)array_subtract,\t\t /*nb_subtract*/\n (binaryfunc)array_multiply,\t\t /*nb_multiply*/\n (binaryfunc)array_divide,\t\t /*nb_divide*/\n (binaryfunc)array_remainder,\t /*nb_remainder*/\n (binaryfunc)array_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)array_power,\t\t /*nb_power*/\n (unaryfunc)array_negative, /*nb_neg*/\t\n (unaryfunc)_array_copy_nice,\t\t /*nb_pos*/ \n (unaryfunc)array_absolute,\t\t /*(unaryfunc)array_abs,*/\n (inquiry)array_all_nonzero,\t\t /*nb_nonzero*/\n (unaryfunc)array_invert,\t\t /*nb_invert*/\n (binaryfunc)array_left_shift,\t /*nb_lshift*/\n (binaryfunc)array_right_shift,\t /*nb_rshift*/\n (binaryfunc)array_bitwise_and,\t /*nb_and*/\n (binaryfunc)array_bitwise_xor,\t /*nb_xor*/\n (binaryfunc)array_bitwise_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)array_int,\t\t /*nb_int*/\n (unaryfunc)array_long,\t\t /*nb_long*/\n (unaryfunc)array_float,\t\t /*nb_float*/\n (unaryfunc)array_oct,\t\t /*nb_oct*/\n (unaryfunc)array_hex,\t\t /*nb_hex*/\n\n /*This code adds augmented assignment functionality*/\n /*that was made available in Python 2.0*/\n (binaryfunc)array_inplace_add,\t /*inplace_add*/\n (binaryfunc)array_inplace_subtract,\t /*inplace_subtract*/\n (binaryfunc)array_inplace_multiply,\t /*inplace_multiply*/\n (binaryfunc)array_inplace_divide,\t /*inplace_divide*/\n (binaryfunc)array_inplace_remainder, /*inplace_remainder*/\n (ternaryfunc)array_inplace_power,\t /*inplace_power*/\n (binaryfunc)array_inplace_left_shift, /*inplace_lshift*/\n (binaryfunc)array_inplace_right_shift, /*inplace_rshift*/\n (binaryfunc)array_inplace_bitwise_and, /*inplace_and*/\n (binaryfunc)array_inplace_bitwise_xor, /*inplace_xor*/\n (binaryfunc)array_inplace_bitwise_or, /*inplace_or*/\n\n (binaryfunc)array_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)array_TRUE_divide,\t /*nb_TRUE_divide*/\n (binaryfunc)array_inplace_floor_divide, /*nb_inplace_floor_divide*/\n (binaryfunc)array_inplace_TRUE_divide, /*nb_inplace_TRUE_divide*/\n\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Sequence Protocol **************************\n *************************************************************************/\n\n/* Some of this is repeated in the array_as_mapping protocol. But\n we fill it in here so that PySequence_XXXX calls work as expected \n*/\n\n\nstatic PyObject * \narray_slice(PyArrayObject *self, int ilow, int ihigh) \n{\n PyArrayObject *r;\n int l;\n char *data;\n\n if (self->nd == 0) {\n PyErr_SetString(PyExc_ValueError, \"can't slice a scalar\");\n return NULL;\n }\n \t\n l=self->dimensions[0];\n if (ihigh < 0) ihigh += l;\n if (ilow < 0) ilow += l;\n if (ilow < 0) ilow = 0;\n else if (ilow > l) ilow = l;\n if (ihigh < 0) ihigh = 0;\n else if (ihigh > l) ihigh = l;\n if (ihigh < ilow) ihigh = ilow;\n\n if (ihigh != ilow) {\n data = index2ptr(self, ilow);\n if (data == NULL) return NULL;\n } else {\n data = self->data;\n }\n\n self->dimensions[0] = ihigh-ilow;\n r = (PyArrayObject *)\\\n\t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n\t\t\t self->descr->type_num, self->strides, data,\n\t\t\t self->itemsize, self->flags, (PyObject *)self);\n\n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n Py_INCREF(self);\n\tPyArray_UpdateFlags(r, UPDATE_ALL_FLAGS); \n return (PyObject *)r;\n}\n\n\nstatic int \narray_ass_slice(PyArrayObject *self, int ilow, int ihigh, PyObject *v) {\n int ret;\n PyArrayObject *tmp;\n\t\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n if ((tmp = (PyArrayObject *)array_slice(self, ilow, ihigh)) \\\n == NULL) \n return -1; \n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\nstatic int\narray_contains(PyArrayObject *self, PyObject *el)\n{\n /* equivalent to any(self == el) */\n\n return PyObject_RichCompareBool((PyObject *)self, el, Py_EQ);\n}\n\n\nstatic PySequenceMethods array_as_sequence = {\n (inquiry)array_length,\t\t/*sq_length*/\n (binaryfunc)NULL, /* sq_concat is handled by nb_add*/\n (intargfunc)NULL, /* sq_repeat is handled nb_multiply*/\n (intargfunc)array_item_nice,\t\t/*sq_item*/\n (intintargfunc)array_slice,\t\t/*sq_slice*/\n (intobjargproc)array_ass_item,\t/*sq_ass_item*/\n (intintobjargproc)array_ass_slice,\t/*sq_ass_slice*/\n\t(objobjproc) array_contains, /* sq_contains */\n\t(binaryfunc) NULL, /* sg_inplace_concat */\n\t(intargfunc) NULL /* sg_inplace_repeat */\n};\n\n\n/****************** End of Sequence Protocol ****************************/\n\n\nstatic int \ndump_data(char **string, int *n, int *max_n, char *data, int nd, \n intp *dimensions, intp *strides, PyArrayObject* self) \n{\n PyArray_Descr *descr=self->descr;\n PyObject *op, *sp;\n char *ostring;\n int i, N;\n\t\n#define CHECK_MEMORY if (*n >= *max_n-16) { *max_n *= 2; \\\n\t\t*string = (char *)realloc(*string, *max_n); }\n\t\n if (nd == 0) {\n\t\t\n if ((op = descr->getitem(data, self)) == NULL) return -1;\n sp = PyObject_Repr(op);\n if (sp == NULL) {Py_DECREF(op); return -1;}\n ostring = PyString_AsString(sp);\n N = PyString_Size(sp)*sizeof(char);\n *n += N;\n CHECK_MEMORY\n memmove(*string+(*n-N), ostring, N);\n Py_DECREF(sp);\n Py_DECREF(op);\n return 0;\n } else {\n CHECK_MEMORY\n (*string)[*n] = '[';\n *n += 1;\n for(i=0; idata, \n\t\t self->nd, self->dimensions, \n self->strides, self) < 0) { \n\t\tfree(string); return NULL; \n\t}\n\t\n\tif (PyArray_ISFLEXIBLE(self)) {\n\t\tchar buf[100];\n\t\tsnprintf(buf, sizeof(buf), \"%d\", self->itemsize);\n\t\tsprintf(string+n, \", '%c%s')\", self->descr->type, buf);\n\t\tret = PyString_FromStringAndSize(string, n+6+strlen(buf));\n\t}\n\telse {\n\t\tsprintf(string+n, \", '%c')\", self->descr->type);\n\t\tret = PyString_FromStringAndSize(string, n+6);\n\t}\n\t\n\n free(string);\n return ret;\n}\n\nstatic PyObject *PyArray_StrFunction=NULL;\nstatic PyObject *PyArray_ReprFunction=NULL;\n\nstatic void \nPyArray_SetStringFunction(PyObject *op, int repr) \n{\n if (repr) {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_ReprFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_ReprFunction = op; \n } else {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_StrFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_StrFunction = op; \n }\n}\n\nstatic PyObject *\narray_repr(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_ReprFunction == NULL) {\n s = array_repr_builtin(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_ReprFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\nstatic PyObject *\narray_str(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_StrFunction == NULL) {\n s = array_repr(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_StrFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\n\nstatic PyObject *\narray_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) \n{\n PyObject *array_other, *result;\n\n switch (cmp_op) \n {\n case Py_LT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less);\n case Py_LE:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less_equal);\n case Py_EQ:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then return the integer\n\t\t\t object 0. This fixes code that used to\n\t\t\t allow equality comparisons between arrays\n\t\t\t and other objects which would give a result\n\t\t\t of 0\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.equal);\n /* If the comparison results in NULL, then the \n\t\t\t two array objects can not be compared together so \n\t\t\t return zero \n */\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n return result;\n case Py_NE:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then objects cannot be \n\t\t\t compared and cannot be equal, therefore, \n\t\t\t return True;\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.not_equal);\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n return result;\n case Py_GT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.greater);\n case Py_GE:\n return PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t other, \n\t\t\t\t\t \t n_ops.greater_equal);\n }\n return NULL;\n}\n\nstatic PyObject *\n_check_axis(PyArrayObject *arr, int *axis, int flags)\n{\n\tPyObject *temp;\n\tint n = arr->nd;\n\n\tif ((*axis >= MAX_DIMS) || (n==0)) {\n\t\ttemp = PyArray_Ravel(arr,0);\n\t\t*axis = 0;\n\t\treturn temp;\n\t}\n\telse {\n\t\tif (flags) {\n\t\t\ttemp = PyArray_FromAny((PyObject *)arr, NULL, \n\t\t\t\t\t 0, 0, flags);\n\t\t\tif (temp == NULL) return NULL;\n\t\t}\n\t\telse {\n\t\t\tPy_INCREF(arr);\n\t\t\ttemp = (PyObject *)arr;\n\t\t}\n\t}\n\tif (*axis < 0) *axis += n;\n\tif ((*axis < 0) || (*axis >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"axis(=%d) out of bounds\", *axis);\n\t\tPy_DECREF(temp);\n\t\treturn NULL;\n\t}\n\treturn temp;\n}\n\n#include \"arraymethods.c\"\n\n/* Lifted from numarray */\nstatic PyObject *\nPyArray_IntTupleFromIntp(int len, intp *vals)\n{\n\tint i;\n PyObject *intTuple = PyTuple_New(len);\n if (!intTuple) goto fail;\n for(i=0; ind == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i = ap->nd-1; i >= 0; --i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int \n_IsFortranContiguous(PyArrayObject *ap) \n{\n\tint sd;\n\tint i;\n\t\n\tif (ap->nd == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i=0; i< ap->nd; ++i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int\n_IsAligned(PyArrayObject *ap) \n{\n\tint i, alignment, aligned=1;\n\tintp ptr;\n\tint type = ap->descr->type_num;\n\n\tif ((type == PyArray_STRING) || (type == PyArray_VOID))\n\t\treturn 1;\n\n\talignment = ap->descr->alignment;\n\n\tptr = (intp) ap->data;\n aligned = (ptr % alignment) == 0;\n for (i=0; i nd; i++)\n aligned &= ((ap->strides[i] % alignment) == 0);\n return aligned != 0;\n}\n\nstatic Bool\n_IsWriteable(PyArrayObject *ap)\n{\n\tPyObject *base=ap->base;\n\tPyBufferProcs *pb;\n\n\t/* If we own our own data, then no-problem */\n\tif ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;\n\n\t/* Get to the final base object \n\t If it is a writeable array, then return TRUE\n\t If we can find an array object \n\t or a writeable buffer object as the final base object\n\t or a string object (for pickling support memory savings).\n\t - this last could be removed if a proper pickleable \n\t buffer was added to Python.\n\t*/\n\n\twhile(PyArray_Check(base)) {\n\t\tif (PyArray_CHKFLAGS(base, OWN_DATA)) \n\t\t\treturn (Bool) (PyArray_ISWRITEABLE(base));\n\t\tbase = PyArray_BASE(base);\n\t}\n\n\t/* here so pickle support works seamlessly \n\t and unpickled array can be set and reset writeable \n\t -- could be abused -- */\n\tif PyString_Check(base) return TRUE;\n\n\tpb = base->ob_type->tp_as_buffer;\n\tif (pb == NULL || pb->bf_getwritebuffer == NULL)\n\t\treturn FALSE;\n\t\n\treturn TRUE;\n}\n\n\nstatic void\nPyArray_UpdateFlags(PyArrayObject *ret, int flagmask)\n{\n\n\tif (flagmask & FORTRAN) {\n\t\tif (_IsFortranContiguous(ret)) {\n\t\t\tret->flags |= FORTRAN;\n\t\t\tif (ret->nd > 1) ret->flags &= ~CONTIGUOUS;\n\t\t}\n\t\telse ret->flags &= ~FORTRAN;\n\t}\n\tif (flagmask & CONTIGUOUS) {\n\t\tif (_IsContiguous(ret)) {\n\t\t\tret->flags |= CONTIGUOUS;\n\t\t\tif (ret->nd > 1) ret->flags &= ~FORTRAN;\n\t\t}\n\t\telse ret->flags &= ~CONTIGUOUS;\n\t}\n\tif (flagmask & ALIGNED) {\n\t\tif (_IsAligned(ret)) ret->flags |= ALIGNED;\n\t\telse ret->flags &= ~ALIGNED;\n\t}\n\treturn;\n}\n\n/* This routine checks to see if newstrides (of length nd) will not \n walk outside of the memory implied by either numbytes or\n a single segment array of the provided dimensions and element size if\n numbytes is 0 */\nstatic Bool\nPyArray_CheckStrides(int elsize, int nd, intp numbytes, \n\t\t intp *dims, intp *newstrides)\n{\n\tint i;\n\t\n\tif (numbytes == 0) \n\t\tnumbytes = PyArray_MultiplyList(dims, nd) * elsize;\n\t\n\tfor (i=0; i numbytes) {\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\treturn TRUE;\n\t\n}\n\n\n/* This is the main array creation routine. */\n\n/* Flags argument has multiple related meanings \n depending on data and strides: \n\n If data is given, then flags is flags associated with data. \n If strides is not given, then a contiguous strides array will be created\n and the CONTIGUOUS bit will be set. If the flags argument \n has the FORTRAN bit set, then a FORTRAN-style strides array will be\n created (and of course the FORTRAN flag bit will be set). \n\n If data is not given but created here, then flags will be DEFAULT_FLAGS\n and a non-zero flags argument can be used to indicate a FORTRAN style\n array is desired. \n*/\n\nstatic intp\n_array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize, \n\t\t int inflag, int *objflags) \n{\n\tint i;\n\t/* Only make Fortran strides if not contiguous as well */\n\tif ((inflag & FORTRAN) && !(inflag & CONTIGUOUS)) {\n\t\tfor (i=0; i 1) *objflags &= ~CONTIGUOUS;\n\t\telse *objflags |= CONTIGUOUS;\n\t}\n\telse {\n\t\tfor (i=nd-1;i>=0;i--) {\n\t\t\tstrides[i] = itemsize;\n\t\t\titemsize *= dims[i] ? dims[i] : 1;\n\t\t}\n\t\t*objflags |= CONTIGUOUS;\n\t\tif (nd > 1) *objflags &= ~FORTRAN;\n\t\telse *objflags |= FORTRAN;\n\t}\n\treturn itemsize;\n}\n\n\t\nstatic PyObject *\nPyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n\t PyObject *obj)\n{\n\tPyArrayObject *self;\n\tPyArray_Descr *descr;\n\tregister int i;\n\tintp sd, temp;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\tif (descr == NULL) return NULL;\n\n\tif (nd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"number of dimensions must be >=0\");\n\t\treturn NULL;\n\t}\n if (nd > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError,\n \"maximum number of dimensions is %d\", MAX_DIMS);\n return NULL;\n\t}\n\n\t/* Check dimensions */\n\tfor (i=nd-1;i>=0;i--) {\n\t\tif (dims[i] < 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"negative dimensions\"\t\\\n\t\t\t\t\t\" are not allowed.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tself = (PyArrayObject *) subtype->tp_alloc(subtype, 0);\n\tif (self == NULL) return NULL;\t\n\tself->descr = descr;\n\tself->dimensions = NULL;\n\tif (data == NULL) { /* strides is NULL too */\n\t\tself->flags = DEFAULT_FLAGS;\n\t\tif (flags) {\n\t\t\tself->flags |= FORTRAN; \n\t\t\tif (nd > 1) self->flags &= ~CONTIGUOUS;\n\t\t\tflags = FORTRAN;\n\t\t}\n\t}\n\telse self->flags = (flags & ~UPDATEIFCOPY);\n\t\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tif (itemsize < 1) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"Type must provide an itemsize.\");\n\t\t\tPyObject_Del(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tself->itemsize = itemsize;\n\t\t/* Guarantee that these kind of arrays are never byteswapped\n\t\t unknowingly. \n\t\t*/\n\t\tif (type_num != PyArray_UNICODE)\n\t\t\tself->flags |= NOTSWAPPED;\n\t}\n\telse self->itemsize = descr->elsize; \n\t\t\n\tsd = self->itemsize;\n\t\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dims, sizeof(intp)*nd);\n\t\tif (strides == NULL) { /* fill it in */\n\t\t\tsd = _array_fill_strides(self->strides, dims, nd, sd,\n\t\t\t\t\t\t flags, &(self->flags));\n\t\t}\n\t\telse {\n\t\t\tif (data == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"If strides is given in \" \\\n\t\t\t\t\t\t\"array creation, data must \" \\\n\t\t\t\t\t\t\"be given too.\");\n\t\t\t\tPyObject_Del(self);\n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\t\treturn NULL;\n\t\t\t}\t\t\t\t\t\n\t\t\tmemcpy(self->strides, strides, sizeof(intp)*nd);\n\t\t}\n\t}\n \t\n\t\t\n\tif (data == NULL) {\n\n\t\t/* Make sure we are aligned on void ptrs (without wasting\n\t\t space if we already are). But, also, allocate something \n\t\t even for zero-space arrays e.g. shape=(0,) -- otherwise\n buffer exposure (a.data) doesn't work as it should. */\n\n\t\tif (sd==0) sd = sizeof(intp);\n\t\telse if ((temp=sd%sizeof(intp))) sd += sizeof(intp) - temp;\n\n\t\tif ((data = PyDataMem_NEW(sd))==NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\tif (self->dimensions != NULL) \n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\n\t\t/* It is bad to have unitialized OBJECT pointers */\n\t\t/* We shouldn't need to check for the OBJECT Letter\n\t\t but perhaps it's best. */\n\t\tif (type_num == PyArray_OBJECT || \\\n\t\t type_num == PyArray_OBJECTLTR) {\n\t\t\tmemset(data, 0, sd);\n\t\t}\n\t}\n\telse {\n self->flags &= ~OWN_DATA; /* If data is passed in, \n\t\t\t\t\t this object won't own it \n\t\t\t\t\t by default.\n\t\t\t\t\t Caller must arrange for \n\t\t\t\t\t this to be reset if truly\n\t\t\t\t\t desired */\n }\n self->data = data;\n\tself->nd = nd;\n\tself->base = (PyObject *)NULL;\n self->weakreflist = (PyObject *)NULL;\n\n /* call the __array_finalize__\n\t method if a subtype and some object passed in */\n\tif ((obj != NULL) && (subtype != &PyArray_Type) && \n\t (subtype != &PyBigArray_Type)) {\n\t\tPyObject *res;\n\t\tres = PyObject_CallMethod((PyObject *)self, \n\t\t\t\t\t \"__array_finalize__\",\n\t\t\t\t\t \"O\", obj);\n\t\tif (res == NULL) PyErr_Clear();\n\t\telse Py_DECREF(res);\n\t}\n\n\treturn (PyObject *)self;\n}\n\n\n\nstatic PyObject * \nPyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape)\n{\n intp oldsize, newsize;\n int new_nd=newshape->len, k, n, elsize;\n int refcnt;\n intp* new_dimensions=newshape->ptr;\n intp new_strides[MAX_DIMS];\n intp sd;\n intp *dimptr;\n char *new_data;\n\t\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n \"resize only works on contiguous arrays\");\n return NULL;\n }\n\n\n newsize = PyArray_MultiplyList(new_dimensions, new_nd);\n\n if (newsize == 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Newsize is zero. Cannot delete an array \"\\\n \"in this way.\");\n return NULL;\n }\n oldsize = PyArray_SIZE(self);\n \n\tif (oldsize != newsize) {\n\t\tif (!(self->flags & OWN_DATA)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize this array: \"\t\\\n\t\t\t\t\t\"it does not own its data.\");\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\trefcnt = (((PyObject *)self)->ob_refcnt);\n\t\tif ((refcnt > 2) || (self->base != NULL) || \\\n\t\t (self->weakreflist != NULL)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize an array that has \"\\\n\t\t\t\t\t\"been referenced or is referencing\\n\"\\\n\t\t\t\t\t\"another array in this way. Use the \"\\\n\t\t\t\t\t\"resize function.\");\n\t\t\treturn NULL;\n\t\t} \n\t\t\n\t\t/* Reallocate space if needed */\n\t\tnew_data = PyDataMem_RENEW(self->data, \n\t\t\t\t\t newsize*(self->itemsize));\n\t\tif (new_data == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n\t\t\t\t\t\"can't allocate memory for array.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tself->data = new_data;\n\t}\n \n if ((newsize > oldsize) && PyArray_ISWRITEABLE(self)) { \n\t\t/* Fill new memory with zeros */\n elsize = self->itemsize;\n\t\tif ((PyArray_TYPE(self) == PyArray_OBJECT)) {\n\t\t\tPyObject *zero = PyInt_FromLong(0);\n PyObject **optr;\n\t\t\toptr = ((PyObject **)self->data) + oldsize;\n\t\t\tn = newsize - oldsize;\n\t\t\tfor (k=0; kdata+oldsize*elsize, 0, \n\t\t\t (newsize-oldsize)*elsize);\n\t\t}\n\t}\n \n if (self->nd != new_nd) { /* Different number of dimensions. */\n self->nd = new_nd;\n \n /* Need new dimensions and strides arrays */\n dimptr = PyDimMem_RENEW(self->dimensions, 2*new_nd);\n if (dimptr == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n \"can't allocate memory for array \" \\\n \"(array may be corrupted).\");\n return NULL;\n }\n self->dimensions = dimptr;\n\t\tself->strides = dimptr + new_nd;\n }\n\n /* make new_strides variable */\n sd = (intp) self->itemsize;\n sd = _array_fill_strides(new_strides, new_dimensions, new_nd, sd,\n 0, &(self->flags));\n\n \n memmove(self->dimensions, new_dimensions, new_nd*sizeof(intp));\n memmove(self->strides, new_strides, new_nd*sizeof(intp));\n\n Py_INCREF(Py_None);\t\n return Py_None;\n \n}\n\n\nstatic void\nPyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj)\n{\n PyObject **optr;\n intp i,n;\n optr = (PyObject **)(arr->data);\n n = PyArray_SIZE(arr);\n if (obj == NULL) {\n for (i=0; ibase = buffer.base;\n Py_INCREF(buffer.base); \n }\n\n PyDimMem_FREE(dims.ptr);\n if (strides.ptr) PyDimMem_FREE(strides.ptr);\n return PyArray_Return(ret);\n \n fail:\n if (dims.ptr) free(dims.ptr);\n if (strides.ptr) free(strides.ptr);\n return NULL;\n}\n\n\n\n/******************* array attribute get and set routines ******************/\n\nstatic PyObject *\narray_ndim_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong(self->nd);\n}\n\nstatic PyObject *\narray_flags_get(PyArrayObject *self)\n{\n static PyObject *module=NULL;\n\n if (module==NULL) {\n module = PyImport_ImportModule(\"scipy.base._internal\");\n if (module == NULL) return NULL;\n }\n return PyObject_CallMethod(module, \"flagsobj\", \"Oi\", \n self, self->flags);\n}\n\n/*\nstatic int\narray_flags_set(PyArrayObject *self, PyObject *obj) \n{\n\tint flagback = self->flags;\n\n if (PyDict_Check(obj)) {\n PyObject *new;\n\t\tnew = PyDict_GetItemString(obj, \"ALIGNED\");\n\t\tif (new) {\n\t\t\tif (PyObject_Not(new)) self->flags &= ~ALIGNED;\n\t\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\t\telse {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"cannot set aligned flag of \" \\\n\t\t\t\t\t\t\"mis-aligned array to True\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n new = PyDict_GetItemString(obj, \"UPDATEIFCOPY\");\n if (new) {\n if (PyObject_Not(new)) {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n else {\n\t\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return -1;\n }\n }\n new = PyDict_GetItemString(obj, \"WRITEABLE\");\n if (new) {\n\t\t\tif (PyObject_IsTrue(new)) {\n\t\t\t\tif (_IsWriteable(self)) {\n\t\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself->flags = flagback;\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\t\"cannot set \"\t\\\n\t\t\t\t\t\t\t\"WRITEABLE \"\t\\\n\t\t\t\t\t\t\t\"flag to True of \"\\\n\t\t\t\t\t\t\t\"this array \");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n new = PyDict_GetItemString(obj, \"NOTSWAPPED\");\n if (new) {\n if (PyObject_IsTrue(new))\n self->flags |= NOTSWAPPED;\n else {\n self->flags &= ~NOTSWAPPED;\n\t\t\t}\n\t\t}\n return 0;\n }\n PyErr_SetString(PyExc_ValueError, \n \"Object must be a dictionary\");\n return -1;\n}\n*/\n\n\nstatic PyObject *\narray_shape_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->dimensions);\n}\n\n\nstatic int\narray_shape_set(PyArrayObject *self, PyObject *val)\n{\n \tint nd;\n\tPyObject *ret;\n\n\tif (!PyTuple_Check(val)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"shape must be a tuple\");\n\t\treturn -1;\n\t}\n\tret = PyArray_Reshape(self, val);\n\tif (ret == NULL) return -1;\n\t\n\tif (self->nd > 0) { /* Free old dimensions and strides */\n\t\tPyDimMem_FREE(self->dimensions);\n\t}\n\tnd = PyArray_NDIM(ret);\n\tself->nd = nd;\n\tif (nd > 0) { /* create new dimensions and strides */\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\tPyErr_SetString(PyExc_MemoryError,\"\");\n\t\t\treturn -1;\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, PyArray_DIMS(ret), \n\t\t nd*sizeof(intp));\n\t\tmemcpy(self->strides, PyArray_STRIDES(ret), \n\t\t nd*sizeof(intp));\n\t}\n\telse self->dimensions=NULL;\n\tPy_DECREF(ret);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_strides_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic int\narray_strides_set(PyArrayObject *self, PyObject *obj)\n{\n\tPyArray_Dims newstrides = {NULL, 0};\n\tPyArrayObject *new;\n\tintp numbytes;\n\n\tif (!PyArray_IntpConverter(obj, &newstrides) || \\\n\t newstrides.ptr == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"invalid strides.\");\n\t\treturn -1;\n\t}\n\tif (newstrides.len != self->nd) {\n\t\tPyErr_Format(PyExc_ValueError, \"strides must be \"\t\\\n\t\t\t \" same length as shape (%d)\", self->nd);\n\t\treturn -1;\n\t}\n\tnew = self;\n\twhile(new->base != NULL) {\n\t\tif (PyArray_Check(new->base)) \n\t\t\tnew = (PyArrayObject *)new->base;\n\t}\n\tnumbytes = PyArray_MultiplyList(new->dimensions, \n\t\t\t\t\tnew->nd)*new->itemsize;\n\t\n\tif (!PyArray_CheckStrides(self->itemsize, self->nd, numbytes, \n\t\t\t\t self->dimensions, newstrides.ptr)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"strides is not \"\\\n\t\t\t\t\"compatible with available memory\");\n\t\treturn -1;\n\t}\n\tmemcpy(self->strides, newstrides.ptr, sizeof(intp)*newstrides.len);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_protocol_strides_get(PyArrayObject *self)\n{\n\tif PyArray_ISCONTIGUOUS(self) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic PyObject *\narray_priority_get(PyArrayObject *self)\n{\n\tif (PyArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_PRIORITY);\n\telse if (PyBigArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_BIG_PRIORITY);\n\telse\n\t\treturn PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY);\n}\n\n\nstatic PyObject *\narray_data_get(PyArrayObject *self)\n{\n\tintp nbytes;\n\tif (!(PyArray_ISONESEGMENT(self))) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot get single-\"\\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn NULL;\n\t}\t\t\n\tnbytes = PyArray_NBYTES(self);\n\tif PyArray_ISWRITEABLE(self) \n\t\treturn PyBuffer_FromReadWriteObject((PyObject *)self, 0, \n\t\t\t\t\t\t (int) nbytes);\n\telse\n\t\treturn PyBuffer_FromObject((PyObject *)self, 0, (int) nbytes);\n}\n\nstatic int\narray_data_set(PyArrayObject *self, PyObject *op)\n{\n\tvoid *buf;\n\tint buf_len;\n\tint writeable=1;\n\n\tif (PyObject_AsWriteBuffer(op, &buf, &buf_len) < 0) {\n\t\twriteable = 0;\n\t\tif (PyObject_AsReadBuffer(op, (const void **)&buf, \n\t\t\t\t\t &buf_len) < 0) {\n\t\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\t\"Object does not have single-segment\" \\\n\t\t\t\t\t\"buffer interface\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif (!PyArray_ISONESEGMENT(self)) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot set single-\" \\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn -1;\n\t}\n\tif (PyArray_NBYTES(self) > buf_len) {\n\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\"Not enough data for array.\");\n\t\treturn -1;\n\t}\n\tif (self->flags & OWN_DATA) {\n\t\tPyArray_XDECREF(self);\n\t\tPyDataMem_FREE(self->data);\n\t}\n\tif (self->base) {\n\t\tif (self->flags & UPDATEIFCOPY) {\n\t\t\t((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tself->flags &= ~UPDATEIFCOPY;\n\t\t}\n\t\tPy_DECREF(self->base);\n\t}\n\tPy_INCREF(op);\n\tself->base = op;\n\tself->data = buf;\n\tself->flags = CARRAY_FLAGS;\n\tif (!writeable)\n\t\tself->flags &= ~WRITEABLE;\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_itemsize_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->itemsize);\n}\n\nstatic PyObject *\narray_size_get(PyArrayObject *self)\n{\n\tlonglong size=PyArray_SIZE(self);\n\tif (size > MAX_INT || size < MIN_INT)\n\t\treturn PyLong_FromLongLong((longlong) size);\n\telse \n\t\treturn PyInt_FromLong((long) size);\n}\n\n\nstatic PyObject *\narray_typechar_get(PyArrayObject *self)\n{\n\tif PyArray_ISFLEXIBLE(self) \n\t\treturn PyString_FromFormat(\"%c%d\", (self->descr->type),\n\t\t\t\t\t self->itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(self->descr->type), 1);\n}\n\nstatic PyObject *\narray_typestr_get(PyArrayObject *self)\n{\n\tstatic char endians[] = \"<>\";\n\tchar endian;\n\tint which;\n\tunsigned long val = 1;\n\tchar *s;\n\tchar basic_=self->descr->kind;\n\n\ts = (char *)&val; /* s[0] == 0 implies big-endian */\n\twhich = (PyArray_ISNOTSWAPPED(self) ? 0 : 1);\n\tif (s[0] == 0) which = 1 - which;\n\tendian = endians[which]; \n\t\n\tif ((basic_==PyArray_VOIDLTR) || (basic_==PyArray_STRINGLTR) || \\\n\t (basic_==PyArray_OBJECTLTR) || (self->itemsize == 1))\n\t\treturn PyString_FromFormat(\"|%c%d\", basic_, self->itemsize);\n\telse\n\t\treturn PyString_FromFormat(\"%c%c%d\", endian, basic_,\n\t\t\t\t\t self->itemsize);\n}\n\nstatic PyObject *\narray_descr_get(PyArrayObject *self)\n{\n\tPyObject *res;\n\tPyObject *dobj;\n\n\t/* hand this off to the typeobject */\n\t/* or give default */\n\tif (PyArray_ISUSERDEF(self)) {\n\t\tres = PyObject_GetAttrString((PyObject *)self->descr->typeobj, \n\t\t\t\t\t \"__array_descr__\");\n\t\tif (res) return res;\n\t\tPyErr_Clear();\n\t}\n\t/* get default */\n\tdobj = PyTuple_New(2);\n\tif (dobj == NULL) return NULL;\n\tPyTuple_SET_ITEM(dobj, 0, PyString_FromString(\"\"));\n\tPyTuple_SET_ITEM(dobj, 1, array_typestr_get(self));\n\tres = PyList_New(1);\n\tif (res == NULL) {Py_DECREF(dobj); return NULL;}\n\tPyList_SET_ITEM(res, 0, dobj);\n\treturn res;\n}\n\nstatic PyObject *\narray_typenum_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->descr->type_num);\n}\n\n\nstatic PyObject *\narray_type_get(PyArrayObject *self)\n{\n\treturn PyArray_TypeObjectFromType(self->descr->type_num);\n}\n\n/* If the type is changed. \n Also needing change: strides, itemsize\n\n Either itemsize is exactly the same\n or the array is single-segment (contiguous or fortran) with\n compatibile dimensions\n\n*/\n\nstatic int\narray_type_set(PyArrayObject *self, PyObject *arg)\n{\n PyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n intp newdim;\n int index;\n char *msg = \"new type not compatible with array.\";\n\n if ((PyArray_TypecodeConverter(arg, &newtype) < 0) ||\n newtype.type_num == PyArray_NOTYPE) {\n PyErr_SetString(PyExc_TypeError, \"Invalid type for array\");\n return -1;\n }\n if (!(PyArray_ISONESEGMENT(self) ||\t\t\\\n\t (newtype.itemsize != self->itemsize))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1; \n }\n\n\tif (PyArray_ISCONTIGUOUS(self)) index = self->nd - 1;\n\telse index = 0;\n\n if (newtype.itemsize < self->itemsize) {\n /* if it is compatible increase the size of the dimension\n at end (or at the front for FORTRAN)\n */\n if (self->itemsize % newtype.itemsize != 0) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n newdim = self->itemsize / newtype.itemsize;\n\t\tself->dimensions[index] *= newdim;\n self->strides[index] = newtype.itemsize;\n\t}\n \n else if (newtype.itemsize > self->itemsize) {\n \n /* Determine if last (or first if FORTRAN) dimension\n is compatible */\n\n\t\tnewdim = self->dimensions[index] * self->itemsize;\n if ((newdim % newtype.itemsize) != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n\t\t\n self->dimensions[index] = newdim / newtype.itemsize;\n self->strides[index] = newtype.itemsize;\n\t\t\n }\n\t\n \n /* fall through -- adjust type*/\n\n self->descr = PyArray_DescrFromType(newtype.type_num);\n self->itemsize = newtype.itemsize;\n PyArray_UpdateFlags(self, ALIGNED);\n return 0;\n\n}\n\n\n\nstatic PyObject *\narray_base_get(PyArrayObject *self)\n{\n\tif (self->base == NULL) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\telse {\n\t\tPy_INCREF(self->base);\n\t\treturn self->base;\n\t}\n}\n\n\nstatic PyObject *\narray_real_get(PyArrayObject *self)\n{\n\tPyArrayObject *ret;\n\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *)ret;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n}\n\n\nstatic int\narray_real_set(PyArrayObject *self, PyObject *val)\n{\n\tPyArrayObject *ret;\n\tPyArrayObject *new;\n\tint rint;\n\n\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0);\n\tif (new == NULL) return -1;\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return -1;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\tret = self;\n\t}\t\n\trint = PyArray_CopyInto(ret, new);\n\tPy_DECREF(ret);\n\treturn rint;\n}\n\nstatic PyObject *\narray_imag_get(PyArrayObject *self)\n{\t\n\tPyArrayObject *ret;\n\tint itemsize;\n\tint typenum;\n PyArray_Typecode type;\n\t\n\ttype.type_num = self->descr->type_num;\n\ttype.itemsize = self->itemsize;\n\ttype.fortran = PyArray_ISFORTRAN(self);\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\titemsize = self->itemsize >> 1;\n\t\ttypenum = self->descr->type_num - PyArray_NUM_FLOATTYPE;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t typenum,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data + itemsize,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *) ret;\n\t}\n\telse {\n\t\tret = (PyArrayObject *)PyArray_Zeros(self->nd, \n\t\t\t\t\t\t self->dimensions, &type);\n\t\tret->flags &= ~WRITEABLE;\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic int\narray_imag_set(PyArrayObject *self, PyObject *val)\n{\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyArrayObject *ret;\n\t\tPyArrayObject *new;\n\t\tint rint;\n\n\t\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0); \n\t\tif (new == NULL) return -1;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides+ \\\n\t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) {\n\t\t\tPy_DECREF(new); \n\t\t\treturn -1;\n\t\t}\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\trint = PyArray_CopyInto(ret, new);\n\t\tPy_DECREF(ret);\t\t\n\t\tPy_DECREF(new);\n\t\treturn rint;\n\t}\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError, \"Does not have imaginary \" \\\n\t\t\t\t\"part to set.\");\n\t\treturn -1;\n\t}\n}\n\nstatic PyObject *\narray_flat_get(PyArrayObject *self)\n{\n return PyArray_IterNew((PyObject *)self);\n}\n\nstatic int \narray_flat_set(PyArrayObject *self, PyObject *val)\n{\n\tPyObject *arr=NULL;\n\tint retval = -1;\n\tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n\tPyArray_Typecode typecode;\n int swap;\n PyArray_CopySwapFunc *copyswap;\n\n\ttypecode.type_num = self->descr->type_num;\n\ttypecode.itemsize = self->itemsize;\n\ttypecode.fortran = PyArray_ISFORTRAN(self);\n\t\n\tarr = PyArray_FromAny(val, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\tarrit = (PyArrayIterObject *)PyArray_IterNew(arr);\n\tif (arrit == NULL) goto exit;\n\tselfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (selfit == NULL) goto exit;\n\n swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);\n copyswap = self->descr->copyswap;\n if (PyArray_ISOBJECT(self)) {\n while(selfit->index < selfit->size) {\n Py_XDECREF(*((PyObject **)selfit->dataptr));\n Py_INCREF(*((PyObject **)arrit->dataptr)); \n memmove(selfit->dataptr, arrit->dataptr, \n sizeof(PyObject *));\n copyswap(selfit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_ITER_NEXT(selfit);\n PyArray_ITER_NEXT(arrit);\n if (arrit->index == arrit->size) \n PyArray_ITER_RESET(arrit);\n }\n retval = 0; \n goto exit;\n }\n\n\twhile(selfit->index < selfit->size) {\n\t\tmemmove(selfit->dataptr, arrit->dataptr, self->itemsize);\n copyswap(selfit->dataptr, NULL, swap, self->itemsize);\n\t\tPyArray_ITER_NEXT(selfit);\n\t\tPyArray_ITER_NEXT(arrit);\n\t\tif (arrit->index == arrit->size) \n\t\t\tPyArray_ITER_RESET(arrit);\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(selfit);\n\tPy_XDECREF(arrit);\n\tPy_XDECREF(arr);\n\treturn retval;\n}\n\nstatic PyGetSetDef array_getsetlist[] = {\n {\"ndim\", \n\t (getter)array_ndim_get, \n\t NULL, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)array_flags_get, \n NULL,\n\t \"special dictionary of flags\"},\n {\"shape\", \n\t (getter)array_shape_get, \n\t (setter)array_shape_set, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)array_strides_get, \n\t (setter)array_strides_set,\n\t \"tuple of bytes steps in each dimension\"},\n {\"data\", \n\t (getter)array_data_get, \n\t (setter)array_data_set, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)array_itemsize_get, \n\t NULL,\n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)array_size_get,\n\t NULL,\n \"number of elements in the array\"},\n\t{\"base\",\n\t (getter)array_base_get,\n\t NULL,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)array_type_get, \n\t (setter)array_type_set,\n\t \"get array type class\"},\n\t{\"dtypechar\",\n\t (getter)array_typechar_get,\n\t NULL,\n\t \"get array type character code\"},\n\t{\"dtypenum\",\n\t (getter)array_typenum_get,\n\t NULL,\n\t \"get array type number code\"},\n\t{\"dtypestr\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)array_real_get, \n\t (setter)array_real_set, \n\t \"real part of array\"},\n {\"imag\", \n\t (getter)array_imag_get, \n\t (setter)array_imag_set, \n\t \"imaginary part of array\"},\n\t{\"flat\", \n\t (getter)array_flat_get, \n\t (setter)array_flat_set, \n\t \"a 1-d view of a contiguous array\"}, \n\t{\"__array_data__\", \n\t (getter)array_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)array_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)array_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)array_protocol_strides_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t{\"__array_priority__\",\n\t (getter)array_priority_get,\n\t NULL,\n\t \"Array priority\"},\n \t{NULL, NULL, NULL, NULL}, /* Sentinel */\n};\n\n/****************** end of attribute get and set routines *******************/\n\n\n\nstatic char Arraytype__doc__[] = \n \"A array object represents a multidimensional, homogeneous array of basic values. It has the folowing data members, m.shape (the size of each dimension in the array), m.itemsize (the size (in bytes) of each element of the array), and m.typecode (a character representing the type of the array elements). Arrays are sequence, mapping and numeric objects. Sequence indexing is similar to lists, with single indices returning a reference that points to the old array data, and slices returning by copy. A array is also allowed to be indexed by a sequence of items.\t Each member of the sequence indexes the corresponding dimension of the array.\";\n\nstatic PyTypeObject PyBigArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.bigndarray\",\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n /* methods */\n (destructor)array_dealloc,\t\t /*tp_dealloc */\n (printfunc)NULL,\t\t\t /*tp_print*/\n 0,\t\t\t\t\t /*tp_getattr*/\n 0,\t\t\t\t\t /*tp_setattr*/\n (cmpfunc)0, \t\t /*tp_compare*/\n (reprfunc)array_repr,\t\t /*tp_repr*/\n &array_as_number,\t\t\t /*tp_as_number*/\n NULL, \t\t\t /*tp_as_sequence*/\n &array_as_mapping,\t\t\t /*tp_as_mapping*/\n (hashfunc)0,\t\t\t /*tp_hash*/\n (ternaryfunc)0,\t\t\t /*tp_call*/\n (reprfunc)array_str, \t /*tp_str*/\n\t\t\n (getattrofunc)0,\t\t\t /*tp_getattro*/\n (setattrofunc)0,\t\t\t /*tp_setattro*/\n NULL, \t /*tp_as_buffer*/\n (Py_TPFLAGS_DEFAULT \n | Py_TPFLAGS_BASETYPE\n | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/\n /*Documentation string */\n Arraytype__doc__,\t\t\t /*tp_doc*/\n\n (traverseproc)0,\t\t\t /*tp_traverse */\n (inquiry)0,\t\t\t /*tp_clear */\n (richcmpfunc)array_richcompare,\t \n offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */\n\n /* Iterator support (use standard) */\n\n (getiterfunc)0, \t\t /* tp_iter */\n (iternextfunc)0,\t\t\t /* tp_iternext */\n\n /* Sub-classing (new-style object) support */\n\n array_methods,\t\t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n array_getsetlist,\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0,\t /* tp_alloc */ \n (newfunc)array_new,\t\t /* tp_new */\n 0,\t \t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n};\n\n/* A standard array will subclass from the Big Array and \n add the array_as_sequence table\n and the array_as_buffer table\n */\n\nstatic PyTypeObject PyArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.ndarray\",\t\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n};\n\n\n/* The rest of this code is to build the right kind of array from a python */\n/* object. */\n\nstatic int \ndiscover_depth(PyObject *s, int max, int stop_at_string) \n{\n int d=0;\n PyObject *e;\n\t\n if(max < 1) return -1;\n\n if(! PySequence_Check(s) || PyInstance_Check(s) || \\\n\t PySequence_Length(s) < 0) {\n PyErr_Clear(); return 0;\n }\n if (PyArray_Check(s))\n\t\treturn PyArray_NDIM(s);\n if(PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))\n\t\treturn stop_at_string ? 0:1;\n if (PySequence_Length(s) == 0) \n\t\treturn 1;\n\t\n if ((e=PySequence_GetItem(s,0)) == NULL) return -1;\n if(e!=s) {\n\t\td=discover_depth(e,max-1, stop_at_string);\n\t\tif(d >= 0) d++;\n\t}\n Py_DECREF(e);\n return d;\n}\n\nstatic int\ndiscover_itemsize(PyObject *s, int nd, int *itemsize) \n{\n\tint n, r, i;\n\tPyObject *e;\n\t\n\tn = PyObject_Length(s);\n\n\tif ((nd == 0) || PyString_Check(s) ||\t\t\\\n\t PyUnicode_Check(s) || PyBuffer_Check(s)) {\n\t\tif PyUnicode_Check(s) \n\t\t\t*itemsize = MAX(*itemsize, sizeof(Py_UNICODE)*n);\n\t\telse\n\t\t\t*itemsize = MAX(*itemsize, n);\n\t\treturn 0;\n\t}\n\tfor (i=0; i n_lower) n_lower = d[1];\n }\n d[1] = n_lower;\n\t\n return 0;\n}\n\nstatic void\n_array_small_type(int chktype, int mintype, int chksize, int minsize, \n\t\t PyArray_Typecode *outtype)\n{\n\touttype->type_num = MAX(chktype, mintype);\n\tif (PyTypeNum_ISFLEXIBLE(outtype->type_num) &&\t\\\n\t PyTypeNum_ISFLEXIBLE(mintype)) {\n\t\t/* Handle string->unicode case separately \n\t\t because string itemsize is twice as large */\n\t\tif (outtype->type_num == PyArray_UNICODE && \n\t\t mintype == PyArray_STRING) {\n\t\t\touttype->itemsize = MAX(chksize, 2*minsize);\n\t\t}\n\t\telse {\n\t\t\touttype->itemsize = MAX(chksize, minsize);\n\t\t}\n\t}\n\telse {\n\t\touttype->itemsize = chksize;\n\t}\n\treturn;\t\n}\n\nstatic void\n_array_find_type(PyObject *op, PyArray_Typecode *minitype, \n\t\t PyArray_Typecode *outtype, int max)\n{\n int l;\n PyObject *ip;\n\tint chktype=0;\n\tint chksize=0;\n\tint mintype, minsize;\n\n\tif (minitype == NULL) {\n\t\tmintype = PyArray_BOOL;\n\t\tminsize = sizeof(Bool);\n\t}\n\telse {\n\t\tmintype = minitype->type_num;\n\t\tminsize = minitype->itemsize;\n\t}\n\n \n if (max < 0 || mintype == -1) goto deflt;\n\t\n if (PyArray_Check(op)) {\n\t\tchktype = PyArray_TYPE(op);\n\t\tchksize = PyArray_ITEMSIZE(op);\n\t\tgoto finish;\n\t}\n\t\n\tif (PyArray_IsScalar(op, Generic)) {\n\t\tPyArray_TypecodeFromScalar(op, outtype);\n\t\tchktype = outtype->type_num;\n\t\tchksize = outtype->itemsize;\n\t\tgoto finish;\n\t}\n\t\n\n if (PyObject_HasAttrString(op, \"__array__\")) {\n ip = PyObject_CallMethod(op, \"__array__\", NULL);\n if(ip && PyArray_Check(ip)) {\n\t\t\tchktype = PyArray_TYPE(ip);\n\t\t\tchksize = PyArray_ITEMSIZE(ip);\n\t\t\tgoto finish;\n\t\t}\n } \n\t\n\tif (PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tint swap=0, res;\n\t\tip = PyObject_GetAttrString(op, \"__array_typestr__\");\n\t\tif (ip && PyString_Check(ip)) {\n\t\t\tres = _array_typecode_fromstr(PyString_AS_STRING(ip), \n\t\t\t\t\t\t &swap, outtype); \n\t\t\tif (res >= 0) {\n\t\t\t\tPy_DECREF(ip);\n\t\t\t\tchktype = outtype->type_num;\n\t\t\t\tchksize = outtype->itemsize;\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t}\n\t\tPy_XDECREF(ip);\n\t}\n\n if (PyString_Check(op)) {\n\t\tchktype = PyArray_STRING;\n\t\tchksize = PyString_GET_SIZE(op);\n\t\tgoto finish;\n }\n\n\tif (PyUnicode_Check(op)) {\n\t\tchktype = PyArray_UNICODE;\n\t\tchksize = PyUnicode_GET_DATA_SIZE(op);\n\t\tgoto finish;\n\t}\n\n\tif (PyBuffer_Check(op)) {\n\t\tchktype = PyArray_VOID;\n\t\tchksize = op->ob_type->tp_as_sequence->sq_length(op);\n\t\tPyErr_Clear();\n\t\tgoto finish;\n\t}\n\n\tif (PyInstance_Check(op)) goto deflt;\n\t\n if (PySequence_Check(op)) {\n\t\tPyArray_Typecode newtype;\n\t\tnewtype.type_num = mintype;\n\t\tnewtype.itemsize = minsize;\n\t\tnewtype.fortran = 0;\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n\t\t\tPyErr_Clear(); \n\t\t\tgoto deflt;\n\t\t}\n if (l == 0 && mintype == 0) {\n\t\t\tnewtype.type_num = PyArray_INTP;\n\t\t\tnewtype.itemsize = sizeof(intp);\n\t\t}\n while (--l >= 0) {\n ip = PySequence_GetItem(op, l);\n if (ip==NULL) {\n\t\t\t\tPyErr_Clear(); \n\t\t\t\tgoto deflt;\n\t\t\t}\n\t\t\t_array_find_type(ip, &newtype, outtype, max-1);\n\t\t\t_array_small_type(outtype->type_num,\n\t\t\t\t\t newtype.type_num, \n\t\t\t\t\t outtype->itemsize,\n\t\t\t\t\t newtype.itemsize,\n\t\t\t\t\t &newtype);\n Py_DECREF(ip);\n }\n\t\tchktype = newtype.type_num;\n\t\tchksize = newtype.itemsize;\n\t\tgoto finish;\n }\n\t\n\tif (PyBool_Check(op)) {\n\t\tchktype = PyArray_BOOL;\n\t\tchksize = sizeof(Bool);\n\t\tgoto finish;\t\t\n\t}\n else if (PyInt_Check(op)) {\n\t\tchktype = PyArray_LONG;\n\t\tchksize = sizeof(long);\n\t\tgoto finish;\n } else if (PyFloat_Check(op)) {\n\t\tchktype = PyArray_DOUBLE;\n\t\tchksize = sizeof(double);\n\t\tgoto finish;\n\t} else if (PyComplex_Check(op)) {\n\t\tchktype = PyArray_CDOUBLE;\n\t\tchksize = sizeof(cdouble);\n\t\tgoto finish;\n\t}\n\n deflt:\n\tchktype = PyArray_OBJECT;\n\tchksize = sizeof(void *);\n\n finish:\n\t_array_small_type(chktype, mintype, chksize, minsize, \n\t\t\t outtype);\n\treturn;\n}\n\nstatic int \nAssign_Array(PyArrayObject *self, PyObject *v) \n{\n PyObject *e;\n int l, r;\n\t\n if (!PySequence_Check(v)) {\n PyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"assignment from non-sequence\");\n return -1;\n }\n\t\n l=PyObject_Length(v);\n if(l < 0) return -1; \n\t\n while(--l >= 0)\n {\n e=PySequence_GetItem(v,l);\n if (e == NULL) return -1; \n\t\t\tr = PySequence_SetItem((PyObject*)self,l,e);\n Py_DECREF(e);\n if(r == -1) return -1;\n }\n return 0;\n}\n\n/* \"Array Scalars don't call this code\" */ \nstatic PyObject *\nArray_FromScalar(PyObject *op, PyArray_Typecode *typecode) \n{\n PyArrayObject *ret;\n\tint itemsize = 0;\n\tint type = typecode->type_num;\n\n\tif PyTypeNum_ISFLEXIBLE(type) {\n\t\titemsize = PyObject_Length(op);\n\t}\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,\n\t\t\t\t\t NULL, NULL, itemsize, 0, NULL);\n\n\tif (ret == NULL) return NULL;\n\n ret->descr->setitem(op, ret->data, ret);\n\t\n if (PyErr_Occurred()) {\n array_dealloc(ret);\n return NULL;\n } else {\n return (PyObject *)ret;\n }\n}\n\n\nstatic PyObject *\nArray_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth)\n{\n PyArrayObject *r;\n int nd;\n\tintp *d;\n\tint stop_at_string;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\t\n\t\n\tstop_at_string = ((type == PyArray_OBJECT) ||\t\\\n\t\t\t (type == PyArray_STRING) ||\t\\\n\t\t\t (type == PyArray_UNICODE) || \\\n\t\t\t (type == PyArray_VOID));\n\n if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string)) > 0)) {\n\t\tif (nd==0)\n\t\t\treturn Array_FromScalar(s, typecode);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid input sequence\");\n return NULL;\n }\n\t\n if ((max_depth && nd > max_depth) ||\t\\\n\t (min_depth && nd < min_depth)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of dimensions\");\n return NULL;\n }\n\t\n\tif ((d=PyDimMem_NEW(nd)) == NULL) {\n\t\treturn PyErr_NoMemory();\n }\n\tif(discover_dimensions(s,nd,d, !stop_at_string) == -1) {\n\t\tPyDimMem_FREE(d);\n\t\treturn NULL;\n\t}\n\tif (itemsize == 0 && PyTypeNum_ISFLEXIBLE(type)) {\n\t\tif (discover_itemsize(s, nd, &itemsize) == -1) {\n\t\t\tPyDimMem_FREE(d);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n r=(PyArrayObject*)PyArray_New(&PyArray_Type, nd, d, \n\t\t\t\t type, NULL, NULL,\n\t\t\t\t itemsize, \n\t\t\t\t typecode->fortran, NULL);\n\n PyDimMem_FREE(d);\n if(!r) return NULL;\n if(Assign_Array(r,s) == -1) {\n\t\tPy_DECREF(r);\n\t\treturn NULL;\n\t}\n return (PyObject*)r;\n}\n\n\nstatic int \nPyArray_ValidType(int type) \n{\n\tPyArray_Descr *descr;\n\t\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr==NULL) return 0;\n\treturn 1;\n}\n\n\n/* If the output is not a CARRAY, then it is buffered also */\n\nstatic int\n_bufferedcast(PyArrayObject *out, PyArrayObject *in)\n{\n\tchar *inbuffer, *bptr, *optr;\n\tchar *outbuffer=NULL;\n\tPyArrayIterObject *it_in=NULL, *it_out=NULL;\n\tregister intp i, index;\n\tintp ncopies = PyArray_SIZE(out) / PyArray_SIZE(in);\n\tint elsize=in->itemsize;\n\tint nels = PyArray_BUFSIZE;\n\tint el;\n\tint inswap, outswap=0;\n\tint obuf=!PyArray_ISCARRAY(out);\n\tint oelsize = out->itemsize;\n\tPyArray_VectorUnaryFunc *castfunc;\n PyArray_CopySwapFunc *in_csn;\n PyArray_CopySwapFunc *out_csn;\n\tint retval = -1;\n\n\tcastfunc = in->descr->cast[out->descr->type_num];\n in_csn = in->descr->copyswap;\n out_csn = out->descr->copyswap;\n\n\t/* If the input or output is STRING, UNICODE, or VOID */\n\t/* then getitem and setitem are used for the cast */\n\t/* and byteswapping is handled by those methods */\n\n\tinswap = !(PyArray_ISFLEXIBLE(in) || PyArray_ISNOTSWAPPED(in));\n\t\n\tinbuffer = PyDataMem_NEW(PyArray_BUFSIZE*elsize);\n\tif (inbuffer == NULL) return -1;\n\tit_in = (PyArrayIterObject *)PyArray_IterNew((PyObject *)in);\n\tif (it_in == NULL) goto exit;\n\n\tif (obuf) {\n\t\toutswap = !(PyArray_ISFLEXIBLE(out) || \\\n\t\t\t PyArray_ISNOTSWAPPED(out));\n\t\toutbuffer = PyDataMem_NEW(PyArray_BUFSIZE*oelsize);\n\t\tif (outbuffer == NULL) goto exit;\n\n\t\tit_out = (PyArrayIterObject *)PyArray_IterNew((PyObject *)out);\n\t\tif (it_out == NULL) goto exit;\n\n\t\tnels = MIN(nels, PyArray_BUFSIZE);\n\t}\n\t\n\toptr = (obuf) ? outbuffer: out->data;\n\tbptr = inbuffer;\n\tel = 0;\t\n\twhile(ncopies--) {\n\t\tindex = it_in->size;\n\t\tPyArray_ITER_RESET(it_in);\n\t\twhile(index--) {\n in_csn(bptr, it_in->dataptr, inswap, elsize);\n\t\t\tbptr += elsize;\n\t\t\tPyArray_ITER_NEXT(it_in);\n\t\t\tel += 1;\n\t\t\tif ((el == nels) || (index == 0)) {\n\t\t\t\t/* buffer filled, do cast */\n\t\t\t\t\n\t\t\t\tcastfunc(inbuffer, optr, el, in, out);\n\t\t\t\t\n\t\t\t\tif (obuf) {\n\t\t\t\t\t/* Copy from outbuffer to array */\n\t\t\t\t\tfor(i=0; idataptr,\n optr, outswap,\n oelsize);\n\t\t\t\t\t\toptr += oelsize;\n\t\t\t\t\t\tPyArray_ITER_NEXT(it_out);\n\t\t\t\t\t}\n\t\t\t\t\toptr = outbuffer;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toptr += out->itemsize * nels;\n\t\t\t\t}\n\t\t\t\tel = 0;\n\t\t\t\tbptr = inbuffer;\n\t\t\t}\n\t\t}\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(it_in);\n\tPyDataMem_FREE(inbuffer);\n\tPyDataMem_FREE(outbuffer);\t\n\tif (obuf) {\n\t\tPy_XDECREF(it_out);\n\t}\n\treturn retval;\n\n}\n\n\n/* For backward compatibility */\n\nstatic PyObject *\nPyArray_Cast(PyArrayObject *mp, int type_num) \n{\n\tPyArray_Typecode type;\n\tPyArray_Descr *descr;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\ttype.itemsize = descr->elsize;\n\ttype.type_num = descr->type_num;\n\ttype.fortran = 0;\n\t\n\treturn PyArray_CastToType(mp, &type);\n}\n\nstatic PyObject * \nPyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at) \n{\n\tPyObject *out;\n\tint ret;\n\n\tif ((mp->descr->type_num == at->type_num) && \\\n\t (at->itemsize==0 || mp->itemsize == at->itemsize) &&\n\t PyArray_ISBEHAVED_RO(mp)) {\n\t\tPy_INCREF(mp);\n\t\treturn (PyObject *)mp;\n\t}\n\t\t\n\tif (at->itemsize == 0) {\n\t\tif (mp->descr->type_num == PyArray_STRING &&\t\\\n\t\t at->type_num == PyArray_UNICODE)\n\t\t\tat->itemsize = mp->itemsize*sizeof(Py_UNICODE);\n\t\tif (mp->descr->type_num == PyArray_UNICODE &&\n\t\t at->type_num == PyArray_STRING) \n\t\t\tat->itemsize = mp->itemsize/sizeof(Py_UNICODE);\n\t\tif (at->type_num == PyArray_VOID)\n\t\t\tat->itemsize = mp->itemsize;\n\t}\n\n\tout = PyArray_New(mp->ob_type, mp->nd, \n\t\t\t mp->dimensions, \n\t\t\t at->type_num,\n\t\t\t NULL, NULL, at->itemsize, \n\t\t\t at->fortran, (PyObject *)mp);\n\tif (out == NULL) return NULL;\n\tret = PyArray_CastTo((PyArrayObject *)out, mp);\n\tif (ret != -1) return out;\n\n\tPy_DECREF(out);\n\treturn NULL;\n\t\n}\n\t \n/* The number of elements in out must be an integer multiple\n of the number of elements in mp. \n*/\n\nstatic int\nPyArray_CastTo(PyArrayObject *out, PyArrayObject *mp)\n{\n\n\tint simple;\n\tintp mpsize = PyArray_SIZE(mp);\n\tintp outsize = PyArray_SIZE(out);\n\n\tif (mpsize == 0) return 0;\n\tif (!PyArray_ISWRITEABLE(out)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array is not writeable.\");\n\t\treturn -1;\n\t}\n\tif (outsize % mpsize != 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array must have an integer-multiple\"\\\n\t\t\t\t\" of the number of elements in the input \"\\\n\t\t\t\t\"array\");\n\t\treturn -1; \n\t}\n\n\tsimple = ((PyArray_ISCARRAY(mp) && PyArray_ISCARRAY(out)) || \\\n (PyArray_ISFARRAY(mp) && PyArray_ISFARRAY(out)));\n\t\n\tif (simple) {\n\t\tchar *inptr;\n\t\tchar *optr = out->data;\n\t\tintp obytes = out->itemsize * outsize;\n\t\tintp ncopies = outsize / mpsize;\n\n\t\twhile(ncopies--) {\n\t\t\tinptr = mp->data;\n\t\t\tmp->descr->cast[out->descr->type_num](inptr, \n\t\t\t\t\t\t\t optr,\n\t\t\t\t\t\t\t mpsize,\n\t\t\t\t\t\t\t mp, out);\n\t\t\toptr += obytes;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t/* If not a well-behaved cast, then use buffers */\n\tif (_bufferedcast(out, mp) == -1) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nstatic PyObject *\narray_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags) \n{\n\t\n\tPyArrayObject *ret=NULL;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\tint copy = 0;\n\tint arrflags;\n\tPyArray_Typecode oldtype;\n\tchar *msg = \"Cannot copy-back to a read-only array.\";\n\n\toldtype.type_num = PyArray_TYPE(arr);\n\toldtype.itemsize = PyArray_ITEMSIZE(arr);\n\toldtype.fortran = 0;\n\n\tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n\tif (itemsize == 0) itemsize = arr->itemsize;\n\ttypecode->type_num = type;\n\ttypecode->itemsize = itemsize;\n\n\t/* Don't copy if sizes are compatible */\n\tif (PyArray_EquivalentTypes(&oldtype, typecode)) {\n\t\tarrflags = arr->flags;\n\n\t\tcopy = (flags & ENSURECOPY) || \\\n\t\t\t((flags & CONTIGUOUS) && (!(arrflags & CONTIGUOUS))) \\\n\t\t\t|| (PyArray_ITEMSIZE(arr) != itemsize) || \\\n\t\t\t((flags & ALIGNED) && (!(arrflags & ALIGNED))) || \\\n\t\t\t((flags & NOTSWAPPED) && (!(arrflags & NOTSWAPPED))) \\\n\t\t\t|| (arr->nd > 1 &&\t\t\t\t\\\n\t\t\t ((flags & FORTRAN) != (arrflags & FORTRAN))) || \\\n\t\t\t((flags & WRITEABLE) && (!(arrflags & WRITEABLE)));\n\t\t\n\t\tif (copy) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_New(arr->ob_type, \n\t\t\t\t\t arr->nd, \n\t\t\t\t\t arr->dimensions,\n\t\t\t\t\t arr->descr->type_num,\n\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t itemsize,\n\t\t\t\t\t flags & FORTRAN,\n\t\t\t\t\t (PyObject *)arr);\n\t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t} \n\t\t/* If no copy then just increase the reference\n\t\t count and return the input */\n\t\telse { \n\t\t\tPy_INCREF(arr);\n\t\t\tret = arr;\n\t\t}\n\t}\n\t\n\t/* The desired output type is different than the input\n\t array type */\n\telse {\n\t\t/* Cast to the desired type if we can do it safely\n\t\t Also cast if source is a ndim-0 array to mimic\n\t\t behavior with Python scalars */\n\t\tif (flags & FORCECAST || PyArray_NDIM(arr)==0 ||\n\t\t PyArray_CanCastSafely(PyArray_TYPE(arr), type)) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_CastToType(arr, typecode);\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Array can not be safely cast \"\\\n\t\t\t\t\t\"to required type\");\n\t\t\tret = NULL;\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic int\n_array_typecode_fromstr(char *str, int *swap, PyArray_Typecode *type)\n{\n int type_num;\n char typechar;\n int size;\n unsigned long number = 1;\n char *s;\n char msg[] = \"unsupported typestring\";\n \n s = (char *)&number; /* s[0] == 0 implies big-endian */\n\n *swap = 0;\n\n if (str[0] == '<' || str[0] == '>') {\n\tif ((str[0] == '<') && (s[0] == 0)) *swap = 1;\n\telse if ((str[0] == '>') && (s[0] != 0)) *swap = 1;\n }\n str += 1;\n \n#define _MY_FAIL {\t\t\t\t \\\n\t PyErr_SetString(PyExc_ValueError, msg); \\\n\t return -1;\t\t\t \\\n }\t\t\n\n typechar = str[0];\n size = atoi(str + 1);\n switch (typechar) {\n case 'b':\n\t if (size == sizeof(Bool))\n\t\t type_num = PyArray_BOOL;\t \n\t else _MY_FAIL \n\t break;\t\t \n case 'u':\n if (size == sizeof(uintp))\n type_num = PyArray_UINTP;\n\t else if (size == sizeof(char))\n\t\t type_num = PyArray_UBYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_USHORT;\n\t else if (size == sizeof(int)) \n\t\t type_num = PyArray_UINT;\n\t else if (size == sizeof(ulong)) \n\t\t type_num = PyArray_ULONG;\n\t else if (size == sizeof(ulonglong))\n\t\t type_num = PyArray_ULONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'i':\n if (size == sizeof(intp))\n type_num = PyArray_INTP;\n\t else if (size == sizeof(char)) \n\t\t type_num = PyArray_BYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_SHORT;\n\t else if (size == sizeof(int))\n\t\t type_num = PyArray_INT;\n\t else if (size == sizeof(long)) \n\t\t type_num = PyArray_LONG;\n\t else if (size == sizeof(longlong))\n\t\t type_num = PyArray_LONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'f':\n\t if (size == sizeof(float))\n\t\t type_num = PyArray_FLOAT;\n\t else if (size == sizeof(double))\n\t\t type_num = PyArray_DOUBLE;\n\t else if (size == sizeof(longdouble))\n\t\t type_num = PyArray_LONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'c':\n\t if (size == sizeof(float)*2)\n\t\t type_num = PyArray_CFLOAT;\n\t else if (size == sizeof(double)*2)\n\t\t type_num = PyArray_CDOUBLE;\n\t else if (size == sizeof(longdouble)*2)\n\t\t type_num = PyArray_CLONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'O':\n\t if (size == sizeof(PyObject *))\n\t\t type_num = PyArray_OBJECT;\n\t else _MY_FAIL\n\t break;\n case 'S':\n\t type_num = PyArray_STRING;\n\t break;\n case 'U':\n\t type_num = PyArray_UNICODE;\n\t size *= sizeof(Py_UNICODE);\n\t break;\t \n case 'V':\n\t type_num = PyArray_VOID;\n\t break;\n default:\n\t _MY_FAIL\n }\n\n#undef _MY_FAIL\n\n type->type_num = type_num;\n type->itemsize = size;\n type->fortran = 0;\n return 0;\n}\n\nstatic PyObject *\narray_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n{\n\tPyObject *attr=NULL, *item=NULL, *r;\n\tPyArrayObject *ret=NULL;\n\tPyArray_Typecode type;\n\tchar *data;\n\tint buffer_len;\n\tint res, i, n;\n\tintp dims[MAX_DIMS], strides[MAX_DIMS];\n\tint swap;\n\n\t/* Get the memory from __array_data__ and __array_offset__ */\n\t/* Get the shape */\n\t/* Get the typestring -- ignore array_descr */\n\t/* Get the strides */\n\t\n\tattr = PyObject_GetAttrString(input, \"__array_data__\");\n\tif (attr == NULL) {\n\t\tPy_INCREF(input);\n\t\tattr = input;\n\t}\n\t\n\tres = PyObject_AsWriteBuffer(attr, (void **)&data, &buffer_len);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n\n\tattr = PyObject_GetAttrString(input, \"__array_typestr__\");\n\tif (!PyString_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_typestr__ must be a string.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\t\n\t}\n\tres = _array_typecode_fromstr(PyString_AS_STRING(attr), &swap, &type);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n \n\tattr = PyObject_GetAttrString(input, \"__array_shape__\");\n\tif (!PyTuple_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_shape__ must be a tuple.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\n\t}\n\tn = PyTuple_GET_SIZE(attr);\n\tfor (i=0; ibase = input;\n \n\tattr = PyObject_GetAttrString(input, \"__array_strides__\");\n\tif (attr != NULL && attr != Py_None) {\n\t\tif (!PyTuple_Check(attr)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"__array_strides__ must be a tuple.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tif (n != PyTuple_GET_SIZE(attr)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"mismatch in length of \"\\\n\t\t\t\t\t\"__array_strides__ and \"\\\n\t\t\t\t\t\"__array_shape__.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tfor (i=0; istrides, strides, n*sizeof(intp));\n\t}\n\n\tif (swap) {\n\t\tPyObject *tmp;\n\t\ttmp = PyObject_CallMethod((PyObject *)ret, \"byteswap\", \"\");\n\t\tPy_DECREF(tmp);\n\t}\n\n\tPyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);\n\tr = array_fromarray(ret, intype, flags);\n\tPy_DECREF(ret);\n\treturn r;\n}\n\nstatic PyObject *\narray_fromattr(PyObject *op, PyArray_Typecode *typecode, int flags) \n{\n PyObject *new, *r;\n\t \n if (typecode->type_num == PyArray_NOTYPE) {\n new = PyObject_CallMethod(op, \"__array__\", NULL);\n } else {\n new = PyObject_CallMethod(op, \"__array__\", \"i\", \n typecode->type_num);\n }\n if (new == NULL) return NULL;\n if (!PyArray_Check(new)) {\n PyErr_SetString(PyExc_ValueError, \n \"object __array__ method not \" \\\n \"producing an array.\");\n Py_DECREF(new);\n return NULL;\n }\n r = array_fromarray((PyArrayObject *)new, typecode, flags);\n Py_DECREF(new);\n return r;\n} \n\n\nstatic PyObject *\narray_fromobject(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth, int flags) \n{\n /* This is the main code to make a NumPy array from a Python\n Object. It is called from lot's of different places which\n is why there are so many checks. The comments try to\n explain some of the checks. */\n\n\tint type = typecode->type_num;\n PyObject *r=NULL;\n\n\t/* Is input object already an array? */\n\t/* This is where the flags are used */\n if (PyArray_Check(op)) \n\t\tr = array_fromarray((PyArrayObject *)op, typecode, flags);\n\telse if (PyObject_HasAttrString(op, \"__array__\")) {\n\t\t/* Code that returns the object to convert for a non\n\t\t multiarray input object from the __array__ attribute of the\n\t\t object. */\n r = array_fromattr(op, typecode, flags);\n\t}\n\telse if (PyObject_HasAttrString(op, \"__array_shape__\") &&\n\t\t PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tr = array_frominterface(op, typecode, flags);\n\t}\n\telse {\n\t\tif (type == PyArray_NOTYPE) {\n\t\t\t_array_find_type(op, NULL, typecode, MAX_DIMS);\n\t\t}\n\t\tif (PySequence_Check(op))\n\t\t\tr = Array_FromSequence(op, typecode, \n\t\t\t\t\t min_depth, max_depth);\n\t\telse\n\t\t\tr = Array_FromScalar(op, typecode);\n\t}\n\n /* If we didn't succed return NULL */\n if (r == NULL) return NULL;\n\t\n\t/* Be sure we succeed here */\n\t\n if(!PyArray_Check(r)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Internal error array_fromobject \"\\\n\t\t\t\t\"not producing an array\");\n\t\tPy_DECREF(r);\n return NULL;\n }\n\n if (min_depth != 0 && ((PyArrayObject *)r)->nd < min_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object of too small depth for desired array\");\n return NULL;\n }\n if (max_depth != 0 && ((PyArrayObject *)r)->nd > max_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object too deep for desired array\");\n return NULL;\n }\n return r;\n}\n\nstatic void\nPyArray_ArrayType(PyObject *op, PyArray_Typecode *intype, \n\t\t PyArray_Typecode *outtype) \n{\n\t_array_find_type(op, intype, outtype, MAX_DIMS);\n\treturn;\n}\n\nstatic int \nPyArray_ObjectType(PyObject *op, int minimum_type) \n{\n\tPyArray_Typecode intype, outtype;\n\tintype.type_num = minimum_type;\n\t_array_find_type(op, &intype, &outtype, MAX_DIMS);\n\treturn outtype.type_num;\n}\n\n\n\n/* flags is any of \n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough\n to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, and WRITEABLE\n and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, the returned array will be a copy of the object, \n (C) contiguous in memory, aligned, notswapped, and writeable.\n \n So CONTIGUOUS | ENSURECOPY passed in means that the returned\n array does not have to be CONTIGUOUS or a COPY but should be\n ALIGNED, NOTSWAPPED and WRITEABLE. \n\n typecode->fortran can be set to request a\n fortran-contiguous array. Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n*/\n\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n{\n \tPyArray_Typecode mine = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode *type;\n\t\n\tif (typecode == NULL) type = &mine;\n\telse type = typecode;\n\t\t\n\tif (requires & ENSURECOPY) {\n\t\trequires |= DEFAULT_FLAGS;\n\t}\n\t/* Ensure that type->fortran and flags & FORTRAN are the\n\t same */\n\tif (requires & FORTRAN) typecode->fortran = 1;\n\tif (type->fortran == 1) {\n\t\trequires |= FARRAY_FLAGS;\n\t\tif (min_depth > 2) requires &= ~CONTIGUOUS;\n\t}\n\n\t/* make sure itemsize is not 0 unless warranted. */\n\tif ((type->itemsize == 0) && (type->type_num != PyArray_NOTYPE)) {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type->type_num);\n\t\tif (descr != NULL) type->itemsize = descr->elsize;\n\t\telse return NULL;\n\t}\n\t\n\treturn array_fromobject(op, type, min_depth, max_depth, \n\t\t\t\trequires);\t\n}\n\n/* This is a quick wrapper around PyArray_FromAny(op, NULL, 0, 0, 0) */\n/* that special cases Arrays and PyArray_Scalars up front */\n/* It steals a reference to the object */\n\n/* Because it decrefs op if any conversion needs to take place \n -- so it can be used like PyArray_EnsureArray(some_function(...)) */\n\nstatic PyObject *\nPyArray_EnsureArray(PyObject *op)\n{\n PyObject *new;\n\n if (op == NULL) return NULL;\n\n if (PyArray_Check(op)) return op;\n\n if (PyArray_IsScalar(op, Generic)) {\n new = PyArray_FromScalar(op, NULL);\n Py_DECREF(op);\n return new;\n }\n new = PyArray_FromAny(op, NULL, 0, 0, 0);\n Py_DECREF(op);\n return new;\n}\n\n/* These are all compressed into a single API */\n/* Deprecated calls -- Use PyArray_FromAny */\n\nstatic PyObject *\nPyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, BEHAVED_FLAGS);\n}\n\nstatic PyObject *\nPyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n\t\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, DEFAULT_FLAGS);\n}\n\nstatic PyObject *\nPyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n\t\t\t ENSURECOPY);\n}\n\n/* End of deprecated */\n\n\nstatic int \nPyArray_CanCastSafely(int fromtype, int totype) \n{\n\tPyArray_Descr *from, *to;\n\n if (fromtype == totype) return 1;\n if (fromtype == PyArray_BOOL) return 1;\n\tif (totype == PyArray_BOOL) return 0;\n if (totype == PyArray_OBJECT || totype == PyArray_VOID) return 1;\n\tif (fromtype == PyArray_OBJECT || fromtype == PyArray_VOID) return 0;\n\n\tfrom = PyArray_DescrFromType(fromtype);\n\tto = PyArray_DescrFromType(totype);\n \n switch(fromtype) {\n case PyArray_BYTE:\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISUNSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_UBYTE:\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_FLOAT:\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\tif (PyTypeNum_ISCOMPLEX(totype)) \n\t\t\treturn ((to->elsize >> 1) >= from->elsize);\n\t\telse\n\t\t\treturn (totype > fromtype);\n case PyArray_CFLOAT:\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn (totype > fromtype);\n\tcase PyArray_STRING:\n\tcase PyArray_UNICODE:\n\t\treturn (totype > fromtype);\n default:\n return 0;\n }\n}\n\nstatic Bool\nPyArray_CanCastTo(PyArray_Typecode *from, PyArray_Typecode *to)\n{\n\tint fromtype=from->type_num;\n\tint totype=to->type_num;\n\tBool ret;\n\n\tret = (Bool) PyArray_CanCastSafely(fromtype, totype);\n\tif (ret) { /* Check String and Unicode more closely */\n\t\tif (fromtype == PyArray_STRING) {\n\t\t\tif (totype == PyArray_STRING) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t\telse if (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize * sizeof(Py_UNICODE)\\\n\t\t\t\t <= to->itemsize);\n\t\t\t}\n\t\t}\n\t\telse if (fromtype == PyArray_UNICODE) {\n\t\t\tif (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}\n\n\n\n/*********************** Element-wise Array Iterator ***********************/\n/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/\n/* and Python's array iterator ***/\n \n\nstatic PyObject *\nPyArray_IterNew(PyObject *obj)\n{\n PyArrayIterObject *it;\n\tint i, nd; \n\tPyArrayObject *ao = (PyArrayObject *)obj;\n\n if (!PyArray_Check(ao)) {\n PyErr_BadInternalCall();\n return NULL;\n }\n\n it = PyObject_GC_New(PyArrayIterObject, &PyArrayIter_Type);\n if (it == NULL)\n return NULL;\n\n\tnd = ao->nd;\n\tPyArray_UpdateFlags(ao, CONTIGUOUS);\n\tit->contiguous = 0;\n\tif PyArray_ISCONTIGUOUS(ao) it->contiguous = 1;\n Py_INCREF(ao);\n it->ao = ao;\n\tit->size = PyArray_SIZE(ao);\n\tit->nd_m1 = nd - 1;\n\tit->factors[nd-1] = 1;\n\tfor (i=0; i < nd; i++) {\n\t\tit->dims_m1[i] = it->ao->dimensions[i] - 1;\n\t\tit->strides[i] = it->ao->strides[i];\n\t\tit->backstrides[i] = it->strides[i] *\t\\\n\t\t\tit->dims_m1[i];\n\t\tif (i > 0)\n\t\t\tit->factors[nd-i-1] = it->factors[nd-i] *\t\\\n\t\t\t\tit->ao->dimensions[nd-i];\n\t}\n\tPyArray_ITER_RESET(it);\n\t\n PyObject_GC_Track(it);\n return (PyObject *)it;\n}\n\n/* Returns an array scalar holding the element desired */\n\nstatic PyObject *\narrayiter_next(PyArrayIterObject *it)\n{\n\tPyObject *ret;\n\n\tif (it->index < it->size) {\n\t\tret = PyArray_ToScalar(it->dataptr, it->ao);\n\t\tPyArray_ITER_NEXT(it);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narrayiter_dealloc(PyArrayIterObject *it)\n{\n PyObject_GC_UnTrack(it);\n Py_XDECREF(it->ao);\n PyObject_GC_Del(it);\n }\n\nstatic int\narrayiter_traverse(PyArrayIterObject *it, visitproc visit, void *arg)\n{\n if (it->ao != NULL)\n return visit((PyObject *)(it->ao), arg);\n return 0;\n}\n\n\nstatic int\niter_length(PyArrayIterObject *self) \n{\n return (int) self->size;\n}\n\n\nstatic PyObject *\niter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tint index, strides, itemsize;\n\tintp count=0;\n\tchar *dptr, *optr;\n\tPyObject *r;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn NULL;\n\t}\n\tindex = (ind->dimensions[0]);\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\t/* Get size of return array */\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0)\n\t\t\tcount++;\n\t\tdptr += strides;\n\t}\n\titemsize = self->ao->itemsize;\n\tr = PyArray_New(self->ao->ob_type, 1, &count, \n\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\titemsize, 0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\t/* Set up loop */\n\toptr = PyArray_DATA(r);\n\tindex = ind->dimensions[0];\n\tdptr = ind->data;\n\n copyswap = self->ao->descr->copyswap;\n\t/* Loop over Boolean array */\n\tswap = !(PyArray_ISNOTSWAPPED(self->ao));\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\t\toptr += itemsize;\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\nstatic PyObject *\niter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tintp num;\n\tPyObject *r;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint swap;\n\tchar *optr;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = self->ao->itemsize;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t}\n\t\n\tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n\t\t\tself->ao->descr->type_num, NULL, \n\t\t\tNULL, self->ao->itemsize, \n\t\t\t0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\toptr = PyArray_DATA(r);\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) {Py_DECREF(r); return NULL;}\n\tindex = ind_it->size;\n copyswap = PyArray_DESCR(r)->copyswap;\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif (num < 0 || num >= self->size) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", (int) num, \n\t\t\t\t (int) self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\tPy_DECREF(r);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\toptr += itemsize;\n\t\tPyArray_ITER_NEXT(ind_it);\n\t}\n\tPy_DECREF(ind_it);\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\n\nstatic PyObject *\niter_subscript(PyArrayIterObject *self, PyObject *ind)\n{\n\tint i;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *r;\n\tchar *dptr;\n\tint size;\n\tPyObject *obj = NULL;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\t\t\n\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\tobj = iter_subscript(self, ind);\n\t\tPy_DECREF(ind);\n\t\treturn obj;\n\t}\n\n\t/* Tuples not accepted --- i.e. no NewAxis */\n\t/* Could implement this with adjusted strides\n\t and dimensions in iterator */\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\tPyArray_ITER_RESET(self);\n\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n\t\t\treturn PyArray_ToScalar(self->dataptr, self->ao);\n\t\t}\n\t\telse { /* empty array */\n\t\t\tintp ii = 0;\n\t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n\t\t\t\t\tself->ao->descr->type_num, NULL, \n\t\t\t\t\tNULL, self->ao->itemsize, 0,\n\t\t\t\t\t(PyObject *)self->ao);\n\t\t\treturn r;\t\t\t\n\t\t}\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) \n\t\t\tgoto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start)\n\t\tif (n_steps == SingleIndex) { /* Integer */\n\t\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn r;\n\t\t}\n\t\tsize = self->ao->itemsize;\n\t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n\t\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\t\tsize, 0, (PyObject *)self->ao);\n\t\tif (r==NULL) goto fail; \n\t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n copyswap = PyArray_DESCR(r)->copyswap;\n\t\twhile(n_steps--) {\n copyswap(dptr, self->dataptr, swap, size);\n\t\t\tfor(i=0; i< step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tdptr += size;\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer) || PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tr = iter_subscript_Bool(self, (PyArrayObject *)obj);\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tobj = new;\n\t\t\tr = iter_subscript_int(self, (PyArrayObject *)obj);\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"unsupported iterator index\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPy_DECREF(obj);\n\t\treturn r;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\n fail:\n\tPy_XDECREF(obj);\n\treturn NULL;\n\n}\n\n\nstatic int\niter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tint index, strides, itemsize;\n\tchar *dptr;\n PyArray_CopySwapFunc *copyswap;\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn -1;\n\t}\n\titemsize = self->ao->itemsize;\n\tindex = ind->dimensions[0];\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\tPyArray_ITER_RESET(self);\n\t/* Loop over Boolean array */\n copyswap = self->ao->descr->copyswap;\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(self->dataptr, val->dataptr, swap,\n itemsize);\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index==val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn 0;\n}\n\nstatic int\niter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tPyArray_Typecode typecode;\n\tintp num;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = typecode.itemsize = self->ao->itemsize;\n\ttypecode.type_num = self->ao->descr->type_num;\n copyswap = self->ao->descr->copyswap;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\treturn 0;\n\t}\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) return -1;\n\tindex = ind_it->size;\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif ((num < 0) || (num >= self->size)) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", (int) num, \n\t\t\t\t (int) self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\treturn -1;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\tPyArray_ITER_NEXT(ind_it);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index == val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPy_DECREF(ind_it);\n\treturn 0;\n}\n\n\nstatic int\niter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) \n{\n\tint i;\n\tPyObject *arrval=NULL;\n\tPyArrayIterObject *val_it=NULL;\n\tPyArray_Typecode type;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint swap;\n\tint itemsize;\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *obj;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\ti = iter_ass_subscript(self, ind, val);\n\t\tPy_DECREF(ind);\n\t\treturn i;\n\t}\n\t\n\ttype.type_num = self->ao->descr->type_num;\n\titemsize = type.itemsize = self->ao->itemsize;\n\t\n\tarrval = PyArray_FromAny(val, &type, 0, 0, 0);\n\tif (arrval==NULL) return -1;\n\tval_it = (PyArrayIterObject *)PyArray_IterNew(arrval);\n\tif (val_it==NULL) goto fail;\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\n copyswap = PyArray_DESCR(arrval)->copyswap;\n\tswap = (PyArray_ISNOTSWAPPED(self->ao)!=PyArray_ISNOTSWAPPED(arrval));\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n copyswap(self->dataptr, PyArray_DATA(arrval), \n swap, itemsize);\n\t\t}\n\t\tgoto succeed;\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) goto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start);\n\t\tif (n_steps == SingleIndex) { /* Integer */\n copyswap(self->dataptr, PyArray_DATA(arrval),\n swap, itemsize);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\tgoto succeed;\n\t\t}\n\t\twhile(n_steps--) {\n copyswap(self->dataptr, val_it->dataptr,\n swap, itemsize);\n\t\t\tfor(i=0; i < step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tPyArray_ITER_NEXT(val_it);\n\t\t\tif (val_it->index == val_it->size) \n\t\t\t\tPyArray_ITER_RESET(val_it);\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\tgoto succeed;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer))\n\t\tobj = PyArray_FromScalar(ind, &indtype);\n\telse if (PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tif (iter_ass_sub_Bool(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tPy_DECREF(obj);\n\t\t\tobj = new;\n\t\t\tif (iter_ass_sub_int(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t}\n\t\telse goto fail;\n\t\tPy_DECREF(obj);\n\t\tgoto succeed;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\tgoto fail;\n\n succeed:\n\tPy_DECREF(val_it);\n\tPy_DECREF(arrval);\n\treturn 0;\n\n fail:\n\tPy_XDECREF(val_it);\n\tPy_XDECREF(arrval);\n\treturn -1;\n\t\n}\n\n\nstatic PyMappingMethods iter_as_mapping = {\n (inquiry)iter_length,\t\t /*mp_length*/\n (binaryfunc)iter_subscript,\t /*mp_subscript*/\n (objobjargproc)iter_ass_subscript,\t/*mp_ass_subscript*/\n};\n\nstatic char doc_iter_array[] = \"__array__(type=None)\\n Get array \"\\\n \"from iterator\";\n\nstatic PyObject *\niter_array(PyArrayIterObject *it, PyObject *op) \n{\n \n PyObject *r;\n intp size;\n\n /* Any argument ignored */\n\n /* Two options: \n 1) underlying array is contiguous\n -- return 1-d wrapper around it \n 2) underlying array is not contiguous\n -- make new 1-d contiguous array with updateifcopy flag set\n to copy back to the old array\n */\n\n size = PyArray_SIZE(it->ao);\n if (PyArray_ISCONTIGUOUS(it->ao)) {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n\t\t\t\tit->ao->flags,\n (PyObject *)it->ao); \n\t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, NULL, it->ao->itemsize, 0, \n (PyObject *)it->ao);\n\t\tif (r==NULL) return NULL;\n\t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n\t\t\tPy_DECREF(r); \n\t\t\treturn NULL;\n\t\t}\n PyArray_FLAGS(r) |= UPDATEIFCOPY;\n it->ao->flags &= ~WRITEABLE;\n }\n Py_INCREF(it->ao);\n PyArray_BASE(r) = (PyObject *)it->ao;\n return r;\n \n}\n\nstatic char doc_iter_copy[] = \"copy()\\n Get a copy of 1-d array\";\n\nstatic PyObject *\niter_copy(PyArrayIterObject *it, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\t\n\treturn PyArray_Flatten(it->ao, 0);\n}\n\nstatic PyMethodDef iter_methods[] = {\n /* to get array */\n {\"__array__\", (PyCFunction)iter_array, 1, doc_iter_array},\n\t{\"copy\", (PyCFunction)iter_copy, 1, doc_iter_copy},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\nstatic PyTypeObject PyArrayIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.flatiter\",\t\t /* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arrayiter_dealloc,\t\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0, \t\t\t /* tp_as_sequence */\n &iter_as_mapping, \t /* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0,\t \t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arrayiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arrayiter_next,\t\t/* tp_iternext */\n iter_methods,\t\t\t\t/* tp_methods */\n};\n\n/** END of Array Iterator **/\n\n\n\n/*********************** Subscript Array Iterator *************************\n * *\n * This object handles subscript behavior for array objects. *\n * It is an iterator object with a next method *\n * It abstracts the n-dimensional mapping behavior to make the looping *\n * code more understandable (maybe) *\n * and so that indexing can be set up ahead of time *\n */ \n\n/* This checks the args for any fancy indexing objects */\n\n#define SOBJ_NOTFANCY 0 \n#define SOBJ_ISFANCY 1\n#define SOBJ_BADARRAY 2\n#define SOBJ_TOOMANY 3\n#define SOBJ_LISTTUP 4\n\nstatic int\nfancy_indexing_check(PyObject *args)\n{\n\tint i, n;\n\tPyObject *obj;\n\tint retval = SOBJ_NOTFANCY;\n\n\tif (PyTuple_Check(args)) {\n\t\tn = PyTuple_GET_SIZE(args);\n\t\tif (n >= MAX_DIMS) return SOBJ_TOOMANY;\n\t\tfor (i=0; i=MAX_DIMS) return SOBJ_ISFANCY;\n\t\tfor (i=0; i SOBJ_ISFANCY) return retval;\n\t\t}\n\t}\n\n\treturn retval;\n}\n\n/* convert an indexing object to an INTP indexing array iterator\n if possible -- otherwise, it is a Slice or Ellipsis object\n and has to be interpreted on bind to a particular \n array so leave it NULL for now.\n */\nstatic int\n_convert_obj(PyObject *obj, PyArrayIterObject **iter)\n{\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tPyObject *arr;\n\n\tif (PySlice_Check(obj) || (obj == Py_Ellipsis))\n\t\t*iter = NULL;\n\telse {\n\t\tarr = PyArray_FromAny(obj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) return -1;\n\t\t*iter = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (*iter == NULL) return -1;\n\t}\n\treturn 0;\n}\n\n/* Adjust dimensionality and strides for index object iterators \n --- i.e. broadcast\n */\nstatic int\nPyArray_Broadcast(PyArrayMultiIterObject *mit)\n{\n\tint i, nd, k, j;\n\tintp tmp;\n\tPyArrayIterObject *it;\n\t\n\t/* Discover the broadcast number of dimensions */\n\tfor (i=0, nd=0; inumiter; i++) \n\t\tnd = MAX(nd, mit->iters[i]->ao->nd);\n\tmit->nd = nd;\n\n\t/* Discover the broadcast shape in each dimension */\n\tfor (i=0; idimensions[i] = 1;\n\t\tfor (j=0; jnumiter; j++) {\n\t\t\tit = mit->iters[j];\n\t\t\t/* This prepends 1 to shapes not already \n\t\t\t equal to nd */\n\t\t\tk = i + it->ao->nd - nd;\n\t\t\tif (k>=0) {\n\t\t\t\ttmp = it->ao->dimensions[k];\n\t\t\t\tif (tmp == 1) continue;\n\t\t\t\tif (mit->dimensions[i] == 1) \n\t\t\t\t\tmit->dimensions[i] = tmp;\n\t\t\t\telse if (mit->dimensions[i] != tmp) {\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\t\"index objects are \" \\\n\t\t\t\t\t\t\t\"not broadcastable \" \\\n\t\t\t\t\t\t\t\"to a single shape.\");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Reset the iterator dimensions and strides of each iterator\n\t object -- using 0 valued strides for broadcasting */\n\n\ttmp = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tmit->size = tmp;\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tit->nd_m1 = mit->nd - 1;\n\t\tit->size = tmp;\n\t\tnd = it->ao->nd;\n\t\tit->factors[mit->nd-1] = 1;\n\t\tfor (j=0; j < mit->nd; j++) {\n\t\t\tit->dims_m1[j] = mit->dimensions[j] - 1;\n\t\t\tk = j + nd - mit->nd;\n\t\t\t/* If this dimension was added or shape\n\t\t\t of underlying array was 1 */\n\t\t\tif ((k < 0) || \\\n\t\t\t it->ao->dimensions[k] != mit->dimensions[j]) {\n\t\t\t\tit->contiguous = 0;\n\t\t\t\tit->strides[j] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tit->strides[j] = it->ao->strides[k];\n\t\t\t}\n\t\t\tit->backstrides[j] = it->strides[j] *\t\\\n\t\t\t\tit->dims_m1[j];\n\t\t\tif (j > 0)\n\t\t\t\tit->factors[mit->nd-j-1] =\t\t\\\n\t\t\t\t\tit->factors[mit->nd-j] *\t\\\n\t\t\t\t\tmit->dimensions[mit->nd-j];\n\t\t}\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn 0;\n}\n\n/* Reset the map iterator to the beginning */\nstatic void\nPyArray_MapIterReset(PyArrayMapIterObject *mit)\n{\n\tint i,j; intp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index = 0;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\n\tif (mit->subspace != NULL) {\n\t\tmemcpy(coord, mit->bscoord, sizeof(intp)*mit->ait->ao->nd);\n\t\tPyArray_ITER_RESET(mit->subspace);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tj = mit->iteraxes[i];\n\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* This function needs to update the state of the map iterator\n and point mit->dataptr to the memory-location of the next object\n*/\nstatic void\nPyArray_MapIterNext(PyArrayMapIterObject *mit)\n{\n\tint i, j;\n\tintp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index += 1;\n\tif (mit->index >= mit->size) return;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\t/* Sub-space iteration */\n\tif (mit->subspace != NULL) {\n\t\tPyArray_ITER_NEXT(mit->subspace);\n\t\tif (mit->subspace->index == mit->subspace->size) {\n\t\t\t/* reset coord to coordinates of \n\t\t\t beginning of the subspace */\n\t\t\tmemcpy(coord, mit->bscoord, \n\t\t\t sizeof(intp)*mit->ait->ao->nd);\n\t\t\tPyArray_ITER_RESET(mit->subspace);\n\t\t\tfor (i=0; inumiter; i++) {\n\t\t\t\tit = mit->iters[i];\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t\tj = mit->iteraxes[i];\n\t\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t\t sizeof(intp));\n\t\t\t}\n\t\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\t}\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* Bind a mapiteration to a particular array */\n\n/* Determine if subspace iteration is necessary. If so, \n 1) Fill in mit->iteraxes\n\t 2) Create subspace iterator\n\t 3) Update nd, dimensions, and size. \n\n Subspace iteration is necessary if: arr->nd > mit->numiter\n*/\n\n/* Need to check for index-errors somewhere. \n\n Let's do it at bind time and also convert all <0 values to >0 here\n as well. \n*/\nstatic void\nPyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n{\n\tint subnd;\n\tPyObject *sub=NULL, *obj=NULL;\n\tint i, j, n, curraxis, ellipexp, noellip;\n\tPyArrayIterObject *it;\n\tintp dimsize;\n\tintp *indptr;\n\n\t/* Remove old binding if any */\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\n\tPy_XDECREF(mit->subspace);\n\tmit->subspace = NULL;\n\t\n\tsubnd = arr->nd - mit->numiter;\n\tif (subnd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Too many indices for array.\");\n\t\treturn;\n\t}\n\n\tmit->ait = (PyArrayIterObject *)PyArray_IterNew((PyObject *)arr);\n\tif (mit->ait == NULL) return;\n\n\t/* If this is just a view, then do nothing more */\n\t/* views are handled by just adjusting the strides\n\t and dimensions of the object.\n\t*/\n\t \n\tif (mit->view) return;\n\n\t/* no subspace iteration needed. Return */\n\tif (subnd == 0) {\n\t\tn = arr->nd;\n\t\tfor (i=0; iiteraxes[i] = i;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\t/* all indexing arrays have been converted to 0 \n\t therefore we can extract the subspace with a simple\n\t getitem call which will use view semantics\n\t*/\n\t\n\tsub = PyObject_GetItem((PyObject *)arr, mit->indexobj);\n\tif (sub == NULL) goto fail;\n\tmit->subspace = (PyArrayIterObject *)PyArray_IterNew(sub);\n\tif (mit->subspace == NULL) goto fail;\n\tPy_DECREF(sub);\n\n\t/* Expand dimensions of result */\n\tn = mit->subspace->ao->nd;\n\tfor (i=0; idimensions[mit->nd+i] = mit->subspace->ao->dimensions[i];\n\tmit->nd += n;\n\n\t/* Now, we still need to interpret the ellipsis and slice objects \n\t to determine which axes the indexing arrays are referring to\n\t*/\n\tn = PyTuple_GET_SIZE(mit->indexobj);\n\n\t/* The number of dimensions an ellipsis takes up */\n\tellipexp = arr->nd - n + 1;\n\t/* Now fill in iteraxes -- remember indexing arrays have been \n converted to 0's in mit->indexobj */\n\tcurraxis = 0;\n\tj = 0;\n\tnoellip = 1; /* Only expand the first ellipsis */\n\tmemset(mit->bscoord, '\\0', sizeof(intp)*arr->nd);\n\tfor (i=0; iindexobj, i);\n\t\tif (PyInt_Check(obj) || PyLong_Check(obj)) \n\t\t\tmit->iteraxes[j++] = curraxis++;\n\t\telse if (noellip && obj == Py_Ellipsis) {\n\t\t\tcurraxis += ellipexp;\n\t\t\tnoellip = 0;\n\t\t}\n\t\telse {\n\t\t\tint start=0;\n\t\t\tint stop, step;\n\t\t\t/* Should be slice object or\n\t\t\t another Ellipsis */\n\t\t\tif (obj == Py_Ellipsis) {\n\t\t\t\tmit->bscoord[curraxis] = 0;\n\t\t\t}\n\t\t\telse if (!PySlice_Check(obj) || \\\n\t\t\t\t (slice_GetIndices((PySliceObject *)obj, \n\t\t\t\t\t\t arr->dimensions[curraxis],\n\t\t\t\t\t\t &start, &stop, &step,\n\t\t\t\t\t\t &dimsize) < 0)) {\n\t\t\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t\t\t \"unexpected object \"\t\\\n\t\t\t\t\t \"(%s) in selection position %d\",\n\t\t\t\t\t obj->ob_type->tp_name, i);\n\t\t\t goto fail;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmit->bscoord[curraxis] = start;\n\t\t\t}\n\t\t\tcurraxis += 1; \n\t\t}\n\t}\n finish:\n\t/* Here check the indexes (now that we have iteraxes) */\n\tmit->size = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tPyArray_ITER_RESET(it);\n\t\tdimsize = arr->dimensions[mit->iteraxes[i]];\n\t\twhile(it->index < it->size) {\n\t\t\tindptr = ((intp *)it->dataptr);\n\t\t\tif (*indptr < 0) *indptr += dimsize;\n\t\t\tif (*indptr < 0 || *indptr >= dimsize) {\n\t\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t\t \"index (%d) out of range \"\\\n\t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n\t\t\t\t\t (int) *indptr, (int) (dimsize-1), \n\t\t\t\t\t mit->iteraxes[i]);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn;\n\n fail:\n\tPy_XDECREF(sub);\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\treturn;\n}\n\n/* This function takes a Boolean array and constructs index objects and\n iterators as if nonzero(Bool) had been called\n*/\nstatic int\n_nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)\n{\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\tPyArrayObject *ba =NULL, *new=NULL;\n\tint nd, j;\n\tintp size, i, count;\n\tBool *ptr;\n\tintp coords[MAX_DIMS], dims_m1[MAX_DIMS];\n\tintp *dptr[MAX_DIMS];\n\n\tba = (PyArrayObject *)PyArray_FromAny(myBool, &typecode, 0, 0, \n\t\t\t\t\t CARRAY_FLAGS);\n\tif (ba == NULL) return -1;\n\tnd = ba->nd;\n\tfor (j=0; jdata;\n\tcount = 0;\n\n\t/* pre-determine how many nonzero entries there are */\n\tfor (i=0; iao->data;\n\t\tcoords[j] = 0;\n\t\tdims_m1[j] = ba->dimensions[j]-1;\n\t}\n\n\tptr = (Bool *)ba->data;\n\n\tif (count == 0) return nd;\n\n\t/* Loop through the Boolean array and copy coordinates\n\t for non-zero entries */\n\tfor (i=0; i=0; j--) {\n\t\t\tif (coords[j] < dims_m1[j]) {\n\t\t\t\tcoords[j]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcoords[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn nd;\n\n fail:\n\tfor (j=0; jiters[i] = NULL;\n \tmit->view = 0;\n \tmit->index = 0;\n \tmit->ait = NULL;\n \tmit->subspace = NULL;\n\tmit->numiter = 0;\n\tmit->consec = 1;\n\tfancy = fancy_indexing_check(indexobj);\n\tPy_INCREF(indexobj);\n\tmit->indexobj = indexobj;\n\tif (fancy == SOBJ_NOTFANCY) { /* bail out */\n\t\tmit->view = 1;\n\t\tgoto ret;\n\t}\n\n\tif (fancy == SOBJ_BADARRAY) {\n\t\tPyErr_SetString(PyExc_TypeError,\t\t\t\\\n\t\t\t\t\"Arrays used as indexes must be of \" \\\n\t\t\t\t\"integer type\");\n\t\tgoto fail;\n\t}\n\tif (fancy == SOBJ_TOOMANY) {\n\t\tPyErr_SetString(PyExc_TypeError,\"Too many indicies\");\n\t\tgoto fail;\n\t}\n\n\tif (fancy == SOBJ_LISTTUP) {\n\t\tPyObject *newobj;\n\t\tnewobj = PySequence_Tuple(indexobj);\n\t\tif (newobj == NULL) goto fail;\n\t\tPy_DECREF(indexobj);\n\t\tindexobj = newobj;\n\t\tmit->indexobj = indexobj;\n\t}\n\n#undef SOBJ_NOTFANCY \n#undef SOBJ_ISFANCY \n#undef SOBJ_BADARRAY \n#undef SOBJ_TOOMANY \n#undef SOBJ_LISTTUP \n\n\n\t/* Must have some kind of fancy indexing if we are here */\n\t/* indexobj is either a list, an arrayobject, or a tuple \n\t (with at least 1 list or arrayobject or Bool object), */\n\t\n\t/* convert all inputs to iterators */\n\tif (PyArray_Check(indexobj) &&\t\t\t\\\n\t (PyArray_TYPE(indexobj) == PyArray_BOOL)) {\n\t\tmit->numiter = _nonzero_indices(indexobj, mit->iters);\n\t\tif (mit->numiter < 0) goto fail;\n\t\tmit->nd = 1;\n\t\tmit->dimensions[0] = mit->iters[0]->dims_m1[0]+1;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = PyTuple_New(mit->numiter);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tPyTuple_SET_ITEM(mit->indexobj, i, \n\t\t\t\t\t PyInt_FromLong(0));\n\t\t}\n\t}\n\n\telse if (PyList_Check(indexobj) || PyArray_Check(indexobj)) {\n\t\tmit->numiter = 1;\n\t\tarr = PyArray_FromAny(indexobj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) goto fail;\n\t\tmit->iters[0] = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (mit->iters[0] == NULL) goto fail;\n\t\tmit->nd = PyArray_NDIM(arr);\n\t\tmemcpy(mit->dimensions,PyArray_DIMS(arr),mit->nd*sizeof(intp));\n\t\tmit->size = PyArray_SIZE(arr);\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = Py_BuildValue(\"(N)\", PyInt_FromLong(0));\n\t}\n\telse { /* must be a tuple */\n\t\tPyObject *obj;\n\t\tPyArrayIterObject *iter;\n\t\tPyObject *new;\n\t\t/* Make a copy of the tuple -- we will be replacing \n\t\t index objects with 0's */\n\t\tn = PyTuple_GET_SIZE(indexobj);\n\t\tnew = PyTuple_New(n);\n\t\tif (new == NULL) goto fail;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = new;\n\t\tstarted = 0;\n\t\tnonindex = 0;\n\t\tfor (i=0; iconsec = 0;\n\t\t\t\tmit->iters[(mit->numiter)++] = iter;\n\t\t\t\tPyTuple_SET_ITEM(new,i,\n\t\t\t\t\t\t PyInt_FromLong(0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (started) nonindex = 1;\n\t\t\t\tPy_INCREF(obj);\n\t\t\t\tPyTuple_SET_ITEM(new,i,obj);\n\t\t\t}\n\t\t}\n\t\t/* Store the number of iterators actually converted */\n\t\t/* These will be mapped to actual axes at bind time */\n\t\tif (PyArray_Broadcast((PyArrayMultiIterObject *)mit) < 0)\n\t\t\tgoto fail;\n\t}\n\n ret:\n PyObject_GC_Track(mit);\n return (PyObject *)mit;\n \n fail:\n\tPy_XDECREF(arr);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n\treturn NULL;\n}\n\n\n/* return unbound mapiter object */\n\nstatic PyObject *\narraymapiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) \n{\n\tPyObject *newtup, *res;\n\tint n;\n\n\tif (!PyTuple_Check(args)) {\n\t\tPyErr_BadInternalCall();\n\t\treturn NULL;\n\t}\n\n\tn = PyTuple_GET_SIZE(args);\n\t\n\tif (n < 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"must be initialized with >= 1 argument\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n > 1) {\n\t\tnewtup = PyTuple_GetSlice(args, 0, n);\n\t\tif (newtup == NULL) return NULL;\n\t\tres = PyArray_MapIterNew(newtup);\n\t\tPy_DECREF(newtup);\n\t}\n\telse { /* n == 1 */\n\t\tnewtup = PyTuple_GET_ITEM(args, 0);\n\t\tres = PyArray_MapIterNew(newtup);\n\t}\n\n\treturn res; \t\n}\n\n\n/* Returns a 0-dim array holding the element desired */\n\nstatic PyObject *\narraymapiter_next(PyArrayMapIterObject *mit)\n{\n\tPyObject *ret;\n\tif (mit->ait == NULL) return NULL;\n\tif (mit->view) return NULL;\n\tif (mit->index < mit->size) {\n\t\tret = PyArray_ToScalar(mit->dataptr, mit->ait->ao);\n\t\tPyArray_MapIterNext(mit);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narraymapiter_dealloc(PyArrayMapIterObject *mit)\n{\n\tint i;\n PyObject_GC_UnTrack(mit);\n Py_XDECREF(mit->ait);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n}\n\nstatic int\narraymapiter_traverse(PyArrayMapIterObject *mit, visitproc visit, void *arg)\n{\n\tint ret, i;\n if (mit->ait != NULL)\n if ((ret = visit((PyObject *)(mit->ait), arg)) != 0) \n\t\t\treturn ret;\t\n\n\tif (mit->iters != NULL) \n\t\tfor (i=0; inumiter; i++) \n\t\t\tif (mit->iters[i] != NULL) \n\t\t\t\tif ((ret=visit((PyObject *)mit->iters[i], \n\t\t\t\t\t arg)) != 0)\n\t\t\t\t\treturn ret;\n\n\tif (mit->indexobj != NULL)\n\t\tif ((ret = visit(mit->indexobj, arg)) != 0) return ret;\n\t\n return 0;\n}\n\n/* \nstatic char doc_mapiter_bind[] = \"obj.bind(a)\\n Bind an array to the \"\\\n\t\"mapiter object\";\n\nstatic PyObject *\nmapiter_bind(PyArrayMapIterObject *mit, PyObject *args)\n{\n\tPyObject *r;\n intp size, strides;\n int nd;\n\tPyArrayObject *arr;\n\n if (!PyArg_ParseTuple(args, \"O!\", &PyArray_Type, &arr)) return NULL;\n\n\tPyArray_MapIterBind(mit, arr);\n\n\tif (mit->ait == NULL) return NULL;\n\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyMethodDef mapiter_methods[] = {\n\t{\"bind\", (PyCFunction)mapiter_bind, 1, doc_mapiter_bind},\n {NULL,\t\tNULL}\t\t\n};\n*/\n\n\nstatic PyTypeObject PyArrayMapIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.mapiter\",\t\t \t/* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arraymapiter_dealloc,\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0,\t\t\t\t\t/* tp_as_sequence */\n 0,\t\t\t\t\t/* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0, \t\t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arraymapiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arraymapiter_next,\t/* tp_iternext */\n 0,\t \t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n 0,\t\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0, \t /* tp_alloc */\n (newfunc)arraymapiter_new,\t /* tp_new */\n 0,\t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n\n};\n\n/** END of Subscript Iterator **/\n\n\n\n", "source_code_before": " /*\n Provide multidimensional arrays as a basic object type in python. \n\nBased on Original Numeric implementation\nCopyright (c) 1995, 1996, 1997 Jim Hugunin, hugunin@mit.edu\n\nwith contributions from many Numeric Python developers 1995-2004 *\n\nHeavily modified in 2005 with inspiration from Numarray \n\nby\n\nTravis Oliphant\nAssistant Professor at\nBrigham Young University \n\nmaintainer email: oliphant.travis@ieee.org\n\nNumarray design (which provided guidance) by \nSpace Science Telescope Institute \n (J. Todd Miller, Perry Greenfield, Rick White)\n\n*/\n\n/* $Id: arrayobject.c,v 1.59 2005/09/14 00:14:00 teoliphant Exp $ */\n\n/*\n#include \"Python.h\"\n#include \"structmember.h\"\n\n#define _MULTIARRAYMODULE\n#include \"Numeric3/arrayobject.h\"\n*/\n\n/* Helper functions */\n\n#define error_converting(x) (((x) == -1) && PyErr_Occurred())\n\nstatic intp\nPyArray_PyIntAsIntp(PyObject *o)\n{\n\tlonglong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INTP, 0, 0};\n\tintp ret;\n\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((intp *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (longlong) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (longlong) PyLong_AsLongLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj != NULL) {\n\t\t\tlong_value = (longlong) PyLong_AsLongLong(obj);\n\t\t\tPy_DECREF(obj);\n\t\t}\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\t\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONGLONG != SIZEOF_PY_INTPTR_T)\n\tif ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C intp\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (intp) long_value;\n}\n\n\nstatic PyObject *array_int(PyArrayObject *v);\n\nstatic int\nPyArray_PyIntAsInt(PyObject *o)\n{\n\tlong long_value = -1;\n\tPyObject *obj;\n\tstatic char *msg = \"an integer is required\";\n\tPyObject *arr=NULL;\n\tPyArray_Typecode typecode = {PyArray_INT, 0, 0};\n\tint ret;\n\t\n\tif (!o) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\tif (PyArray_Check(o)) {\n\t\tif (PyArray_SIZE(o)!=1 || !PyArray_ISINTEGER(o)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\t\treturn -1;\n\t\t}\n\t\tarr = PyArray_CastToType((PyArrayObject *)o, &typecode);\n\t}\n\tif (PyArray_IsScalar(o, Integer)) {\n\t\tarr = PyArray_FromScalar(o, &typecode);\n\t}\n\tif (arr != NULL) {\n\t\tret = *((int *)PyArray_DATA(arr));\n\t\tPy_DECREF(arr);\n\t\treturn ret;\n\t}\t\t\n\tif (PyInt_Check(o)) {\n\t\tlong_value = (long) PyInt_AS_LONG(o);\n\t} else if (PyLong_Check(o)) {\n\t\tlong_value = (long) PyLong_AsLong(o);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_long != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_long(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else if (o->ob_type->tp_as_number != NULL &&\t\t\\\n\t\t o->ob_type->tp_as_number->nb_int != NULL) {\n\t\tobj = o->ob_type->tp_as_number->nb_int(o);\n\t\tif (obj == NULL) return -1;\n\t\tlong_value = (long) PyLong_AsLong(obj);\n\t\tPy_DECREF(obj);\n\t} else {\n\t\tPyErr_SetString(PyExc_NotImplementedError,\"\");\n\t}\n\tif error_converting(long_value) {\n\t\tPyErr_SetString(PyExc_TypeError, msg);\n\t\treturn -1;\n\t}\n\t\n#if (SIZEOF_LONG != SIZEOF_INT)\n\tif ((long_value < INT_MIN) || (long_value > INT_MAX)) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"integer won't fit into a C int\");\n\t\treturn -1;\n\t}\n#endif\n\treturn (int) long_value;\n}\n\n\nstatic double\nPyArray_GetPriority(PyObject *obj, double default_) \n{\n PyObject *ret;\n double priority=PyArray_PRIORITY;\n\n\tif (PyArray_CheckExact(obj))\n\t\treturn priority;\n if (PyBigArray_CheckExact(obj)) \n return PyArray_BIG_PRIORITY;\n\n ret = PyObject_GetAttrString(obj, \"__array_priority__\");\n if (ret != NULL) priority = PyFloat_AsDouble(ret);\n if (PyErr_Occurred()) {\n PyErr_Clear(); \n priority = default_;\n }\n Py_XDECREF(ret);\n return priority; \n}\n\n/* Backward compatibility only */\n/* In both Zero and One\n\n ***You must free the memory once you are done with it\n using PyDataMem_FREE(ptr) or you create a memory leak***\n\n If arr is an Object array you are getting a \n BORROWED reference to Zero or One.\n Do not DECREF.\n Please INCREF if you will be hanging on to it.\n\n The memory for the ptr still must be freed in any case;\n*/\n\nstatic char *\nPyArray_Zero(PyArrayObject *arr)\n{\n char *zeroval;\n char *buf;\n int buf_len;\n PyObject *obj, *ret;\n\n zeroval = PyDataMem_NEW(arr->itemsize);\n if (zeroval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n if (PyArray_ISOBJECT(arr)) {\n obj=PyInt_FromLong((long) 0);\n memcpy(zeroval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return zeroval;\n }\n ret = PyObject_GetAttrString((PyObject *)arr, \"_zero\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_zero not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n return NULL;\n }\n memcpy(zeroval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n memset(zeroval, 0, arr->itemsize);\n return zeroval;\n}\n\nstatic char *\nPyArray_One(PyArrayObject *arr)\n{\n char *oneval;\n char *buf;\n int buf_len, ret2;\n PyObject *obj, *ret;\n\n oneval = PyDataMem_NEW(arr->itemsize);\n if (oneval == NULL) {\n PyErr_SetNone(PyExc_MemoryError);\n return NULL;\n }\n\n obj = PyInt_FromLong((long) 1);\n if (PyArray_ISOBJECT(arr)) {\n memcpy(oneval, &obj, sizeof(PyObject *));\n Py_DECREF(obj);\n return oneval;\n }\n \n ret = PyObject_GetAttrString((PyObject *)arr, \"_one\");\n if (ret != NULL) {\n if (PyObject_AsReadBuffer(ret, (const void **)&buf, \n &buf_len) < 0) {\n PyErr_SetString(PyExc_ValueError, \n \"_one not returning \" \\\n \"writeable buffer.\");\n Py_DECREF(ret);\n PyDataMem_FREE(oneval);\n return NULL;\n }\n memcpy(oneval, buf, buf_len);\n Py_DECREF(ret);\n }\n if (PyErr_Occurred()) PyErr_Clear();\n\n ret2 = arr->descr->setitem(obj, oneval, arr);\n Py_DECREF(obj);\n if (ret < 0) {\n PyDataMem_FREE(oneval);\n return NULL;\n }\n return oneval;\n}\n\n/* End deprecated */\n\n\nstatic int \ndo_sliced_copy(char *dest, intp *dest_strides, intp *dest_dimensions,\n\t int dest_nd, char *src, intp *src_strides, \n\t intp *src_dimensions, int src_nd, int elsize, \n\t int copies) {\n intp i, j;\n\t\n if (src_nd == 0 && dest_nd == 0) {\n for(j=0; j src_nd) {\n for(i=0; i<*dest_dimensions; i++, dest += *dest_strides) {\n if (do_sliced_copy(dest, dest_strides+1, \n dest_dimensions+1, dest_nd-1,\n src, src_strides, \n src_dimensions, src_nd, \n elsize, copies) == -1) \n return -1;\n }\n return 0;\n }\n\t\n if (dest_nd == 1) {\n if (*dest_dimensions != *src_dimensions) {\n PyErr_SetString(PyExc_ValueError, \n \"matrices are not aligned for copy\");\n return -1;\n }\n for(i=0; i<*dest_dimensions; i++, src += *src_strides) {\n for(j=0; j 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize) && \n ((*src_strides)[*src_nd-1] == *elsize)) {\n if ((*dest_dimensions)[*dest_nd-1] != \n (*src_dimensions)[*src_nd-1]) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"matrices are not aligned\");\n return -1;\n }\n *elsize *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1; *src_nd-=1;\n } else {\n break;\n }\n }\n if (*src_nd == 0) {\n while (*dest_nd > 0) {\n if (((*dest_strides)[*dest_nd-1] == *elsize)) {\n *copies *= (*dest_dimensions)[*dest_nd-1];\n *dest_nd-=1;\n } else {\n break;\n }\n }\n }\n return 0;\n}\n\nstatic char *\ncontiguous_data(PyArrayObject *src) \n{\n intp dest_strides[MAX_DIMS], *dest_strides_ptr;\n intp *dest_dimensions=src->dimensions;\n int dest_nd=src->nd;\n intp *src_strides = src->strides;\n intp *src_dimensions=src->dimensions;\n int src_nd=src->nd;\n int elsize=src->itemsize;\n int copies=1;\n int ret, i;\n intp stride=elsize;\n char *new_data;\n\t\n for(i=dest_nd-1; i>=0; i--) {\n dest_strides[i] = stride;\n stride *= dest_dimensions[i];\n }\n\t\n dest_strides_ptr = dest_strides;\n\t\n if (optimize_slices(&dest_strides_ptr, &dest_dimensions, &dest_nd,\n &src_strides, &src_dimensions, &src_nd,\n &elsize, &copies) == -1) \n return NULL;\n\t\n new_data = (char *)malloc(stride);\n\t\n ret = do_sliced_copy(new_data, dest_strides_ptr, dest_dimensions, \n dest_nd, src->data, src_strides, \n src_dimensions, src_nd, elsize, copies);\n\t\n if (ret != -1) { return new_data; }\n else { free(new_data); return NULL; }\n}\n\n/* end Helper functions */\n\n\nstatic PyObject *PyArray_New(PyTypeObject *, int nd, intp *, \n int, intp *, char *, int, int, PyObject *);\n\n/* C-API functions */\n\n/* Used for arrays of python objects to increment the reference count of */\n/* every python object in the array. */\nstatic int \nPyArray_INCREF(PyArrayObject *mp) \n{\n\tintp i, n;\n\n PyObject **data, **data2;\n\t\n if (mp->descr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data;\n for(i=0; idescr->type_num != PyArray_OBJECT) return 0;\n\t\n if (PyArray_ISONESEGMENT(mp)) {\n data = (PyObject **)mp->data;\n } else {\n if ((data = (PyObject **)contiguous_data(mp)) == NULL) \n return -1;\n }\n\t\n n = PyArray_SIZE(mp);\n data2 = data; \n for(i=0; i 0; n--, a += 1) {\n b = a + 1;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 4:\n for (a = (char*)p ; n > 0; n--, a += 2) {\n b = a + 3;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n case 8:\n for (a = (char*)p ; n > 0; n--, a += 4) {\n b = a + 7;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b-- = c;\n c = *a; *a++ = *b; *b = c;\n }\n break;\n default:\n m = size / 2;\n for (a = (char *)p ; n > 0; n--, a += m) {\n b = a + (size-1);\n for (j=0; j 1, then dst must be contiguous */\nstatic void\ncopy_and_swap(void *dst, void *src, int itemsize, intp numitems,\n intp srcstrides, int swap) \n{\n int i;\n char *s1 = (char *)src;\n char *d1 = (char *)dst;\n \n\n if ((numitems == 1) || (itemsize == srcstrides)) \n memcpy(d1, s1, itemsize*numitems);\n else { \n for (i = 0; i < numitems; i++) {\n memcpy(d1, s1, itemsize);\n d1 += itemsize;\n s1 += srcstrides;\n } \n }\n\n if (swap)\n byte_swap_vector(d1, numitems, itemsize);\n}\n\n\n/* Computer-generated arraytype and scalartype code */\n#include \"scalartypes.inc\"\n#include \"arraytypes.inc\"\n\nstatic char *\nindex2ptr(PyArrayObject *mp, int i) \n{\n\tif (i==0 && (mp->nd == 0 || mp->dimensions[0] > 0)) \n\t\treturn mp->data;\n\t\n if (mp->nd>0 && i>0 && i < mp->dimensions[0]) {\n return mp->data+i*mp->strides[0];\n }\n PyErr_SetString(PyExc_IndexError,\"index out of bounds\");\n return NULL;\n}\n\nstatic intp \nPyArray_Size(PyObject *op) \n{\n if (PyArray_Check(op)) {\n return PyArray_SIZE((PyArrayObject *)op);\n } \n\telse {\n return 0;\n }\n}\n\n/* If destination is not the right type, then src \n will be cast to destination. \n*/\n\n/* Does a flat iterator-based copy. \n\n The arrays are assumed to have the same number of elements\n They can be different sizes and have different types however. \n*/\n\nstatic int\nPyArray_CopyInto(PyArrayObject *dest, PyArrayObject *src)\n{\n intp dsize, ssize, sbytes;\n\tint ncopies, elsize, index;\n PyArrayIterObject *dit=NULL;\n PyArrayIterObject *sit=NULL;\n\tchar *dptr;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n PyArray_CopySwapNFunc *copyswapn;\n \n if (!PyArray_ISWRITEABLE(dest)) {\n PyErr_SetString(PyExc_RuntimeError, \n \"Cannot write to array.\");\n return -1;\n }\n\n if (!PyArray_EquivArrTypes(dest, src)) {\n return PyArray_CastTo(dest, src);\n }\n\n dsize = PyArray_SIZE(dest);\n ssize = PyArray_SIZE(src);\n\tif (ssize == 0) return 0;\n if (dsize % ssize != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Destination number of elements must be\"\\\n \"an integer multiple of the source number of\"\\\n \"elements.\");\n return -1;\n }\n ncopies = dsize / ssize;\n\n\tswap = PyArray_ISNOTSWAPPED(dest) != PyArray_ISNOTSWAPPED(src);\n\tcopyswap = dest->descr->copyswap;\n\tcopyswapn = dest->descr->copyswapn;\n\n elsize = dest->itemsize;\n\n if ((PyArray_ISCONTIGUOUS(dest) && PyArray_ISCONTIGUOUS(src)) \\\n\t || (PyArray_ISFORTRAN(dest) && PyArray_ISFORTRAN(src))) {\n \n PyArray_XDECREF(dest);\n dptr = dest->data;\n sbytes = ssize * src->itemsize;\n while(ncopies--) {\n memmove(dptr, src->data, sbytes);\n dptr += sbytes;\n }\n\t\tif (swap)\n\t\t\tcopyswapn(dest->data, NULL, dsize, 1, elsize);\n PyArray_INCREF(dest);\n return 0;\n }\n\n dit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)dest);\n sit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)src);\n\n if ((dit == NULL) || (sit == NULL)) {\n Py_XDECREF(dit);\n Py_XDECREF(sit);\n return -1;\n }\n\n PyArray_XDECREF(dest);\n while(ncopies--) {\n index = ssize;\n while(index--) {\n memmove(dit->dataptr, sit->dataptr, elsize);\n\t\t\tif (swap)\n\t\t\t\tcopyswap(dit->dataptr, NULL, 1, elsize);\n PyArray_ITER_NEXT(dit);\n PyArray_ITER_NEXT(sit);\n }\n PyArray_ITER_RESET(sit);\n } \n PyArray_INCREF(dest);\n Py_DECREF(dit);\n Py_DECREF(sit);\n\treturn 0;\n}\n\n\nstatic int \nPyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) \n{\n PyArrayObject *src;\n int ret;\n\tPyArray_Typecode typecode;\n\n\n\ttypecode.type_num = dest->descr->type_num;\n\ttypecode.itemsize = dest->itemsize;\n\ttypecode.fortran = PyArray_ISFORTRAN(dest);\n\t\t\t\n src = (PyArrayObject *)PyArray_FromAny(src_object,\n\t\t\t\t\t &typecode, 0,\n\t\t\t\t\t dest->nd, 0);\n if (src == NULL) return -1;\n\n ret = PyArray_CopyInto(dest, src);\n Py_DECREF(src);\n return ret;\n}\n\n\n/* These are also old calls (should use PyArray_New) */\n\n/* They all zero-out the memory as previously done */\n\nstatic PyObject *\nPyArray_FromDimsAndDataAndDescr(int nd, int *d, \n PyArray_Descr *descr,\n char *data) {\n\tPyObject *ret;\n\n#if SIZEOF_INTP != SIZEOF_INT\n\tint i;\n\tintp newd[MAX_DIMS];\n\t\n\tfor (i=0; itype_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#else\n\tret = PyArray_New(&PyArray_Type, nd, (intp *)d, \n descr->type_num, NULL, data, descr->elsize, \n\t\t\t CARRAY_FLAGS, NULL);\n#endif\n\tif (descr->type_num != PyArray_OBJECT)\n\t\tmemset(PyArray_DATA(ret), 0, PyArray_SIZE(ret));\n\treturn ret;\n}\n\n\nstatic PyObject *\nPyArray_FromDimsAndData(int nd, int *d, int type, char *data) \n{\n\tPyObject *ret;\n#if SIZEOF_INTP != SIZEOF_INT\n\tintp newd[MAX_DIMS];\n\tint i;\t\n\tfor (i=0; iob_type, m1->nd, \n\t\t\t\t\t m1->dimensions,\n\t\t\t\t\t m1->descr->type_num,\n\t\t\t\t\t NULL, NULL, m1->itemsize,\n\t\t\t\t\t 0, (PyObject *)m1);\n\t\n if (PyArray_CopyInto(ret, m1) == -1) return NULL;\n\t\n return (PyObject *)ret;\n}\n\n\nstatic PyObject *array_item(PyArrayObject *, int);\n\nstatic PyObject *\nPyArray_Scalar(char *data, int type_num, int itemsize, int swap)\n{\n PyArray_Descr *descr;\n\tPyTypeObject *type;\n\tPyObject *obj;\t\n\tchar *destptr;\n PyArray_CopySwapFunc *copyswap;\n\n descr = PyArray_DescrFromType(type_num);\n if (descr == NULL) return NULL;\n type = descr->typeobj;\n copyswap = descr->copyswap;\n\tif (type_num == PyArray_STRING) \n\t\tobj = type->tp_alloc(type, itemsize);\n\telse\n\t\tobj = type->tp_alloc(type, 0);\n\tif (obj == NULL) return NULL;\n\tif PyTypeNum_ISFLEXIBLE(type_num) { \n\t\tif (type_num == PyArray_STRING) {\n\t\t\tdestptr = PyString_AS_STRING(obj);\n\t\t\t((PyStringObject *)obj)->ob_shash = -1;\n\t\t\t((PyStringObject *)obj)->ob_sstate =\t\\\n\t\t\t\tSSTATE_NOT_INTERNED; \n\t\t}\n\t\telse {\n\t\t\tdestptr = PyDataMem_NEW(itemsize);\n\t\t\tif (destptr == NULL) {\n\t\t\t\tPyObject_Del(obj);\n\t\t\t\treturn PyErr_NoMemory();\n\t\t\t}\n\t\t\tif (type_num == PyArray_UNICODE) {\n\t\t\t\tPyUnicode_AS_UNICODE(obj) = \\\n\t\t\t\t\t(Py_UNICODE *)destptr;\n\t\t\t\t((PyUnicodeObject*)obj)->length = itemsize / \\\n\t\t\t\t\tsizeof(Py_UNICODE);\n\t\t\t\t((PyUnicodeObject*)obj)->hash = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t((PyVoidScalarObject *)obj)->obval = destptr;\n\t\t\t\t((PyVoidScalarObject *)obj)->ob_size = itemsize;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tdestptr = &(((PyScalarObject*)obj)->obval);\n\t}\n\t/* copyswap for OBJECT increments the reference count */\n copyswap(destptr, data, swap, itemsize);\n\treturn obj;\n}\n\n/* returns an Array-Scalar Object of the type of arr\n from the given pointer to memory -- main Scalar creation function\n default new method calls this. \n*/\nstatic PyObject *\nPyArray_ToScalar(char *data, PyArrayObject *arr)\n{\n\tint type_num = arr->descr->type_num;\n\tint itemsize = arr->itemsize;\n int swap = !(PyArray_ISNOTSWAPPED(arr));\n\n\treturn PyArray_Scalar(data, type_num, itemsize, swap);\n}\n\n\n/* Return Python scalar if 0-d array object is encountered */\n\nstatic PyObject *\nPyArray_Return(PyArrayObject *mp) \n{\n \n\tif (mp == NULL) return NULL;\n\n if (PyErr_Occurred()) {\n Py_XDECREF(mp);\n return NULL;\n }\n\n\tif (PyArray_Check((PyObject *)mp) && mp->nd == 0) {\n\t\tPyObject *ret;\n\t\tret = PyArray_ToScalar(mp->data, mp);\n\t\tPy_DECREF(mp);\n\t\treturn ret;\n\t}\n\telse {\n\t\treturn (PyObject *)mp;\n\t}\n}\n\n/*\n returns typenum to associate with this type >=PyArray_USERDEF.\n Also creates a copy of the VOID_DESCR table inserting it's typeobject in\n and it's typenum in the appropriate place.\n \n needs the userdecrs table and PyArray_NUMUSER variables\n defined in arratypes.inc\n*/\nstatic int \nPyArray_RegisterDataType(PyTypeObject *type)\n{\n\tPyArray_Descr *descr;\n\tint typenum;\n\tint i;\n\t\n\tif ((type == &PyVoidArrType_Type) ||\t\t\t\\\n\t !PyType_IsSubtype(type, &PyVoidArrType_Type)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Can only register void subtypes.\");\n\t\treturn -1;\n\t}\n\t/* See if this type is already registered */\n\tfor (i=0; itypeobj == type)\n\t\t\treturn descr->type_num;\n\t}\n\tdescr = malloc(sizeof(PyArray_Descr));\n\tmemcpy(descr, PyArray_DescrFromType(PyArray_VOID), \n\t sizeof(PyArray_Descr));\n\ttypenum = PyArray_USERDEF + PyArray_NUMUSERTYPES;\n\tdescr->type_num = typenum;\n\tdescr->typeobj = type;\n\tuserdescrs = realloc(userdescrs, \n\t\t\t (PyArray_NUMUSERTYPES+1)*sizeof(void *));\n if (userdescrs == NULL) {\n PyErr_SetString(PyExc_MemoryError, \"RegisterDataType\");\n return -1;\n }\n\tuserdescrs[PyArray_NUMUSERTYPES++] = descr;\n\treturn typenum;\n}\n\n\n/* \n copyies over from the old descr table for anything\n NULL or zero in what is given. \n frees the copy of the Descr_table already there.\n places a pointer to the new one into the slot.\n*/\nstatic int\nPyArray_RegisterDescrForType(int typenum, PyArray_Descr *descr)\n{\n\tPyArray_Descr *old;\n\tint i;\n\n\tif (!PyTypeNum_ISUSERDEF(typenum)) {\n\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\"Data type not registered.\");\n\t\treturn -1;\n\t}\n\told = userdescrs[typenum-PyArray_USERDEF];\n\tdescr->typeobj = old->typeobj;\n\tdescr->type_num = typenum;\n\n#define _NULL_CHECK(member) \\\n\tif (descr->member == NULL) descr->member = old->member\n\n\tfor (i=0; imember == 0) descr->member = old->member\n\n\t_ZERO_CHECK(kind);\n\t_ZERO_CHECK(type);\n\t_ZERO_CHECK(elsize);\n\t_ZERO_CHECK(alignment);\n#undef _ZERO_CHECK\n\n\tfree(old);\n\tuserdescrs[typenum-PyArray_USERDEF] = descr;\n\treturn 0;\n}\n\n\nstatic int\nPyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) \n{\n intp size;\n intp n, n2;\n int n3, n4;\n PyArrayIterObject *it;\n PyObject *obj, *strobj, *tupobj;\n\n n3 = strlen((const char *)sep);\n if (n3 == 0) { /* binary data */\n if (PyArray_ISOBJECT(self)) {\n PyErr_SetString(PyExc_ValueError, \"Cannot write \"\\\n\t\t\t\t\t\"object arrays to a file in \"\\\n\t\t\t\t\t\"binary mode.\");\n return -1;\n }\n\n if (PyArray_ISCONTIGUOUS(self)) {\n size = PyArray_SIZE(self);\n if ((n=fwrite((const void *)self->data, \n (size_t) self->itemsize,\n (size_t) size, fp)) < size) {\n PyErr_Format(PyExc_ValueError, \n \"%ld requested and %ld written\",\n (long) size, (long) n);\n return -1;\n }\n }\n else {\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n while(it->index < it->size) {\n if (fwrite((const void *)it->dataptr, \n (size_t) self->itemsize,\n 1, fp) < 1) {\n PyErr_Format(PyExc_IOError, \n \"problem writing element\"\\\n \" %d to file\", it->index);\n Py_DECREF(it);\n return -1;\n }\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n } \n }\n else { /* text data */\n it=(PyArrayIterObject *) \\\n PyArray_IterNew((PyObject *)self);\n\t\tn4 = strlen((const char *)format);\n while(it->index < it->size) {\n obj = self->descr->getitem(it->dataptr, self);\n if (obj == NULL) {Py_DECREF(it); return -1;}\n\t\t\tif (n4 == 0) { /* standard writing */\n\t\t\t\tstrobj = PyObject_Str(obj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n\t\t\telse { /* use format string */\n\t\t\t\ttupobj = PyTuple_New(1);\n\t\t\t\tif (tupobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t\tPyTuple_SET_ITEM(tupobj,0,obj);\n\t\t\t\tobj = PyString_FromString((const char *)format);\n\t\t\t\tif (obj == NULL) {Py_DECREF(tupobj); \n\t\t\t\t\tPy_DECREF(it); return -1;}\n\t\t\t\tstrobj = PyString_Format(obj, tupobj);\n\t\t\t\tPy_DECREF(obj);\n\t\t\t\tPy_DECREF(tupobj);\n\t\t\t\tif (strobj == NULL) {Py_DECREF(it); return -1;}\n\t\t\t}\n if ((n=fwrite(PyString_AS_STRING(strobj), \n 1, n2=PyString_GET_SIZE(strobj),\n fp)) < n2) {\n PyErr_Format(PyExc_IOError,\n \"problem writing element %d\"\\\n \" to file\", it->index);\n Py_DECREF(strobj);\n Py_DECREF(it);\n return -1;\n }\n /* write separator for all but last one */\n if (it->index != it->size-1) \n fwrite(sep, 1, n3, fp);\n Py_DECREF(strobj);\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n return 0;\n}\n\nstatic PyObject *\nPyArray_ToList(PyArrayObject *self) \n{\n PyObject *lp;\n PyArrayObject *v;\n intp sz, i;\n\t\n if (!PyArray_Check(self)) return (PyObject *)self;\n\n if (self->nd == 0) \n\t\treturn self->descr->getitem(self->data,self);\n\t\n sz = self->dimensions[0];\n lp = PyList_New(sz);\n\t\n for (i=0; ind >= self->nd) {\n\t\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\t\"array_item not returning smaller\" \\\n\t\t\t\t\t\" dimensional array\");\n\t\t\tPy_DECREF(lp);\n\t\t\treturn NULL;\n\t\t}\n PyList_SetItem(lp, i, PyArray_ToList(v));\n\t\tPy_DECREF(v);\n }\n\t\n return lp;\n}\n\nstatic PyObject *\nPyArray_ToString(PyArrayObject *self)\n{\n intp numbytes;\n intp index;\n char *dptr;\n int elsize;\n PyObject *ret;\n PyArrayIterObject *it;\n \n if (PyArray_TYPE(self) == PyArray_OBJECT) {\n PyErr_SetString(PyExc_ValueError, \"a string for the data\"\\\n\t\t\t\t\"in an object array is not appropriate.\");\n return NULL;\n }\n\n numbytes = PyArray_NBYTES(self);\n if (PyArray_ISONESEGMENT(self)) {\n ret = PyString_FromStringAndSize(self->data, (int) numbytes);\n }\n else {\n it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n if (it==NULL) return NULL;\n ret = PyString_FromStringAndSize(NULL, (int) numbytes);\n if (ret == NULL) {Py_DECREF(it); return NULL;}\n dptr = PyString_AS_STRING(ret);\n index = it->size;\n elsize = self->itemsize;\n while(index--) {\n memcpy(dptr, it->dataptr, elsize);\n dptr += elsize;\n PyArray_ITER_NEXT(it);\n }\n Py_DECREF(it);\n }\n\treturn ret;\n}\n\n\n/*********************** end C-API functions **********************/\n\n\n/* array object functions */\n\nstatic void \narray_dealloc(PyArrayObject *self) {\n\n if (self->weakreflist != NULL)\n PyObject_ClearWeakRefs((PyObject *)self);\n\n if(self->base) {\n\t\t/* UPDATEIFCOPY means that base points to an \n\t\t array that should be updated with the contents\n\t\t of this array upon destruction.\n self->base->flags must have been WRITEABLE \n (checked previously) and it was locked here\n thus, unlock it.\n\t\t*/\n\t\tif (self->flags & UPDATEIFCOPY) {\n ((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tPy_INCREF(self); /* hold on to self in next call */\n PyArray_CopyInto((PyArrayObject *)self->base, self);\n\t\t\t/* Don't need to DECREF -- because we are deleting\n\t\t\t self already... */\n\t\t}\n\t\t/* In any case base is pointing to something that we need\n\t\t to DECREF -- either a view or a buffer object */\n Py_DECREF(self->base);\n }\n \n if ((self->flags & OWN_DATA) && (self->data != NULL)) {\n\t\t/* Free internal references if an Object array */\n\t\tPyArray_XDECREF(self);\n\n PyDataMem_FREE(self->data);\n }\n\t\n if (self->dimensions != NULL) {\n PyDimMem_FREE(self->dimensions); \n\t}\n\t\n self->ob_type->tp_free((PyObject *)self);\n}\n\n/*************************************************************************\n **************** Implement Mapping Protocol ***************************\n *************************************************************************/\n\nstatic int \narray_length(PyArrayObject *self) \n{\n if (self->nd != 0) {\n return self->dimensions[0];\n } else {\n\t\tPyErr_SetString(PyExc_TypeError, \"len() of unsized object.\");\n\t\treturn -1;\n }\n}\n\n\nstatic PyObject *\narray_item(PyArrayObject *self, int i) \n{\n char *item;\n PyArrayObject *r;\n\n\n\tif(self->nd == 0) {\n\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\"0-d arrays can't be indexed.\");\n\t\treturn NULL;\n\t}\n if ((item = index2ptr(self, i)) == NULL) return NULL;\n\n\tr = (PyArrayObject *)PyArray_New(self->ob_type, \n\t\t\t\t\t self->nd-1, self->dimensions+1, \n\t\t\t\t\t self->descr->type_num, \n\t\t\t\t\t self->strides+1, item, \n\t\t\t\t\t self->itemsize, self->flags,\n\t\t\t\t\t (PyObject *)self);\n\tif (r == NULL) return NULL;\n\tPy_INCREF(self);\n\tr->base = (PyObject *)self;\n PyArray_UpdateFlags(r, CONTIGUOUS | FORTRAN);\n\treturn (PyObject *)r;\n}\n\nstatic PyObject *\narray_item_nice(PyArrayObject *self, int i) \n{\n\treturn PyArray_Return((PyArrayObject *)array_item(self, i));\n}\n\n\nstatic int \narray_ass_item(PyArrayObject *self, int i, PyObject *v) \n{\n PyArrayObject *tmp;\n char *item;\n int ret;\n\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n if (i < 0) i = i+self->dimensions[0];\n\n if (self->nd > 1) {\n if((tmp = (PyArrayObject *)array_item(self, i)) == NULL)\n return -1;\n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n return ret; \n }\n\t\n if ((item = index2ptr(self, i)) == NULL) return -1;\n if (self->descr->setitem(v, item, self) == -1) return -1;\n return 0;\n}\n\n/* -------------------------------------------------------------- */\nstatic int\nslice_coerce_index(PyObject *o, int *v)\n{\n\t*v = PyArray_PyIntAsInt(o);\n\tif (error_converting(*v)) {\n\t\tPyErr_Clear();\n\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\n/* This is basically PySlice_GetIndicesEx, but with our coercion\n * of indices to integers (plus, that function is new in Python 2.3) */\nstatic int\nslice_GetIndices(PySliceObject *r, int length,\n int *start, int *stop, int *step,\n intp *slicelength)\n{\n\tint defstart, defstop;\n\t\n\tif (r->step == Py_None) {\n\t\t*step = 1;\n\t} else {\n\t\tif (!slice_coerce_index(r->step, step)) return -1;\n\t\tif (*step == 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"slice step can not be zero\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tdefstart = *step < 0 ? length - 1 : 0;\n\tdefstop = *step < 0 ? -1 : length;\n\t\n\tif (r->start == Py_None) {\n\t\t*start = *step < 0 ? length-1 : 0;\n\t} else {\n\t\tif (!slice_coerce_index(r->start, start)) return -1;\n\t\tif (*start < 0) *start += length;\n\t\tif (*start < 0) *start = (*step < 0) ? -1 : 0;\n\t\tif (*start >= length) {\n\t\t\t*start = (*step < 0) ? length - 1 : length;\n\t\t}\n\t}\n\t\n\tif (r->stop == Py_None) {\n\t\t*stop = defstop;\n\t} else {\n\t\tif (!slice_coerce_index(r->stop, stop)) return -1;\n\t\tif (*stop < 0) *stop += length;\n if (*stop < 0) *stop = -1;\n if (*stop > length) *stop = length;\n\t}\n\t\n\tif ((*step < 0 && *stop >= *start) || \\\n\t (*step > 0 && *start >= *stop)) {\n\t\t*slicelength = 0;\n\t} else if (*step < 0) {\n\t\t*slicelength = (*stop - *start + 1) / (*step) + 1;\n\t} else {\n\t\t*slicelength = (*stop - *start - 1) / (*step) + 1;\n\t}\n\t\n\treturn 0;\n}\n\n#define PseudoIndex -1\n#define RubberIndex -2\n#define SingleIndex -3\n\nstatic int\nparse_subindex(PyObject *op, int *step_size, intp *n_steps, int max)\n{\n\tint index;\n\t\n\tif (op == Py_None) {\n\t\t*n_steps = PseudoIndex;\n\t\tindex = 0;\n\t} else if (op == Py_Ellipsis) {\n\t\t*n_steps = RubberIndex;\n\t\tindex = 0;\n\t} else if (PySlice_Check(op)) {\n\t\tint stop;\n\t\tif (slice_GetIndices((PySliceObject *)op, max,\n\t\t\t\t &index, &stop, step_size, n_steps) < 0) {\n\t\t\tif (!PyErr_Occurred()) {\n\t\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\t\"invalid slice\");\n\t\t\t}\n\t\t\tgoto fail;\n\t\t}\n\t\tif (*n_steps <= 0) {\n\t\t\t*n_steps = 0;\n\t\t\t*step_size = 1;\n\t\t\tindex = 0;\n\t\t}\n\t} else {\n\t\tindex = PyArray_PyIntAsInt(op);\n\t\tif (error_converting(index)) {\n\t\t\tPyErr_SetString(PyExc_IndexError,\n\t\t\t\t\t\"each subindex must be either a \"\\\n\t\t\t\t\t\"slice, an integer, Ellipsis, or \"\\\n\t\t\t\t\t\"newaxis\");\n\t\t\tgoto fail;\n\t\t}\n\t\t*n_steps = SingleIndex;\n\t\t*step_size = 0;\n\t\tif (index < 0) index += max;\n\t\tif (index >= max || index < 0) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \"invalid index\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn index;\n fail:\n\treturn -1;\n}\n\n\nstatic int \nparse_index(PyArrayObject *self, PyObject *op, \n intp *dimensions, intp *strides, intp *offset_ptr)\n{\n int i, j, n;\n int nd_old, nd_new, start, offset, n_add, n_pseudo;\n int step_size;\n\tintp n_steps;\n PyObject *op1=NULL;\n int is_slice;\n\n\n if (PySlice_Check(op) || op == Py_Ellipsis || op == Py_None) {\n n = 1;\n op1 = op;\n Py_INCREF(op);\t\n /* this relies on the fact that n==1 for loop below */\n is_slice = 1;\n }\n else {\n if (!PySequence_Check(op)) {\n PyErr_SetString(PyExc_IndexError, \n \"index must be either an int \"\\\n \"or a sequence\");\n return -1;\n }\n n = PySequence_Length(op);\n is_slice = 0;\n }\n\t\n nd_old = nd_new = 0;\n\t\n offset = 0;\n for(i=0; ind ? \\\n self->dimensions[nd_old] : 0);\n Py_DECREF(op1);\n if (start == -1) break;\n\t\t\n if (n_steps == PseudoIndex) {\n dimensions[nd_new] = 1; strides[nd_new] = 0; nd_new++;\n } else {\n if (n_steps == RubberIndex) {\n for(j=i+1, n_pseudo=0; jnd-(n-i-n_pseudo-1+nd_old);\n if (n_add < 0) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = \\\n self->strides[nd_old];\n nd_new++; nd_old++;\n }\n } else {\n if (nd_old >= self->nd) {\n PyErr_SetString(PyExc_IndexError, \n \"too many indices\");\n return -1;\n }\n offset += self->strides[nd_old]*start;\n nd_old++;\n if (n_steps != SingleIndex) {\n dimensions[nd_new] = n_steps;\n strides[nd_new] = step_size * \\\n self->strides[nd_old-1];\n nd_new++;\n }\n }\n }\n }\n if (i < n) return -1;\n n_add = self->nd-nd_old;\n for(j=0; jdimensions[nd_old];\n strides[nd_new] = self->strides[nd_old];\n nd_new++; nd_old++;\n }\t \n *offset_ptr = offset;\n return nd_new;\n}\n\nstatic void\n_swap_axes(PyArrayMapIterObject *mit, PyArrayObject **ret)\n{\n\tPyObject *new, *tup;\n\tint n1, n2, n3, val;\n\tint i;\n\n\ttup = PyTuple_New(mit->nd);\n\t/* tuple for transpose is \n\t (n1,..,n1+n2-1,0,..,n1-1,n1+n2,...,n3-1)\n\t n1 is the number of dimensions of \n\t the broadcasted index array \n\t n2 is the number of dimensions skipped at the\n\t start\n\t n3 is the number of dimensions of the \n\t result \n\t*/\n\tn1 = mit->iters[0]->nd_m1 + 1;\n\tn2 = mit->iteraxes[0];\n\tn3 = mit->nd;\n\tval = n1;\n\ti = 0;\n\twhile(val < n1+n2) \n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = 0;\n\twhile(val < n1)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\tval = n1+n2;\n\twhile(val < n3)\n\t\tPyTuple_SET_ITEM(tup, i++, PyInt_FromLong((long)val++));\n\n\tnew = PyArray_Transpose(*ret, tup);\n\tPy_DECREF(tup);\n\tPy_DECREF(*ret);\n\t*ret = (PyArrayObject *)new;\n}\n\n\n\nstatic PyObject *\nPyArray_GetMap(PyArrayMapIterObject *mit)\n{\n\n\tPyArrayObject *ret, *temp;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\t/* Unbound map iterator --- Bind should have been called */\n\tif (mit->ait == NULL) return NULL;\n\n\t/* This relies on the map iterator object telling us the shape\n\t of the new array in nd and dimensions.\n\t*/\n\ttemp = mit->ait->ao;\n\tret = (PyArrayObject *)\\\n\t\tPyArray_New(temp->ob_type, mit->nd, mit->dimensions, \n\t\t\t temp->descr->type_num, NULL, NULL, \n\t\t\t temp->itemsize, \n\t\t\t PyArray_ISFORTRAN(temp),\n\t\t\t (PyObject *)temp);\n\tif (ret == NULL) return NULL;\n\n\t/* Now just iterate through the new array filling it in\n\t with the next object from the original array as\n\t defined by the mapping iterator */\n\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ret)) \n\t == NULL) \n\t\treturn NULL;\n\tindex = it->size;\n\tswap = ((temp->flags & NOTSWAPPED) != (ret->flags & NOTSWAPPED));\n copyswap = ret->descr->copyswap;\n\tPyArray_MapIterReset(mit);\n\twhile (index--) {\n copyswap(it->dataptr, mit->dataptr, swap, ret->itemsize);\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\t\n\t/* check for consecutive axes */\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, &ret);\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\nstatic int\nPyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)\n{\n\tPyObject *arr=NULL;\n\tPyArrayIterObject *it;\n\tint index;\n\tint swap;\n\tPyArray_Typecode typecode = {0, 0, 0};\n PyArray_CopySwapFunc *copyswap;\n\n\t/* Unbound Map Iterator */\n\tif (mit->ait == NULL) return -1;\n\n\ttypecode.type_num = mit->ait->ao->descr->type_num;\n\ttypecode.itemsize = mit->ait->ao->itemsize;\n\n\tarr = PyArray_FromAny(op, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\n\tif ((mit->subspace != NULL) && (mit->consec)) {\n\t\tif (mit->iteraxes[0] > 0) { /* then we need to swap */\n\t\t\t_swap_axes(mit, (PyArrayObject **)&arr);\n\t\t}\n\t}\n\t\n\tif ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) \n\t\treturn -1;\n\n\tindex = mit->size;\n\tswap = ((mit->ait->ao->flags & NOTSWAPPED) != \\\n\t\t(PyArray_FLAGS(arr) & NOTSWAPPED));\n\n copyswap = PyArray_DESCR(arr)->copyswap;\n\tPyArray_MapIterReset(mit);\n /* Need to decref OBJECT arrays */\n if (PyTypeNum_ISOBJECT(typecode.type_num)) {\n while (index--) {\n Py_XDECREF(*((PyObject **)mit->dataptr));\n Py_INCREF(*((PyObject **)it->dataptr));\n memmove(mit->dataptr, it->dataptr, sizeof(PyObject *));\n copyswap(mit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_MapIterNext(mit);\n PyArray_ITER_NEXT(it);\n if (it->index == it->size)\n PyArray_ITER_RESET(it);\n }\n return 0;\n }\n\n\twhile(index--) {\n\t\tmemmove(mit->dataptr, it->dataptr, PyArray_ITEMSIZE(arr));\n copyswap(mit->dataptr, NULL, swap, PyArray_ITEMSIZE(arr));\n\t\tPyArray_MapIterNext(mit);\n\t\tPyArray_ITER_NEXT(it);\n\t\tif (it->index == it->size)\n\t\t\tPyArray_ITER_RESET(it);\n\t}\t\t\n\treturn 0;\n}\n\n/* Called when treating array object like a mapping -- called first from \n Python when using a[object] unless object is a standard slice object\n (not an extended one). \n\n*/\n\n/* There are two situations: \n\n 1 - the subscript is a standard view and a reference to the \n array can be returned\n\n 2 - the subscript uses Boolean masks or integer indexing and\n therefore a new array is created and returned. \n\n*/\n\n/* Always returns 0-dimensional arrays */\n\nstatic PyObject *\narray_subscript(PyArrayObject *self, PyObject *op) \n{\n intp dimensions[MAX_DIMS], strides[MAX_DIMS];\n\tintp offset;\n int nd, i;\n PyArrayObject *other;\n\tPyArrayMapIterObject *mit;\n\n if (PyArray_IsScalar(op, Integer) || PyInt_Check(op) || \\\n PyLong_Check(op)) {\n intp value;\n value = PyArray_PyIntAsIntp(op);\n if (PyErr_Occurred())\n PyErr_Clear();\n else if (value >= 0) {\n if (value <= MAX_INT)\n return array_item(self, (int) value);\n }\n else if (value < 0) {\n if (value >= -MAX_INT) {\n if (self->nd > 0) value += self->dimensions[0];\n return array_item(self, (int) value);\n }\n }\n }\n\n\tif (PyArrayMapIter_Check(op)) {\n\t\tmit = (PyArrayMapIterObject *)op;\n\t\t/* bind to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\n\t\t/* If the mapiterator was created with standard indexing\n\t\t behavior, fall through to view-based code */\n\t\tif (!mit->view) return PyArray_GetMap(mit);\n\t\top = mit->indexobj;\n\t}\n\telse { /* wrap arguments into a mapiter object */\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(op);\n\t\tif (mit == NULL) return NULL;\n\t\tif (!mit->view) { /* fancy indexing */\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tother = (PyArrayObject *)PyArray_GetMap(mit);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn (PyObject *)other;\n\t\t}\n\t\tPy_DECREF(mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(op);\n\tif (!error_converting(i)) {\n\t\tif (i < 0 && self->nd > 0) i = i+self->dimensions[0];\n\t\treturn array_item(self, i);\n\t}\n\tPyErr_Clear();\n\n\t/* Standard (view-based) Indexing */\n if ((nd = parse_index(self, op, dimensions, strides, &offset)) \n == -1) \n return NULL;\n\n\t/* This will only work if new array will be a view */\n\tif ((other = (PyArrayObject *)\t\t\t\t\t\\\n\t PyArray_New(self->ob_type, nd, dimensions, self->descr->type_num,\n\t\t\t strides, self->data+offset, \n\t\t\t self->itemsize, self->flags,\n\t\t\t (PyObject *)self)) == NULL) \n\t\treturn NULL;\n\n\n\tother->base = (PyObject *)self;\n\tPy_INCREF(self);\n\t\n\tPyArray_UpdateFlags(other, UPDATE_ALL_FLAGS);\n\t\n\treturn (PyObject *)other;\n}\n\n\n/* Another assignment hacked by using CopyObject. */\n\n/* This only works if subscript returns a standard view. */\n\n/* Again there are two cases. In the first case, PyArray_CopyObject\n can be used. In the second case, a new indexing function has to be \n used.\n*/\n\nstatic int \narray_ass_sub(PyArrayObject *self, PyObject *index, PyObject *op) \n{\n int ret, i;\n PyArrayObject *tmp;\n\tPyArrayMapIterObject *mit;\n\t\n if (op == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n\n\tif (PyArrayMapIter_Check(index)) {\n\t\tmit = (PyArrayMapIterObject *)index;\n\t\t/* bind behavior to current array */\n\t\tPyArray_MapIterBind(mit, self);\n\t\t\t\n\t\t/* fall through if standard view-based map iterator */\n\t\tif (!mit->view) return PyArray_SetMap(mit, op);\n\t\tindex = mit->indexobj;\n\t}\n\telse {\n\t\tmit = (PyArrayMapIterObject *)PyArray_MapIterNew(index);\n\t\tif (mit == NULL) return -1;\n\t\tif (!mit->view) {\n\t\t\tPyArray_MapIterBind(mit, self);\n\t\t\tret = PyArray_SetMap(mit, op);\n\t\t\tPy_DECREF(mit);\n\t\t\treturn ret;\n\t\t}\n\t\tPy_DECREF((PyObject*)mit);\n\t}\n\n\ti = PyArray_PyIntAsInt(index);\n\tif (!error_converting(i)) {\n\t\treturn array_ass_item(self, i, op);\n\t}\n\tPyErr_Clear();\n\t\n\t/* Rest of standard (view-based) indexing */\n\n if ((tmp = (PyArrayObject *)array_subscript(self, index)) == NULL)\n return -1; \n ret = PyArray_CopyObject(tmp, op);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\n/* There are places that require that array_subscript return a PyArrayObject\n and not possibly a scalar. Thus, this is the function exposed to \n Python so that 0-dim arrays are passed as scalars\n*/\n\nstatic PyObject *\narray_subscript_nice(PyArrayObject *self, PyObject *op) \n{\n\treturn PyArray_Return((PyArrayObject *)array_subscript(self, op));\n}\n\n\nstatic PyMappingMethods array_as_mapping = {\n (inquiry)array_length,\t\t /*mp_length*/\n (binaryfunc)array_subscript_nice,\t/*mp_subscript*/\n (objobjargproc)array_ass_sub,\t /*mp_ass_subscript*/\n};\n\n/****************** End of Mapping Protocol ******************************/\n\n\n/*************************************************************************\n **************** Implement Buffer Protocol ****************************\n *************************************************************************/\n\n/* removed multiple segment interface */\n\nstatic int \narray_getsegcount(PyArrayObject *self, int *lenp) \n{\n if (lenp)\n *lenp = PyArray_NBYTES(self);\n\n if (PyArray_ISONESEGMENT(self)) {\n return 1;\n }\n\n if (lenp)\n *lenp = 0;\n return 0;\n}\n\nstatic int \narray_getreadbuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (segment != 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Accessing non-existing array segment\");\n return -1;\n }\n \n if (PyArray_ISONESEGMENT(self)) {\n *ptrptr = self->data;\n return PyArray_NBYTES(self);\n }\n PyErr_SetString(PyExc_ValueError, \"Array is not a single segment\");\n *ptrptr = NULL;\n return -1;\n}\n\n\nstatic int \narray_getwritebuf(PyArrayObject *self, int segment, void **ptrptr) \n{\n if (PyArray_CHKFLAGS(self, WRITEABLE)) \n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_ValueError, \"Array cannot be \"\\\n \"accessed as a writeable buffer.\");\n return -1;\n }\n}\n\nstatic int \narray_getcharbuf(PyArrayObject *self, int segment, const char **ptrptr) \n{\n if (self->descr->type_num == PyArray_STRING || \\\n\t self->descr->type_num == PyArray_UNICODE)\n return array_getreadbuf(self, segment, (void **) ptrptr);\n else {\n PyErr_SetString(PyExc_TypeError, \n \"Non-character array cannot be interpreted \"\\\n \"as character buffer.\");\n return -1;\n }\n}\n\nstatic PyBufferProcs array_as_buffer = {\n (getreadbufferproc)array_getreadbuf, /*bf_getreadbuffer*/\n (getwritebufferproc)array_getwritebuf, /*bf_getwritebuffer*/\n (getsegcountproc)array_getsegcount,\t /*bf_getsegcount*/\n (getcharbufferproc)array_getcharbuf, /*bf_getcharbuffer*/\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Number Protocol ****************************\n *************************************************************************/\n\n\ntypedef struct {\n PyObject *add,\n *subtract,\n *multiply,\n *divide,\n *remainder,\n *power,\n\t\t*sqrt,\n *negative,\n *absolute,\n *invert,\n *left_shift,\n *right_shift,\n *bitwise_and,\n *bitwise_xor,\n *bitwise_or,\n *less,\n *less_equal,\n *equal,\n *not_equal,\n *greater,\n *greater_equal,\n *floor_divide,\n *TRUE_divide,\n\t\t*logical_or,\n\t\t*logical_and,\n\t\t*floor,\n\t\t*ceil,\n\t\t*maximum,\n\t\t*minimum;\t\n\t\n} NumericOps;\n\nstatic NumericOps n_ops = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n NULL, NULL, NULL, NULL, NULL};\n\n/* Dictionary can contain any of the numeric operations, by name. \n Those not present will not be changed\n */\n\n#define SET(op) temp=PyDict_GetItemString(dict, #op);\t\\\n\tif (temp != NULL) {\t\t\t\t\\\n\t\tif (!(PyCallable_Check(temp))) return -1; \\\n Py_XDECREF(n_ops.op); \\\n\t\tn_ops.op = temp; \\\n\t}\n\n \nint \nPyArray_SetNumericOps(PyObject *dict) \n{\n PyObject *temp = NULL;\n SET(add);\n SET(subtract);\n SET(multiply);\n SET(divide);\n SET(remainder);\n SET(power);\n\tSET(sqrt);\n SET(negative);\n SET(absolute);\n SET(invert);\n SET(left_shift);\n SET(right_shift);\n SET(bitwise_and);\n SET(bitwise_or);\n SET(bitwise_xor);\n SET(less);\t \n SET(less_equal);\n SET(equal);\n SET(not_equal);\n SET(greater);\n SET(greater_equal);\n SET(floor_divide);\t\n SET(TRUE_divide);\t\n\tSET(logical_or);\n\tSET(logical_and);\n\tSET(floor);\n\tSET(ceil);\n\tSET(maximum);\n\tSET(minimum);\n return 0;\n}\n\n#define GET(op) if (PyDict_SetItemString(dict, #op, n_ops.op)==-1) \\\n\t\tgoto fail;\n\nstatic PyObject *\nPyArray_GetNumericOps(void) \n{\n\tPyObject *dict;\n\tif ((dict = PyDict_New())==NULL) \n\t\treturn NULL;\t\n\tGET(add);\n GET(subtract);\n GET(multiply);\n GET(divide);\n GET(remainder);\n GET(power);\n\tGET(sqrt);\n GET(negative);\n GET(absolute);\n GET(invert);\n GET(left_shift);\n GET(right_shift);\n GET(bitwise_and);\n GET(bitwise_or);\n GET(bitwise_xor);\n GET(less);\t \n GET(less_equal);\n GET(equal);\n GET(not_equal);\n GET(greater);\n GET(greater_equal);\n GET(floor_divide); \n GET(TRUE_divide); \n\tGET(logical_or);\n\tGET(logical_and);\n\tGET(floor);\n\tGET(ceil);\n\tGET(maximum);\n\tGET(minimum);\n\treturn dict;\t\n\n fail:\n\tPy_DECREF(dict);\n\treturn NULL;\t\t\n}\n\nstatic PyObject *\nPyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"reduce\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,\n\t\t\t\t int rtype)\n{\n\tPyObject *args, *ret=NULL, *meth;\n\tif (op == NULL) {\n\t\tPy_INCREF(Py_NotImplemented);\n\t\treturn Py_NotImplemented;\n\t}\n\tif (rtype == PyArray_NOTYPE) \n\t\targs = Py_BuildValue(\"(Oi)\", m1, axis);\n\telse\n\t\targs = Py_BuildValue(\"(Oii)\", m1, axis, rtype);\n\tmeth = PyObject_GetAttrString(op, \"accumulate\");\n\tif (meth && PyCallable_Check(meth)) {\n\t\tret = PyObject_Call(meth, args, NULL);\n\t}\n\tPy_DECREF(args);\n\tPy_DECREF(meth);\n\treturn ret;\n}\t\n\n\nstatic PyObject *\nPyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OO)\", m1, m2);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(O)\", m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\nPyArray_GenericInplaceBinaryFunction(PyArrayObject *m1, \n\t\t\t\t PyObject *m2, PyObject *op) \n{\n PyObject *args, *ret;\n if (op == NULL) {\n Py_INCREF(Py_NotImplemented);\n return Py_NotImplemented; \n }\n args = Py_BuildValue(\"(OOO)\", m1, m2, m1);\n ret = PyObject_Call(op, args, NULL);\n Py_DECREF(args);\n return ret;\n}\n\nstatic PyObject *\narray_add(PyArrayObject *m1, PyObject *m2) \n{ \n return PyArray_GenericBinaryFunction(m1, m2, n_ops.add); \n}\n\nstatic PyObject *\narray_subtract(PyArrayObject *m1, PyObject *m2) \n{\n\treturn PyArray_GenericBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_negative(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.negative);\n}\n\nstatic PyObject *\narray_absolute(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.absolute);\n}\n\nstatic PyObject *\narray_invert(PyArrayObject *m1) \n{ \n return PyArray_GenericUnaryFunction(m1, n_ops.invert);\n}\n\nstatic PyObject *\narray_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_inplace_add(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.add);\n}\n\nstatic PyObject *\narray_inplace_subtract(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.subtract);\n}\n\nstatic PyObject *\narray_inplace_multiply(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.multiply);\n}\n\nstatic PyObject *\narray_inplace_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.divide);\n}\n\nstatic PyObject *\narray_inplace_remainder(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.remainder);\n}\n\nstatic PyObject *\narray_inplace_power(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.power);\n}\n\nstatic PyObject *\narray_inplace_left_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.left_shift);\n}\n\nstatic PyObject *\narray_inplace_right_shift(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.right_shift);\n}\n\nstatic PyObject *\narray_inplace_bitwise_and(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_and);\n}\n\nstatic PyObject *\narray_inplace_bitwise_or(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_or);\n}\n\nstatic PyObject *\narray_inplace_bitwise_xor(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, n_ops.bitwise_xor);\n}\n\nstatic PyObject *\narray_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericBinaryFunction(m1, m2, n_ops.TRUE_divide);\n}\n\nstatic PyObject *\narray_inplace_floor_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.floor_divide);\n}\n\nstatic PyObject *\narray_inplace_TRUE_divide(PyArrayObject *m1, PyObject *m2) \n{\n return PyArray_GenericInplaceBinaryFunction(m1, m2, \n\t\t\t\t\t\t n_ops.TRUE_divide);\n}\n\n/* Array evaluates as \"TRUE\" if any of the elements are non-zero */\nstatic int \narray_all_nonzero(PyArrayObject *mp) \n{\n\tintp index;\n\tPyArrayIterObject *it;\n\tBool anyTRUE = 0;\n\t\n\tit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)mp);\n\tif (it==NULL) return anyTRUE;\n\tindex = it->size;\n\twhile(index--) {\n\t\tif (mp->descr->nonzero(it->dataptr, mp)) {\n\t\t\tanyTRUE = 1;\n\t\t\tbreak;\n\t\t}\n\t\tPyArray_ITER_NEXT(it);\n\t}\n\tPy_DECREF(it);\n\treturn anyTRUE;\n}\n\nstatic PyObject *\narray_divmod(PyArrayObject *op1, PyObject *op2) \n{\n PyObject *divp, *modp, *result;\n\n divp = array_divide(op1, op2);\n if (divp == NULL) return NULL;\n modp = array_remainder(op1, op2);\n if (modp == NULL) {\n Py_DECREF(divp);\n return NULL;\n }\n result = Py_BuildValue(\"OO\", divp, modp);\n Py_DECREF(divp);\n Py_DECREF(modp);\n return result;\n}\n\n\nstatic PyObject *\narray_int(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can be\"\\\n\t\t\t\t\" converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_int == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to int\");\n Py_DECREF(pv);\n return NULL;\n }\n\n pv2 = pv->ob_type->tp_as_number->nb_int(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_float(PyArrayObject *v) \n{\n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv == NULL) return NULL;\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an \"\\\n\t\t\t\t\"int, scalar object is not a number.\");\n Py_DECREF(pv);\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_float == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to float\");\n Py_DECREF(pv);\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_float(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_long(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_long == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to long\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_long(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_oct(PyArrayObject *v) \n{\t \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_oct == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to oct\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_oct(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\narray_hex(PyArrayObject *v) \n{ \n PyObject *pv, *pv2;\n if (PyArray_SIZE(v) != 1) {\n PyErr_SetString(PyExc_TypeError, \"only length-1 arrays can \"\\\n\t\t\t\t\"be converted to Python scalars.\");\n return NULL;\n }\n pv = v->descr->getitem(v->data, v);\n if (pv->ob_type->tp_as_number == 0) {\n PyErr_SetString(PyExc_TypeError, \"cannot convert to an int, \"\\\n\t\t\t\t\"scalar object is not a number.\");\n return NULL;\n }\n if (pv->ob_type->tp_as_number->nb_hex == 0) {\n PyErr_SetString(PyExc_TypeError, \"don't know how to convert \"\\\n\t\t\t\t\"scalar number to hex\");\n return NULL;\n }\n pv2 = pv->ob_type->tp_as_number->nb_hex(pv);\n Py_DECREF(pv);\n return pv2;\t \n}\n\nstatic PyObject *\n_array_copy_nice(PyArrayObject *self)\n{\n\treturn PyArray_Return((PyArrayObject *)\t\t\\\n\t\t\t PyArray_Copy(self));\n}\n\nstatic PyNumberMethods array_as_number = {\n (binaryfunc)array_add,\t\t /*nb_add*/\n (binaryfunc)array_subtract,\t\t /*nb_subtract*/\n (binaryfunc)array_multiply,\t\t /*nb_multiply*/\n (binaryfunc)array_divide,\t\t /*nb_divide*/\n (binaryfunc)array_remainder,\t /*nb_remainder*/\n (binaryfunc)array_divmod,\t\t /*nb_divmod*/\n (ternaryfunc)array_power,\t\t /*nb_power*/\n (unaryfunc)array_negative, /*nb_neg*/\t\n (unaryfunc)_array_copy_nice,\t\t /*nb_pos*/ \n (unaryfunc)array_absolute,\t\t /*(unaryfunc)array_abs,*/\n (inquiry)array_all_nonzero,\t\t /*nb_nonzero*/\n (unaryfunc)array_invert,\t\t /*nb_invert*/\n (binaryfunc)array_left_shift,\t /*nb_lshift*/\n (binaryfunc)array_right_shift,\t /*nb_rshift*/\n (binaryfunc)array_bitwise_and,\t /*nb_and*/\n (binaryfunc)array_bitwise_xor,\t /*nb_xor*/\n (binaryfunc)array_bitwise_or,\t /*nb_or*/\n 0,\t\t /*nb_coerce*/\n (unaryfunc)array_int,\t\t /*nb_int*/\n (unaryfunc)array_long,\t\t /*nb_long*/\n (unaryfunc)array_float,\t\t /*nb_float*/\n (unaryfunc)array_oct,\t\t /*nb_oct*/\n (unaryfunc)array_hex,\t\t /*nb_hex*/\n\n /*This code adds augmented assignment functionality*/\n /*that was made available in Python 2.0*/\n (binaryfunc)array_inplace_add,\t /*inplace_add*/\n (binaryfunc)array_inplace_subtract,\t /*inplace_subtract*/\n (binaryfunc)array_inplace_multiply,\t /*inplace_multiply*/\n (binaryfunc)array_inplace_divide,\t /*inplace_divide*/\n (binaryfunc)array_inplace_remainder, /*inplace_remainder*/\n (ternaryfunc)array_inplace_power,\t /*inplace_power*/\n (binaryfunc)array_inplace_left_shift, /*inplace_lshift*/\n (binaryfunc)array_inplace_right_shift, /*inplace_rshift*/\n (binaryfunc)array_inplace_bitwise_and, /*inplace_and*/\n (binaryfunc)array_inplace_bitwise_xor, /*inplace_xor*/\n (binaryfunc)array_inplace_bitwise_or, /*inplace_or*/\n\n (binaryfunc)array_floor_divide,\t /*nb_floor_divide*/\n (binaryfunc)array_TRUE_divide,\t /*nb_TRUE_divide*/\n (binaryfunc)array_inplace_floor_divide, /*nb_inplace_floor_divide*/\n (binaryfunc)array_inplace_TRUE_divide, /*nb_inplace_TRUE_divide*/\n\n};\n\n/****************** End of Buffer Protocol *******************************/\n\n\n/*************************************************************************\n **************** Implement Sequence Protocol **************************\n *************************************************************************/\n\n/* Some of this is repeated in the array_as_mapping protocol. But\n we fill it in here so that PySequence_XXXX calls work as expected \n*/\n\n\nstatic PyObject * \narray_slice(PyArrayObject *self, int ilow, int ihigh) \n{\n PyArrayObject *r;\n int l;\n char *data;\n\n if (self->nd == 0) {\n PyErr_SetString(PyExc_ValueError, \"can't slice a scalar\");\n return NULL;\n }\n \t\n l=self->dimensions[0];\n if (ihigh < 0) ihigh += l;\n if (ilow < 0) ilow += l;\n if (ilow < 0) ilow = 0;\n else if (ilow > l) ilow = l;\n if (ihigh < 0) ihigh = 0;\n else if (ihigh > l) ihigh = l;\n if (ihigh < ilow) ihigh = ilow;\n\n if (ihigh != ilow) {\n data = index2ptr(self, ilow);\n if (data == NULL) return NULL;\n } else {\n data = self->data;\n }\n\n self->dimensions[0] = ihigh-ilow;\n r = (PyArrayObject *)\\\n\t\tPyArray_New(self->ob_type, self->nd, self->dimensions, \n\t\t\t self->descr->type_num, self->strides, data,\n\t\t\t self->itemsize, self->flags, (PyObject *)self);\n\n self->dimensions[0] = l;\n r->base = (PyObject *)self;\n Py_INCREF(self);\n\tPyArray_UpdateFlags(r, UPDATE_ALL_FLAGS); \n return (PyObject *)r;\n}\n\n\nstatic int \narray_ass_slice(PyArrayObject *self, int ilow, int ihigh, PyObject *v) {\n int ret;\n PyArrayObject *tmp;\n\t\n if (v == NULL) {\n PyErr_SetString(PyExc_ValueError, \n \"Can't delete array elements.\");\n return -1;\n }\n\tif (!PyArray_ISWRITEABLE(self)) {\n\t\tPyErr_SetString(PyExc_RuntimeError,\n\t\t\t\t\"Array is not writeable.\");\n\t\treturn -1;\n\t}\n if ((tmp = (PyArrayObject *)array_slice(self, ilow, ihigh)) \\\n == NULL) \n return -1; \n ret = PyArray_CopyObject(tmp, v);\n Py_DECREF(tmp);\n\t\n return ret;\n}\n\nstatic int\narray_contains(PyArrayObject *self, PyObject *el)\n{\n /* equivalent to any(self == el) */\n\n return PyObject_RichCompareBool((PyObject *)self, el, Py_EQ);\n}\n\n\nstatic PySequenceMethods array_as_sequence = {\n (inquiry)array_length,\t\t/*sq_length*/\n (binaryfunc)NULL, /* sq_concat is handled by nb_add*/\n (intargfunc)NULL, /* sq_repeat is handled nb_multiply*/\n (intargfunc)array_item_nice,\t\t/*sq_item*/\n (intintargfunc)array_slice,\t\t/*sq_slice*/\n (intobjargproc)array_ass_item,\t/*sq_ass_item*/\n (intintobjargproc)array_ass_slice,\t/*sq_ass_slice*/\n\t(objobjproc) array_contains, /* sq_contains */\n\t(binaryfunc) NULL, /* sg_inplace_concat */\n\t(intargfunc) NULL /* sg_inplace_repeat */\n};\n\n\n/****************** End of Sequence Protocol ****************************/\n\n\nstatic int \ndump_data(char **string, int *n, int *max_n, char *data, int nd, \n intp *dimensions, intp *strides, PyArrayObject* self) \n{\n PyArray_Descr *descr=self->descr;\n PyObject *op, *sp;\n char *ostring;\n int i, N;\n\t\n#define CHECK_MEMORY if (*n >= *max_n-16) { *max_n *= 2; \\\n\t\t*string = (char *)realloc(*string, *max_n); }\n\t\n if (nd == 0) {\n\t\t\n if ((op = descr->getitem(data, self)) == NULL) return -1;\n sp = PyObject_Repr(op);\n if (sp == NULL) {Py_DECREF(op); return -1;}\n ostring = PyString_AsString(sp);\n N = PyString_Size(sp)*sizeof(char);\n *n += N;\n CHECK_MEMORY\n memmove(*string+(*n-N), ostring, N);\n Py_DECREF(sp);\n Py_DECREF(op);\n return 0;\n } else {\n CHECK_MEMORY\n (*string)[*n] = '[';\n *n += 1;\n for(i=0; idata, \n\t\t self->nd, self->dimensions, \n self->strides, self) < 0) { \n\t\tfree(string); return NULL; \n\t}\n\t\n\tif (PyArray_ISFLEXIBLE(self)) {\n\t\tchar buf[100];\n\t\tsnprintf(buf, sizeof(buf), \"%d\", self->itemsize);\n\t\tsprintf(string+n, \", '%c%s')\", self->descr->type, buf);\n\t\tret = PyString_FromStringAndSize(string, n+6+strlen(buf));\n\t}\n\telse {\n\t\tsprintf(string+n, \", '%c')\", self->descr->type);\n\t\tret = PyString_FromStringAndSize(string, n+6);\n\t}\n\t\n\n free(string);\n return ret;\n}\n\nstatic PyObject *PyArray_StrFunction=NULL;\nstatic PyObject *PyArray_ReprFunction=NULL;\n\nstatic void \nPyArray_SetStringFunction(PyObject *op, int repr) \n{\n if (repr) {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_ReprFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_ReprFunction = op; \n } else {\n\t\t/* Dispose of previous callback */\n Py_XDECREF(PyArray_StrFunction); \n\t\t/* Add a reference to new callback */\n Py_XINCREF(op); \n\t\t/* Remember new callback */\n PyArray_StrFunction = op; \n }\n}\n\nstatic PyObject *\narray_repr(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_ReprFunction == NULL) {\n s = array_repr_builtin(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_ReprFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\nstatic PyObject *\narray_str(PyArrayObject *self) \n{\n PyObject *s, *arglist;\n\t\n if (PyArray_StrFunction == NULL) {\n s = array_repr(self);\n } else {\n arglist = Py_BuildValue(\"(O)\", self);\n s = PyEval_CallObject(PyArray_StrFunction, arglist);\n Py_DECREF(arglist); \n }\n return s;\n}\n\n\nstatic PyObject *\narray_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) \n{\n PyObject *array_other, *result;\n\n switch (cmp_op) \n {\n case Py_LT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less);\n case Py_LE:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.less_equal);\n case Py_EQ:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then return the integer\n\t\t\t object 0. This fixes code that used to\n\t\t\t allow equality comparisons between arrays\n\t\t\t and other objects which would give a result\n\t\t\t of 0\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.equal);\n /* If the comparison results in NULL, then the \n\t\t\t two array objects can not be compared together so \n\t\t\t return zero \n */\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_False);\n return Py_False;\n }\n return result;\n case Py_NE:\n /* Try to convert other to an array */\n array_other = PyArray_FromObject(other, \n\t\t\t\t\t\t\t PyArray_NOTYPE, 0, 0);\n /* If not successful, then objects cannot be \n\t\t\t compared and cannot be equal, therefore, \n\t\t\t return True;\n */\n if ((array_other == NULL) || \\\n\t\t\t (array_other == Py_None)) {\n Py_XDECREF(array_other);\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n result = PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t array_other, \n\t\t\t\t\t\t\t n_ops.not_equal);\n Py_DECREF(array_other);\n if (result == NULL) {\n PyErr_Clear();\n Py_INCREF(Py_True);\n return Py_True;\n }\n return result;\n case Py_GT:\n return PyArray_GenericBinaryFunction(self, other, \n\t\t\t\t\t\t\t n_ops.greater);\n case Py_GE:\n return PyArray_GenericBinaryFunction(self, \n\t\t\t\t\t\t\t other, \n\t\t\t\t\t \t n_ops.greater_equal);\n }\n return NULL;\n}\n\nstatic PyObject *\n_check_axis(PyArrayObject *arr, int *axis, int flags)\n{\n\tPyObject *temp;\n\tint n = arr->nd;\n\n\tif ((*axis >= MAX_DIMS) || (n==0)) {\n\t\ttemp = PyArray_Ravel(arr,0);\n\t\t*axis = 0;\n\t\treturn temp;\n\t}\n\telse {\n\t\tif (flags) {\n\t\t\ttemp = PyArray_FromAny((PyObject *)arr, NULL, \n\t\t\t\t\t 0, 0, flags);\n\t\t\tif (temp == NULL) return NULL;\n\t\t}\n\t\telse {\n\t\t\tPy_INCREF(arr);\n\t\t\ttemp = (PyObject *)arr;\n\t\t}\n\t}\n\tif (*axis < 0) *axis += n;\n\tif ((*axis < 0) || (*axis >= n)) {\n\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t \"axis(=%d) out of bounds\", *axis);\n\t\tPy_DECREF(temp);\n\t\treturn NULL;\n\t}\n\treturn temp;\n}\n\n#include \"arraymethods.c\"\n\n/* Lifted from numarray */\nstatic PyObject *\nPyArray_IntTupleFromIntp(int len, intp *vals)\n{\n\tint i;\n PyObject *intTuple = PyTuple_New(len);\n if (!intTuple) goto fail;\n for(i=0; ind == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i = ap->nd-1; i >= 0; --i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int \n_IsFortranContiguous(PyArrayObject *ap) \n{\n\tint sd;\n\tint i;\n\t\n\tif (ap->nd == 0) return 1;\n\tsd = ap->itemsize;\n\tif (ap->nd == 1) return sd == ap->strides[0];\n\tfor (i=0; i< ap->nd; ++i) {\n\t\t/* contiguous by definition */\n\t\tif (ap->dimensions[i] == 0) return 1; \n\t\t\n\t\tif (ap->strides[i] != sd) return 0;\n\t\tsd *= ap->dimensions[i];\n\t}\n\treturn 1;\n}\n\n\nstatic int\n_IsAligned(PyArrayObject *ap) \n{\n\tint i, alignment, aligned=1;\n\tintp ptr;\n\tint type = ap->descr->type_num;\n\n\tif ((type == PyArray_STRING) || (type == PyArray_VOID))\n\t\treturn 1;\n\n\talignment = ap->descr->alignment;\n\n\tptr = (intp) ap->data;\n aligned = (ptr % alignment) == 0;\n for (i=0; i nd; i++)\n aligned &= ((ap->strides[i] % alignment) == 0);\n return aligned != 0;\n}\n\nstatic Bool\n_IsWriteable(PyArrayObject *ap)\n{\n\tPyObject *base=ap->base;\n\tPyBufferProcs *pb;\n\n\t/* If we own our own data, then no-problem */\n\tif ((base == NULL) || (ap->flags & OWN_DATA)) return TRUE;\n\n\t/* Get to the final base object \n\t If it is a writeable array, then return TRUE\n\t If we can find an array object \n\t or a writeable buffer object as the final base object\n\t or a string object (for pickling support memory savings).\n\t - this last could be removed if a proper pickleable \n\t buffer was added to Python.\n\t*/\n\n\twhile(PyArray_Check(base)) {\n\t\tif (PyArray_CHKFLAGS(base, OWN_DATA)) \n\t\t\treturn (Bool) (PyArray_ISWRITEABLE(base));\n\t\tbase = PyArray_BASE(base);\n\t}\n\n\t/* here so pickle support works seamlessly \n\t and unpickled array can be set and reset writeable \n\t -- could be abused -- */\n\tif PyString_Check(base) return TRUE;\n\n\tpb = base->ob_type->tp_as_buffer;\n\tif (pb == NULL || pb->bf_getwritebuffer == NULL)\n\t\treturn FALSE;\n\t\n\treturn TRUE;\n}\n\n\nstatic void\nPyArray_UpdateFlags(PyArrayObject *ret, int flagmask)\n{\n\n\tif (flagmask & FORTRAN) {\n\t\tif (_IsFortranContiguous(ret)) {\n\t\t\tret->flags |= FORTRAN;\n\t\t\tif (ret->nd > 1) ret->flags &= ~CONTIGUOUS;\n\t\t}\n\t\telse ret->flags &= ~FORTRAN;\n\t}\n\tif (flagmask & CONTIGUOUS) {\n\t\tif (_IsContiguous(ret)) {\n\t\t\tret->flags |= CONTIGUOUS;\n\t\t\tif (ret->nd > 1) ret->flags &= ~FORTRAN;\n\t\t}\n\t\telse ret->flags &= ~CONTIGUOUS;\n\t}\n\tif (flagmask & ALIGNED) {\n\t\tif (_IsAligned(ret)) ret->flags |= ALIGNED;\n\t\telse ret->flags &= ~ALIGNED;\n\t}\n\treturn;\n}\n\n/* This routine checks to see if newstrides (of length nd) will not \n walk outside of the memory implied by either numbytes or\n a single segment array of the provided dimensions and element size if\n numbytes is 0 */\nstatic Bool\nPyArray_CheckStrides(int elsize, int nd, intp numbytes, \n\t\t intp *dims, intp *newstrides)\n{\n\tint i;\n\t\n\tif (numbytes == 0) \n\t\tnumbytes = PyArray_MultiplyList(dims, nd) * elsize;\n\t\n\tfor (i=0; i numbytes) {\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\treturn TRUE;\n\t\n}\n\n\n/* This is the main array creation routine. */\n\n/* Flags argument has multiple related meanings \n depending on data and strides: \n\n If data is given, then flags is flags associated with data. \n If strides is not given, then a contiguous strides array will be created\n and the CONTIGUOUS bit will be set. If the flags argument \n has the FORTRAN bit set, then a FORTRAN-style strides array will be\n created (and of course the FORTRAN flag bit will be set). \n\n If data is not given but created here, then flags will be DEFAULT_FLAGS\n and a non-zero flags argument can be used to indicate a FORTRAN style\n array is desired. \n*/\n\nstatic intp\n_array_fill_strides(intp *strides, intp *dims, int nd, intp itemsize, \n\t\t int inflag, int *objflags) \n{\n\tint i;\n\t/* Only make Fortran strides if not contiguous as well */\n\tif ((inflag & FORTRAN) && !(inflag & CONTIGUOUS)) {\n\t\tfor (i=0; i 1) *objflags &= ~CONTIGUOUS;\n\t\telse *objflags |= CONTIGUOUS;\n\t}\n\telse {\n\t\tfor (i=nd-1;i>=0;i--) {\n\t\t\tstrides[i] = itemsize;\n\t\t\titemsize *= dims[i] ? dims[i] : 1;\n\t\t}\n\t\t*objflags |= CONTIGUOUS;\n\t\tif (nd > 1) *objflags &= ~FORTRAN;\n\t\telse *objflags |= FORTRAN;\n\t}\n\treturn itemsize;\n}\n\n\t\nstatic PyObject *\nPyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num,\n intp *strides, char *data, int itemsize, int flags,\n\t PyObject *obj)\n{\n\tPyArrayObject *self;\n\tPyArray_Descr *descr;\n\tregister int i;\n\tintp sd, temp;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\tif (descr == NULL) return NULL;\n\n\tif (nd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"number of dimensions must be >=0\");\n\t\treturn NULL;\n\t}\n if (nd > MAX_DIMS) {\n PyErr_Format(PyExc_ValueError,\n \"maximum number of dimensions is %d\", MAX_DIMS);\n return NULL;\n\t}\n\n\t/* Check dimensions */\n\tfor (i=nd-1;i>=0;i--) {\n\t\tif (dims[i] < 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"negative dimensions\"\t\\\n\t\t\t\t\t\" are not allowed.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n\tself = (PyArrayObject *) subtype->tp_alloc(subtype, 0);\n\tif (self == NULL) return NULL;\t\n\tself->descr = descr;\n\tself->dimensions = NULL;\n\tif (data == NULL) { /* strides is NULL too */\n\t\tself->flags = DEFAULT_FLAGS;\n\t\tif (flags) {\n\t\t\tself->flags |= FORTRAN; \n\t\t\tif (nd > 1) self->flags &= ~CONTIGUOUS;\n\t\t\tflags = FORTRAN;\n\t\t}\n\t}\n\telse self->flags = (flags & ~UPDATEIFCOPY);\n\t\n\tif (PyTypeNum_ISFLEXIBLE(type_num)) {\n\t\tif (itemsize < 1) {\n\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\"Type must provide an itemsize.\");\n\t\t\tPyObject_Del(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tself->itemsize = itemsize;\n\t\t/* Guarantee that these kind of arrays are never byteswapped\n\t\t unknowingly. \n\t\t*/\n\t\tif (type_num != PyArray_UNICODE)\n\t\t\tself->flags |= NOTSWAPPED;\n\t}\n\telse self->itemsize = descr->elsize; \n\t\t\n\tsd = self->itemsize;\n\t\n\tif (nd > 0) {\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, dims, sizeof(intp)*nd);\n\t\tif (strides == NULL) { /* fill it in */\n\t\t\tsd = _array_fill_strides(self->strides, dims, nd, sd,\n\t\t\t\t\t\t flags, &(self->flags));\n\t\t}\n\t\telse {\n\t\t\tif (data == NULL) {\n\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\"If strides is given in \" \\\n\t\t\t\t\t\t\"array creation, data must \" \\\n\t\t\t\t\t\t\"be given too.\");\n\t\t\t\tPyObject_Del(self);\n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\t\treturn NULL;\n\t\t\t}\t\t\t\t\t\n\t\t\tmemcpy(self->strides, strides, sizeof(intp)*nd);\n\t\t}\n\t}\n \t\n\t\t\n\tif (data == NULL) {\n\n\t\t/* Make sure we are aligned on void ptrs (without wasting\n\t\t space if we already are). But, also, allocate something \n\t\t even for zero-space arrays e.g. shape=(0,) -- otherwise\n buffer exposure (a.data) doesn't work as it should. */\n\n\t\tif (sd==0) sd = sizeof(intp);\n\t\telse if ((temp=sd%sizeof(intp))) sd += sizeof(intp) - temp;\n\n\t\tif ((data = PyDataMem_NEW(sd))==NULL) {\n\t\t\tPyObject_Del(self);\n\t\t\tif (self->dimensions != NULL) \n\t\t\t\tPyDimMem_FREE(self->dimensions);\n\t\t\treturn PyErr_NoMemory();\n\t\t}\n\t\tself->flags |= OWN_DATA;\n\n\t\t/* It is bad to have unitialized OBJECT pointers */\n\t\t/* We shouldn't need to check for the OBJECT Letter\n\t\t but perhaps it's best. */\n\t\tif (type_num == PyArray_OBJECT || \\\n\t\t type_num == PyArray_OBJECTLTR) {\n\t\t\tmemset(data, 0, sd);\n\t\t}\n\t}\n\telse {\n self->flags &= ~OWN_DATA; /* If data is passed in, \n\t\t\t\t\t this object won't own it \n\t\t\t\t\t by default.\n\t\t\t\t\t Caller must arrange for \n\t\t\t\t\t this to be reset if truly\n\t\t\t\t\t desired */\n }\n self->data = data;\n\tself->nd = nd;\n\tself->base = (PyObject *)NULL;\n self->weakreflist = (PyObject *)NULL;\n\n /* call the __array_finalize__\n\t method if a subtype and some object passed in */\n\tif ((obj != NULL) && (subtype != &PyArray_Type) && \n\t (subtype != &PyBigArray_Type)) {\n\t\tPyObject *res;\n\t\tres = PyObject_CallMethod((PyObject *)self, \n\t\t\t\t\t \"__array_finalize__\",\n\t\t\t\t\t \"O\", obj);\n\t\tif (res == NULL) PyErr_Clear();\n\t\telse Py_DECREF(res);\n\t}\n\n\treturn (PyObject *)self;\n}\n\n\n\nstatic PyObject * \nPyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape)\n{\n intp oldsize, newsize;\n int new_nd=newshape->len, k, n, elsize;\n int refcnt;\n intp* new_dimensions=newshape->ptr;\n intp new_strides[MAX_DIMS];\n intp sd;\n intp *dimptr;\n char *new_data;\n\t\n if (!PyArray_ISCONTIGUOUS(self)) {\n PyErr_SetString(PyExc_ValueError, \n \"resize only works on contiguous arrays\");\n return NULL;\n }\n\n\n newsize = PyArray_MultiplyList(new_dimensions, new_nd);\n\n if (newsize == 0) {\n PyErr_SetString(PyExc_ValueError, \n \"Newsize is zero. Cannot delete an array \"\\\n \"in this way.\");\n return NULL;\n }\n oldsize = PyArray_SIZE(self);\n \n\tif (oldsize != newsize) {\n\t\tif (!(self->flags & OWN_DATA)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize this array: \"\t\\\n\t\t\t\t\t\"it does not own its data.\");\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\trefcnt = (((PyObject *)self)->ob_refcnt);\n\t\tif ((refcnt > 2) || (self->base != NULL) || \\\n\t\t (self->weakreflist != NULL)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"cannot resize an array that has \"\\\n\t\t\t\t\t\"been referenced or is referencing\\n\"\\\n\t\t\t\t\t\"another array in this way. Use the \"\\\n\t\t\t\t\t\"resize function.\");\n\t\t\treturn NULL;\n\t\t} \n\t\t\n\t\t/* Reallocate space if needed */\n\t\tnew_data = PyDataMem_RENEW(self->data, \n\t\t\t\t\t newsize*(self->itemsize));\n\t\tif (new_data == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n\t\t\t\t\t\"can't allocate memory for array.\");\n\t\t\treturn NULL;\n\t\t}\n\t\tself->data = new_data;\n\t}\n \n if ((newsize > oldsize) && PyArray_ISWRITEABLE(self)) { \n\t\t/* Fill new memory with zeros */\n elsize = self->itemsize;\n\t\tif ((PyArray_TYPE(self) == PyArray_OBJECT)) {\n\t\t\tPyObject *zero = PyInt_FromLong(0);\n PyObject **optr;\n\t\t\toptr = ((PyObject **)self->data) + oldsize;\n\t\t\tn = newsize - oldsize;\n\t\t\tfor (k=0; kdata+oldsize*elsize, 0, \n\t\t\t (newsize-oldsize)*elsize);\n\t\t}\n\t}\n \n if (self->nd != new_nd) { /* Different number of dimensions. */\n self->nd = new_nd;\n \n /* Need new dimensions and strides arrays */\n dimptr = PyDimMem_RENEW(self->dimensions, 2*new_nd);\n if (dimptr == NULL) {\n\t\t\tPyErr_SetString(PyExc_MemoryError, \n \"can't allocate memory for array \" \\\n \"(array may be corrupted).\");\n return NULL;\n }\n self->dimensions = dimptr;\n\t\tself->strides = dimptr + new_nd;\n }\n\n /* make new_strides variable */\n sd = (intp) self->itemsize;\n sd = _array_fill_strides(new_strides, new_dimensions, new_nd, sd,\n 0, &(self->flags));\n\n \n memmove(self->dimensions, new_dimensions, new_nd*sizeof(intp));\n memmove(self->strides, new_strides, new_nd*sizeof(intp));\n\n Py_INCREF(Py_None);\t\n return Py_None;\n \n}\n\n\nstatic void\nPyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj)\n{\n PyObject **optr;\n intp i,n;\n optr = (PyObject **)(arr->data);\n n = PyArray_SIZE(arr);\n if (obj == NULL) {\n for (i=0; ibase = buffer.base;\n Py_INCREF(buffer.base); \n }\n\n PyDimMem_FREE(dims.ptr);\n if (strides.ptr) PyDimMem_FREE(strides.ptr);\n return PyArray_Return(ret);\n \n fail:\n if (dims.ptr) free(dims.ptr);\n if (strides.ptr) free(strides.ptr);\n return NULL;\n}\n\n\n\n/******************* array attribute get and set routines ******************/\n\nstatic PyObject *\narray_ndim_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong(self->nd);\n}\n\nstatic PyObject *\narray_flags_get(PyArrayObject *self)\n{\n static PyObject *module=NULL;\n\n if (module==NULL) {\n module = PyImport_ImportModule(\"scipy.base._internal\");\n if (module == NULL) return NULL;\n }\n return PyObject_CallMethod(module, \"flagsobj\", \"Oi\", \n self, self->flags);\n}\n\n/*\nstatic int\narray_flags_set(PyArrayObject *self, PyObject *obj) \n{\n\tint flagback = self->flags;\n\n if (PyDict_Check(obj)) {\n PyObject *new;\n\t\tnew = PyDict_GetItemString(obj, \"ALIGNED\");\n\t\tif (new) {\n\t\t\tif (PyObject_Not(new)) self->flags &= ~ALIGNED;\n\t\t\telse if (_IsAligned(self)) self->flags |= ALIGNED;\n\t\t\telse {\n\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\"cannot set aligned flag of \" \\\n\t\t\t\t\t\t\"mis-aligned array to True\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n new = PyDict_GetItemString(obj, \"UPDATEIFCOPY\");\n if (new) {\n if (PyObject_Not(new)) {\n self->flags &= ~UPDATEIFCOPY;\n Py_DECREF(self->base);\n self->base = NULL;\n }\n else {\n\t\t\t\tself->flags = flagback;\n PyErr_SetString(PyExc_ValueError, \n \"cannot set UPDATEIFCOPY\" \\\n \"flag to True\");\n return -1;\n }\n }\n new = PyDict_GetItemString(obj, \"WRITEABLE\");\n if (new) {\n\t\t\tif (PyObject_IsTrue(new)) {\n\t\t\t\tif (_IsWriteable(self)) {\n\t\t\t\t\tself->flags |= WRITEABLE;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself->flags = flagback;\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError,\n\t\t\t\t\t\t\t\"cannot set \"\t\\\n\t\t\t\t\t\t\t\"WRITEABLE \"\t\\\n\t\t\t\t\t\t\t\"flag to True of \"\\\n\t\t\t\t\t\t\t\"this array \");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n else\n self->flags &= ~WRITEABLE;\n }\n new = PyDict_GetItemString(obj, \"NOTSWAPPED\");\n if (new) {\n if (PyObject_IsTrue(new))\n self->flags |= NOTSWAPPED;\n else {\n self->flags &= ~NOTSWAPPED;\n\t\t\t}\n\t\t}\n return 0;\n }\n PyErr_SetString(PyExc_ValueError, \n \"Object must be a dictionary\");\n return -1;\n}\n*/\n\n\nstatic PyObject *\narray_shape_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->dimensions);\n}\n\n\nstatic int\narray_shape_set(PyArrayObject *self, PyObject *val)\n{\n \tint nd;\n\tPyObject *ret;\n\n\tif (!PyTuple_Check(val)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"shape must be a tuple\");\n\t\treturn -1;\n\t}\n\tret = PyArray_Reshape(self, val);\n\tif (ret == NULL) return -1;\n\t\n\tif (self->nd > 0) { /* Free old dimensions and strides */\n\t\tPyDimMem_FREE(self->dimensions);\n\t}\n\tnd = PyArray_NDIM(ret);\n\tself->nd = nd;\n\tif (nd > 0) { /* create new dimensions and strides */\n\t\tself->dimensions = PyDimMem_NEW(2*nd);\n\t\tif (self->dimensions == NULL) {\n\t\t\tPy_DECREF(ret);\n\t\t\tPyErr_SetString(PyExc_MemoryError,\"\");\n\t\t\treturn -1;\n\t\t}\n\t\tself->strides = self->dimensions + nd;\n\t\tmemcpy(self->dimensions, PyArray_DIMS(ret), \n\t\t nd*sizeof(intp));\n\t\tmemcpy(self->strides, PyArray_STRIDES(ret), \n\t\t nd*sizeof(intp));\n\t}\n\telse self->dimensions=NULL;\n\tPy_DECREF(ret);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_strides_get(PyArrayObject *self)\n{\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic int\narray_strides_set(PyArrayObject *self, PyObject *obj)\n{\n\tPyArray_Dims newstrides = {NULL, 0};\n\tPyArrayObject *new;\n\tintp numbytes;\n\n\tif (!PyArray_IntpConverter(obj, &newstrides) || \\\n\t newstrides.ptr == NULL) {\n\t\tPyErr_SetString(PyExc_TypeError, \"invalid strides.\");\n\t\treturn -1;\n\t}\n\tif (newstrides.len != self->nd) {\n\t\tPyErr_Format(PyExc_ValueError, \"strides must be \"\t\\\n\t\t\t \" same length as shape (%d)\", self->nd);\n\t\treturn -1;\n\t}\n\tnew = self;\n\twhile(new->base != NULL) {\n\t\tif (PyArray_Check(new->base)) \n\t\t\tnew = (PyArrayObject *)new->base;\n\t}\n\tnumbytes = PyArray_MultiplyList(new->dimensions, \n\t\t\t\t\tnew->nd)*new->itemsize;\n\t\n\tif (!PyArray_CheckStrides(self->itemsize, self->nd, numbytes, \n\t\t\t\t self->dimensions, newstrides.ptr)) {\n\t\tPyErr_SetString(PyExc_ValueError, \"strides is not \"\\\n\t\t\t\t\"compatible with available memory\");\n\t\treturn -1;\n\t}\n\tmemcpy(self->strides, newstrides.ptr, sizeof(intp)*newstrides.len);\n\tPyArray_UpdateFlags(self, CONTIGUOUS | FORTRAN);\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_protocol_strides_get(PyArrayObject *self)\n{\n\tif PyArray_ISCONTIGUOUS(self) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\treturn PyArray_IntTupleFromIntp(self->nd, self->strides);\n}\n\nstatic PyObject *\narray_priority_get(PyArrayObject *self)\n{\n\tif (PyArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_PRIORITY);\n\telse if (PyBigArray_CheckExact(self)) \n\t\treturn PyFloat_FromDouble(PyArray_BIG_PRIORITY);\n\telse\n\t\treturn PyFloat_FromDouble(PyArray_SUBTYPE_PRIORITY);\n}\n\n\nstatic PyObject *\narray_data_get(PyArrayObject *self)\n{\n\tintp nbytes;\n\tif (!(PyArray_ISONESEGMENT(self))) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot get single-\"\\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn NULL;\n\t}\t\t\n\tnbytes = PyArray_NBYTES(self);\n\tif PyArray_ISWRITEABLE(self) \n\t\treturn PyBuffer_FromReadWriteObject((PyObject *)self, 0, \n\t\t\t\t\t\t (int) nbytes);\n\telse\n\t\treturn PyBuffer_FromObject((PyObject *)self, 0, (int) nbytes);\n}\n\nstatic int\narray_data_set(PyArrayObject *self, PyObject *op)\n{\n\tvoid *buf;\n\tint buf_len;\n\tint writeable=1;\n\n\tif (PyObject_AsWriteBuffer(op, &buf, &buf_len) < 0) {\n\t\twriteable = 0;\n\t\tif (PyObject_AsReadBuffer(op, (const void **)&buf, \n\t\t\t\t\t &buf_len) < 0) {\n\t\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\t\"Object does not have single-segment\" \\\n\t\t\t\t\t\"buffer interface\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\tif (!PyArray_ISONESEGMENT(self)) {\n\t\tPyErr_SetString(PyExc_AttributeError, \"Cannot set single-\" \\\n\t\t\t\t\"segment buffer for discontiguous array\");\n\t\treturn -1;\n\t}\n\tif (PyArray_NBYTES(self) > buf_len) {\n\t\tPyErr_SetString(PyExc_AttributeError, \n\t\t\t\t\"Not enough data for array.\");\n\t\treturn -1;\n\t}\n\tif (self->flags & OWN_DATA) {\n\t\tPyArray_XDECREF(self);\n\t\tPyDataMem_FREE(self->data);\n\t}\n\tif (self->base) {\n\t\tif (self->flags & UPDATEIFCOPY) {\n\t\t\t((PyArrayObject *)self->base)->flags |= WRITEABLE;\n\t\t\tself->flags &= ~UPDATEIFCOPY;\n\t\t}\n\t\tPy_DECREF(self->base);\n\t}\n\tPy_INCREF(op);\n\tself->base = op;\n\tself->data = buf;\n\tself->flags = CARRAY_FLAGS;\n\tif (!writeable)\n\t\tself->flags &= ~WRITEABLE;\n\treturn 0;\n}\n\n\nstatic PyObject *\narray_itemsize_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->itemsize);\n}\n\nstatic PyObject *\narray_size_get(PyArrayObject *self)\n{\n\tlonglong size=PyArray_SIZE(self);\n\tif (size > MAX_INT || size < MIN_INT)\n\t\treturn PyLong_FromLongLong((longlong) size);\n\telse \n\t\treturn PyInt_FromLong((long) size);\n}\n\n\nstatic PyObject *\narray_typechar_get(PyArrayObject *self)\n{\n\tif PyArray_ISFLEXIBLE(self) \n\t\treturn PyString_FromFormat(\"%c%d\", (self->descr->type),\n\t\t\t\t\t self->itemsize);\n\telse \n\t\treturn PyString_FromStringAndSize(&(self->descr->type), 1);\n}\n\nstatic PyObject *\narray_typestr_get(PyArrayObject *self)\n{\n\tstatic char endians[] = \"<>\";\n\tchar endian;\n\tint which;\n\tunsigned long val = 1;\n\tchar *s;\n\tchar basic_=self->descr->kind;\n\n\ts = (char *)&val; /* s[0] == 0 implies big-endian */\n\twhich = (PyArray_ISNOTSWAPPED(self) ? 0 : 1);\n\tif (s[0] == 0) which = 1 - which;\n\tendian = endians[which]; \n\t\n\tif ((basic_==PyArray_VOIDLTR) || (basic_==PyArray_STRINGLTR) || \\\n\t (basic_==PyArray_OBJECTLTR) || (self->itemsize == 1))\n\t\treturn PyString_FromFormat(\"|%c%d\", basic_, self->itemsize);\n\telse\n\t\treturn PyString_FromFormat(\"%c%c%d\", endian, basic_,\n\t\t\t\t\t self->itemsize);\n}\n\nstatic PyObject *\narray_descr_get(PyArrayObject *self)\n{\n\tPyObject *res;\n\tPyObject *dobj;\n\n\t/* hand this off to the typeobject */\n\t/* or give default */\n\tif (PyArray_ISUSERDEF(self)) {\n\t\tres = PyObject_GetAttrString((PyObject *)self->descr->typeobj, \n\t\t\t\t\t \"__array_descr__\");\n\t\tif (res) return res;\n\t\tPyErr_Clear();\n\t}\n\t/* get default */\n\tdobj = PyTuple_New(2);\n\tif (dobj == NULL) return NULL;\n\tPyTuple_SET_ITEM(dobj, 0, PyString_FromString(\"\"));\n\tPyTuple_SET_ITEM(dobj, 1, array_typestr_get(self));\n\tres = PyList_New(1);\n\tif (res == NULL) {Py_DECREF(dobj); return NULL;}\n\tPyList_SET_ITEM(res, 0, dobj);\n\treturn res;\n}\n\nstatic PyObject *\narray_typenum_get(PyArrayObject *self)\n{\n\treturn PyInt_FromLong((long) self->descr->type_num);\n}\n\n\nstatic PyObject *\narray_type_get(PyArrayObject *self)\n{\n\treturn PyArray_TypeObjectFromType(self->descr->type_num);\n}\n\n/* If the type is changed. \n Also needing change: strides, itemsize\n\n Either itemsize is exactly the same\n or the array is single-segment (contiguous or fortran) with\n compatibile dimensions\n\n*/\n\nstatic int\narray_type_set(PyArrayObject *self, PyObject *arg)\n{\n PyArray_Typecode newtype = {PyArray_NOTYPE, 0, 0};\n intp newdim;\n int index;\n char *msg = \"new type not compatible with array.\";\n\n if ((PyArray_TypecodeConverter(arg, &newtype) < 0) ||\n newtype.type_num == PyArray_NOTYPE) {\n PyErr_SetString(PyExc_TypeError, \"Invalid type for array\");\n return -1;\n }\n if (!(PyArray_ISONESEGMENT(self) ||\t\t\\\n\t (newtype.itemsize != self->itemsize))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1; \n }\n\n\tif (PyArray_ISCONTIGUOUS(self)) index = self->nd - 1;\n\telse index = 0;\n\n if (newtype.itemsize < self->itemsize) {\n /* if it is compatible increase the size of the dimension\n at end (or at the front for FORTRAN)\n */\n if (self->itemsize % newtype.itemsize != 0) {\n PyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n newdim = self->itemsize / newtype.itemsize;\n\t\tself->dimensions[index] *= newdim;\n self->strides[index] = newtype.itemsize;\n\t}\n \n else if (newtype.itemsize > self->itemsize) {\n \n /* Determine if last (or first if FORTRAN) dimension\n is compatible */\n\n\t\tnewdim = self->dimensions[index] * self->itemsize;\n if ((newdim % newtype.itemsize) != 0) {\n\t\t\tPyErr_SetString(PyExc_ValueError, msg);\n return -1;\n }\n\t\t\n self->dimensions[index] = newdim / newtype.itemsize;\n self->strides[index] = newtype.itemsize;\n\t\t\n }\n\t\n \n /* fall through -- adjust type*/\n\n self->descr = PyArray_DescrFromType(newtype.type_num);\n self->itemsize = newtype.itemsize;\n PyArray_UpdateFlags(self, ALIGNED);\n return 0;\n\n}\n\n\n\nstatic PyObject *\narray_base_get(PyArrayObject *self)\n{\n\tif (self->base == NULL) {\n\t\tPy_INCREF(Py_None);\n\t\treturn Py_None;\n\t}\n\telse {\n\t\tPy_INCREF(self->base);\n\t\treturn self->base;\n\t}\n}\n\n\nstatic PyObject *\narray_real_get(PyArrayObject *self)\n{\n\tPyArrayObject *ret;\n\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *)ret;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\treturn (PyObject *)self;\n\t}\n}\n\n\nstatic int\narray_real_set(PyArrayObject *self, PyObject *val)\n{\n\tPyArrayObject *ret;\n\tPyArrayObject *new;\n\tint rint;\n\n\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0);\n\tif (new == NULL) return -1;\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return -1;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t}\n\telse {\n\t\tPy_INCREF(self);\n\t\tret = self;\n\t}\t\n\trint = PyArray_CopyInto(ret, new);\n\tPy_DECREF(ret);\n\treturn rint;\n}\n\nstatic PyObject *\narray_imag_get(PyArrayObject *self)\n{\t\n\tPyArrayObject *ret;\n\tint itemsize;\n\tint typenum;\n PyArray_Typecode type;\n\t\n\ttype.type_num = self->descr->type_num;\n\ttype.itemsize = self->itemsize;\n\ttype.fortran = PyArray_ISFORTRAN(self);\n\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\titemsize = self->itemsize >> 1;\n\t\ttypenum = self->descr->type_num - PyArray_NUM_FLOATTYPE;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t typenum,\n\t\t\t\t\t\t self->strides,\n\t\t\t\t\t\t self->data + itemsize,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) return NULL;\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\treturn (PyObject *) ret;\n\t}\n\telse {\n\t\tret = (PyArrayObject *)PyArray_Zeros(self->nd, \n\t\t\t\t\t\t self->dimensions, &type);\n\t\tret->flags &= ~WRITEABLE;\n\t\treturn (PyObject *)ret;\n\t}\n}\n\nstatic int\narray_imag_set(PyArrayObject *self, PyObject *val)\n{\t\n\tif (PyArray_ISCOMPLEX(self)) {\n\t\tPyArrayObject *ret;\n\t\tPyArrayObject *new;\n\t\tint rint;\n\n\t\tnew = (PyArrayObject *)PyArray_FromAny(val, NULL, 0, 0, 0); \n\t\tif (new == NULL) return -1;\n\t\tret = (PyArrayObject *)PyArray_New(self->ob_type,\n\t\t\t\t\t\t self->nd,\n\t\t\t\t\t\t self->dimensions,\n\t\t\t\t\t\t self->descr->type_num - \\\n\t\t\t\t\t\t PyArray_NUM_FLOATTYPE,\n\t\t\t\t\t\t self->strides+ \\\n\t\t\t\t\t\t (self->itemsize >> 1) ,\n \t\t\t\t\t\t self->data,\n\t\t\t\t\t\t 0,\n\t\t\t\t\t\t self->flags, (PyObject *)self);\n\t\tif (ret == NULL) {\n\t\t\tPy_DECREF(new); \n\t\t\treturn -1;\n\t\t}\n\t\tret->flags &= ~CONTIGUOUS;\n\t\tret->flags &= ~FORTRAN;\n\t\tPy_INCREF(self);\n\t\tret->base = (PyObject *)self;\n\t\trint = PyArray_CopyInto(ret, new);\n\t\tPy_DECREF(ret);\t\t\n\t\tPy_DECREF(new);\n\t\treturn rint;\n\t}\n\telse {\n\t\tPyErr_SetString(PyExc_TypeError, \"Does not have imaginary \" \\\n\t\t\t\t\"part to set.\");\n\t\treturn -1;\n\t}\n}\n\nstatic PyObject *\narray_flat_get(PyArrayObject *self)\n{\n return PyArray_IterNew((PyObject *)self);\n}\n\nstatic int \narray_flat_set(PyArrayObject *self, PyObject *val)\n{\n\tPyObject *arr=NULL;\n\tint retval = -1;\n\tPyArrayIterObject *selfit=NULL, *arrit=NULL;\n\tPyArray_Typecode typecode;\n int swap;\n PyArray_CopySwapFunc *copyswap;\n\n\ttypecode.type_num = self->descr->type_num;\n\ttypecode.itemsize = self->itemsize;\n\ttypecode.fortran = PyArray_ISFORTRAN(self);\n\t\n\tarr = PyArray_FromAny(val, &typecode, \n\t\t\t 0, 0, FORCECAST);\n\tif (arr == NULL) return -1;\n\tarrit = (PyArrayIterObject *)PyArray_IterNew(arr);\n\tif (arrit == NULL) goto exit;\n\tselfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);\n\tif (selfit == NULL) goto exit;\n\n swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);\n copyswap = self->descr->copyswap;\n if (PyArray_ISOBJECT(self)) {\n while(selfit->index < selfit->size) {\n Py_XDECREF(*((PyObject **)selfit->dataptr));\n Py_INCREF(*((PyObject **)arrit->dataptr)); \n memmove(selfit->dataptr, arrit->dataptr, \n sizeof(PyObject *));\n copyswap(selfit->dataptr, NULL, swap, \n sizeof(PyObject *));\n PyArray_ITER_NEXT(selfit);\n PyArray_ITER_NEXT(arrit);\n if (arrit->index == arrit->size) \n PyArray_ITER_RESET(arrit);\n }\n retval = 0; \n goto exit;\n }\n\n\twhile(selfit->index < selfit->size) {\n\t\tmemmove(selfit->dataptr, arrit->dataptr, self->itemsize);\n copyswap(selfit->dataptr, NULL, swap, self->itemsize);\n\t\tPyArray_ITER_NEXT(selfit);\n\t\tPyArray_ITER_NEXT(arrit);\n\t\tif (arrit->index == arrit->size) \n\t\t\tPyArray_ITER_RESET(arrit);\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(selfit);\n\tPy_XDECREF(arrit);\n\tPy_XDECREF(arr);\n\treturn retval;\n}\n\nstatic PyGetSetDef array_getsetlist[] = {\n {\"ndim\", \n\t (getter)array_ndim_get, \n\t NULL, \n\t \"number of array dimensions\"},\n {\"flags\", \n\t (getter)array_flags_get, \n NULL,\n\t \"special dictionary of flags\"},\n {\"shape\", \n\t (getter)array_shape_get, \n\t (setter)array_shape_set, \n\t \"tuple of array dimensions\"},\n {\"strides\", \n\t (getter)array_strides_get, \n\t (setter)array_strides_set,\n\t \"tuple of bytes steps in each dimension\"},\n {\"data\", \n\t (getter)array_data_get, \n\t (setter)array_data_set, \n\t \"pointer to start of data\"},\n {\"itemsize\", \n\t (getter)array_itemsize_get, \n\t NULL,\n\t \"length of one element in bytes\"},\n {\"size\",\n (getter)array_size_get,\n\t NULL,\n \"number of elements in the array\"},\n\t{\"base\",\n\t (getter)array_base_get,\n\t NULL,\n\t \"base object\"},\n {\"dtype\", \n\t (getter)array_type_get, \n\t (setter)array_type_set,\n\t \"get array type class\"},\n\t{\"dtypechar\",\n\t (getter)array_typechar_get,\n\t NULL,\n\t \"get array type character code\"},\n\t{\"dtypenum\",\n\t (getter)array_typenum_get,\n\t NULL,\n\t \"get array type number code\"},\n\t{\"dtypestr\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"get array type string\"},\n {\"real\", \n\t (getter)array_real_get, \n\t (setter)array_real_set, \n\t \"real part of array\"},\n {\"imag\", \n\t (getter)array_imag_get, \n\t (setter)array_imag_set, \n\t \"imaginary part of array\"},\n\t{\"flat\", \n\t (getter)array_flat_get, \n\t (setter)array_flat_set, \n\t \"a 1-d view of a contiguous array\"}, \n\t{\"__array_data__\", \n\t (getter)array_data_get,\n\t NULL,\n\t \"Array protocol: data\"},\n\t{\"__array_typestr__\",\n\t (getter)array_typestr_get,\n\t NULL,\n\t \"Array protocol: typestr\"},\n\t{\"__array_descr__\",\n\t (getter)array_descr_get,\n\t NULL,\n\t \"Array protocol: descr\"},\n\t{\"__array_shape__\", \n\t (getter)array_shape_get,\n\t NULL,\n\t \"Array protocol: shape\"},\n\t{\"__array_strides__\",\n\t (getter)array_protocol_strides_get,\n\t NULL,\n\t \"Array protocol: strides\"},\n\t{\"__array_priority__\",\n\t (getter)array_priority_get,\n\t NULL,\n\t \"Array priority\"},\n \t{NULL, NULL, NULL, NULL}, /* Sentinel */\n};\n\n/****************** end of attribute get and set routines *******************/\n\n\n\nstatic char Arraytype__doc__[] = \n \"A array object represents a multidimensional, homogeneous array of basic values. It has the folowing data members, m.shape (the size of each dimension in the array), m.itemsize (the size (in bytes) of each element of the array), and m.typecode (a character representing the type of the array elements). Arrays are sequence, mapping and numeric objects. Sequence indexing is similar to lists, with single indices returning a reference that points to the old array data, and slices returning by copy. A array is also allowed to be indexed by a sequence of items.\t Each member of the sequence indexes the corresponding dimension of the array.\";\n\nstatic PyTypeObject PyBigArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.bigndarray\",\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n /* methods */\n (destructor)array_dealloc,\t\t /*tp_dealloc */\n (printfunc)NULL,\t\t\t /*tp_print*/\n 0,\t\t\t\t\t /*tp_getattr*/\n 0,\t\t\t\t\t /*tp_setattr*/\n (cmpfunc)0, \t\t /*tp_compare*/\n (reprfunc)array_repr,\t\t /*tp_repr*/\n &array_as_number,\t\t\t /*tp_as_number*/\n NULL, \t\t\t /*tp_as_sequence*/\n &array_as_mapping,\t\t\t /*tp_as_mapping*/\n (hashfunc)0,\t\t\t /*tp_hash*/\n (ternaryfunc)0,\t\t\t /*tp_call*/\n (reprfunc)array_str, \t /*tp_str*/\n\t\t\n (getattrofunc)0,\t\t\t /*tp_getattro*/\n (setattrofunc)0,\t\t\t /*tp_setattro*/\n NULL, \t /*tp_as_buffer*/\n (Py_TPFLAGS_DEFAULT \n | Py_TPFLAGS_BASETYPE\n | Py_TPFLAGS_CHECKTYPES), /*tp_flags*/\n /*Documentation string */\n Arraytype__doc__,\t\t\t /*tp_doc*/\n\n (traverseproc)0,\t\t\t /*tp_traverse */\n (inquiry)0,\t\t\t /*tp_clear */\n (richcmpfunc)array_richcompare,\t \n offsetof(PyArrayObject, weakreflist), /*tp_weaklistoffset */\n\n /* Iterator support (use standard) */\n\n (getiterfunc)0, \t\t /* tp_iter */\n (iternextfunc)0,\t\t\t /* tp_iternext */\n\n /* Sub-classing (new-style object) support */\n\n array_methods,\t\t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n array_getsetlist,\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0,\t /* tp_alloc */ \n (newfunc)array_new,\t\t /* tp_new */\n 0,\t \t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n};\n\n/* A standard array will subclass from the Big Array and \n add the array_as_sequence table\n and the array_as_buffer table\n */\n\nstatic PyTypeObject PyArray_Type = { \n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /*ob_size*/\n \"scipy.ndarray\",\t\t\t /*tp_name*/\n sizeof(PyArrayObject),\t\t /*tp_basicsize*/\n 0,\t\t\t\t\t /*tp_itemsize*/\n};\n\n\n/* The rest of this code is to build the right kind of array from a python */\n/* object. */\n\nstatic int \ndiscover_depth(PyObject *s, int max, int stop_at_string) \n{\n int d=0;\n PyObject *e;\n\t\n if(max < 1) return -1;\n\n if(! PySequence_Check(s) || PyInstance_Check(s) || \\\n\t PySequence_Length(s) < 0) {\n PyErr_Clear(); return 0;\n }\n if (PyArray_Check(s))\n\t\treturn PyArray_NDIM(s);\n if(PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))\n\t\treturn stop_at_string ? 0:1;\n if (PySequence_Length(s) == 0) \n\t\treturn 1;\n\t\n if ((e=PySequence_GetItem(s,0)) == NULL) return -1;\n if(e!=s) {\n\t\td=discover_depth(e,max-1, stop_at_string);\n\t\tif(d >= 0) d++;\n\t}\n Py_DECREF(e);\n return d;\n}\n\nstatic int\ndiscover_itemsize(PyObject *s, int nd, int *itemsize) \n{\n\tint n, r, i;\n\tPyObject *e;\n\t\n\tn = PyObject_Length(s);\n\n\tif ((nd == 0) || PyString_Check(s) ||\t\t\\\n\t PyUnicode_Check(s) || PyBuffer_Check(s)) {\n\t\tif PyUnicode_Check(s) \n\t\t\t*itemsize = MAX(*itemsize, sizeof(Py_UNICODE)*n);\n\t\telse\n\t\t\t*itemsize = MAX(*itemsize, n);\n\t\treturn 0;\n\t}\n\tfor (i=0; i n_lower) n_lower = d[1];\n }\n d[1] = n_lower;\n\t\n return 0;\n}\n\nstatic void\n_array_small_type(int chktype, int mintype, int chksize, int minsize, \n\t\t PyArray_Typecode *outtype)\n{\n\touttype->type_num = MAX(chktype, mintype);\n\tif (PyTypeNum_ISFLEXIBLE(outtype->type_num) &&\t\\\n\t PyTypeNum_ISFLEXIBLE(mintype)) {\n\t\t/* Handle string->unicode case separately \n\t\t because string itemsize is twice as large */\n\t\tif (outtype->type_num == PyArray_UNICODE && \n\t\t mintype == PyArray_STRING) {\n\t\t\touttype->itemsize = MAX(chksize, 2*minsize);\n\t\t}\n\t\telse {\n\t\t\touttype->itemsize = MAX(chksize, minsize);\n\t\t}\n\t}\n\telse {\n\t\touttype->itemsize = chksize;\n\t}\n\treturn;\t\n}\n\nstatic void\n_array_find_type(PyObject *op, PyArray_Typecode *minitype, \n\t\t PyArray_Typecode *outtype, int max)\n{\n int l;\n PyObject *ip;\n\tint chktype=0;\n\tint chksize=0;\n\tint mintype, minsize;\n\n\tif (minitype == NULL) {\n\t\tmintype = PyArray_BOOL;\n\t\tminsize = sizeof(Bool);\n\t}\n\telse {\n\t\tmintype = minitype->type_num;\n\t\tminsize = minitype->itemsize;\n\t}\n\n \n if (max < 0 || mintype == -1) goto deflt;\n\t\n if (PyArray_Check(op)) {\n\t\tchktype = PyArray_TYPE(op);\n\t\tchksize = PyArray_ITEMSIZE(op);\n\t\tgoto finish;\n\t}\n\t\n\tif (PyArray_IsScalar(op, Generic)) {\n\t\tPyArray_TypecodeFromScalar(op, outtype);\n\t\tchktype = outtype->type_num;\n\t\tchksize = outtype->itemsize;\n\t\tgoto finish;\n\t}\n\t\n\n if (PyObject_HasAttrString(op, \"__array__\")) {\n ip = PyObject_CallMethod(op, \"__array__\", NULL);\n if(ip && PyArray_Check(ip)) {\n\t\t\tchktype = PyArray_TYPE(ip);\n\t\t\tchksize = PyArray_ITEMSIZE(ip);\n\t\t\tgoto finish;\n\t\t}\n } \n\t\n\tif (PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tint swap=0, res;\n\t\tip = PyObject_GetAttrString(op, \"__array_typestr__\");\n\t\tif (ip && PyString_Check(ip)) {\n\t\t\tres = _array_typecode_fromstr(PyString_AS_STRING(ip), \n\t\t\t\t\t\t &swap, outtype); \n\t\t\tif (res >= 0) {\n\t\t\t\tPy_DECREF(ip);\n\t\t\t\tchktype = outtype->type_num;\n\t\t\t\tchksize = outtype->itemsize;\n\t\t\t\tgoto finish;\n\t\t\t}\n\t\t}\n\t\tPy_XDECREF(ip);\n\t}\n\n if (PyString_Check(op)) {\n\t\tchktype = PyArray_STRING;\n\t\tchksize = PyString_GET_SIZE(op);\n\t\tgoto finish;\n }\n\n\tif (PyUnicode_Check(op)) {\n\t\tchktype = PyArray_UNICODE;\n\t\tchksize = PyUnicode_GET_DATA_SIZE(op);\n\t\tgoto finish;\n\t}\n\n\tif (PyBuffer_Check(op)) {\n\t\tchktype = PyArray_VOID;\n\t\tchksize = op->ob_type->tp_as_sequence->sq_length(op);\n\t\tPyErr_Clear();\n\t\tgoto finish;\n\t}\n\n\tif (PyInstance_Check(op)) goto deflt;\n\t\n if (PySequence_Check(op)) {\n\t\tPyArray_Typecode newtype;\n\t\tnewtype.type_num = mintype;\n\t\tnewtype.itemsize = minsize;\n\t\tnewtype.fortran = 0;\n l = PyObject_Length(op);\n if (l < 0 && PyErr_Occurred()) { \n\t\t\tPyErr_Clear(); \n\t\t\tgoto deflt;\n\t\t}\n if (l == 0 && mintype == 0) {\n\t\t\tnewtype.type_num = PyArray_INTP;\n\t\t\tnewtype.itemsize = sizeof(intp);\n\t\t}\n while (--l >= 0) {\n ip = PySequence_GetItem(op, l);\n if (ip==NULL) {\n\t\t\t\tPyErr_Clear(); \n\t\t\t\tgoto deflt;\n\t\t\t}\n\t\t\t_array_find_type(ip, &newtype, outtype, max-1);\n\t\t\t_array_small_type(outtype->type_num,\n\t\t\t\t\t newtype.type_num, \n\t\t\t\t\t outtype->itemsize,\n\t\t\t\t\t newtype.itemsize,\n\t\t\t\t\t &newtype);\n Py_DECREF(ip);\n }\n\t\tchktype = newtype.type_num;\n\t\tchksize = newtype.itemsize;\n\t\tgoto finish;\n }\n\t\n\tif (PyBool_Check(op)) {\n\t\tchktype = PyArray_BOOL;\n\t\tchksize = sizeof(Bool);\n\t\tgoto finish;\t\t\n\t}\n else if (PyInt_Check(op)) {\n\t\tchktype = PyArray_LONG;\n\t\tchksize = sizeof(long);\n\t\tgoto finish;\n } else if (PyFloat_Check(op)) {\n\t\tchktype = PyArray_DOUBLE;\n\t\tchksize = sizeof(double);\n\t\tgoto finish;\n\t} else if (PyComplex_Check(op)) {\n\t\tchktype = PyArray_CDOUBLE;\n\t\tchksize = sizeof(cdouble);\n\t\tgoto finish;\n\t}\n\n deflt:\n\tchktype = PyArray_OBJECT;\n\tchksize = sizeof(void *);\n\n finish:\n\t_array_small_type(chktype, mintype, chksize, minsize, \n\t\t\t outtype);\n\treturn;\n}\n\nstatic int \nAssign_Array(PyArrayObject *self, PyObject *v) \n{\n PyObject *e;\n int l, r;\n\t\n if (!PySequence_Check(v)) {\n PyErr_SetString(PyExc_ValueError,\n\t\t\t\t\"assignment from non-sequence\");\n return -1;\n }\n\t\n l=PyObject_Length(v);\n if(l < 0) return -1; \n\t\n while(--l >= 0)\n {\n e=PySequence_GetItem(v,l);\n if (e == NULL) return -1; \n\t\t\tr = PySequence_SetItem((PyObject*)self,l,e);\n Py_DECREF(e);\n if(r == -1) return -1;\n }\n return 0;\n}\n\n/* \"Array Scalars don't call this code\" */ \nstatic PyObject *\nArray_FromScalar(PyObject *op, PyArray_Typecode *typecode) \n{\n PyArrayObject *ret;\n\tint itemsize = 0;\n\tint type = typecode->type_num;\n\n\tif PyTypeNum_ISFLEXIBLE(type) {\n\t\titemsize = PyObject_Length(op);\n\t}\n\n\tret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,\n\t\t\t\t\t NULL, NULL, itemsize, 0, NULL);\n\n\tif (ret == NULL) return NULL;\n\n ret->descr->setitem(op, ret->data, ret);\n\t\n if (PyErr_Occurred()) {\n array_dealloc(ret);\n return NULL;\n } else {\n return (PyObject *)ret;\n }\n}\n\n\nstatic PyObject *\nArray_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth)\n{\n PyArrayObject *r;\n int nd;\n\tintp *d;\n\tint stop_at_string;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\t\n\t\n\tstop_at_string = ((type == PyArray_OBJECT) ||\t\\\n\t\t\t (type == PyArray_STRING) ||\t\\\n\t\t\t (type == PyArray_UNICODE) || \\\n\t\t\t (type == PyArray_VOID));\n\n if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string)) > 0)) {\n\t\tif (nd==0)\n\t\t\treturn Array_FromScalar(s, typecode);\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid input sequence\");\n return NULL;\n }\n\t\n if ((max_depth && nd > max_depth) ||\t\\\n\t (min_depth && nd < min_depth)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"invalid number of dimensions\");\n return NULL;\n }\n\t\n\tif ((d=PyDimMem_NEW(nd)) == NULL) {\n\t\treturn PyErr_NoMemory();\n }\n\tif(discover_dimensions(s,nd,d, !stop_at_string) == -1) {\n\t\tPyDimMem_FREE(d);\n\t\treturn NULL;\n\t}\n\tif (itemsize == 0 && PyTypeNum_ISFLEXIBLE(type)) {\n\t\tif (discover_itemsize(s, nd, &itemsize) == -1) {\n\t\t\tPyDimMem_FREE(d);\n\t\t\treturn NULL;\n\t\t}\n\t}\n\t\n r=(PyArrayObject*)PyArray_New(&PyArray_Type, nd, d, \n\t\t\t\t type, NULL, NULL,\n\t\t\t\t itemsize, \n\t\t\t\t typecode->fortran, NULL);\n\n PyDimMem_FREE(d);\n if(!r) return NULL;\n if(Assign_Array(r,s) == -1) {\n\t\tPy_DECREF(r);\n\t\treturn NULL;\n\t}\n return (PyObject*)r;\n}\n\n\nstatic int \nPyArray_ValidType(int type) \n{\n\tPyArray_Descr *descr;\n\t\n\tdescr = PyArray_DescrFromType(type);\n\tif (descr==NULL) return 0;\n\treturn 1;\n}\n\n\n/* If the output is not a CARRAY, then it is buffered also */\n\nstatic int\n_bufferedcast(PyArrayObject *out, PyArrayObject *in)\n{\n\tchar *inbuffer, *bptr, *optr;\n\tchar *outbuffer=NULL;\n\tPyArrayIterObject *it_in=NULL, *it_out=NULL;\n\tregister intp i, index;\n\tintp ncopies = PyArray_SIZE(out) / PyArray_SIZE(in);\n\tint elsize=in->itemsize;\n\tint nels = PyArray_BUFSIZE;\n\tint el;\n\tint inswap, outswap=0;\n\tint obuf=!PyArray_ISCARRAY(out);\n\tint oelsize = out->itemsize;\n\tPyArray_VectorUnaryFunc *castfunc;\n PyArray_CopySwapFunc *in_csn;\n PyArray_CopySwapFunc *out_csn;\n\tint retval = -1;\n\n\tcastfunc = in->descr->cast[out->descr->type_num];\n in_csn = in->descr->copyswap;\n out_csn = out->descr->copyswap;\n\n\t/* If the input or output is STRING, UNICODE, or VOID */\n\t/* then getitem and setitem are used for the cast */\n\t/* and byteswapping is handled by those methods */\n\n\tinswap = !(PyArray_ISFLEXIBLE(in) || PyArray_ISNOTSWAPPED(in));\n\t\n\tinbuffer = PyDataMem_NEW(PyArray_BUFSIZE*elsize);\n\tif (inbuffer == NULL) return -1;\n\tit_in = (PyArrayIterObject *)PyArray_IterNew((PyObject *)in);\n\tif (it_in == NULL) goto exit;\n\n\tif (obuf) {\n\t\toutswap = !(PyArray_ISFLEXIBLE(out) || \\\n\t\t\t PyArray_ISNOTSWAPPED(out));\n\t\toutbuffer = PyDataMem_NEW(PyArray_BUFSIZE*oelsize);\n\t\tif (outbuffer == NULL) goto exit;\n\n\t\tit_out = (PyArrayIterObject *)PyArray_IterNew((PyObject *)out);\n\t\tif (it_out == NULL) goto exit;\n\n\t\tnels = MIN(nels, PyArray_BUFSIZE);\n\t}\n\t\n\toptr = (obuf) ? outbuffer: out->data;\n\tbptr = inbuffer;\n\tel = 0;\t\n\twhile(ncopies--) {\n\t\tindex = it_in->size;\n\t\tPyArray_ITER_RESET(it_in);\n\t\twhile(index--) {\n in_csn(bptr, it_in->dataptr, inswap, elsize);\n\t\t\tbptr += elsize;\n\t\t\tPyArray_ITER_NEXT(it_in);\n\t\t\tel += 1;\n\t\t\tif ((el == nels) || (index == 0)) {\n\t\t\t\t/* buffer filled, do cast */\n\t\t\t\t\n\t\t\t\tcastfunc(inbuffer, optr, el, in, out);\n\t\t\t\t\n\t\t\t\tif (obuf) {\n\t\t\t\t\t/* Copy from outbuffer to array */\n\t\t\t\t\tfor(i=0; idataptr,\n optr, outswap,\n oelsize);\n\t\t\t\t\t\toptr += oelsize;\n\t\t\t\t\t\tPyArray_ITER_NEXT(it_out);\n\t\t\t\t\t}\n\t\t\t\t\toptr = outbuffer;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toptr += out->itemsize * nels;\n\t\t\t\t}\n\t\t\t\tel = 0;\n\t\t\t\tbptr = inbuffer;\n\t\t\t}\n\t\t}\n\t}\n\tretval = 0;\n exit:\n\tPy_XDECREF(it_in);\n\tPyDataMem_FREE(inbuffer);\n\tPyDataMem_FREE(outbuffer);\t\n\tif (obuf) {\n\t\tPy_XDECREF(it_out);\n\t}\n\treturn retval;\n\n}\n\n\n/* For backward compatibility */\n\nstatic PyObject *\nPyArray_Cast(PyArrayObject *mp, int type_num) \n{\n\tPyArray_Typecode type;\n\tPyArray_Descr *descr;\n\n\tdescr = PyArray_DescrFromType(type_num);\n\ttype.itemsize = descr->elsize;\n\ttype.type_num = descr->type_num;\n\ttype.fortran = 0;\n\t\n\treturn PyArray_CastToType(mp, &type);\n}\n\nstatic PyObject * \nPyArray_CastToType(PyArrayObject *mp, PyArray_Typecode *at) \n{\n\tPyObject *out;\n\tint ret;\n\n\tif ((mp->descr->type_num == at->type_num) && \\\n\t (at->itemsize==0 || mp->itemsize == at->itemsize) &&\n\t PyArray_ISBEHAVED_RO(mp)) {\n\t\tPy_INCREF(mp);\n\t\treturn (PyObject *)mp;\n\t}\n\t\t\n\tif (at->itemsize == 0) {\n\t\tif (mp->descr->type_num == PyArray_STRING &&\t\\\n\t\t at->type_num == PyArray_UNICODE)\n\t\t\tat->itemsize = mp->itemsize*sizeof(Py_UNICODE);\n\t\tif (mp->descr->type_num == PyArray_UNICODE &&\n\t\t at->type_num == PyArray_STRING) \n\t\t\tat->itemsize = mp->itemsize/sizeof(Py_UNICODE);\n\t\tif (at->type_num == PyArray_VOID)\n\t\t\tat->itemsize = mp->itemsize;\n\t}\n\n\tout = PyArray_New(mp->ob_type, mp->nd, \n\t\t\t mp->dimensions, \n\t\t\t at->type_num,\n\t\t\t NULL, NULL, at->itemsize, \n\t\t\t at->fortran, (PyObject *)mp);\n\tif (out == NULL) return NULL;\n\tret = PyArray_CastTo((PyArrayObject *)out, mp);\n\tif (ret != -1) return out;\n\n\tPy_DECREF(out);\n\treturn NULL;\n\t\n}\n\t \n/* The number of elements in out must be an integer multiple\n of the number of elements in mp. \n*/\n\nstatic int\nPyArray_CastTo(PyArrayObject *out, PyArrayObject *mp)\n{\n\n\tint simple;\n\tintp mpsize = PyArray_SIZE(mp);\n\tintp outsize = PyArray_SIZE(out);\n\n\tif (mpsize == 0) return 0;\n\tif (!PyArray_ISWRITEABLE(out)) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array is not writeable.\");\n\t\treturn -1;\n\t}\n\tif (outsize % mpsize != 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Output array must have an integer-multiple\"\\\n\t\t\t\t\" of the number of elements in the input \"\\\n\t\t\t\t\"array\");\n\t\treturn -1; \n\t}\n\n\tsimple = ((PyArray_ISCARRAY(mp) && PyArray_ISCARRAY(out)) || \\\n (PyArray_ISFARRAY(mp) && PyArray_ISFARRAY(out)));\n\t\n\tif (simple) {\n\t\tchar *inptr;\n\t\tchar *optr = out->data;\n\t\tintp obytes = out->itemsize * outsize;\n\t\tintp ncopies = outsize / mpsize;\n\n\t\twhile(ncopies--) {\n\t\t\tinptr = mp->data;\n\t\t\tmp->descr->cast[out->descr->type_num](inptr, \n\t\t\t\t\t\t\t optr,\n\t\t\t\t\t\t\t mpsize,\n\t\t\t\t\t\t\t mp, out);\n\t\t\toptr += obytes;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t/* If not a well-behaved cast, then use buffers */\n\tif (_bufferedcast(out, mp) == -1) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nstatic PyObject *\narray_fromarray(PyArrayObject *arr, PyArray_Typecode *typecode, int flags) \n{\n\t\n\tPyArrayObject *ret=NULL;\n\tint type = typecode->type_num;\n\tint itemsize = typecode->itemsize;\n\tint copy = 0;\n\tint arrflags;\n\tPyArray_Typecode oldtype;\n\tchar *msg = \"Cannot copy-back to a read-only array.\";\n\n\toldtype.type_num = PyArray_TYPE(arr);\n\toldtype.itemsize = PyArray_ITEMSIZE(arr);\n\toldtype.fortran = 0;\n\n\tif (type == PyArray_NOTYPE) type = arr->descr->type_num;\n\tif (itemsize == 0) itemsize = arr->itemsize;\n\ttypecode->type_num = type;\n\ttypecode->itemsize = itemsize;\n\n\t/* Don't copy if sizes are compatible */\n\tif (PyArray_EquivalentTypes(&oldtype, typecode)) {\n\t\tarrflags = arr->flags;\n\n\t\tcopy = (flags & ENSURECOPY) || \\\n\t\t\t((flags & CONTIGUOUS) && (!(arrflags & CONTIGUOUS))) \\\n\t\t\t|| (PyArray_ITEMSIZE(arr) != itemsize) || \\\n\t\t\t((flags & ALIGNED) && (!(arrflags & ALIGNED))) || \\\n\t\t\t((flags & NOTSWAPPED) && (!(arrflags & NOTSWAPPED))) \\\n\t\t\t|| (arr->nd > 1 &&\t\t\t\t\\\n\t\t\t ((flags & FORTRAN) != (arrflags & FORTRAN))) || \\\n\t\t\t((flags & WRITEABLE) && (!(arrflags & WRITEABLE)));\n\t\t\n\t\tif (copy) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_New(arr->ob_type, \n\t\t\t\t\t arr->nd, \n\t\t\t\t\t arr->dimensions,\n\t\t\t\t\t arr->descr->type_num,\n\t\t\t\t\t NULL, NULL, \n\t\t\t\t\t itemsize,\n\t\t\t\t\t flags & FORTRAN,\n\t\t\t\t\t (PyObject *)arr);\n\t\t\tif (PyArray_CopyInto(ret, arr) == -1) return NULL;\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t} \n\t\t/* If no copy then just increase the reference\n\t\t count and return the input */\n\t\telse { \n\t\t\tPy_INCREF(arr);\n\t\t\tret = arr;\n\t\t}\n\t}\n\t\n\t/* The desired output type is different than the input\n\t array type */\n\telse {\n\t\t/* Cast to the desired type if we can do it safely\n\t\t Also cast if source is a ndim-0 array to mimic\n\t\t behavior with Python scalars */\n\t\tif (flags & FORCECAST || PyArray_NDIM(arr)==0 ||\n\t\t PyArray_CanCastSafely(PyArray_TYPE(arr), type)) {\n if ((flags & UPDATEIFCOPY) && \\\n (!PyArray_ISWRITEABLE(arr))) {\n PyErr_SetString(PyExc_ValueError, msg);\n return NULL;\n }\n\t\t\tret = (PyArrayObject *)\\\n\t\t\t\tPyArray_CastToType(arr, typecode);\n\t\t\tif (flags & UPDATEIFCOPY) {\n\t\t\t\tret->flags |= UPDATEIFCOPY;\n\t\t\t\tret->base = (PyObject *)arr;\n PyArray_FLAGS(ret->base) &= ~WRITEABLE;\n\t\t\t\tPy_INCREF(arr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"Array can not be safely cast \"\\\n\t\t\t\t\t\"to required type\");\n\t\t\tret = NULL;\n\t\t}\n\t}\n\treturn (PyObject *)ret;\n}\n\n\nstatic int\n_array_typecode_fromstr(char *str, int *swap, PyArray_Typecode *type)\n{\n int type_num;\n char typechar;\n int size;\n unsigned long number = 1;\n char *s;\n char msg[] = \"unsupported typestring\";\n \n s = (char *)&number; /* s[0] == 0 implies big-endian */\n\n *swap = 0;\n\n if (str[0] == '<' || str[0] == '>') {\n\tif ((str[0] == '<') && (s[0] == 0)) *swap = 1;\n\telse if ((str[0] == '>') && (s[0] != 0)) *swap = 1;\n }\n str += 1;\n \n#define _MY_FAIL {\t\t\t\t \\\n\t PyErr_SetString(PyExc_ValueError, msg); \\\n\t return -1;\t\t\t \\\n }\t\t\n\n typechar = str[0];\n size = atoi(str + 1);\n switch (typechar) {\n case 'b':\n\t if (size == sizeof(Bool))\n\t\t type_num = PyArray_BOOL;\t \n\t else _MY_FAIL \n\t break;\t\t \n case 'u':\n if (size == sizeof(uintp))\n type_num = PyArray_UINTP;\n\t else if (size == sizeof(char))\n\t\t type_num = PyArray_UBYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_USHORT;\n\t else if (size == sizeof(int)) \n\t\t type_num = PyArray_UINT;\n\t else if (size == sizeof(ulong)) \n\t\t type_num = PyArray_ULONG;\n\t else if (size == sizeof(ulonglong))\n\t\t type_num = PyArray_ULONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'i':\n if (size == sizeof(intp))\n type_num = PyArray_INTP;\n\t else if (size == sizeof(char)) \n\t\t type_num = PyArray_BYTE;\n\t else if (size == sizeof(short)) \n\t\t type_num = PyArray_SHORT;\n\t else if (size == sizeof(int))\n\t\t type_num = PyArray_INT;\n\t else if (size == sizeof(long)) \n\t\t type_num = PyArray_LONG;\n\t else if (size == sizeof(longlong))\n\t\t type_num = PyArray_LONGLONG;\n\t else _MY_FAIL\n\t break;\t\t \n case 'f':\n\t if (size == sizeof(float))\n\t\t type_num = PyArray_FLOAT;\n\t else if (size == sizeof(double))\n\t\t type_num = PyArray_DOUBLE;\n\t else if (size == sizeof(longdouble))\n\t\t type_num = PyArray_LONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'c':\n\t if (size == sizeof(float)*2)\n\t\t type_num = PyArray_CFLOAT;\n\t else if (size == sizeof(double)*2)\n\t\t type_num = PyArray_CDOUBLE;\n\t else if (size == sizeof(longdouble)*2)\n\t\t type_num = PyArray_CLONGDOUBLE;\n\t else _MY_FAIL\n\t break;\n case 'O':\n\t if (size == sizeof(PyObject *))\n\t\t type_num = PyArray_OBJECT;\n\t else _MY_FAIL\n\t break;\n case 'S':\n\t type_num = PyArray_STRING;\n\t break;\n case 'U':\n\t type_num = PyArray_UNICODE;\n\t size *= sizeof(Py_UNICODE);\n\t break;\t \n case 'V':\n\t type_num = PyArray_VOID;\n\t break;\n default:\n\t _MY_FAIL\n }\n\n#undef _MY_FAIL\n\n type->type_num = type_num;\n type->itemsize = size;\n type->fortran = 0;\n return 0;\n}\n\nstatic PyObject *\narray_frominterface(PyObject *input, PyArray_Typecode *intype, int flags)\n{\n\tPyObject *attr=NULL, *item=NULL, *r;\n\tPyArrayObject *ret=NULL;\n\tPyArray_Typecode type;\n\tchar *data;\n\tint buffer_len;\n\tint res, i, n;\n\tintp dims[MAX_DIMS], strides[MAX_DIMS];\n\tint swap;\n\n\t/* Get the memory from __array_data__ and __array_offset__ */\n\t/* Get the shape */\n\t/* Get the typestring -- ignore array_descr */\n\t/* Get the strides */\n\t\n\tattr = PyObject_GetAttrString(input, \"__array_data__\");\n\tif (attr == NULL) {\n\t\tPy_INCREF(input);\n\t\tattr = input;\n\t}\n\t\n\tres = PyObject_AsWriteBuffer(attr, (void **)&data, &buffer_len);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n\n\tattr = PyObject_GetAttrString(input, \"__array_typestr__\");\n\tif (!PyString_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_typestr__ must be a string.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\t\n\t}\n\tres = _array_typecode_fromstr(PyString_AS_STRING(attr), &swap, &type);\n\tPy_DECREF(attr);\n\tif (res < 0) return NULL;\n \n\tattr = PyObject_GetAttrString(input, \"__array_shape__\");\n\tif (!PyTuple_Check(attr)) {\n\t\tPyErr_SetString(PyExc_TypeError, \"__array_shape__ must be a tuple.\");\n\t\tPy_DECREF(attr);\n\t\treturn NULL;\n\t}\n\tn = PyTuple_GET_SIZE(attr);\n\tfor (i=0; ibase = input;\n \n\tattr = PyObject_GetAttrString(input, \"__array_strides__\");\n\tif (attr != NULL && attr != Py_None) {\n\t\tif (!PyTuple_Check(attr)) {\n\t\t\tPyErr_SetString(PyExc_TypeError, \n\t\t\t\t\t\"__array_strides__ must be a tuple.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tif (n != PyTuple_GET_SIZE(attr)) {\n\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\"mismatch in length of \"\\\n\t\t\t\t\t\"__array_strides__ and \"\\\n\t\t\t\t\t\"__array_shape__.\");\n\t\t\tPy_DECREF(attr);\n\t\t\treturn NULL;\n\t\t}\n\t\tfor (i=0; istrides, strides, n*sizeof(intp));\n\t}\n\n\tif (swap) {\n\t\tPyObject *tmp;\n\t\ttmp = PyObject_CallMethod((PyObject *)ret, \"byteswap\", \"\");\n\t\tPy_DECREF(tmp);\n\t}\n\n\tPyArray_UpdateFlags(ret, UPDATE_ALL_FLAGS);\n\tr = array_fromarray(ret, intype, flags);\n\tPy_DECREF(ret);\n\treturn r;\n}\n\nstatic PyObject *\narray_fromattr(PyObject *op, PyArray_Typecode *typecode, int flags) \n{\n PyObject *new, *r;\n\t \n if (typecode->type_num == PyArray_NOTYPE) {\n new = PyObject_CallMethod(op, \"__array__\", NULL);\n } else {\n new = PyObject_CallMethod(op, \"__array__\", \"i\", \n typecode->type_num);\n }\n if (new == NULL) return NULL;\n if (!PyArray_Check(new)) {\n PyErr_SetString(PyExc_ValueError, \n \"object __array__ method not \" \\\n \"producing an array.\");\n Py_DECREF(new);\n return NULL;\n }\n r = array_fromarray((PyArrayObject *)new, typecode, flags);\n Py_DECREF(new);\n return r;\n} \n\n\nstatic PyObject *\narray_fromobject(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\t int max_depth, int flags) \n{\n /* This is the main code to make a NumPy array from a Python\n Object. It is called from lot's of different places which\n is why there are so many checks. The comments try to\n explain some of the checks. */\n\n\tint type = typecode->type_num;\n PyObject *r=NULL;\n\n\t/* Is input object already an array? */\n\t/* This is where the flags are used */\n if (PyArray_Check(op)) \n\t\tr = array_fromarray((PyArrayObject *)op, typecode, flags);\n\telse if (PyObject_HasAttrString(op, \"__array__\")) {\n\t\t/* Code that returns the object to convert for a non\n\t\t multiarray input object from the __array__ attribute of the\n\t\t object. */\n r = array_fromattr(op, typecode, flags);\n\t}\n\telse if (PyObject_HasAttrString(op, \"__array_shape__\") &&\n\t\t PyObject_HasAttrString(op, \"__array_typestr__\")) {\n\t\tr = array_frominterface(op, typecode, flags);\n\t}\n\telse {\n\t\tif (type == PyArray_NOTYPE) {\n\t\t\t_array_find_type(op, NULL, typecode, MAX_DIMS);\n\t\t}\n\t\tif (PySequence_Check(op))\n\t\t\tr = Array_FromSequence(op, typecode, \n\t\t\t\t\t min_depth, max_depth);\n\t\telse\n\t\t\tr = Array_FromScalar(op, typecode);\n\t}\n\n /* If we didn't succed return NULL */\n if (r == NULL) return NULL;\n\t\n\t/* Be sure we succeed here */\n\t\n if(!PyArray_Check(r)) {\n PyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Internal error array_fromobject \"\\\n\t\t\t\t\"not producing an array\");\n\t\tPy_DECREF(r);\n return NULL;\n }\n\n if (min_depth != 0 && ((PyArrayObject *)r)->nd < min_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object of too small depth for desired array\");\n return NULL;\n }\n if (max_depth != 0 && ((PyArrayObject *)r)->nd > max_depth) {\n Py_DECREF(r);\n PyErr_SetString(PyExc_ValueError, \n \"Object too deep for desired array\");\n return NULL;\n }\n return r;\n}\n\nstatic void\nPyArray_ArrayType(PyObject *op, PyArray_Typecode *intype, \n\t\t PyArray_Typecode *outtype) \n{\n\t_array_find_type(op, intype, outtype, MAX_DIMS);\n\treturn;\n}\n\nstatic int \nPyArray_ObjectType(PyObject *op, int minimum_type) \n{\n\tPyArray_Typecode intype, outtype;\n\tintype.type_num = minimum_type;\n\t_array_find_type(op, &intype, &outtype, MAX_DIMS);\n\treturn outtype.type_num;\n}\n\n\n\n/* flags is any of \n CONTIGUOUS, \n FORTRAN, (or set typecode->fortran=1)\n ALIGNED, \n NOTSWAPPED, \n WRITEABLE, \n ENSURECOPY, \n UPDATEIFCOPY,\n FORCECAST,\n\n or'd (|) together\n\n Any of these flags present means that the returned array should \n guarantee that aspect of the array. Otherwise the returned array\n won't guarantee it -- it will depend on the object as to whether or \n not it has such features. \n\n Note that ENSURECOPY is enough\n to guarantee CONTIGUOUS, ALIGNED, NOTSWAPPED, and WRITEABLE\n and therefore it is redundant to include those as well. \n\n BEHAVED_FLAGS == ALIGNED | NOTSWAPPED | WRITEABLE\n BEHAVED_FLAGS_RO == ALIGNED | NOTSWAPPED\n CARRAY_FLAGS = CONTIGUOUS | BEHAVED_FLAGS\n FARRAY_FLAGS = FORTRAN | BEHAVED_FLAGS\n \n By default, the returned array will be a copy of the object, \n (C) contiguous in memory, aligned, notswapped, and writeable.\n \n So CONTIGUOUS | ENSURECOPY passed in means that the returned\n array does not have to be CONTIGUOUS or a COPY but should be\n ALIGNED, NOTSWAPPED and WRITEABLE. \n\n typecode->fortran can be set to request a\n fortran-contiguous array. Fortran arrays are always behaved (aligned, \n notswapped, and writeable) and not (C) CONTIGUOUS. Note that either\n FORTRAN in the flag or typecode->fortran = 1 is enough to request\n a FORTRAN-style array. \n\n UPDATEIFCOPY flag sets this flag in the returned array if a copy is\n made and the base argument points to the (possibly) misbehaved array.\n When the new array is deallocated, the original array held in base\n is updated with the contents of the new array. \n\n FORCECAST will cause a cast to occur regardless of whether or not\n it is safe. \n*/\n\n\nstatic PyObject *\nPyArray_FromAny(PyObject *op, PyArray_Typecode *typecode, int min_depth, \n\t\tint max_depth, int requires) \n{\n \tPyArray_Typecode mine = {PyArray_NOTYPE, 0, 0};\n\tPyArray_Typecode *type;\n\t\n\tif (typecode == NULL) type = &mine;\n\telse type = typecode;\n\t\t\n\tif (requires & ENSURECOPY) {\n\t\trequires |= DEFAULT_FLAGS;\n\t}\n\t/* Ensure that type->fortran and flags & FORTRAN are the\n\t same */\n\tif (requires & FORTRAN) typecode->fortran = 1;\n\tif (type->fortran == 1) {\n\t\trequires |= FARRAY_FLAGS;\n\t\tif (min_depth > 2) requires &= ~CONTIGUOUS;\n\t}\n\n\t/* make sure itemsize is not 0 unless warranted. */\n\tif ((type->itemsize == 0) && (type->type_num != PyArray_NOTYPE)) {\n\t\tPyArray_Descr *descr;\n\t\tdescr = PyArray_DescrFromType(type->type_num);\n\t\tif (descr != NULL) type->itemsize = descr->elsize;\n\t\telse return NULL;\n\t}\n\t\n\treturn array_fromobject(op, type, min_depth, max_depth, \n\t\t\t\trequires);\t\n}\n\n/* This is a quick wrapper around PyArray_FromAny(op, NULL, 0, 0, 0) */\n/* that special cases Arrays and PyArray_Scalars up front */\n/* It steals a reference to the object */\n\n/* Because it decrefs op if any conversion needs to take place \n -- so it can be used like PyArray_EnsureArray(some_function(...)) */\n\nstatic PyObject *\nPyArray_EnsureArray(PyObject *op)\n{\n PyObject *new;\n\n if (op == NULL) return NULL;\n\n if (PyArray_Check(op)) return op;\n\n if (PyArray_IsScalar(op, Generic)) {\n new = PyArray_FromScalar(op, NULL);\n Py_DECREF(op);\n return new;\n }\n new = PyArray_FromAny(op, NULL, 0, 0, 0);\n Py_DECREF(op);\n return new;\n}\n\n/* These are all compressed into a single API */\n/* Deprecated calls -- Use PyArray_FromAny */\n\nstatic PyObject *\nPyArray_FromObject(PyObject *op, int type, int min_depth, int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, BEHAVED_FLAGS);\n}\n\nstatic PyObject *\nPyArray_ContiguousFromObject(PyObject *op, int type, int min_depth, \n\t\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth,\n\t\t\t max_depth, DEFAULT_FLAGS);\n}\n\nstatic PyObject *\nPyArray_CopyFromObject(PyObject *op, int type, int min_depth, \n\t\t int max_depth) \n{\n\tPyArray_Typecode typecode = {0, 0, 0};\n\ttypecode.type_num = type;\n return PyArray_FromAny(op, &typecode, min_depth, max_depth,\n\t\t\t ENSURECOPY);\n}\n\n/* End of deprecated */\n\n\nstatic int \nPyArray_CanCastSafely(int fromtype, int totype) \n{\n\tPyArray_Descr *from, *to;\n\n if (fromtype == totype) return 1;\n if (fromtype == PyArray_BOOL) return 1;\n\tif (totype == PyArray_BOOL) return 0;\n if (totype == PyArray_OBJECT || totype == PyArray_VOID) return 1;\n\tif (fromtype == PyArray_OBJECT || fromtype == PyArray_VOID) return 0;\n\n\tfrom = PyArray_DescrFromType(fromtype);\n\tto = PyArray_DescrFromType(totype);\n \n switch(fromtype) {\n case PyArray_BYTE:\n\tcase PyArray_SHORT:\n case PyArray_INT:\n case PyArray_LONG:\n\tcase PyArray_LONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISUNSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_UBYTE:\n case PyArray_USHORT:\n case PyArray_UINT:\n\tcase PyArray_ULONG:\n\tcase PyArray_ULONGLONG:\n\t\tif (PyTypeNum_ISINTEGER(totype)) {\n\t\t\tif (PyTypeNum_ISSIGNED(totype)) {\n\t\t\t\treturn (to->elsize > from->elsize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn (to->elsize >= from->elsize);\n\t\t\t}\n\t\t}\n\t\telse if (PyTypeNum_ISFLOAT(totype)) {\n\t\t\treturn (to->elsize > from->elsize);\n\t\t}\n\t\telse if (PyTypeNum_ISCOMPLEX(totype)) {\n\t\t\treturn ((to->elsize >> 1) > from->elsize);\n\t\t}\n\t\telse return totype > fromtype;\n case PyArray_FLOAT:\n case PyArray_DOUBLE:\n\tcase PyArray_LONGDOUBLE:\n\t\tif (PyTypeNum_ISCOMPLEX(totype)) \n\t\t\treturn ((to->elsize >> 1) >= from->elsize);\n\t\telse\n\t\t\treturn (totype > fromtype);\n case PyArray_CFLOAT:\n case PyArray_CDOUBLE:\n\tcase PyArray_CLONGDOUBLE:\n\t\treturn (totype > fromtype);\n\tcase PyArray_STRING:\n\tcase PyArray_UNICODE:\n\t\treturn (totype > fromtype);\n default:\n return 0;\n }\n}\n\nstatic Bool\nPyArray_CanCastTo(PyArray_Typecode *from, PyArray_Typecode *to)\n{\n\tint fromtype=from->type_num;\n\tint totype=to->type_num;\n\tBool ret;\n\n\tret = (Bool) PyArray_CanCastSafely(fromtype, totype);\n\tif (ret) { /* Check String and Unicode more closely */\n\t\tif (fromtype == PyArray_STRING) {\n\t\t\tif (totype == PyArray_STRING) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t\telse if (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize * sizeof(Py_UNICODE)\\\n\t\t\t\t <= to->itemsize);\n\t\t\t}\n\t\t}\n\t\telse if (fromtype == PyArray_UNICODE) {\n\t\t\tif (totype == PyArray_UNICODE) {\n\t\t\t\tret = (from->itemsize <= to->itemsize);\n\t\t\t}\n\t\t}\n\t}\n\treturn ret;\n}\n\n\n\n/*********************** Element-wise Array Iterator ***********************/\n/* Aided by Peter J. Verveer's nd_image package and scipy's arraymap ****/\n/* and Python's array iterator ***/\n \n\nstatic PyObject *\nPyArray_IterNew(PyObject *obj)\n{\n PyArrayIterObject *it;\n\tint i, nd; \n\tPyArrayObject *ao = (PyArrayObject *)obj;\n\n if (!PyArray_Check(ao)) {\n PyErr_BadInternalCall();\n return NULL;\n }\n\n it = PyObject_GC_New(PyArrayIterObject, &PyArrayIter_Type);\n if (it == NULL)\n return NULL;\n\n\tnd = ao->nd;\n\tPyArray_UpdateFlags(ao, CONTIGUOUS);\n\tit->contiguous = 0;\n\tif PyArray_ISCONTIGUOUS(ao) it->contiguous = 1;\n Py_INCREF(ao);\n it->ao = ao;\n\tit->size = PyArray_SIZE(ao);\n\tit->nd_m1 = nd - 1;\n\tit->factors[nd-1] = 1;\n\tfor (i=0; i < nd; i++) {\n\t\tit->dims_m1[i] = it->ao->dimensions[i] - 1;\n\t\tit->strides[i] = it->ao->strides[i];\n\t\tit->backstrides[i] = it->strides[i] *\t\\\n\t\t\tit->dims_m1[i];\n\t\tif (i > 0)\n\t\t\tit->factors[nd-i-1] = it->factors[nd-i] *\t\\\n\t\t\t\tit->ao->dimensions[nd-i];\n\t}\n\tPyArray_ITER_RESET(it);\n\t\n PyObject_GC_Track(it);\n return (PyObject *)it;\n}\n\n/* Returns an array scalar holding the element desired */\n\nstatic PyObject *\narrayiter_next(PyArrayIterObject *it)\n{\n\tPyObject *ret;\n\n\tif (it->index < it->size) {\n\t\tret = PyArray_ToScalar(it->dataptr, it->ao);\n\t\tPyArray_ITER_NEXT(it);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narrayiter_dealloc(PyArrayIterObject *it)\n{\n PyObject_GC_UnTrack(it);\n Py_XDECREF(it->ao);\n PyObject_GC_Del(it);\n }\n\nstatic int\narrayiter_traverse(PyArrayIterObject *it, visitproc visit, void *arg)\n{\n if (it->ao != NULL)\n return visit((PyObject *)(it->ao), arg);\n return 0;\n}\n\n\nstatic int\niter_length(PyArrayIterObject *self) \n{\n return (int) self->size;\n}\n\n\nstatic PyObject *\niter_subscript_Bool(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tint index, strides, itemsize;\n\tintp count=0;\n\tchar *dptr, *optr;\n\tPyObject *r;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn NULL;\n\t}\n\tindex = (ind->dimensions[0]);\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\t/* Get size of return array */\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0)\n\t\t\tcount++;\n\t\tdptr += strides;\n\t}\n\titemsize = self->ao->itemsize;\n\tr = PyArray_New(self->ao->ob_type, 1, &count, \n\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\titemsize, 0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\t/* Set up loop */\n\toptr = PyArray_DATA(r);\n\tindex = ind->dimensions[0];\n\tdptr = ind->data;\n\n copyswap = self->ao->descr->copyswap;\n\t/* Loop over Boolean array */\n\tswap = !(PyArray_ISNOTSWAPPED(self->ao));\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\t\toptr += itemsize;\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\nstatic PyObject *\niter_subscript_int(PyArrayIterObject *self, PyArrayObject *ind)\n{\n\tintp num;\n\tPyObject *r;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint swap;\n\tchar *optr;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = self->ao->itemsize;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t}\n\t\n\tr = PyArray_New(self->ao->ob_type, ind->nd, ind->dimensions,\n\t\t\tself->ao->descr->type_num, NULL, \n\t\t\tNULL, self->ao->itemsize, \n\t\t\t0, (PyObject *)self->ao);\n\tif (r==NULL) return NULL;\n\n\toptr = PyArray_DATA(r);\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) {Py_DECREF(r); return NULL;}\n\tindex = ind_it->size;\n copyswap = PyArray_DESCR(r)->copyswap;\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif (num < 0 || num >= self->size) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\tPy_DECREF(r);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn NULL;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(optr, self->dataptr, swap, itemsize);\n\t\toptr += itemsize;\n\t\tPyArray_ITER_NEXT(ind_it);\n\t}\n\tPy_DECREF(ind_it);\n\tPyArray_ITER_RESET(self);\n\treturn r;\n}\n\n\nstatic PyObject *\niter_subscript(PyArrayIterObject *self, PyObject *ind)\n{\n\tint i;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *r;\n\tchar *dptr;\n\tint size;\n\tPyObject *obj = NULL;\n\tint swap;\n PyArray_CopySwapFunc *copyswap;\n\t\t\n\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\tobj = iter_subscript(self, ind);\n\t\tPy_DECREF(ind);\n\t\treturn obj;\n\t}\n\n\t/* Tuples not accepted --- i.e. no NewAxis */\n\t/* Could implement this with adjusted strides\n\t and dimensions in iterator */\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\tPyArray_ITER_RESET(self);\n\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n\t\t\treturn PyArray_ToScalar(self->dataptr, self->ao);\n\t\t}\n\t\telse { /* empty array */\n\t\t\tintp ii = 0;\n\t\t\tr = PyArray_New(self->ao->ob_type, 1, &ii, \n\t\t\t\t\tself->ao->descr->type_num, NULL, \n\t\t\t\t\tNULL, self->ao->itemsize, 0,\n\t\t\t\t\t(PyObject *)self->ao);\n\t\t\treturn r;\t\t\t\n\t\t}\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) \n\t\t\tgoto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start)\n\t\tif (n_steps == SingleIndex) { /* Integer */\n\t\t\tr = PyArray_ToScalar(self->dataptr, self->ao);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\treturn r;\n\t\t}\n\t\tsize = self->ao->itemsize;\n\t\tr = PyArray_New(self->ao->ob_type, 1, &n_steps, \n\t\t\t\tself->ao->descr->type_num, NULL, NULL,\n\t\t\t\tsize, 0, (PyObject *)self->ao);\n\t\tif (r==NULL) goto fail; \n\t\tdptr = PyArray_DATA(r);\n swap = !PyArray_ISNOTSWAPPED(self->ao);\n copyswap = PyArray_DESCR(r)->copyswap;\n\t\twhile(n_steps--) {\n copyswap(dptr, self->dataptr, swap, size);\n\t\t\tfor(i=0; i< step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tdptr += size;\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\treturn r;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer) || PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tr = iter_subscript_Bool(self, (PyArrayObject *)obj);\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tobj = new;\n\t\t\tr = iter_subscript_int(self, (PyArrayObject *)obj);\n\t\t}\n\t\telse {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"unsupported iterator index\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPy_DECREF(obj);\n\t\treturn r;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\n fail:\n\tPy_XDECREF(obj);\n\treturn NULL;\n\n}\n\n\nstatic int\niter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tint index, strides, itemsize;\n\tchar *dptr;\n PyArray_CopySwapFunc *copyswap;\n\n\tif (ind->nd != 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Boolean index array should have 1 dim\");\n\t\treturn -1;\n\t}\n\titemsize = self->ao->itemsize;\n\tindex = ind->dimensions[0];\n\tstrides = ind->strides[0];\n\tdptr = ind->data;\n\tPyArray_ITER_RESET(self);\n\t/* Loop over Boolean array */\n copyswap = self->ao->descr->copyswap;\n\twhile(index--) {\n\t\tif (*((Bool *)dptr) != 0) {\n copyswap(self->dataptr, val->dataptr, swap,\n itemsize);\n\t\t}\n\t\tdptr += strides;\n\t\tPyArray_ITER_NEXT(self);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index==val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPyArray_ITER_RESET(self);\n\treturn 0;\n}\n\nstatic int\niter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind,\n\t\t PyArrayIterObject *val, int swap)\n{\n\tPyArray_Typecode typecode;\n\tintp num;\n\tPyArrayIterObject *ind_it;\n\tint itemsize;\n\tint index;\n PyArray_CopySwapFunc *copyswap;\n\n\titemsize = typecode.itemsize = self->ao->itemsize;\n\ttypecode.type_num = self->ao->descr->type_num;\n copyswap = self->ao->descr->copyswap;\n\tif (ind->nd == 0) {\n\t\tnum = *((intp *)ind->data);\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\treturn 0;\n\t}\n\tind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind);\n\tif (ind_it == NULL) return -1;\n\tindex = ind_it->size;\n\twhile(index--) {\n\t\tnum = *((intp *)(ind_it->dataptr));\n\t\tif (num < 0) num += self->size;\n\t\tif ((num < 0) || (num >= self->size)) {\n\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t \"Index %d out of bounds\"\t\t\\\n\t\t\t\t \" 0<=index<%d\", num, self->size);\n\t\t\tPy_DECREF(ind_it);\n\t\t\treturn -1;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, num);\n copyswap(self->dataptr, val->dataptr, swap, itemsize);\n\t\tPyArray_ITER_NEXT(ind_it);\n\t\tPyArray_ITER_NEXT(val);\n\t\tif (val->index == val->size) \n\t\t\tPyArray_ITER_RESET(val);\n\t}\n\tPy_DECREF(ind_it);\n\treturn 0;\n}\n\n\nstatic int\niter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) \n{\n\tint i;\n\tPyObject *arrval=NULL;\n\tPyArrayIterObject *val_it=NULL;\n\tPyArray_Typecode type;\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tint swap;\n\tint itemsize;\n\tint start, step_size;\n\tintp n_steps;\n\tPyObject *obj;\n PyArray_CopySwapFunc *copyswap;\n\t\n\tif (ind == Py_Ellipsis) {\n\t\tind = PySlice_New(NULL, NULL, NULL);\n\t\ti = iter_ass_subscript(self, ind, val);\n\t\tPy_DECREF(ind);\n\t\treturn i;\n\t}\n\t\n\ttype.type_num = self->ao->descr->type_num;\n\titemsize = type.itemsize = self->ao->itemsize;\n\t\n\tarrval = PyArray_FromAny(val, &type, 0, 0, 0);\n\tif (arrval==NULL) return -1;\n\tval_it = (PyArrayIterObject *)PyArray_IterNew(arrval);\n\tif (val_it==NULL) goto fail;\n\n\t/* Check for Boolean -- this is first becasue\n\t Bool is a subclass of Int */\n\n copyswap = PyArray_DESCR(arrval)->copyswap;\n\tswap = (PyArray_ISNOTSWAPPED(self->ao)!=PyArray_ISNOTSWAPPED(arrval));\n\tif (PyBool_Check(ind)) {\n\t\tif (PyObject_IsTrue(ind)) {\n copyswap(self->dataptr, PyArray_DATA(arrval), \n swap, itemsize);\n\t\t}\n\t\tgoto succeed;\n\t}\n\n\t/* Check for Integer or Slice */\n\t\n\tif (PyLong_Check(ind) || PyInt_Check(ind) || PySlice_Check(ind)) {\n\t\tstart = parse_subindex(ind, &step_size, &n_steps, \n\t\t\t\t self->size);\n\t\tif (start == -1) goto fail;\n\t\tif (n_steps == RubberIndex || n_steps == PseudoIndex) {\n\t\t\tPyErr_SetString(PyExc_IndexError, \n\t\t\t\t\t\"cannot use Ellipsis or NewAxes here\");\n\t\t\tgoto fail;\n\t\t}\n\t\tPyArray_ITER_GOTO1D(self, start);\n\t\tif (n_steps == SingleIndex) { /* Integer */\n copyswap(self->dataptr, PyArray_DATA(arrval),\n swap, itemsize);\n\t\t\tPyArray_ITER_RESET(self);\n\t\t\tgoto succeed;\n\t\t}\n\t\twhile(n_steps--) {\n copyswap(self->dataptr, val_it->dataptr,\n swap, itemsize);\n\t\t\tfor(i=0; i < step_size; i++) \n\t\t\t\tPyArray_ITER_NEXT(self);\n\t\t\tPyArray_ITER_NEXT(val_it);\n\t\t\tif (val_it->index == val_it->size) \n\t\t\t\tPyArray_ITER_RESET(val_it);\n\t\t}\n\t\tPyArray_ITER_RESET(self);\n\t\tgoto succeed;\n\t} \n\n\t/* convert to INTP array if Integer array scalar or List */\n\n\tif (PyArray_IsScalar(ind, Integer))\n\t\tobj = PyArray_FromScalar(ind, &indtype);\n\telse if (PyList_Check(ind)) {\n\t\tobj = PyArray_FromAny(ind, &indtype, 0, 0, FORCECAST);\n\t}\n\telse {\n\t\tPy_INCREF(ind);\n\t\tobj = ind;\n\t}\n\t\n\tif (PyArray_Check(obj)) {\n\t\t/* Check for Boolean object */\n\t\tif (PyArray_TYPE(obj)==PyArray_BOOL) {\n\t\t\tif (iter_ass_sub_Bool(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t} \n\t\t/* Check for integer array */\n\t\telse if (PyArray_ISINTEGER(obj)) {\n\t\t\tPyObject *new;\n\t\t\tnew = PyArray_FromAny(obj, &indtype, 0, 0, \n\t\t\t\t\t FORCECAST | BEHAVED_FLAGS);\n\t\t\tif (new==NULL) goto fail;\n\t\t\tPy_DECREF(obj);\n\t\t\tobj = new;\n\t\t\tif (iter_ass_sub_int(self, (PyArrayObject *)obj,\n\t\t\t\t\t val_it, swap) < 0)\n\t\t\t\tgoto fail;\n\t\t}\n\t\telse goto fail;\n\t\tPy_DECREF(obj);\n\t\tgoto succeed;\n\t}\n\n\tPyErr_SetString(PyExc_IndexError, \"unsupported iterator index\");\n\tgoto fail;\n\n succeed:\n\tPy_DECREF(val_it);\n\tPy_DECREF(arrval);\n\treturn 0;\n\n fail:\n\tPy_XDECREF(val_it);\n\tPy_XDECREF(arrval);\n\treturn -1;\n\t\n}\n\n\nstatic PyMappingMethods iter_as_mapping = {\n (inquiry)iter_length,\t\t /*mp_length*/\n (binaryfunc)iter_subscript,\t /*mp_subscript*/\n (objobjargproc)iter_ass_subscript,\t/*mp_ass_subscript*/\n};\n\nstatic char doc_iter_array[] = \"__array__(type=None)\\n Get array \"\\\n \"from iterator\";\n\nstatic PyObject *\niter_array(PyArrayIterObject *it, PyObject *op) \n{\n \n PyObject *r;\n intp size;\n\n /* Any argument ignored */\n\n /* Two options: \n 1) underlying array is contiguous\n -- return 1-d wrapper around it \n 2) underlying array is not contiguous\n -- make new 1-d contiguous array with updateifcopy flag set\n to copy back to the old array\n */\n\n size = PyArray_SIZE(it->ao);\n if (PyArray_ISCONTIGUOUS(it->ao)) {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, it->ao->data, it->ao->itemsize, \n\t\t\t\tit->ao->flags,\n (PyObject *)it->ao); \n\t\tif (r==NULL) return NULL;\n }\n else {\n r = PyArray_New(it->ao->ob_type, 1, &size, \n\t\t\t\tit->ao->descr->type_num,\n NULL, NULL, it->ao->itemsize, 0, \n (PyObject *)it->ao);\n\t\tif (r==NULL) return NULL;\n\t\tif (PyArray_CopyInto((PyArrayObject *)r, it->ao) < 0) {\n\t\t\tPy_DECREF(r); \n\t\t\treturn NULL;\n\t\t}\n PyArray_FLAGS(r) |= UPDATEIFCOPY;\n it->ao->flags &= ~WRITEABLE;\n }\n Py_INCREF(it->ao);\n PyArray_BASE(r) = (PyObject *)it->ao;\n return r;\n \n}\n\nstatic char doc_iter_copy[] = \"copy()\\n Get a copy of 1-d array\";\n\nstatic PyObject *\niter_copy(PyArrayIterObject *it, PyObject *args)\n{\n if (!PyArg_ParseTuple(args, \"\")) return NULL;\t\n\treturn PyArray_Flatten(it->ao, 0);\n}\n\nstatic PyMethodDef iter_methods[] = {\n /* to get array */\n {\"__array__\", (PyCFunction)iter_array, 1, doc_iter_array},\n\t{\"copy\", (PyCFunction)iter_copy, 1, doc_iter_copy},\n {NULL,\t\tNULL}\t\t/* sentinel */\n};\n\n\nstatic PyTypeObject PyArrayIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.flatiter\",\t\t /* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arrayiter_dealloc,\t\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0, \t\t\t /* tp_as_sequence */\n &iter_as_mapping, \t /* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0,\t \t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arrayiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arrayiter_next,\t\t/* tp_iternext */\n iter_methods,\t\t\t\t/* tp_methods */\n};\n\n/** END of Array Iterator **/\n\n\n\n/*********************** Subscript Array Iterator *************************\n * *\n * This object handles subscript behavior for array objects. *\n * It is an iterator object with a next method *\n * It abstracts the n-dimensional mapping behavior to make the looping *\n * code more understandable (maybe) *\n * and so that indexing can be set up ahead of time *\n */ \n\n/* This checks the args for any fancy indexing objects */\n\n#define SOBJ_NOTFANCY 0 \n#define SOBJ_ISFANCY 1\n#define SOBJ_BADARRAY 2\n#define SOBJ_TOOMANY 3\n#define SOBJ_LISTTUP 4\n\nstatic int\nfancy_indexing_check(PyObject *args)\n{\n\tint i, n;\n\tPyObject *obj;\n\tint retval = SOBJ_NOTFANCY;\n\n\tif (PyTuple_Check(args)) {\n\t\tn = PyTuple_GET_SIZE(args);\n\t\tif (n >= MAX_DIMS) return SOBJ_TOOMANY;\n\t\tfor (i=0; i=MAX_DIMS) return SOBJ_ISFANCY;\n\t\tfor (i=0; i SOBJ_ISFANCY) return retval;\n\t\t}\n\t}\n\n\treturn retval;\n}\n\n/* convert an indexing object to an INTP indexing array iterator\n if possible -- otherwise, it is a Slice or Ellipsis object\n and has to be interpreted on bind to a particular \n array so leave it NULL for now.\n */\nstatic int\n_convert_obj(PyObject *obj, PyArrayIterObject **iter)\n{\n\tPyArray_Typecode indtype = {PyArray_INTP, 0, 0};\n\tPyObject *arr;\n\n\tif (PySlice_Check(obj) || (obj == Py_Ellipsis))\n\t\t*iter = NULL;\n\telse {\n\t\tarr = PyArray_FromAny(obj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) return -1;\n\t\t*iter = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (*iter == NULL) return -1;\n\t}\n\treturn 0;\n}\n\n/* Adjust dimensionality and strides for index object iterators \n --- i.e. broadcast\n */\nstatic int\nPyArray_Broadcast(PyArrayMultiIterObject *mit)\n{\n\tint i, nd, k, j;\n\tintp tmp;\n\tPyArrayIterObject *it;\n\t\n\t/* Discover the broadcast number of dimensions */\n\tfor (i=0, nd=0; inumiter; i++) \n\t\tnd = MAX(nd, mit->iters[i]->ao->nd);\n\tmit->nd = nd;\n\n\t/* Discover the broadcast shape in each dimension */\n\tfor (i=0; idimensions[i] = 1;\n\t\tfor (j=0; jnumiter; j++) {\n\t\t\tit = mit->iters[j];\n\t\t\t/* This prepends 1 to shapes not already \n\t\t\t equal to nd */\n\t\t\tk = i + it->ao->nd - nd;\n\t\t\tif (k>=0) {\n\t\t\t\ttmp = it->ao->dimensions[k];\n\t\t\t\tif (tmp == 1) continue;\n\t\t\t\tif (mit->dimensions[i] == 1) \n\t\t\t\t\tmit->dimensions[i] = tmp;\n\t\t\t\telse if (mit->dimensions[i] != tmp) {\n\t\t\t\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\t\t\t\"index objects are \" \\\n\t\t\t\t\t\t\t\"not broadcastable \" \\\n\t\t\t\t\t\t\t\"to a single shape.\");\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Reset the iterator dimensions and strides of each iterator\n\t object -- using 0 valued strides for broadcasting */\n\n\ttmp = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tmit->size = tmp;\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tit->nd_m1 = mit->nd - 1;\n\t\tit->size = tmp;\n\t\tnd = it->ao->nd;\n\t\tit->factors[mit->nd-1] = 1;\n\t\tfor (j=0; j < mit->nd; j++) {\n\t\t\tit->dims_m1[j] = mit->dimensions[j] - 1;\n\t\t\tk = j + nd - mit->nd;\n\t\t\t/* If this dimension was added or shape\n\t\t\t of underlying array was 1 */\n\t\t\tif ((k < 0) || \\\n\t\t\t it->ao->dimensions[k] != mit->dimensions[j]) {\n\t\t\t\tit->contiguous = 0;\n\t\t\t\tit->strides[j] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tit->strides[j] = it->ao->strides[k];\n\t\t\t}\n\t\t\tit->backstrides[j] = it->strides[j] *\t\\\n\t\t\t\tit->dims_m1[j];\n\t\t\tif (j > 0)\n\t\t\t\tit->factors[mit->nd-j-1] =\t\t\\\n\t\t\t\t\tit->factors[mit->nd-j] *\t\\\n\t\t\t\t\tmit->dimensions[mit->nd-j];\n\t\t}\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn 0;\n}\n\n/* Reset the map iterator to the beginning */\nstatic void\nPyArray_MapIterReset(PyArrayMapIterObject *mit)\n{\n\tint i,j; intp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index = 0;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\n\tif (mit->subspace != NULL) {\n\t\tmemcpy(coord, mit->bscoord, sizeof(intp)*mit->ait->ao->nd);\n\t\tPyArray_ITER_RESET(mit->subspace);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tj = mit->iteraxes[i];\n\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_RESET(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* This function needs to update the state of the map iterator\n and point mit->dataptr to the memory-location of the next object\n*/\nstatic void\nPyArray_MapIterNext(PyArrayMapIterObject *mit)\n{\n\tint i, j;\n\tintp coord[MAX_DIMS];\n\tPyArrayIterObject *it;\n\tPyArray_CopySwapFunc *copyswap;\n\n\tmit->index += 1;\n\tif (mit->index >= mit->size) return;\n\tcopyswap = mit->iters[0]->ao->descr->copyswap;\n\t/* Sub-space iteration */\n\tif (mit->subspace != NULL) {\n\t\tPyArray_ITER_NEXT(mit->subspace);\n\t\tif (mit->subspace->index == mit->subspace->size) {\n\t\t\t/* reset coord to coordinates of \n\t\t\t beginning of the subspace */\n\t\t\tmemcpy(coord, mit->bscoord, \n\t\t\t sizeof(intp)*mit->ait->ao->nd);\n\t\t\tPyArray_ITER_RESET(mit->subspace);\n\t\t\tfor (i=0; inumiter; i++) {\n\t\t\t\tit = mit->iters[i];\n\t\t\t\tPyArray_ITER_NEXT(it);\n\t\t\t\tj = mit->iteraxes[i];\n\t\t\t\tcopyswap(coord+j,it->dataptr,\n\t\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t\t sizeof(intp));\n\t\t\t}\n\t\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\t\tmit->subspace->dataptr = mit->ait->dataptr;\n\t\t}\n\t\tmit->dataptr = mit->subspace->dataptr;\n\t}\n\telse {\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tit = mit->iters[i];\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t\tcopyswap(coord+i,it->dataptr, \n\t\t\t\t !PyArray_ISNOTSWAPPED(it->ao),\n\t\t\t\t sizeof(intp));\n\t\t}\n\t\tPyArray_ITER_GOTO(mit->ait, coord);\n\t\tmit->dataptr = mit->ait->dataptr;\n\t}\n\treturn;\n}\n\n/* Bind a mapiteration to a particular array */\n\n/* Determine if subspace iteration is necessary. If so, \n 1) Fill in mit->iteraxes\n\t 2) Create subspace iterator\n\t 3) Update nd, dimensions, and size. \n\n Subspace iteration is necessary if: arr->nd > mit->numiter\n*/\n\n/* Need to check for index-errors somewhere. \n\n Let's do it at bind time and also convert all <0 values to >0 here\n as well. \n*/\nstatic void\nPyArray_MapIterBind(PyArrayMapIterObject *mit, PyArrayObject *arr)\n{\n\tint subnd;\n\tPyObject *sub=NULL, *obj=NULL;\n\tint i, j, n, curraxis, ellipexp, noellip;\n\tPyArrayIterObject *it;\n\tintp dimsize;\n\tintp *indptr;\n\n\t/* Remove old binding if any */\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\n\tPy_XDECREF(mit->subspace);\n\tmit->subspace = NULL;\n\t\n\tsubnd = arr->nd - mit->numiter;\n\tif (subnd < 0) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"Too many indices for array.\");\n\t\treturn;\n\t}\n\n\tmit->ait = (PyArrayIterObject *)PyArray_IterNew((PyObject *)arr);\n\tif (mit->ait == NULL) return;\n\n\t/* If this is just a view, then do nothing more */\n\t/* views are handled by just adjusting the strides\n\t and dimensions of the object.\n\t*/\n\t \n\tif (mit->view) return;\n\n\t/* no subspace iteration needed. Return */\n\tif (subnd == 0) {\n\t\tn = arr->nd;\n\t\tfor (i=0; iiteraxes[i] = i;\n\t\t}\n\t\tgoto finish;\n\t}\n\n\t/* all indexing arrays have been converted to 0 \n\t therefore we can extract the subspace with a simple\n\t getitem call which will use view semantics\n\t*/\n\t\n\tsub = PyObject_GetItem((PyObject *)arr, mit->indexobj);\n\tif (sub == NULL) goto fail;\n\tmit->subspace = (PyArrayIterObject *)PyArray_IterNew(sub);\n\tif (mit->subspace == NULL) goto fail;\n\tPy_DECREF(sub);\n\n\t/* Expand dimensions of result */\n\tn = mit->subspace->ao->nd;\n\tfor (i=0; idimensions[mit->nd+i] = mit->subspace->ao->dimensions[i];\n\tmit->nd += n;\n\n\t/* Now, we still need to interpret the ellipsis and slice objects \n\t to determine which axes the indexing arrays are referring to\n\t*/\n\tn = PyTuple_GET_SIZE(mit->indexobj);\n\n\t/* The number of dimensions an ellipsis takes up */\n\tellipexp = arr->nd - n + 1;\n\t/* Now fill in iteraxes -- remember indexing arrays have been \n converted to 0's in mit->indexobj */\n\tcurraxis = 0;\n\tj = 0;\n\tnoellip = 1; /* Only expand the first ellipsis */\n\tmemset(mit->bscoord, '\\0', sizeof(intp)*arr->nd);\n\tfor (i=0; iindexobj, i);\n\t\tif (PyInt_Check(obj) || PyLong_Check(obj)) \n\t\t\tmit->iteraxes[j++] = curraxis++;\n\t\telse if (noellip && obj == Py_Ellipsis) {\n\t\t\tcurraxis += ellipexp;\n\t\t\tnoellip = 0;\n\t\t}\n\t\telse {\n\t\t\tint start=0;\n\t\t\tint stop, step;\n\t\t\t/* Should be slice object or\n\t\t\t another Ellipsis */\n\t\t\tif (obj == Py_Ellipsis) {\n\t\t\t\tmit->bscoord[curraxis] = 0;\n\t\t\t}\n\t\t\telse if (!PySlice_Check(obj) || \\\n\t\t\t\t (slice_GetIndices((PySliceObject *)obj, \n\t\t\t\t\t\t arr->dimensions[curraxis],\n\t\t\t\t\t\t &start, &stop, &step,\n\t\t\t\t\t\t &dimsize) < 0)) {\n\t\t\t\tPyErr_Format(PyExc_ValueError, \n\t\t\t\t\t \"unexpected object \"\t\\\n\t\t\t\t\t \"(%s) in selection position %d\",\n\t\t\t\t\t obj->ob_type->tp_name, i);\n\t\t\t goto fail;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmit->bscoord[curraxis] = start;\n\t\t\t}\n\t\t\tcurraxis += 1; \n\t\t}\n\t}\n finish:\n\t/* Here check the indexes (now that we have iteraxes) */\n\tmit->size = PyArray_MultiplyList(mit->dimensions, mit->nd);\n\tfor (i=0; inumiter; i++) {\n\t\tit = mit->iters[i];\n\t\tPyArray_ITER_RESET(it);\n\t\tdimsize = arr->dimensions[mit->iteraxes[i]];\n\t\twhile(it->index < it->size) {\n\t\t\tindptr = ((intp *)it->dataptr);\n\t\t\tif (*indptr < 0) *indptr += dimsize;\n\t\t\tif (*indptr < 0 || *indptr >= dimsize) {\n\t\t\t\tPyErr_Format(PyExc_IndexError,\n\t\t\t\t\t \"index (%d) out of range \"\\\n\t\t\t\t\t \"(0<=index<=%d) in dimension %d\",\n\t\t\t\t\t *indptr, dimsize-1, \n\t\t\t\t\t mit->iteraxes[i]);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tPyArray_ITER_NEXT(it);\n\t\t}\t\t\n\t\tPyArray_ITER_RESET(it);\n\t}\n\treturn;\n\n fail:\n\tPy_XDECREF(sub);\n\tPy_XDECREF(mit->ait);\n\tmit->ait = NULL;\n\treturn;\n}\n\n/* This function takes a Boolean array and constructs index objects and\n iterators as if nonzero(Bool) had been called\n*/\nstatic int\n_nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)\n{\n\tPyArray_Typecode typecode = {PyArray_BOOL, 0, 0};\n\tPyArrayObject *ba =NULL, *new=NULL;\n\tint nd, j;\n\tintp size, i, count;\n\tBool *ptr;\n\tintp coords[MAX_DIMS], dims_m1[MAX_DIMS];\n\tintp *dptr[MAX_DIMS];\n\n\tba = (PyArrayObject *)PyArray_FromAny(myBool, &typecode, 0, 0, \n\t\t\t\t\t CARRAY_FLAGS);\n\tif (ba == NULL) return -1;\n\tnd = ba->nd;\n\tfor (j=0; jdata;\n\tcount = 0;\n\n\t/* pre-determine how many nonzero entries there are */\n\tfor (i=0; iao->data;\n\t\tcoords[j] = 0;\n\t\tdims_m1[j] = ba->dimensions[j]-1;\n\t}\n\n\tptr = (Bool *)ba->data;\n\n\tif (count == 0) return nd;\n\n\t/* Loop through the Boolean array and copy coordinates\n\t for non-zero entries */\n\tfor (i=0; i=0; j--) {\n\t\t\tif (coords[j] < dims_m1[j]) {\n\t\t\t\tcoords[j]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcoords[j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\treturn nd;\n\n fail:\n\tfor (j=0; jiters[i] = NULL;\n \tmit->view = 0;\n \tmit->index = 0;\n \tmit->ait = NULL;\n \tmit->subspace = NULL;\n\tmit->numiter = 0;\n\tmit->consec = 1;\n\tfancy = fancy_indexing_check(indexobj);\n\tPy_INCREF(indexobj);\n\tmit->indexobj = indexobj;\n\tif (fancy == SOBJ_NOTFANCY) { /* bail out */\n\t\tmit->view = 1;\n\t\tgoto ret;\n\t}\n\n\tif (fancy == SOBJ_BADARRAY) {\n\t\tPyErr_SetString(PyExc_TypeError,\t\t\t\\\n\t\t\t\t\"Arrays used as indexes must be of \" \\\n\t\t\t\t\"integer type\");\n\t\tgoto fail;\n\t}\n\tif (fancy == SOBJ_TOOMANY) {\n\t\tPyErr_SetString(PyExc_TypeError,\"Too many indicies\");\n\t\tgoto fail;\n\t}\n\n\tif (fancy == SOBJ_LISTTUP) {\n\t\tPyObject *newobj;\n\t\tnewobj = PySequence_Tuple(indexobj);\n\t\tif (newobj == NULL) goto fail;\n\t\tPy_DECREF(indexobj);\n\t\tindexobj = newobj;\n\t\tmit->indexobj = indexobj;\n\t}\n\n#undef SOBJ_NOTFANCY \n#undef SOBJ_ISFANCY \n#undef SOBJ_BADARRAY \n#undef SOBJ_TOOMANY \n#undef SOBJ_LISTTUP \n\n\n\t/* Must have some kind of fancy indexing if we are here */\n\t/* indexobj is either a list, an arrayobject, or a tuple \n\t (with at least 1 list or arrayobject or Bool object), */\n\t\n\t/* convert all inputs to iterators */\n\tif (PyArray_Check(indexobj) &&\t\t\t\\\n\t (PyArray_TYPE(indexobj) == PyArray_BOOL)) {\n\t\tmit->numiter = _nonzero_indices(indexobj, mit->iters);\n\t\tif (mit->numiter < 0) goto fail;\n\t\tmit->nd = 1;\n\t\tmit->dimensions[0] = mit->iters[0]->dims_m1[0]+1;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = PyTuple_New(mit->numiter);\n\t\tfor (i=0; inumiter; i++) {\n\t\t\tPyTuple_SET_ITEM(mit->indexobj, i, \n\t\t\t\t\t PyInt_FromLong(0));\n\t\t}\n\t}\n\n\telse if (PyList_Check(indexobj) || PyArray_Check(indexobj)) {\n\t\tmit->numiter = 1;\n\t\tarr = PyArray_FromAny(indexobj, &indtype, 0, 0, FORCECAST);\n\t\tif (arr == NULL) goto fail;\n\t\tmit->iters[0] = (PyArrayIterObject *)PyArray_IterNew(arr);\n\t\tPy_DECREF(arr);\n\t\tif (mit->iters[0] == NULL) goto fail;\n\t\tmit->nd = PyArray_NDIM(arr);\n\t\tmemcpy(mit->dimensions,PyArray_DIMS(arr),mit->nd*sizeof(intp));\n\t\tmit->size = PyArray_SIZE(arr);\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = Py_BuildValue(\"(N)\", PyInt_FromLong(0));\n\t}\n\telse { /* must be a tuple */\n\t\tPyObject *obj;\n\t\tPyArrayIterObject *iter;\n\t\tPyObject *new;\n\t\t/* Make a copy of the tuple -- we will be replacing \n\t\t index objects with 0's */\n\t\tn = PyTuple_GET_SIZE(indexobj);\n\t\tnew = PyTuple_New(n);\n\t\tif (new == NULL) goto fail;\n\t\tPy_DECREF(mit->indexobj);\n\t\tmit->indexobj = new;\n\t\tstarted = 0;\n\t\tnonindex = 0;\n\t\tfor (i=0; iconsec = 0;\n\t\t\t\tmit->iters[(mit->numiter)++] = iter;\n\t\t\t\tPyTuple_SET_ITEM(new,i,\n\t\t\t\t\t\t PyInt_FromLong(0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (started) nonindex = 1;\n\t\t\t\tPy_INCREF(obj);\n\t\t\t\tPyTuple_SET_ITEM(new,i,obj);\n\t\t\t}\n\t\t}\n\t\t/* Store the number of iterators actually converted */\n\t\t/* These will be mapped to actual axes at bind time */\n\t\tif (PyArray_Broadcast((PyArrayMultiIterObject *)mit) < 0)\n\t\t\tgoto fail;\n\t}\n\n ret:\n PyObject_GC_Track(mit);\n return (PyObject *)mit;\n \n fail:\n\tPy_XDECREF(arr);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n\treturn NULL;\n}\n\n\n/* return unbound mapiter object */\n\nstatic PyObject *\narraymapiter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) \n{\n\tPyObject *newtup, *res;\n\tint n;\n\n\tif (!PyTuple_Check(args)) {\n\t\tPyErr_BadInternalCall();\n\t\treturn NULL;\n\t}\n\n\tn = PyTuple_GET_SIZE(args);\n\t\n\tif (n < 1) {\n\t\tPyErr_SetString(PyExc_ValueError, \n\t\t\t\t\"must be initialized with >= 1 argument\");\n\t\treturn NULL;\n\t}\n\t\n\tif (n > 1) {\n\t\tnewtup = PyTuple_GetSlice(args, 0, n);\n\t\tif (newtup == NULL) return NULL;\n\t\tres = PyArray_MapIterNew(newtup);\n\t\tPy_DECREF(newtup);\n\t}\n\telse { /* n == 1 */\n\t\tnewtup = PyTuple_GET_ITEM(args, 0);\n\t\tres = PyArray_MapIterNew(newtup);\n\t}\n\n\treturn res; \t\n}\n\n\n/* Returns a 0-dim array holding the element desired */\n\nstatic PyObject *\narraymapiter_next(PyArrayMapIterObject *mit)\n{\n\tPyObject *ret;\n\tif (mit->ait == NULL) return NULL;\n\tif (mit->view) return NULL;\n\tif (mit->index < mit->size) {\n\t\tret = PyArray_ToScalar(mit->dataptr, mit->ait->ao);\n\t\tPyArray_MapIterNext(mit);\n\t\treturn ret;\n\t}\n return NULL;\n}\n\nstatic void\narraymapiter_dealloc(PyArrayMapIterObject *mit)\n{\n\tint i;\n PyObject_GC_UnTrack(mit);\n Py_XDECREF(mit->ait);\n\tPy_XDECREF(mit->indexobj);\n\tfor (i=0; inumiter; i++)\n\t\tPy_XDECREF(mit->iters[i]);\n PyObject_GC_Del(mit);\n}\n\nstatic int\narraymapiter_traverse(PyArrayMapIterObject *mit, visitproc visit, void *arg)\n{\n\tint ret, i;\n if (mit->ait != NULL)\n if ((ret = visit((PyObject *)(mit->ait), arg)) != 0) \n\t\t\treturn ret;\t\n\n\tif (mit->iters != NULL) \n\t\tfor (i=0; inumiter; i++) \n\t\t\tif (mit->iters[i] != NULL) \n\t\t\t\tif ((ret=visit((PyObject *)mit->iters[i], \n\t\t\t\t\t arg)) != 0)\n\t\t\t\t\treturn ret;\n\n\tif (mit->indexobj != NULL)\n\t\tif ((ret = visit(mit->indexobj, arg)) != 0) return ret;\n\t\n return 0;\n}\n\n/* \nstatic char doc_mapiter_bind[] = \"obj.bind(a)\\n Bind an array to the \"\\\n\t\"mapiter object\";\n\nstatic PyObject *\nmapiter_bind(PyArrayMapIterObject *mit, PyObject *args)\n{\n\tPyObject *r;\n intp size, strides;\n int nd;\n\tPyArrayObject *arr;\n\n if (!PyArg_ParseTuple(args, \"O!\", &PyArray_Type, &arr)) return NULL;\n\n\tPyArray_MapIterBind(mit, arr);\n\n\tif (mit->ait == NULL) return NULL;\n\n\tPy_INCREF(Py_None);\n\treturn Py_None;\n}\n\nstatic PyMethodDef mapiter_methods[] = {\n\t{\"bind\", (PyCFunction)mapiter_bind, 1, doc_mapiter_bind},\n {NULL,\t\tNULL}\t\t\n};\n*/\n\n\nstatic PyTypeObject PyArrayMapIter_Type = {\n PyObject_HEAD_INIT(NULL)\n 0,\t\t\t\t\t /* ob_size */\n \"scipy.mapiter\",\t\t \t/* tp_name */\n sizeof(PyArrayIterObject), /* tp_basicsize */\n 0,\t\t\t\t\t /* tp_itemsize */\n /* methods */\n (destructor)arraymapiter_dealloc,\t/* tp_dealloc */\n 0,\t\t\t\t\t/* tp_print */\n 0,\t\t\t\t\t/* tp_getattr */\n 0,\t\t\t\t\t/* tp_setattr */\n 0,\t\t\t\t\t/* tp_compare */\n 0,\t\t\t\t\t/* tp_repr */\n 0,\t\t\t\t\t/* tp_as_number */\n 0,\t\t\t\t\t/* tp_as_sequence */\n 0,\t\t\t\t\t/* tp_as_mapping */\n 0,\t\t\t\t\t/* tp_hash */\n 0,\t\t\t\t\t/* tp_call */\n 0,\t\t\t\t\t/* tp_str */\n 0, \t\t/* tp_getattro */\n 0,\t\t\t\t\t/* tp_setattro */\n 0,\t\t\t\t\t/* tp_as_buffer */\n Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */\n 0,\t\t\t\t\t/* tp_doc */\n (traverseproc)arraymapiter_traverse,\t/* tp_traverse */\n 0,\t\t\t\t\t/* tp_clear */\n 0,\t\t\t\t\t/* tp_richcompare */\n 0,\t\t\t\t\t/* tp_weaklistoffset */\n 0,\t\t \t /* tp_iter */\n (iternextfunc)arraymapiter_next,\t/* tp_iternext */\n 0,\t \t\t /* tp_methods */\n 0,\t\t\t\t\t /* tp_members */\n 0,\t\t\t /* tp_getset */\n 0,\t\t\t\t\t /* tp_base */\n 0,\t\t\t\t\t /* tp_dict */\n 0,\t\t\t\t\t /* tp_descr_get */\n 0,\t\t\t\t\t /* tp_descr_set */\n 0,\t\t\t\t\t /* tp_dictoffset */\n (initproc)0,\t \t /* tp_init */\n 0, \t /* tp_alloc */\n (newfunc)arraymapiter_new,\t /* tp_new */\n 0,\t /* tp_free */\n 0,\t\t\t\t\t /* tp_is_gc */\n 0,\t\t\t\t\t /* tp_bases */\n 0,\t\t\t\t\t /* tp_mro */\n 0,\t\t\t\t\t /* tp_cache */\n 0,\t\t\t\t\t /* tp_subclasses */\n 0\t\t\t\t\t /* tp_weaklist */\n\n};\n\n/** END of Subscript Iterator **/\n\n\n\n", "methods": [ { "name": "PyArray_PyIntAsIntp", "long_name": "PyArray_PyIntAsIntp( PyObject * o)", "filename": "arrayobject.c", "nloc": 59, "complexity": 19, "token_count": 385, "parameters": [ "o" ], "start_line": 40, "end_line": 103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "PyArray_PyIntAsInt", "long_name": "PyArray_PyIntAsInt( PyObject * o)", "filename": "arrayobject.c", "nloc": 57, "complexity": 19, "token_count": 389, "parameters": [ "o" ], "start_line": 109, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 86, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 191, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "PyArray_Zero", "long_name": "PyArray_Zero( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 190, "parameters": [ "arr" ], "start_line": 208, "end_line": 243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_One", "long_name": "PyArray_One( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 40, "complexity": 7, "token_count": 222, "parameters": [ "arr" ], "start_line": 246, "end_line": 289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "do_sliced_copy", "long_name": "do_sliced_copy( char * dest , intp * dest_strides , intp * dest_dimensions , int dest_nd , char * src , intp * src_strides , intp * src_dimensions , int src_nd , int elsize , int copies)", "filename": "arrayobject.c", "nloc": 48, "complexity": 13, "token_count": 313, "parameters": [ "dest", "dest_strides", "dest_dimensions", "dest_nd", "src", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 295, "end_line": 345, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "optimize_slices", "long_name": "optimize_slices( intp ** dest_strides , intp ** dest_dimensions , int * dest_nd , intp ** src_strides , intp ** src_dimensions , int * src_nd , int * elsize , int * copies)", "filename": "arrayobject.c", "nloc": 32, "complexity": 8, "token_count": 214, "parameters": [ "dest_strides", "dest_dimensions", "dest_nd", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 368, "end_line": 399, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 402, "end_line": 436, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_INCREF", "long_name": "PyArray_INCREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 449, "end_line": 471, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_XDECREF", "long_name": "PyArray_XDECREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 474, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "byte_swap_vector", "long_name": "byte_swap_vector( * p , int n , int size)", "filename": "arrayobject.c", "nloc": 38, "complexity": 10, "token_count": 340, "parameters": [ "p", "n", "size" ], "start_line": 499, "end_line": 537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "copy_and_swap", "long_name": "copy_and_swap( * dst , * src , int itemsize , intp numitems , intp srcstrides , int swap)", "filename": "arrayobject.c", "nloc": 18, "complexity": 5, "token_count": 120, "parameters": [ "dst", "src", "itemsize", "numitems", "srcstrides", "swap" ], "start_line": 542, "end_line": 562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "index2ptr", "long_name": "index2ptr( PyArrayObject * mp , int i)", "filename": "arrayobject.c", "nloc": 10, "complexity": 7, "token_count": 86, "parameters": [ "mp", "i" ], "start_line": 570, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Size", "long_name": "PyArray_Size( PyObject * op)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 33, "parameters": [ "op" ], "start_line": 583, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_CopyInto", "long_name": "PyArray_CopyInto( PyArrayObject * dest , PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 71, "complexity": 16, "token_count": 425, "parameters": [ "dest", "src" ], "start_line": 604, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 16, "complexity": 2, "token_count": 98, "parameters": [ "dest", "src_object" ], "start_line": 688, "end_line": 707, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndDataAndDescr", "long_name": "PyArray_FromDimsAndDataAndDescr( int nd , int * d , PyArray_Descr * descr , char * data)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 144, "parameters": [ "nd", "d", "descr", "data" ], "start_line": 715, "end_line": 736, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 5, "token_count": 137, "parameters": [ "nd", "d", "type", "data" ], "start_line": 740, "end_line": 760, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 5, "token_count": 133, "parameters": [ "nd", "d", "type" ], "start_line": 764, "end_line": 781, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 77, "parameters": [ "m1" ], "start_line": 787, "end_line": 799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_Scalar", "long_name": "PyArray_Scalar( char * data , int type_num , int itemsize , int swap)", "filename": "arrayobject.c", "nloc": 48, "complexity": 8, "token_count": 289, "parameters": [ "data", "type_num", "itemsize", "swap" ], "start_line": 805, "end_line": 854, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyArray_ToScalar", "long_name": "PyArray_ToScalar( char * data , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 51, "parameters": [ "data", "arr" ], "start_line": 861, "end_line": 868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_Return", "long_name": "PyArray_Return( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 85, "parameters": [ "mp" ], "start_line": 874, "end_line": 893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 31, "complexity": 6, "token_count": 177, "parameters": [ "type" ], "start_line": 904, "end_line": 936, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 946, "end_line": 989, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 89, "complexity": 16, "token_count": 577, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 993, "end_line": 1084, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 92, "top_nesting_level": 0 }, { "name": "PyArray_ToList", "long_name": "PyArray_ToList( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 24, "complexity": 5, "token_count": 151, "parameters": [ "self" ], "start_line": 1087, "end_line": 1115, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_ToString", "long_name": "PyArray_ToString( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 191, "parameters": [ "self" ], "start_line": 1118, "end_line": 1153, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_dealloc", "long_name": "array_dealloc( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 20, "complexity": 7, "token_count": 144, "parameters": [ "self" ], "start_line": 1162, "end_line": 1199, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_length", "long_name": "array_length( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 1206, "end_line": 1214, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 150, "parameters": [ "self", "i" ], "start_line": 1218, "end_line": 1242, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_item_nice", "long_name": "array_item_nice( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "i" ], "start_line": 1245, "end_line": 1248, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_ass_item", "long_name": "array_ass_item( PyArrayObject * self , int i , PyObject * v)", "filename": "arrayobject.c", "nloc": 27, "complexity": 8, "token_count": 177, "parameters": [ "self", "i", "v" ], "start_line": 1252, "end_line": 1282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "slice_coerce_index", "long_name": "slice_coerce_index( PyObject * o , int * v)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "o", "v" ], "start_line": 1286, "end_line": 1294, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "slice_GetIndices", "long_name": "slice_GetIndices( PySliceObject * r , int length , int * start , int * stop , int * step , intp * slicelength)", "filename": "arrayobject.c", "nloc": 45, "complexity": 24, "token_count": 376, "parameters": [ "r", "length", "start", "stop", "step", "slicelength" ], "start_line": 1300, "end_line": 1350, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "parse_subindex", "long_name": "parse_subindex( PyObject * op , int * step_size , intp * n_steps , int max)", "filename": "arrayobject.c", "nloc": 45, "complexity": 11, "token_count": 223, "parameters": [ "op", "step_size", "n_steps", "max" ], "start_line": 1357, "end_line": 1402, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "parse_index", "long_name": "parse_index( PyArrayObject * self , PyObject * op , intp * dimensions , intp * strides , intp * offset_ptr)", "filename": "arrayobject.c", "nloc": 89, "complexity": 20, "token_count": 540, "parameters": [ "self", "op", "dimensions", "strides", "offset_ptr" ], "start_line": 1406, "end_line": 1501, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "_swap_axes", "long_name": "_swap_axes( PyArrayMapIterObject * mit , PyArrayObject ** ret)", "filename": "arrayobject.c", "nloc": 24, "complexity": 4, "token_count": 187, "parameters": [ "mit", "ret" ], "start_line": 1504, "end_line": 1538, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 252, "parameters": [ "mit" ], "start_line": 1543, "end_line": 1593, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "PyArray_SetMap", "long_name": "PyArray_SetMap( PyArrayMapIterObject * mit , PyObject * op)", "filename": "arrayobject.c", "nloc": 50, "complexity": 12, "token_count": 392, "parameters": [ "mit", "op" ], "start_line": 1596, "end_line": 1655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 425, "parameters": [ "self", "op" ], "start_line": 1676, "end_line": 1751, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "array_ass_sub", "long_name": "array_ass_sub( PyArrayObject * self , PyObject * index , PyObject * op)", "filename": "arrayobject.c", "nloc": 43, "complexity": 9, "token_count": 251, "parameters": [ "self", "index", "op" ], "start_line": 1764, "end_line": 1816, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "array_subscript_nice", "long_name": "array_subscript_nice( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "self", "op" ], "start_line": 1824, "end_line": 1827, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_getsegcount", "long_name": "array_getsegcount( PyArrayObject * self , int * lenp)", "filename": "arrayobject.c", "nloc": 11, "complexity": 4, "token_count": 48, "parameters": [ "self", "lenp" ], "start_line": 1846, "end_line": 1858, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_getreadbuf", "long_name": "array_getreadbuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 72, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1861, "end_line": 1876, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_getwritebuf", "long_name": "array_getwritebuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1880, "end_line": 1889, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_getcharbuf", "long_name": "array_getcharbuf( PyArrayObject * self , int segment , const char ** ptrptr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 3, "token_count": 65, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1892, "end_line": 1903, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_SetNumericOps", "long_name": "PyArray_SetNumericOps( PyObject * dict)", "filename": "arrayobject.c", "nloc": 34, "complexity": 1, "token_count": 162, "parameters": [ "dict" ], "start_line": 1971, "end_line": 2004, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_GetNumericOps", "long_name": "PyArray_GetNumericOps()", "filename": "arrayobject.c", "nloc": 39, "complexity": 2, "token_count": 183, "parameters": [], "start_line": 2010, "end_line": 2049, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_GenericReduceFunction", "long_name": "PyArray_GenericReduceFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2052, "end_line": 2071, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericAccumulateFunction", "long_name": "PyArray_GenericAccumulateFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2075, "end_line": 2094, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericBinaryFunction", "long_name": "PyArray_GenericBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 69, "parameters": [ "m1", "m2", "op" ], "start_line": 2098, "end_line": 2109, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericUnaryFunction", "long_name": "PyArray_GenericUnaryFunction( PyArrayObject * m1 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 63, "parameters": [ "m1", "op" ], "start_line": 2112, "end_line": 2123, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericInplaceBinaryFunction", "long_name": "PyArray_GenericInplaceBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 13, "complexity": 2, "token_count": 71, "parameters": [ "m1", "m2", "op" ], "start_line": 2126, "end_line": 2138, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_add", "long_name": "array_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2141, "end_line": 2144, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_subtract", "long_name": "array_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2147, "end_line": 2150, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_multiply", "long_name": "array_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2153, "end_line": 2156, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_divide", "long_name": "array_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2159, "end_line": 2162, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_remainder", "long_name": "array_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2165, "end_line": 2168, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_power", "long_name": "array_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2171, "end_line": 2174, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_negative", "long_name": "array_negative( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2177, "end_line": 2180, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_absolute", "long_name": "array_absolute( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2183, "end_line": 2186, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_invert", "long_name": "array_invert( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2189, "end_line": 2192, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_left_shift", "long_name": "array_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2195, "end_line": 2198, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_right_shift", "long_name": "array_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2201, "end_line": 2204, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_and", "long_name": "array_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2207, "end_line": 2210, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_or", "long_name": "array_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2213, "end_line": 2216, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_xor", "long_name": "array_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2219, "end_line": 2222, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_add", "long_name": "array_inplace_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2225, "end_line": 2228, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_subtract", "long_name": "array_inplace_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2231, "end_line": 2234, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_multiply", "long_name": "array_inplace_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2237, "end_line": 2240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_divide", "long_name": "array_inplace_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2243, "end_line": 2246, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_remainder", "long_name": "array_inplace_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2249, "end_line": 2252, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_power", "long_name": "array_inplace_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2255, "end_line": 2258, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_left_shift", "long_name": "array_inplace_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2261, "end_line": 2264, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_right_shift", "long_name": "array_inplace_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2267, "end_line": 2270, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_and", "long_name": "array_inplace_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2273, "end_line": 2276, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_or", "long_name": "array_inplace_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2279, "end_line": 2282, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_xor", "long_name": "array_inplace_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2285, "end_line": 2288, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_floor_divide", "long_name": "array_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2291, "end_line": 2294, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_TRUE_divide", "long_name": "array_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2297, "end_line": 2300, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_floor_divide", "long_name": "array_inplace_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2303, "end_line": 2307, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_inplace_TRUE_divide", "long_name": "array_inplace_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2310, "end_line": 2314, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_all_nonzero", "long_name": "array_all_nonzero( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 93, "parameters": [ "mp" ], "start_line": 2318, "end_line": 2336, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_divmod", "long_name": "array_divmod( PyArrayObject * op1 , PyObject * op2)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 89, "parameters": [ "op1", "op2" ], "start_line": 2339, "end_line": 2354, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_int", "long_name": "array_int( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2358, "end_line": 2384, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_float", "long_name": "array_float( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2387, "end_line": 2412, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_long", "long_name": "array_long( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2415, "end_line": 2437, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_oct", "long_name": "array_oct( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2440, "end_line": 2462, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_hex", "long_name": "array_hex( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2465, "end_line": 2487, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "_array_copy_nice", "long_name": "_array_copy_nice( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 22, "parameters": [ "self" ], "start_line": 2490, "end_line": 2494, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 258, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2555, "end_line": 2593, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_ass_slice", "long_name": "array_ass_slice( PyArrayObject * self , int ilow , int ihigh , PyObject * v)", "filename": "arrayobject.c", "nloc": 20, "complexity": 4, "token_count": 108, "parameters": [ "self", "ilow", "ihigh", "v" ], "start_line": 2597, "end_line": 2618, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_contains", "long_name": "array_contains( PyArrayObject * self , PyObject * el)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "el" ], "start_line": 2621, "end_line": 2626, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "dump_data", "long_name": "dump_data( char ** string , int * n , int * max_n , char * data , int nd , intp * dimensions , intp * strides , PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 41, "complexity": 7, "token_count": 308, "parameters": [ "string", "n", "max_n", "data", "nd", "dimensions", "strides", "self" ], "start_line": 2647, "end_line": 2694, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "array_repr_builtin", "long_name": "array_repr_builtin( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 30, "complexity": 4, "token_count": 222, "parameters": [ "self" ], "start_line": 2697, "end_line": 2733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_SetStringFunction", "long_name": "PyArray_SetStringFunction( PyObject * op , int repr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 48, "parameters": [ "op", "repr" ], "start_line": 2739, "end_line": 2756, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2759, "end_line": 2771, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2774, "end_line": 2786, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_richcompare", "long_name": "array_richcompare( PyArrayObject * self , PyObject * other , int cmp_op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 13, "token_count": 273, "parameters": [ "self", "other", "cmp_op" ], "start_line": 2790, "end_line": 2867, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 78, "top_nesting_level": 0 }, { "name": "_check_axis", "long_name": "_check_axis( PyArrayObject * arr , int * axis , int flags)", "filename": "arrayobject.c", "nloc": 29, "complexity": 8, "token_count": 164, "parameters": [ "arr", "axis", "flags" ], "start_line": 2870, "end_line": 2899, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyArray_IntTupleFromIntp", "long_name": "PyArray_IntTupleFromIntp( int len , intp * vals)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 91, "parameters": [ "len", "vals" ], "start_line": 2905, "end_line": 2921, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_IntpFromSequence", "long_name": "PyArray_IntpFromSequence( PyObject * seq , intp * vals , int maxvals)", "filename": "arrayobject.c", "nloc": 21, "complexity": 7, "token_count": 161, "parameters": [ "seq", "vals", "maxvals" ], "start_line": 2926, "end_line": 2949, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "_IsContiguous", "long_name": "_IsContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 109, "parameters": [ "ap" ], "start_line": 2955, "end_line": 2971, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsFortranContiguous", "long_name": "_IsFortranContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 107, "parameters": [ "ap" ], "start_line": 2975, "end_line": 2991, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsAligned", "long_name": "_IsAligned( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 110, "parameters": [ "ap" ], "start_line": 2995, "end_line": 3011, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsWriteable", "long_name": "_IsWriteable( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 16, "complexity": 8, "token_count": 109, "parameters": [ "ap" ], "start_line": 3014, "end_line": 3047, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_UpdateFlags", "long_name": "PyArray_UpdateFlags( PyArrayObject * ret , int flagmask)", "filename": "arrayobject.c", "nloc": 22, "complexity": 9, "token_count": 129, "parameters": [ "ret", "flagmask" ], "start_line": 3051, "end_line": 3073, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_CheckStrides", "long_name": "PyArray_CheckStrides( int elsize , int nd , intp numbytes , intp * dims , intp * newstrides)", "filename": "arrayobject.c", "nloc": 13, "complexity": 4, "token_count": 84, "parameters": [ "elsize", "nd", "numbytes", "dims", "newstrides" ], "start_line": 3080, "end_line": 3095, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "_array_fill_strides", "long_name": "_array_fill_strides( intp * strides , intp * dims , int nd , intp itemsize , int inflag , int * objflags)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 171, "parameters": [ "strides", "dims", "nd", "itemsize", "inflag", "objflags" ], "start_line": 3115, "end_line": 3139, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 672, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3143, "end_line": 3287, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "PyArray_Resize", "long_name": "PyArray_Resize( PyArrayObject * self , PyArray_Dims * newshape)", "filename": "arrayobject.c", "nloc": 87, "complexity": 15, "token_count": 501, "parameters": [ "self", "newshape" ], "start_line": 3292, "end_line": 3397, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_FillObjectArray", "long_name": "PyArray_FillObjectArray( PyArrayObject * arr , PyObject * obj)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 98, "parameters": [ "arr", "obj" ], "start_line": 3401, "end_line": 3418, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_new", "long_name": "array_new( PyTypeObject * subtype , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 100, "complexity": 20, "token_count": 593, "parameters": [ "subtype", "args", "kwds" ], "start_line": 3422, "end_line": 3537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 116, "top_nesting_level": 0 }, { "name": "array_ndim_get", "long_name": "array_ndim_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 3544, "end_line": 3547, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flags_get", "long_name": "array_flags_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 10, "complexity": 3, "token_count": 55, "parameters": [ "self" ], "start_line": 3550, "end_line": 3560, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_shape_get", "long_name": "array_shape_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3633, "end_line": 3636, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_shape_set", "long_name": "array_shape_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 33, "complexity": 6, "token_count": 206, "parameters": [ "self", "val" ], "start_line": 3640, "end_line": 3674, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_strides_get", "long_name": "array_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3678, "end_line": 3681, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_strides_set", "long_name": "array_strides_set( PyArrayObject * self , PyObject * obj)", "filename": "arrayobject.c", "nloc": 32, "complexity": 7, "token_count": 209, "parameters": [ "self", "obj" ], "start_line": 3684, "end_line": 3717, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_protocol_strides_get", "long_name": "array_protocol_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 35, "parameters": [ "self" ], "start_line": 3721, "end_line": 3728, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_priority_get", "long_name": "array_priority_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 3, "token_count": 42, "parameters": [ "self" ], "start_line": 3731, "end_line": 3739, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_data_get", "long_name": "array_data_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 82, "parameters": [ "self" ], "start_line": 3743, "end_line": 3757, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_data_set", "long_name": "array_data_set( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 44, "complexity": 9, "token_count": 229, "parameters": [ "self", "op" ], "start_line": 3760, "end_line": 3804, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "array_itemsize_get", "long_name": "array_itemsize_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 3808, "end_line": 3811, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_size_get", "long_name": "array_size_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "self" ], "start_line": 3814, "end_line": 3821, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typechar_get", "long_name": "array_typechar_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 47, "parameters": [ "self" ], "start_line": 3825, "end_line": 3832, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typestr_get", "long_name": "array_typestr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 7, "token_count": 141, "parameters": [ "self" ], "start_line": 3835, "end_line": 3855, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_descr_get", "long_name": "array_descr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 128, "parameters": [ "self" ], "start_line": 3858, "end_line": 3880, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_typenum_get", "long_name": "array_typenum_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 3883, "end_line": 3886, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_get", "long_name": "array_type_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 3890, "end_line": 3893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_set", "long_name": "array_type_set( PyArrayObject * self , PyObject * arg)", "filename": "arrayobject.c", "nloc": 41, "complexity": 10, "token_count": 294, "parameters": [ "self", "arg" ], "start_line": 3905, "end_line": 3963, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "array_base_get", "long_name": "array_base_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 41, "parameters": [ "self" ], "start_line": 3968, "end_line": 3978, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 129, "parameters": [ "self" ], "start_line": 3982, "end_line": 4007, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 177, "parameters": [ "self", "val" ], "start_line": 4011, "end_line": 4043, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 3, "token_count": 200, "parameters": [ "self" ], "start_line": 4046, "end_line": 4081, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 203, "parameters": [ "self", "val" ], "start_line": 4084, "end_line": 4121, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_flat_get", "long_name": "array_flat_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 4124, "end_line": 4127, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 51, "complexity": 9, "token_count": 368, "parameters": [ "self", "val" ], "start_line": 4130, "end_line": 4184, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "discover_depth", "long_name": "discover_depth( PyObject * s , int max , int stop_at_string)", "filename": "arrayobject.c", "nloc": 23, "complexity": 14, "token_count": 169, "parameters": [ "s", "max", "stop_at_string" ], "start_line": 4360, "end_line": 4385, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "discover_itemsize", "long_name": "discover_itemsize( PyObject * s , int nd , int * itemsize)", "filename": "arrayobject.c", "nloc": 21, "complexity": 9, "token_count": 161, "parameters": [ "s", "nd", "itemsize" ], "start_line": 4388, "end_line": 4410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "discover_dimensions", "long_name": "discover_dimensions( PyObject * s , int nd , intp * d , int check_it)", "filename": "arrayobject.c", "nloc": 24, "complexity": 10, "token_count": 188, "parameters": [ "s", "nd", "d", "check_it" ], "start_line": 4417, "end_line": 4443, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_array_small_type", "long_name": "_array_small_type( int chktype , int mintype , int chksize , int minsize , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 100, "parameters": [ "chktype", "mintype", "chksize", "minsize", "outtype" ], "start_line": 4446, "end_line": 4466, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 126, "complexity": 28, "token_count": 671, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4469, "end_line": 4610, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 142, "top_nesting_level": 0 }, { "name": "Assign_Array", "long_name": "Assign_Array( PyArrayObject * self , PyObject * v)", "filename": "arrayobject.c", "nloc": 21, "complexity": 6, "token_count": 121, "parameters": [ "self", "v" ], "start_line": 4613, "end_line": 4636, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromScalar", "long_name": "Array_FromScalar( PyObject * op , PyArray_Typecode * typecode)", "filename": "arrayobject.c", "nloc": 19, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode" ], "start_line": 4640, "end_line": 4663, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromSequence", "long_name": "Array_FromSequence( PyObject * s , PyArray_Typecode * typecode , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 51, "complexity": 17, "token_count": 313, "parameters": [ "s", "typecode", "min_depth", "max_depth" ], "start_line": 4667, "end_line": 4724, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_ValidType", "long_name": "PyArray_ValidType( int type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 2, "token_count": 30, "parameters": [ "type" ], "start_line": 4728, "end_line": 4735, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "_bufferedcast", "long_name": "_bufferedcast( PyArrayObject * out , PyArrayObject * in)", "filename": "arrayobject.c", "nloc": 75, "complexity": 16, "token_count": 477, "parameters": [ "out", "in" ], "start_line": 4741, "end_line": 4831, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "PyArray_Cast", "long_name": "PyArray_Cast( PyArrayObject * mp , int type_num)", "filename": "arrayobject.c", "nloc": 10, "complexity": 1, "token_count": 56, "parameters": [ "mp", "type_num" ], "start_line": 4837, "end_line": 4848, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 233, "parameters": [ "mp", "at" ], "start_line": 4851, "end_line": 4886, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_CastTo", "long_name": "PyArray_CastTo( PyArrayObject * out , PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 40, "complexity": 10, "token_count": 214, "parameters": [ "out", "mp" ], "start_line": 4893, "end_line": 4939, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 80, "complexity": 26, "token_count": 522, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4942, "end_line": 5036, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "_array_typecode_fromstr", "long_name": "_array_typecode_fromstr( char * str , int * swap , PyArray_Typecode * type)", "filename": "arrayobject.c", "nloc": 94, "complexity": 36, "token_count": 533, "parameters": [ "str", "swap", "type" ], "start_line": 5040, "end_line": 5145, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5148, "end_line": 5242, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_fromattr", "long_name": "array_fromattr( PyObject * op , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 21, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode", "flags" ], "start_line": 5245, "end_line": 5266, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_fromobject", "long_name": "array_fromobject( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int flags)", "filename": "arrayobject.c", "nloc": 46, "complexity": 13, "token_count": 270, "parameters": [ "op", "typecode", "min_depth", "max_depth", "flags" ], "start_line": 5270, "end_line": 5332, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_ArrayType", "long_name": "PyArray_ArrayType( PyObject * op , PyArray_Typecode * intype , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 29, "parameters": [ "op", "intype", "outtype" ], "start_line": 5335, "end_line": 5340, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ObjectType", "long_name": "PyArray_ObjectType( PyObject * op , int minimum_type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 40, "parameters": [ "op", "minimum_type" ], "start_line": 5343, "end_line": 5349, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_FromAny", "long_name": "PyArray_FromAny( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int requires)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 165, "parameters": [ "op", "typecode", "min_depth", "max_depth", "requires" ], "start_line": 5403, "end_line": 5433, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "PyArray_EnsureArray", "long_name": "PyArray_EnsureArray( PyObject * op)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 82, "parameters": [ "op" ], "start_line": 5443, "end_line": 5459, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5465, "end_line": 5471, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5474, "end_line": 5481, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5484, "end_line": 5491, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CanCastSafely", "long_name": "PyArray_CanCastSafely( int fromtype , int totype)", "filename": "arrayobject.c", "nloc": 69, "complexity": 35, "token_count": 386, "parameters": [ "fromtype", "totype" ], "start_line": 5497, "end_line": 5568, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_CanCastTo", "long_name": "PyArray_CanCastTo( PyArray_Typecode * from , PyArray_Typecode * to)", "filename": "arrayobject.c", "nloc": 24, "complexity": 7, "token_count": 134, "parameters": [ "from", "to" ], "start_line": 5571, "end_line": 5595, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_IterNew", "long_name": "PyArray_IterNew( PyObject * obj)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 258, "parameters": [ "obj" ], "start_line": 5605, "end_line": 5642, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "arrayiter_next", "long_name": "arrayiter_next( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "it" ], "start_line": 5647, "end_line": 5657, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "arrayiter_dealloc", "long_name": "arrayiter_dealloc( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 25, "parameters": [ "it" ], "start_line": 5660, "end_line": 5665, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "arrayiter_traverse", "long_name": "arrayiter_traverse( PyArrayIterObject * it , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 6, "complexity": 2, "token_count": 42, "parameters": [ "it", "visit", "arg" ], "start_line": 5668, "end_line": 5673, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "iter_length", "long_name": "iter_length( PyArrayIterObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 5677, "end_line": 5680, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 272, "parameters": [ "self", "ind" ], "start_line": 5684, "end_line": 5732, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 51, "complexity": 8, "token_count": 347, "parameters": [ "self", "ind" ], "start_line": 5735, "end_line": 5788, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 54, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 593, "parameters": [ "self", "ind" ], "start_line": 5792, "end_line": 5911, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "iter_ass_sub_Bool", "long_name": "iter_ass_sub_Bool( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 31, "complexity": 5, "token_count": 176, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5915, "end_line": 5947, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 42, "complexity": 8, "token_count": 289, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5950, "end_line": 5992, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "iter_ass_subscript", "long_name": "iter_ass_subscript( PyArrayIterObject * self , PyObject * ind , PyObject * val)", "filename": "arrayobject.c", "nloc": 103, "complexity": 24, "token_count": 636, "parameters": [ "self", "ind", "val" ], "start_line": 5996, "end_line": 6118, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 30, "complexity": 5, "token_count": 221, "parameters": [ "it", "op" ], "start_line": 6131, "end_line": 6173, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "iter_copy", "long_name": "iter_copy( PyArrayIterObject * it , PyObject * args)", "filename": "arrayobject.c", "nloc": 5, "complexity": 2, "token_count": 35, "parameters": [ "it", "args" ], "start_line": 6178, "end_line": 6182, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "fancy_indexing_check", "long_name": "fancy_indexing_check( PyObject * args)", "filename": "arrayobject.c", "nloc": 55, "complexity": 22, "token_count": 293, "parameters": [ "args" ], "start_line": 6247, "end_line": 6308, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 62, "top_nesting_level": 0 }, { "name": "_convert_obj", "long_name": "_convert_obj( PyObject * obj , PyArrayIterObject ** iter)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 105, "parameters": [ "obj", "iter" ], "start_line": 6316, "end_line": 6331, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyArray_Broadcast", "long_name": "PyArray_Broadcast( PyArrayMultiIterObject * mit)", "filename": "arrayobject.c", "nloc": 58, "complexity": 13, "token_count": 464, "parameters": [ "mit" ], "start_line": 6337, "end_line": 6406, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterReset", "long_name": "PyArray_MapIterReset( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 35, "complexity": 4, "token_count": 261, "parameters": [ "mit" ], "start_line": 6410, "end_line": 6446, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNext", "long_name": "PyArray_MapIterNext( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 41, "complexity": 6, "token_count": 296, "parameters": [ "mit" ], "start_line": 6452, "end_line": 6496, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 690, "parameters": [ "mit", "arr" ], "start_line": 6514, "end_line": 6650, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "_nonzero_indices", "long_name": "_nonzero_indices( PyObject * myBool , PyArrayIterObject ** iters)", "filename": "arrayobject.c", "nloc": 57, "complexity": 15, "token_count": 454, "parameters": [ "myBool", "iters" ], "start_line": 6656, "end_line": 6725, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNew", "long_name": "PyArray_MapIterNew( PyObject * indexobj)", "filename": "arrayobject.c", "nloc": 111, "complexity": 24, "token_count": 745, "parameters": [ "indexobj" ], "start_line": 6728, "end_line": 6861, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 134, "top_nesting_level": 0 }, { "name": "arraymapiter_new", "long_name": "arraymapiter_new( PyTypeObject * type , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 130, "parameters": [ "type", "args", "kwds" ], "start_line": 6867, "end_line": 6897, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "arraymapiter_next", "long_name": "arraymapiter_next( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 12, "complexity": 4, "token_count": 70, "parameters": [ "mit" ], "start_line": 6903, "end_line": 6914, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "arraymapiter_dealloc", "long_name": "arraymapiter_dealloc( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 60, "parameters": [ "mit" ], "start_line": 6917, "end_line": 6926, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "arraymapiter_traverse", "long_name": "arraymapiter_traverse( PyArrayMapIterObject * mit , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 16, "complexity": 9, "token_count": 146, "parameters": [ "mit", "visit", "arg" ], "start_line": 6929, "end_line": 6947, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 } ], "methods_before": [ { "name": "PyArray_PyIntAsIntp", "long_name": "PyArray_PyIntAsIntp( PyObject * o)", "filename": "arrayobject.c", "nloc": 59, "complexity": 19, "token_count": 385, "parameters": [ "o" ], "start_line": 40, "end_line": 103, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 64, "top_nesting_level": 0 }, { "name": "PyArray_PyIntAsInt", "long_name": "PyArray_PyIntAsInt( PyObject * o)", "filename": "arrayobject.c", "nloc": 57, "complexity": 19, "token_count": 389, "parameters": [ "o" ], "start_line": 109, "end_line": 169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 61, "top_nesting_level": 0 }, { "name": "PyArray_GetPriority", "long_name": "PyArray_GetPriority( PyObject * obj , double default_)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 86, "parameters": [ "obj", "default_" ], "start_line": 173, "end_line": 191, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "PyArray_Zero", "long_name": "PyArray_Zero( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 190, "parameters": [ "arr" ], "start_line": 208, "end_line": 243, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_One", "long_name": "PyArray_One( PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 40, "complexity": 7, "token_count": 222, "parameters": [ "arr" ], "start_line": 246, "end_line": 289, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "do_sliced_copy", "long_name": "do_sliced_copy( char * dest , intp * dest_strides , intp * dest_dimensions , int dest_nd , char * src , intp * src_strides , intp * src_dimensions , int src_nd , int elsize , int copies)", "filename": "arrayobject.c", "nloc": 48, "complexity": 13, "token_count": 313, "parameters": [ "dest", "dest_strides", "dest_dimensions", "dest_nd", "src", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 295, "end_line": 345, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "optimize_slices", "long_name": "optimize_slices( intp ** dest_strides , intp ** dest_dimensions , int * dest_nd , intp ** src_strides , intp ** src_dimensions , int * src_nd , int * elsize , int * copies)", "filename": "arrayobject.c", "nloc": 32, "complexity": 8, "token_count": 214, "parameters": [ "dest_strides", "dest_dimensions", "dest_nd", "src_strides", "src_dimensions", "src_nd", "elsize", "copies" ], "start_line": 368, "end_line": 399, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 32, "top_nesting_level": 0 }, { "name": "contiguous_data", "long_name": "contiguous_data( PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 29, "complexity": 4, "token_count": 213, "parameters": [ "src" ], "start_line": 402, "end_line": 436, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_INCREF", "long_name": "PyArray_INCREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 449, "end_line": 471, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_XDECREF", "long_name": "PyArray_XDECREF( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 6, "token_count": 125, "parameters": [ "mp" ], "start_line": 474, "end_line": 495, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "byte_swap_vector", "long_name": "byte_swap_vector( * p , int n , int size)", "filename": "arrayobject.c", "nloc": 38, "complexity": 10, "token_count": 340, "parameters": [ "p", "n", "size" ], "start_line": 499, "end_line": 537, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "copy_and_swap", "long_name": "copy_and_swap( * dst , * src , int itemsize , intp numitems , intp srcstrides , int swap)", "filename": "arrayobject.c", "nloc": 18, "complexity": 5, "token_count": 120, "parameters": [ "dst", "src", "itemsize", "numitems", "srcstrides", "swap" ], "start_line": 542, "end_line": 562, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "index2ptr", "long_name": "index2ptr( PyArrayObject * mp , int i)", "filename": "arrayobject.c", "nloc": 10, "complexity": 7, "token_count": 86, "parameters": [ "mp", "i" ], "start_line": 570, "end_line": 580, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "PyArray_Size", "long_name": "PyArray_Size( PyObject * op)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 33, "parameters": [ "op" ], "start_line": 583, "end_line": 591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "PyArray_CopyInto", "long_name": "PyArray_CopyInto( PyArrayObject * dest , PyArrayObject * src)", "filename": "arrayobject.c", "nloc": 71, "complexity": 16, "token_count": 425, "parameters": [ "dest", "src" ], "start_line": 604, "end_line": 684, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 81, "top_nesting_level": 0 }, { "name": "PyArray_CopyObject", "long_name": "PyArray_CopyObject( PyArrayObject * dest , PyObject * src_object)", "filename": "arrayobject.c", "nloc": 16, "complexity": 2, "token_count": 98, "parameters": [ "dest", "src_object" ], "start_line": 688, "end_line": 707, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndDataAndDescr", "long_name": "PyArray_FromDimsAndDataAndDescr( int nd , int * d , PyArray_Descr * descr , char * data)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 144, "parameters": [ "nd", "d", "descr", "data" ], "start_line": 715, "end_line": 736, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "PyArray_FromDimsAndData", "long_name": "PyArray_FromDimsAndData( int nd , int * d , int type , char * data)", "filename": "arrayobject.c", "nloc": 16, "complexity": 5, "token_count": 137, "parameters": [ "nd", "d", "type", "data" ], "start_line": 740, "end_line": 760, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "PyArray_FromDims", "long_name": "PyArray_FromDims( int nd , int * d , int type)", "filename": "arrayobject.c", "nloc": 14, "complexity": 5, "token_count": 133, "parameters": [ "nd", "d", "type" ], "start_line": 764, "end_line": 781, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "PyArray_Copy", "long_name": "PyArray_Copy( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 77, "parameters": [ "m1" ], "start_line": 787, "end_line": 799, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "PyArray_Scalar", "long_name": "PyArray_Scalar( char * data , int type_num , int itemsize , int swap)", "filename": "arrayobject.c", "nloc": 48, "complexity": 8, "token_count": 289, "parameters": [ "data", "type_num", "itemsize", "swap" ], "start_line": 805, "end_line": 854, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 50, "top_nesting_level": 0 }, { "name": "PyArray_ToScalar", "long_name": "PyArray_ToScalar( char * data , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 51, "parameters": [ "data", "arr" ], "start_line": 861, "end_line": 868, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_Return", "long_name": "PyArray_Return( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 17, "complexity": 5, "token_count": 85, "parameters": [ "mp" ], "start_line": 874, "end_line": 893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDataType", "long_name": "PyArray_RegisterDataType( PyTypeObject * type)", "filename": "arrayobject.c", "nloc": 31, "complexity": 6, "token_count": 177, "parameters": [ "type" ], "start_line": 904, "end_line": 936, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "PyArray_RegisterDescrForType", "long_name": "PyArray_RegisterDescrForType( int typenum , PyArray_Descr * descr)", "filename": "arrayobject.c", "nloc": 32, "complexity": 3, "token_count": 167, "parameters": [ "typenum", "descr" ], "start_line": 946, "end_line": 989, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 44, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 87, "complexity": 16, "token_count": 571, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 993, "end_line": 1082, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 90, "top_nesting_level": 0 }, { "name": "PyArray_ToList", "long_name": "PyArray_ToList( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 24, "complexity": 5, "token_count": 151, "parameters": [ "self" ], "start_line": 1085, "end_line": 1113, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 29, "top_nesting_level": 0 }, { "name": "PyArray_ToString", "long_name": "PyArray_ToString( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 191, "parameters": [ "self" ], "start_line": 1116, "end_line": 1151, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_dealloc", "long_name": "array_dealloc( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 20, "complexity": 7, "token_count": 144, "parameters": [ "self" ], "start_line": 1160, "end_line": 1197, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_length", "long_name": "array_length( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "self" ], "start_line": 1204, "end_line": 1212, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_item", "long_name": "array_item( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 22, "complexity": 4, "token_count": 150, "parameters": [ "self", "i" ], "start_line": 1216, "end_line": 1240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "array_item_nice", "long_name": "array_item_nice( PyArrayObject * self , int i)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "i" ], "start_line": 1243, "end_line": 1246, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_ass_item", "long_name": "array_ass_item( PyArrayObject * self , int i , PyObject * v)", "filename": "arrayobject.c", "nloc": 27, "complexity": 8, "token_count": 177, "parameters": [ "self", "i", "v" ], "start_line": 1250, "end_line": 1280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "slice_coerce_index", "long_name": "slice_coerce_index( PyObject * o , int * v)", "filename": "arrayobject.c", "nloc": 9, "complexity": 2, "token_count": 40, "parameters": [ "o", "v" ], "start_line": 1284, "end_line": 1292, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "slice_GetIndices", "long_name": "slice_GetIndices( PySliceObject * r , int length , int * start , int * stop , int * step , intp * slicelength)", "filename": "arrayobject.c", "nloc": 45, "complexity": 24, "token_count": 376, "parameters": [ "r", "length", "start", "stop", "step", "slicelength" ], "start_line": 1298, "end_line": 1348, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "parse_subindex", "long_name": "parse_subindex( PyObject * op , int * step_size , intp * n_steps , int max)", "filename": "arrayobject.c", "nloc": 45, "complexity": 11, "token_count": 223, "parameters": [ "op", "step_size", "n_steps", "max" ], "start_line": 1355, "end_line": 1400, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 46, "top_nesting_level": 0 }, { "name": "parse_index", "long_name": "parse_index( PyArrayObject * self , PyObject * op , intp * dimensions , intp * strides , intp * offset_ptr)", "filename": "arrayobject.c", "nloc": 89, "complexity": 20, "token_count": 540, "parameters": [ "self", "op", "dimensions", "strides", "offset_ptr" ], "start_line": 1404, "end_line": 1499, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 96, "top_nesting_level": 0 }, { "name": "_swap_axes", "long_name": "_swap_axes( PyArrayMapIterObject * mit , PyArrayObject ** ret)", "filename": "arrayobject.c", "nloc": 24, "complexity": 4, "token_count": 187, "parameters": [ "mit", "ret" ], "start_line": 1502, "end_line": 1536, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "PyArray_GetMap", "long_name": "PyArray_GetMap( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 36, "complexity": 8, "token_count": 252, "parameters": [ "mit" ], "start_line": 1541, "end_line": 1591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 51, "top_nesting_level": 0 }, { "name": "PyArray_SetMap", "long_name": "PyArray_SetMap( PyArrayMapIterObject * mit , PyObject * op)", "filename": "arrayobject.c", "nloc": 50, "complexity": 12, "token_count": 392, "parameters": [ "mit", "op" ], "start_line": 1594, "end_line": 1653, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 60, "top_nesting_level": 0 }, { "name": "array_subscript", "long_name": "array_subscript( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 19, "token_count": 425, "parameters": [ "self", "op" ], "start_line": 1674, "end_line": 1749, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 76, "top_nesting_level": 0 }, { "name": "array_ass_sub", "long_name": "array_ass_sub( PyArrayObject * self , PyObject * index , PyObject * op)", "filename": "arrayobject.c", "nloc": 43, "complexity": 9, "token_count": 251, "parameters": [ "self", "index", "op" ], "start_line": 1762, "end_line": 1814, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "array_subscript_nice", "long_name": "array_subscript_nice( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 27, "parameters": [ "self", "op" ], "start_line": 1822, "end_line": 1825, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_getsegcount", "long_name": "array_getsegcount( PyArrayObject * self , int * lenp)", "filename": "arrayobject.c", "nloc": 11, "complexity": 4, "token_count": 48, "parameters": [ "self", "lenp" ], "start_line": 1844, "end_line": 1856, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_getreadbuf", "long_name": "array_getreadbuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 72, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1859, "end_line": 1874, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_getwritebuf", "long_name": "array_getwritebuf( PyArrayObject * self , int segment , ** ptrptr)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 54, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1878, "end_line": 1887, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "array_getcharbuf", "long_name": "array_getcharbuf( PyArrayObject * self , int segment , const char ** ptrptr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 3, "token_count": 65, "parameters": [ "self", "segment", "ptrptr" ], "start_line": 1890, "end_line": 1901, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_SetNumericOps", "long_name": "PyArray_SetNumericOps( PyObject * dict)", "filename": "arrayobject.c", "nloc": 34, "complexity": 1, "token_count": 162, "parameters": [ "dict" ], "start_line": 1969, "end_line": 2002, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_GetNumericOps", "long_name": "PyArray_GetNumericOps()", "filename": "arrayobject.c", "nloc": 39, "complexity": 2, "token_count": 183, "parameters": [], "start_line": 2008, "end_line": 2047, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 40, "top_nesting_level": 0 }, { "name": "PyArray_GenericReduceFunction", "long_name": "PyArray_GenericReduceFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2050, "end_line": 2069, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericAccumulateFunction", "long_name": "PyArray_GenericAccumulateFunction( PyArrayObject * m1 , PyObject * op , int axis , int rtype)", "filename": "arrayobject.c", "nloc": 20, "complexity": 5, "token_count": 121, "parameters": [ "m1", "op", "axis", "rtype" ], "start_line": 2073, "end_line": 2092, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 20, "top_nesting_level": 0 }, { "name": "PyArray_GenericBinaryFunction", "long_name": "PyArray_GenericBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 69, "parameters": [ "m1", "m2", "op" ], "start_line": 2096, "end_line": 2107, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericUnaryFunction", "long_name": "PyArray_GenericUnaryFunction( PyArrayObject * m1 , PyObject * op)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 63, "parameters": [ "m1", "op" ], "start_line": 2110, "end_line": 2121, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_GenericInplaceBinaryFunction", "long_name": "PyArray_GenericInplaceBinaryFunction( PyArrayObject * m1 , PyObject * m2 , PyObject * op)", "filename": "arrayobject.c", "nloc": 13, "complexity": 2, "token_count": 71, "parameters": [ "m1", "m2", "op" ], "start_line": 2124, "end_line": 2136, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_add", "long_name": "array_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2139, "end_line": 2142, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_subtract", "long_name": "array_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2145, "end_line": 2148, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_multiply", "long_name": "array_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2151, "end_line": 2154, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_divide", "long_name": "array_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2157, "end_line": 2160, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_remainder", "long_name": "array_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2163, "end_line": 2166, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_power", "long_name": "array_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2169, "end_line": 2172, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_negative", "long_name": "array_negative( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2175, "end_line": 2178, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_absolute", "long_name": "array_absolute( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2181, "end_line": 2184, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_invert", "long_name": "array_invert( PyArrayObject * m1)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "m1" ], "start_line": 2187, "end_line": 2190, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_left_shift", "long_name": "array_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2193, "end_line": 2196, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_right_shift", "long_name": "array_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2199, "end_line": 2202, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_and", "long_name": "array_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2205, "end_line": 2208, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_or", "long_name": "array_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2211, "end_line": 2214, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_bitwise_xor", "long_name": "array_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2217, "end_line": 2220, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_add", "long_name": "array_inplace_add( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2223, "end_line": 2226, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_subtract", "long_name": "array_inplace_subtract( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2229, "end_line": 2232, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_multiply", "long_name": "array_inplace_multiply( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2235, "end_line": 2238, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_divide", "long_name": "array_inplace_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2241, "end_line": 2244, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_remainder", "long_name": "array_inplace_remainder( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2247, "end_line": 2250, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_power", "long_name": "array_inplace_power( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2253, "end_line": 2256, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_left_shift", "long_name": "array_inplace_left_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2259, "end_line": 2262, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_right_shift", "long_name": "array_inplace_right_shift( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2265, "end_line": 2268, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_and", "long_name": "array_inplace_bitwise_and( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2271, "end_line": 2274, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_or", "long_name": "array_inplace_bitwise_or( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2277, "end_line": 2280, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_bitwise_xor", "long_name": "array_inplace_bitwise_xor( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2283, "end_line": 2286, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_floor_divide", "long_name": "array_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2289, "end_line": 2292, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_TRUE_divide", "long_name": "array_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2295, "end_line": 2298, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_inplace_floor_divide", "long_name": "array_inplace_floor_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2301, "end_line": 2305, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_inplace_TRUE_divide", "long_name": "array_inplace_TRUE_divide( PyArrayObject * m1 , PyObject * m2)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 24, "parameters": [ "m1", "m2" ], "start_line": 2308, "end_line": 2312, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_all_nonzero", "long_name": "array_all_nonzero( PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 93, "parameters": [ "mp" ], "start_line": 2316, "end_line": 2334, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 }, { "name": "array_divmod", "long_name": "array_divmod( PyArrayObject * op1 , PyObject * op2)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 89, "parameters": [ "op1", "op2" ], "start_line": 2337, "end_line": 2352, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "array_int", "long_name": "array_int( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2356, "end_line": 2382, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "array_float", "long_name": "array_float( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 143, "parameters": [ "v" ], "start_line": 2385, "end_line": 2410, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_long", "long_name": "array_long( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2413, "end_line": 2435, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_oct", "long_name": "array_oct( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2438, "end_line": 2460, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_hex", "long_name": "array_hex( PyArrayObject * v)", "filename": "arrayobject.c", "nloc": 23, "complexity": 4, "token_count": 124, "parameters": [ "v" ], "start_line": 2463, "end_line": 2485, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "_array_copy_nice", "long_name": "_array_copy_nice( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 5, "complexity": 1, "token_count": 22, "parameters": [ "self" ], "start_line": 2488, "end_line": 2492, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "array_slice", "long_name": "array_slice( PyArrayObject * self , int ilow , int ihigh)", "filename": "arrayobject.c", "nloc": 34, "complexity": 11, "token_count": 258, "parameters": [ "self", "ilow", "ihigh" ], "start_line": 2553, "end_line": 2591, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 39, "top_nesting_level": 0 }, { "name": "array_ass_slice", "long_name": "array_ass_slice( PyArrayObject * self , int ilow , int ihigh , PyObject * v)", "filename": "arrayobject.c", "nloc": 20, "complexity": 4, "token_count": 108, "parameters": [ "self", "ilow", "ihigh", "v" ], "start_line": 2595, "end_line": 2616, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_contains", "long_name": "array_contains( PyArrayObject * self , PyObject * el)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 26, "parameters": [ "self", "el" ], "start_line": 2619, "end_line": 2624, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "dump_data", "long_name": "dump_data( char ** string , int * n , int * max_n , char * data , int nd , intp * dimensions , intp * strides , PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 41, "complexity": 7, "token_count": 308, "parameters": [ "string", "n", "max_n", "data", "nd", "dimensions", "strides", "self" ], "start_line": 2645, "end_line": 2692, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 48, "top_nesting_level": 0 }, { "name": "array_repr_builtin", "long_name": "array_repr_builtin( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 30, "complexity": 4, "token_count": 222, "parameters": [ "self" ], "start_line": 2695, "end_line": 2731, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_SetStringFunction", "long_name": "PyArray_SetStringFunction( PyObject * op , int repr)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 48, "parameters": [ "op", "repr" ], "start_line": 2737, "end_line": 2754, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_repr", "long_name": "array_repr( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2757, "end_line": 2769, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_str", "long_name": "array_str( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 12, "complexity": 2, "token_count": 59, "parameters": [ "self" ], "start_line": 2772, "end_line": 2784, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 13, "top_nesting_level": 0 }, { "name": "array_richcompare", "long_name": "array_richcompare( PyArrayObject * self , PyObject * other , int cmp_op)", "filename": "arrayobject.c", "nloc": 61, "complexity": 13, "token_count": 273, "parameters": [ "self", "other", "cmp_op" ], "start_line": 2788, "end_line": 2865, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 78, "top_nesting_level": 0 }, { "name": "_check_axis", "long_name": "_check_axis( PyArrayObject * arr , int * axis , int flags)", "filename": "arrayobject.c", "nloc": 29, "complexity": 8, "token_count": 164, "parameters": [ "arr", "axis", "flags" ], "start_line": 2868, "end_line": 2897, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 30, "top_nesting_level": 0 }, { "name": "PyArray_IntTupleFromIntp", "long_name": "PyArray_IntTupleFromIntp( int len , intp * vals)", "filename": "arrayobject.c", "nloc": 17, "complexity": 4, "token_count": 91, "parameters": [ "len", "vals" ], "start_line": 2903, "end_line": 2919, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_IntpFromSequence", "long_name": "PyArray_IntpFromSequence( PyObject * seq , intp * vals , int maxvals)", "filename": "arrayobject.c", "nloc": 21, "complexity": 7, "token_count": 161, "parameters": [ "seq", "vals", "maxvals" ], "start_line": 2924, "end_line": 2947, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "_IsContiguous", "long_name": "_IsContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 109, "parameters": [ "ap" ], "start_line": 2953, "end_line": 2969, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsFortranContiguous", "long_name": "_IsFortranContiguous( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 6, "token_count": 107, "parameters": [ "ap" ], "start_line": 2973, "end_line": 2989, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsAligned", "long_name": "_IsAligned( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 110, "parameters": [ "ap" ], "start_line": 2993, "end_line": 3009, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "_IsWriteable", "long_name": "_IsWriteable( PyArrayObject * ap)", "filename": "arrayobject.c", "nloc": 16, "complexity": 8, "token_count": 109, "parameters": [ "ap" ], "start_line": 3012, "end_line": 3045, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "PyArray_UpdateFlags", "long_name": "PyArray_UpdateFlags( PyArrayObject * ret , int flagmask)", "filename": "arrayobject.c", "nloc": 22, "complexity": 9, "token_count": 129, "parameters": [ "ret", "flagmask" ], "start_line": 3049, "end_line": 3071, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "PyArray_CheckStrides", "long_name": "PyArray_CheckStrides( int elsize , int nd , intp numbytes , intp * dims , intp * newstrides)", "filename": "arrayobject.c", "nloc": 13, "complexity": 4, "token_count": 84, "parameters": [ "elsize", "nd", "numbytes", "dims", "newstrides" ], "start_line": 3078, "end_line": 3093, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "_array_fill_strides", "long_name": "_array_fill_strides( intp * strides , intp * dims , int nd , intp itemsize , int inflag , int * objflags)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 171, "parameters": [ "strides", "dims", "nd", "itemsize", "inflag", "objflags" ], "start_line": 3113, "end_line": 3137, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_New", "long_name": "PyArray_New( PyTypeObject * subtype , int nd , intp * dims , int type_num , intp * strides , char * data , int itemsize , int flags , PyObject * obj)", "filename": "arrayobject.c", "nloc": 112, "complexity": 28, "token_count": 672, "parameters": [ "subtype", "nd", "dims", "type_num", "strides", "data", "itemsize", "flags", "obj" ], "start_line": 3141, "end_line": 3285, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 145, "top_nesting_level": 0 }, { "name": "PyArray_Resize", "long_name": "PyArray_Resize( PyArrayObject * self , PyArray_Dims * newshape)", "filename": "arrayobject.c", "nloc": 87, "complexity": 15, "token_count": 501, "parameters": [ "self", "newshape" ], "start_line": 3290, "end_line": 3395, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "PyArray_FillObjectArray", "long_name": "PyArray_FillObjectArray( PyArrayObject * arr , PyObject * obj)", "filename": "arrayobject.c", "nloc": 18, "complexity": 4, "token_count": 98, "parameters": [ "arr", "obj" ], "start_line": 3399, "end_line": 3416, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 18, "top_nesting_level": 0 }, { "name": "array_new", "long_name": "array_new( PyTypeObject * subtype , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 100, "complexity": 20, "token_count": 593, "parameters": [ "subtype", "args", "kwds" ], "start_line": 3420, "end_line": 3535, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 116, "top_nesting_level": 0 }, { "name": "array_ndim_get", "long_name": "array_ndim_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 3542, "end_line": 3545, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flags_get", "long_name": "array_flags_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 10, "complexity": 3, "token_count": 55, "parameters": [ "self" ], "start_line": 3548, "end_line": 3558, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_shape_get", "long_name": "array_shape_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3631, "end_line": 3634, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_shape_set", "long_name": "array_shape_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 33, "complexity": 6, "token_count": 206, "parameters": [ "self", "val" ], "start_line": 3638, "end_line": 3672, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 35, "top_nesting_level": 0 }, { "name": "array_strides_get", "long_name": "array_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 20, "parameters": [ "self" ], "start_line": 3676, "end_line": 3679, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_strides_set", "long_name": "array_strides_set( PyArrayObject * self , PyObject * obj)", "filename": "arrayobject.c", "nloc": 32, "complexity": 7, "token_count": 209, "parameters": [ "self", "obj" ], "start_line": 3682, "end_line": 3715, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 34, "top_nesting_level": 0 }, { "name": "array_protocol_strides_get", "long_name": "array_protocol_strides_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 35, "parameters": [ "self" ], "start_line": 3719, "end_line": 3726, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_priority_get", "long_name": "array_priority_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 9, "complexity": 3, "token_count": 42, "parameters": [ "self" ], "start_line": 3729, "end_line": 3737, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 9, "top_nesting_level": 0 }, { "name": "array_data_get", "long_name": "array_data_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 15, "complexity": 3, "token_count": 82, "parameters": [ "self" ], "start_line": 3741, "end_line": 3755, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 15, "top_nesting_level": 0 }, { "name": "array_data_set", "long_name": "array_data_set( PyArrayObject * self , PyObject * op)", "filename": "arrayobject.c", "nloc": 44, "complexity": 9, "token_count": 229, "parameters": [ "self", "op" ], "start_line": 3758, "end_line": 3802, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "array_itemsize_get", "long_name": "array_itemsize_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 19, "parameters": [ "self" ], "start_line": 3806, "end_line": 3809, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_size_get", "long_name": "array_size_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 3, "token_count": 45, "parameters": [ "self" ], "start_line": 3812, "end_line": 3819, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typechar_get", "long_name": "array_typechar_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 8, "complexity": 2, "token_count": 47, "parameters": [ "self" ], "start_line": 3823, "end_line": 3830, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "array_typestr_get", "long_name": "array_typestr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 7, "token_count": 141, "parameters": [ "self" ], "start_line": 3833, "end_line": 3853, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "array_descr_get", "long_name": "array_descr_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 128, "parameters": [ "self" ], "start_line": 3856, "end_line": 3878, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "array_typenum_get", "long_name": "array_typenum_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 21, "parameters": [ "self" ], "start_line": 3881, "end_line": 3884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_get", "long_name": "array_type_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 3888, "end_line": 3891, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_type_set", "long_name": "array_type_set( PyArrayObject * self , PyObject * arg)", "filename": "arrayobject.c", "nloc": 41, "complexity": 10, "token_count": 294, "parameters": [ "self", "arg" ], "start_line": 3903, "end_line": 3961, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 59, "top_nesting_level": 0 }, { "name": "array_base_get", "long_name": "array_base_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 11, "complexity": 2, "token_count": 41, "parameters": [ "self" ], "start_line": 3966, "end_line": 3976, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "array_real_get", "long_name": "array_real_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 25, "complexity": 3, "token_count": 129, "parameters": [ "self" ], "start_line": 3980, "end_line": 4005, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "array_real_set", "long_name": "array_real_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 31, "complexity": 4, "token_count": 177, "parameters": [ "self", "val" ], "start_line": 4009, "end_line": 4041, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "array_imag_get", "long_name": "array_imag_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 34, "complexity": 3, "token_count": 200, "parameters": [ "self" ], "start_line": 4044, "end_line": 4079, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "array_imag_set", "long_name": "array_imag_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 37, "complexity": 4, "token_count": 203, "parameters": [ "self", "val" ], "start_line": 4082, "end_line": 4119, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "array_flat_get", "long_name": "array_flat_get( PyArrayObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 18, "parameters": [ "self" ], "start_line": 4122, "end_line": 4125, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "array_flat_set", "long_name": "array_flat_set( PyArrayObject * self , PyObject * val)", "filename": "arrayobject.c", "nloc": 51, "complexity": 9, "token_count": 368, "parameters": [ "self", "val" ], "start_line": 4128, "end_line": 4182, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 55, "top_nesting_level": 0 }, { "name": "discover_depth", "long_name": "discover_depth( PyObject * s , int max , int stop_at_string)", "filename": "arrayobject.c", "nloc": 23, "complexity": 14, "token_count": 169, "parameters": [ "s", "max", "stop_at_string" ], "start_line": 4358, "end_line": 4383, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 26, "top_nesting_level": 0 }, { "name": "discover_itemsize", "long_name": "discover_itemsize( PyObject * s , int nd , int * itemsize)", "filename": "arrayobject.c", "nloc": 21, "complexity": 9, "token_count": 161, "parameters": [ "s", "nd", "itemsize" ], "start_line": 4386, "end_line": 4408, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 23, "top_nesting_level": 0 }, { "name": "discover_dimensions", "long_name": "discover_dimensions( PyObject * s , int nd , intp * d , int check_it)", "filename": "arrayobject.c", "nloc": 24, "complexity": 10, "token_count": 188, "parameters": [ "s", "nd", "d", "check_it" ], "start_line": 4415, "end_line": 4441, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 27, "top_nesting_level": 0 }, { "name": "_array_small_type", "long_name": "_array_small_type( int chktype , int mintype , int chksize , int minsize , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 19, "complexity": 5, "token_count": 100, "parameters": [ "chktype", "mintype", "chksize", "minsize", "outtype" ], "start_line": 4444, "end_line": 4464, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 21, "top_nesting_level": 0 }, { "name": "_array_find_type", "long_name": "_array_find_type( PyObject * op , PyArray_Typecode * minitype , PyArray_Typecode * outtype , int max)", "filename": "arrayobject.c", "nloc": 126, "complexity": 28, "token_count": 671, "parameters": [ "op", "minitype", "outtype", "max" ], "start_line": 4467, "end_line": 4608, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 142, "top_nesting_level": 0 }, { "name": "Assign_Array", "long_name": "Assign_Array( PyArrayObject * self , PyObject * v)", "filename": "arrayobject.c", "nloc": 21, "complexity": 6, "token_count": 121, "parameters": [ "self", "v" ], "start_line": 4611, "end_line": 4634, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromScalar", "long_name": "Array_FromScalar( PyObject * op , PyArray_Typecode * typecode)", "filename": "arrayobject.c", "nloc": 19, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode" ], "start_line": 4638, "end_line": 4661, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 24, "top_nesting_level": 0 }, { "name": "Array_FromSequence", "long_name": "Array_FromSequence( PyObject * s , PyArray_Typecode * typecode , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 51, "complexity": 17, "token_count": 313, "parameters": [ "s", "typecode", "min_depth", "max_depth" ], "start_line": 4665, "end_line": 4722, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 58, "top_nesting_level": 0 }, { "name": "PyArray_ValidType", "long_name": "PyArray_ValidType( int type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 2, "token_count": 30, "parameters": [ "type" ], "start_line": 4726, "end_line": 4733, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "_bufferedcast", "long_name": "_bufferedcast( PyArrayObject * out , PyArrayObject * in)", "filename": "arrayobject.c", "nloc": 75, "complexity": 16, "token_count": 477, "parameters": [ "out", "in" ], "start_line": 4739, "end_line": 4829, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 91, "top_nesting_level": 0 }, { "name": "PyArray_Cast", "long_name": "PyArray_Cast( PyArrayObject * mp , int type_num)", "filename": "arrayobject.c", "nloc": 10, "complexity": 1, "token_count": 56, "parameters": [ "mp", "type_num" ], "start_line": 4835, "end_line": 4846, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "PyArray_CastToType", "long_name": "PyArray_CastToType( PyArrayObject * mp , PyArray_Typecode * at)", "filename": "arrayobject.c", "nloc": 31, "complexity": 13, "token_count": 233, "parameters": [ "mp", "at" ], "start_line": 4849, "end_line": 4884, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 36, "top_nesting_level": 0 }, { "name": "PyArray_CastTo", "long_name": "PyArray_CastTo( PyArrayObject * out , PyArrayObject * mp)", "filename": "arrayobject.c", "nloc": 40, "complexity": 10, "token_count": 214, "parameters": [ "out", "mp" ], "start_line": 4891, "end_line": 4937, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 47, "top_nesting_level": 0 }, { "name": "array_fromarray", "long_name": "array_fromarray( PyArrayObject * arr , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 80, "complexity": 26, "token_count": 522, "parameters": [ "arr", "typecode", "flags" ], "start_line": 4940, "end_line": 5034, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "_array_typecode_fromstr", "long_name": "_array_typecode_fromstr( char * str , int * swap , PyArray_Typecode * type)", "filename": "arrayobject.c", "nloc": 94, "complexity": 36, "token_count": 533, "parameters": [ "str", "swap", "type" ], "start_line": 5038, "end_line": 5143, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 106, "top_nesting_level": 0 }, { "name": "array_frominterface", "long_name": "array_frominterface( PyObject * input , PyArray_Typecode * intype , int flags)", "filename": "arrayobject.c", "nloc": 82, "complexity": 18, "token_count": 549, "parameters": [ "input", "intype", "flags" ], "start_line": 5146, "end_line": 5240, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 95, "top_nesting_level": 0 }, { "name": "array_fromattr", "long_name": "array_fromattr( PyObject * op , PyArray_Typecode * typecode , int flags)", "filename": "arrayobject.c", "nloc": 21, "complexity": 4, "token_count": 120, "parameters": [ "op", "typecode", "flags" ], "start_line": 5243, "end_line": 5264, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 22, "top_nesting_level": 0 }, { "name": "array_fromobject", "long_name": "array_fromobject( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int flags)", "filename": "arrayobject.c", "nloc": 46, "complexity": 13, "token_count": 270, "parameters": [ "op", "typecode", "min_depth", "max_depth", "flags" ], "start_line": 5268, "end_line": 5330, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 63, "top_nesting_level": 0 }, { "name": "PyArray_ArrayType", "long_name": "PyArray_ArrayType( PyObject * op , PyArray_Typecode * intype , PyArray_Typecode * outtype)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 29, "parameters": [ "op", "intype", "outtype" ], "start_line": 5333, "end_line": 5338, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "PyArray_ObjectType", "long_name": "PyArray_ObjectType( PyObject * op , int minimum_type)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 40, "parameters": [ "op", "minimum_type" ], "start_line": 5341, "end_line": 5347, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_FromAny", "long_name": "PyArray_FromAny( PyObject * op , PyArray_Typecode * typecode , int min_depth , int max_depth , int requires)", "filename": "arrayobject.c", "nloc": 24, "complexity": 9, "token_count": 165, "parameters": [ "op", "typecode", "min_depth", "max_depth", "requires" ], "start_line": 5401, "end_line": 5431, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "PyArray_EnsureArray", "long_name": "PyArray_EnsureArray( PyObject * op)", "filename": "arrayobject.c", "nloc": 14, "complexity": 4, "token_count": 82, "parameters": [ "op" ], "start_line": 5441, "end_line": 5457, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 17, "top_nesting_level": 0 }, { "name": "PyArray_FromObject", "long_name": "PyArray_FromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 7, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5463, "end_line": 5469, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 7, "top_nesting_level": 0 }, { "name": "PyArray_ContiguousFromObject", "long_name": "PyArray_ContiguousFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5472, "end_line": 5479, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CopyFromObject", "long_name": "PyArray_CopyFromObject( PyObject * op , int type , int min_depth , int max_depth)", "filename": "arrayobject.c", "nloc": 8, "complexity": 1, "token_count": 49, "parameters": [ "op", "type", "min_depth", "max_depth" ], "start_line": 5482, "end_line": 5489, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 8, "top_nesting_level": 0 }, { "name": "PyArray_CanCastSafely", "long_name": "PyArray_CanCastSafely( int fromtype , int totype)", "filename": "arrayobject.c", "nloc": 69, "complexity": 35, "token_count": 386, "parameters": [ "fromtype", "totype" ], "start_line": 5495, "end_line": 5566, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 72, "top_nesting_level": 0 }, { "name": "PyArray_CanCastTo", "long_name": "PyArray_CanCastTo( PyArray_Typecode * from , PyArray_Typecode * to)", "filename": "arrayobject.c", "nloc": 24, "complexity": 7, "token_count": 134, "parameters": [ "from", "to" ], "start_line": 5569, "end_line": 5593, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 25, "top_nesting_level": 0 }, { "name": "PyArray_IterNew", "long_name": "PyArray_IterNew( PyObject * obj)", "filename": "arrayobject.c", "nloc": 34, "complexity": 6, "token_count": 258, "parameters": [ "obj" ], "start_line": 5603, "end_line": 5640, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 38, "top_nesting_level": 0 }, { "name": "arrayiter_next", "long_name": "arrayiter_next( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 48, "parameters": [ "it" ], "start_line": 5645, "end_line": 5655, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 11, "top_nesting_level": 0 }, { "name": "arrayiter_dealloc", "long_name": "arrayiter_dealloc( PyArrayIterObject * it)", "filename": "arrayobject.c", "nloc": 6, "complexity": 1, "token_count": 25, "parameters": [ "it" ], "start_line": 5658, "end_line": 5663, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "arrayiter_traverse", "long_name": "arrayiter_traverse( PyArrayIterObject * it , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 6, "complexity": 2, "token_count": 42, "parameters": [ "it", "visit", "arg" ], "start_line": 5666, "end_line": 5671, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 6, "top_nesting_level": 0 }, { "name": "iter_length", "long_name": "iter_length( PyArrayIterObject * self)", "filename": "arrayobject.c", "nloc": 4, "complexity": 1, "token_count": 16, "parameters": [ "self" ], "start_line": 5675, "end_line": 5678, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 4, "top_nesting_level": 0 }, { "name": "iter_subscript_Bool", "long_name": "iter_subscript_Bool( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 42, "complexity": 7, "token_count": 272, "parameters": [ "self", "ind" ], "start_line": 5682, "end_line": 5730, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 49, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 50, "complexity": 8, "token_count": 341, "parameters": [ "self", "ind" ], "start_line": 5733, "end_line": 5785, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 53, "top_nesting_level": 0 }, { "name": "iter_subscript", "long_name": "iter_subscript( PyArrayIterObject * self , PyObject * ind)", "filename": "arrayobject.c", "nloc": 97, "complexity": 20, "token_count": 593, "parameters": [ "self", "ind" ], "start_line": 5789, "end_line": 5908, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 120, "top_nesting_level": 0 }, { "name": "iter_ass_sub_Bool", "long_name": "iter_ass_sub_Bool( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 31, "complexity": 5, "token_count": 176, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5912, "end_line": 5944, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 33, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 41, "complexity": 8, "token_count": 283, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5947, "end_line": 5988, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 42, "top_nesting_level": 0 }, { "name": "iter_ass_subscript", "long_name": "iter_ass_subscript( PyArrayIterObject * self , PyObject * ind , PyObject * val)", "filename": "arrayobject.c", "nloc": 103, "complexity": 24, "token_count": 636, "parameters": [ "self", "ind", "val" ], "start_line": 5992, "end_line": 6114, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 123, "top_nesting_level": 0 }, { "name": "iter_array", "long_name": "iter_array( PyArrayIterObject * it , PyObject * op)", "filename": "arrayobject.c", "nloc": 30, "complexity": 5, "token_count": 221, "parameters": [ "it", "op" ], "start_line": 6127, "end_line": 6169, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "iter_copy", "long_name": "iter_copy( PyArrayIterObject * it , PyObject * args)", "filename": "arrayobject.c", "nloc": 5, "complexity": 2, "token_count": 35, "parameters": [ "it", "args" ], "start_line": 6174, "end_line": 6178, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 5, "top_nesting_level": 0 }, { "name": "fancy_indexing_check", "long_name": "fancy_indexing_check( PyObject * args)", "filename": "arrayobject.c", "nloc": 55, "complexity": 22, "token_count": 293, "parameters": [ "args" ], "start_line": 6243, "end_line": 6304, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 62, "top_nesting_level": 0 }, { "name": "_convert_obj", "long_name": "_convert_obj( PyObject * obj , PyArrayIterObject ** iter)", "filename": "arrayobject.c", "nloc": 15, "complexity": 5, "token_count": 105, "parameters": [ "obj", "iter" ], "start_line": 6312, "end_line": 6327, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 16, "top_nesting_level": 0 }, { "name": "PyArray_Broadcast", "long_name": "PyArray_Broadcast( PyArrayMultiIterObject * mit)", "filename": "arrayobject.c", "nloc": 58, "complexity": 13, "token_count": 464, "parameters": [ "mit" ], "start_line": 6333, "end_line": 6402, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterReset", "long_name": "PyArray_MapIterReset( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 35, "complexity": 4, "token_count": 261, "parameters": [ "mit" ], "start_line": 6406, "end_line": 6442, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 37, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNext", "long_name": "PyArray_MapIterNext( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 41, "complexity": 6, "token_count": 296, "parameters": [ "mit" ], "start_line": 6448, "end_line": 6492, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 45, "top_nesting_level": 0 }, { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 682, "parameters": [ "mit", "arr" ], "start_line": 6510, "end_line": 6646, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "_nonzero_indices", "long_name": "_nonzero_indices( PyObject * myBool , PyArrayIterObject ** iters)", "filename": "arrayobject.c", "nloc": 57, "complexity": 15, "token_count": 454, "parameters": [ "myBool", "iters" ], "start_line": 6652, "end_line": 6721, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 70, "top_nesting_level": 0 }, { "name": "PyArray_MapIterNew", "long_name": "PyArray_MapIterNew( PyObject * indexobj)", "filename": "arrayobject.c", "nloc": 111, "complexity": 24, "token_count": 745, "parameters": [ "indexobj" ], "start_line": 6724, "end_line": 6857, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 134, "top_nesting_level": 0 }, { "name": "arraymapiter_new", "long_name": "arraymapiter_new( PyTypeObject * type , PyObject * args , PyObject * kwds)", "filename": "arrayobject.c", "nloc": 26, "complexity": 5, "token_count": 130, "parameters": [ "type", "args", "kwds" ], "start_line": 6863, "end_line": 6893, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 31, "top_nesting_level": 0 }, { "name": "arraymapiter_next", "long_name": "arraymapiter_next( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 12, "complexity": 4, "token_count": 70, "parameters": [ "mit" ], "start_line": 6899, "end_line": 6910, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 12, "top_nesting_level": 0 }, { "name": "arraymapiter_dealloc", "long_name": "arraymapiter_dealloc( PyArrayMapIterObject * mit)", "filename": "arrayobject.c", "nloc": 10, "complexity": 2, "token_count": 60, "parameters": [ "mit" ], "start_line": 6913, "end_line": 6922, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 10, "top_nesting_level": 0 }, { "name": "arraymapiter_traverse", "long_name": "arraymapiter_traverse( PyArrayMapIterObject * mit , visitproc visit , * arg)", "filename": "arrayobject.c", "nloc": 16, "complexity": 9, "token_count": 146, "parameters": [ "mit", "visit", "arg" ], "start_line": 6925, "end_line": 6943, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 19, "top_nesting_level": 0 } ], "changed_methods": [ { "name": "PyArray_MapIterBind", "long_name": "PyArray_MapIterBind( PyArrayMapIterObject * mit , PyArrayObject * arr)", "filename": "arrayobject.c", "nloc": 102, "complexity": 22, "token_count": 690, "parameters": [ "mit", "arr" ], "start_line": 6514, "end_line": 6650, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 137, "top_nesting_level": 0 }, { "name": "PyArray_ToFile", "long_name": "PyArray_ToFile( PyArrayObject * self , FILE * fp , char * sep , char * format)", "filename": "arrayobject.c", "nloc": 89, "complexity": 16, "token_count": 577, "parameters": [ "self", "fp", "sep", "format" ], "start_line": 993, "end_line": 1084, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 92, "top_nesting_level": 0 }, { "name": "iter_ass_sub_int", "long_name": "iter_ass_sub_int( PyArrayIterObject * self , PyArrayObject * ind , PyArrayIterObject * val , int swap)", "filename": "arrayobject.c", "nloc": 42, "complexity": 8, "token_count": 289, "parameters": [ "self", "ind", "val", "swap" ], "start_line": 5950, "end_line": 5992, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 43, "top_nesting_level": 0 }, { "name": "iter_subscript_int", "long_name": "iter_subscript_int( PyArrayIterObject * self , PyArrayObject * ind)", "filename": "arrayobject.c", "nloc": 51, "complexity": 8, "token_count": 347, "parameters": [ "self", "ind" ], "start_line": 5735, "end_line": 5788, "fan_in": 0, "fan_out": 0, "general_fan_out": 0, "length": 54, "top_nesting_level": 0 } ], "nloc": 5497, "complexity": 1207, "token_count": 32896, "diff_parsed": { "added": [ " \" %d to file\",", "\t\t\t\t\t\t (int)it->index);", " \" to file\",", "\t\t\t\t\t (int) it->index);", "\t\t\t\t \" 0<=index<%d\", (int) num,", "\t\t\t\t (int) self->size);", "\t\t\t\t \" 0<=index<%d\", (int) num,", "\t\t\t\t (int) self->size);", "\t\t\t\t\t (int) *indptr, (int) (dimsize-1)," ], "deleted": [ " \" %d to file\", it->index);", " \" to file\", it->index);", "\t\t\t\t \" 0<=index<%d\", num, self->size);", "\t\t\t\t \" 0<=index<%d\", num, self->size);", "\t\t\t\t\t *indptr, dimsize-1," ] } } ] } ]